Skip to content

Commit

Permalink
Expose the ProviderName type
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Kemp committed Mar 25, 2021
1 parent eff5c3c commit 3f2a400
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion matchers/email_fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func getRawEmailContacts(rawWhois string) []ProviderContact {

sortedEmails := make([]ProviderContact, 0, len(emails))
for email := range emails {
sortedEmails = append(sortedEmails, AbuseEmail{providerID(email), email})
sortedEmails = append(sortedEmails, AbuseEmail{ProviderName(email), email})
}
sort.Slice(sortedEmails, func(i, j int) bool {
return sortedEmails[i].(AbuseEmail).Email < sortedEmails[j].(AbuseEmail).Email
Expand Down
2 changes: 1 addition & 1 deletion matchers/shared_hosting.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func IsSharedHostingProvider(u *url.URL) (bool, ProviderContact) {
// Matches content served by shared hosting providers i.e. where the abusive content
// is not served by the domain/server owner.
//
// Try to keep this sorted alphabetically by providerID
// Try to keep this sorted alphabetically by ProviderName
var sharedHostMatchers = []matcher{
{OnlineForm{"000webhost", "https://www.000webhost.com/report-abuse"}, isSubDomainOf("000webhost.com")},
{OnlineForm{"00webhost", "https://www.000webhost.com/report-abuse"}, isSubDomainOf("000webhostapp.com")},
Expand Down
8 changes: 4 additions & 4 deletions matchers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ type ProviderContact interface {
}

type OnlineForm struct {
providerID
ProviderName
URL string
}

type AbuseEmail struct {
providerID
ProviderName
Email string
}

type providerID string
type ProviderName string

func (m providerID) Name() string {
func (m ProviderName) Name() string {
return string(m)
}

Expand Down
2 changes: 1 addition & 1 deletion matchers/whois_matchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

// Matches WHOIS data to the best way to report abuse to the registrar/hosting provider.
//
// Try to keep this sorted alphabetically by providerID
// Try to keep this sorted alphabetically by ProviderName
var whoisMatchers = []matcher{
{OnlineForm{"Cloudflare", "https://www.cloudflare.com/abuse/form"}, whoisContains("[email protected]")},
{OnlineForm{"Dynadot", "https://www.dynadot.com/report_abuse.html"}, whoisContains("[email protected]")},
Expand Down

0 comments on commit 3f2a400

Please sign in to comment.