mirror of
https://github.com/xiaoqidun/tipdw.git
synced 2025-06-06 17:24:22 +08:00
feat(优化代码): 允许使用外部http客户端覆盖
This commit is contained in:
4
tipdw.go
4
tipdw.go
@ -10,8 +10,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
client = &http.Client{Timeout: 5 * time.Second}
|
|
||||||
ipCache = &sync.Map{}
|
ipCache = &sync.Map{}
|
||||||
|
DefaultHttpClient = &http.Client{Timeout: 5 * time.Second}
|
||||||
)
|
)
|
||||||
|
|
||||||
type Body struct {
|
type Body struct {
|
||||||
@ -58,7 +58,7 @@ func QueryIP(sk string, key string, ip string) (result Result, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resp, err := client.Do(req)
|
resp, err := DefaultHttpClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user