mirror of
https://github.com/xiaoqidun/aipdw.git
synced 2026-10-05 02:34:06 +08:00
feat(优化代码): 允许使用外部http客户端覆盖
This commit is contained in:
1 parent
bb8f9974a8
commit
51a26e582a
1 file changed
+2
-2
@@ -12,8 +12,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
client = &http.Client{Timeout: 5 * time.Second}
|
||||
ipCache = &sync.Map{}
|
||||
DefaultHttpClient = &http.Client{Timeout: 5 * time.Second}
|
||||
)
|
||||
|
||||
type Body struct {
|
||||
@@ -61,7 +61,7 @@ func QueryIP(sk string, key string, ip string) (result Result, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
resp, err := DefaultHttpClient.Do(req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user