diff --git a/matchers/whois_client.go b/matchers/whois_client.go new file mode 100644 index 0000000..97d7a02 --- /dev/null +++ b/matchers/whois_client.go @@ -0,0 +1,7 @@ +package matchers + +import "os/exec" + +var WHOISClient = func(query string) (rawResult []byte, err error) { + return exec.Command("whois", query).CombinedOutput() +} diff --git a/matchers/whois_matchers.go b/matchers/whois_matchers.go index f27a8fb..add8e34 100644 --- a/matchers/whois_matchers.go +++ b/matchers/whois_matchers.go @@ -2,7 +2,6 @@ package matchers import ( "fmt" - "os/exec" "strings" ) @@ -29,7 +28,7 @@ func whoisContains(contents string) func(string) bool { } func getContactsFromWHOIS(query string) ([]ProviderContact, error) { - rawWhois, err := exec.Command("whois", query).CombinedOutput() + rawWhois, err := WHOISClient(query) if err != nil { return nil, fmt.Errorf("failed to query whois: %s, %w", string(rawWhois), err) }