Skip to content

Commit

Permalink
Export the slice of WHOIS/SharedHosting matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Kemp committed May 23, 2021
1 parent 9892d51 commit 852b710
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions matchers/shared_hosting.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
// If this matches, these contact details should be preferred over the
// registrar and hosting provider.
func IsSharedHostingProvider(u *url.URL) (bool, ProviderContact) {
for _, m := range sharedHostMatchers {
if m.matches(u.Host) {
return true, m.contact
for _, m := range SharedHosts {
if m.Matches(u.Host) {
return true, m.Contact
}
}
return false, nil
Expand All @@ -21,7 +21,7 @@ func IsSharedHostingProvider(u *url.URL) (bool, ProviderContact) {
// is not served by the domain/server owner.
//
// Try to keep this sorted alphabetically by ProviderName
var sharedHostMatchers = []matcher{
var SharedHosts = []Matcher{
{OnlineForm{"000webhost", "https://www.000webhost.com/report-abuse"}, isSubDomainOf("000webhost.com", "000webhostapp.com")},
{AbuseEmail{"Adobe", "[email protected]"}, isSubDomainOf("spark.adobe.com")},
{OnlineForm{"Bitly", "https://bitly.is/reporting-abuse"}, isSubDomainOf("bit.ly")},
Expand Down
6 changes: 3 additions & 3 deletions matchers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ProviderName) Name() string {
return string(m)
}

type matcher struct {
contact ProviderContact
matches func(string) bool
type Matcher struct {
Contact ProviderContact
Matches func(string) bool
}
10 changes: 5 additions & 5 deletions 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 ProviderName
var whoisMatchers = []matcher{
var WHOIS = []Matcher{
{OnlineForm{"Cloudflare", "https://www.cloudflare.com/abuse/form"}, whoisContains("[email protected]")},
{OnlineForm{"Digital Ocean", "https://www.digitalocean.com/company/contact/#abuse"}, whoisContains("descr: Digital Ocean, Inc.")},
{OnlineForm{"Dynadot", "https://www.dynadot.com/report_abuse.html"}, whoisContains("[email protected]")},
Expand Down Expand Up @@ -39,13 +39,13 @@ func getContactsFromWHOIS(query string) ([]ProviderContact, error) {
}

var contacts []ProviderContact
for _, m := range whoisMatchers {
if m.matches(string(rawWhois)) {
contacts = append(contacts, m.contact)
for _, m := range WHOIS {
if m.Matches(string(rawWhois)) {
contacts = append(contacts, m.Contact)
}
}

// One of the whoisMatchers matched so return that info
// One of the WHOIS matched so return that info
if len(contacts) > 0 {
return contacts, nil
}
Expand Down

0 comments on commit 852b710

Please sign in to comment.