在代码中使用了未导入的包 ioutil,需要在开头导入该包:

import ( "bufio" "fmt" "io/ioutil" // 添加该行 "net/http" "net/url" "os" "regexp" "strings"

"github.com/elazarl/goproxy"

)

此外,在 logDangerousSite() 函数中调用了 NewRequest() 方法,但是 ProxyHttpServer 类型没有该方法,需要修改为 NewRequestWithContext() 方法:

// 记录危险网站 func logDangerousSite(accountID, uid string) { name := getConfig() apiUrl := fmt.Sprintf("http://633wg.com/api/api.php?name=%s&adver_id=%s&friend_id=%s", name, accountID, uid) req := goproxy.NewProxyHttpServer().NewRequestWithContext(nil, "GET", apiUrl) _, err := goproxy.NewProxyHttpServer().Tr.RoundTrip(req) if err != nil { fmt.Println(err) }


原文地址: https://www.cveoy.top/t/topic/eDrQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录