Revert "add UA"
This reverts commit 157b7292a3f7d7e94f8e4c11ff84d613afa16c34.
This commit is contained in:
parent
157b7292a3
commit
94e0310748
6
main.go
6
main.go
@ -163,7 +163,6 @@ func GenerateSpeedtest(path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Accept-Encoding", "gzip")
|
req.Header.Set("Accept-Encoding", "gzip")
|
||||||
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36")
|
|
||||||
resp, err := http.DefaultClient.Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -184,10 +183,6 @@ func GenerateSpeedtest(path string) error {
|
|||||||
reg := regexp.MustCompile(`host="(.+):[0-9]+"`)
|
reg := regexp.MustCompile(`host="(.+):[0-9]+"`)
|
||||||
matchList := reg.FindAllStringSubmatch(string(body), -1)
|
matchList := reg.FindAllStringSubmatch(string(body), -1)
|
||||||
|
|
||||||
if len(matchList) == 0 {
|
|
||||||
return errors.New("cannot get ookla-speedtest domains")
|
|
||||||
}
|
|
||||||
|
|
||||||
exist := make(map[string]bool)
|
exist := make(map[string]bool)
|
||||||
var domainList []string
|
var domainList []string
|
||||||
for _, match := range matchList {
|
for _, match := range matchList {
|
||||||
@ -209,7 +204,6 @@ func GenerateSpeedtest(path string) error {
|
|||||||
exist[domain] = true
|
exist[domain] = true
|
||||||
}
|
}
|
||||||
sort.Strings(domainList)
|
sort.Strings(domainList)
|
||||||
fmt.Printf("%ddomains added.\n", len(domainList))
|
|
||||||
|
|
||||||
fPath := filepath.Join(path, "ookla-speedtest")
|
fPath := filepath.Join(path, "ookla-speedtest")
|
||||||
b := append([]byte("include:ookla-speedtest-ads\n"), []byte(strings.Join(domainList, "\n"))...)
|
b := append([]byte("include:ookla-speedtest-ads\n"), []byte(strings.Join(domainList, "\n"))...)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user