Skip to content

Commit c915c23

Browse files
committed
fix DnslogDetect exception
在与dnslog网络不可达的情况下未捕获到异常导致程序clash
1 parent 4bfb46b commit c915c23

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Detect/detect.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,15 @@ func DnslogDetect(target string,payload string,session string) string{
164164
}
165165
httpReq.Header.Add("Content-Type", "application/json")
166166
httpRsp, err := http.DefaultClient.Do(httpReq)
167-
if err != nil {
168-
err.Error()
167+
if err != nil{
168+
httpRsp = Utils.NetWorkErrHandle(http.DefaultClient,httpReq,err)
169+
if httpRsp == nil{
170+
fmt.Println("与dns平台网络不可达,请检查网络")
171+
return Utils.NETWORK_NOT_ACCESS
172+
}
169173
}
170174
defer httpRsp.Body.Close()
175+
171176
//fmt.Println(session)
172177
time.Sleep(3*time.Second) // 等3秒钟,防止由于网络原因误报
173178
//fmt.Println(payload+":"+ Utils.GetDnslogRecord(session))

0 commit comments

Comments
 (0)