Revert "add UA"

This reverts commit 157b7292a3.
This commit is contained in:
Richard Chen 2020-02-09 18:26:35 +08:00
parent 157b7292a3
commit 94e0310748
No known key found for this signature in database
GPG Key ID: BD81B3FB9AEC3951

View File

@ -163,7 +163,6 @@ func GenerateSpeedtest(path string) error {
}
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)
if err != nil {
return err
@ -184,10 +183,6 @@ func GenerateSpeedtest(path string) error {
reg := regexp.MustCompile(`host="(.+):[0-9]+"`)
matchList := reg.FindAllStringSubmatch(string(body), -1)
if len(matchList) == 0 {
return errors.New("cannot get ookla-speedtest domains")
}
exist := make(map[string]bool)
var domainList []string
for _, match := range matchList {
@ -209,7 +204,6 @@ func GenerateSpeedtest(path string) error {
exist[domain] = true
}
sort.Strings(domainList)
fmt.Printf("%ddomains added.\n", len(domainList))
fPath := filepath.Join(path, "ookla-speedtest")
b := append([]byte("include:ookla-speedtest-ads\n"), []byte(strings.Join(domainList, "\n"))...)