-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdomains_txt_provider.go
52 lines (40 loc) · 1.47 KB
/
domains_txt_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"strings"
"github.com/pkg/errors"
)
type DomainsTxtProvider struct {
}
func NewDomainsTxtProvider() *DomainsTxtProvider {
return new(DomainsTxtProvider)
}
func (provider *DomainsTxtProvider) Get() ([]string, error) {
domains := []string{}
urls := []string{
"https://raw.githubusercontent.com/MattKetmo/EmailChecker/master/res/throwaway_domains.txt",
"https://raw.githubusercontent.com/wesbos/burner-email-providers/master/emails.txt",
"https://raw.githubusercontent.com/andreis/disposable/master/domains.txt",
"https://raw.githubusercontent.com/mailster/mailster-email-verify/master/dea.txt",
"https://raw.githubusercontent.com/vboctor/disposable_email_checker/master/data/domains.txt",
"https://raw.githubusercontent.com/khanhicetea/fast-email-validator/master/src/database/DisposableEmails.txt",
"https://raw.githubusercontent.com/nojacko/email-data-disposable/master/bin/disposable.txt",
"https://raw.githubusercontent.com/slester/disposable-email-providers/master/domains.txt",
}
for _, url := range urls {
providerDomains, _ := provider.getSingle(url)
for _, domain := range providerDomains {
domains = append(domains, domain)
}
}
return domains, nil
}
func (provider *DomainsTxtProvider) getSingle(url string) ([]string, error) {
content, response, err := getURL(url)
if err != nil {
return []string{}, err
}
if response.StatusCode != 200 {
return []string{}, errors.New(content)
}
return strings.Split(content,"\n"), nil
}