更新指纹、优化内存占用

This commit is contained in:
影舞者
2021-09-10 20:32:51 +08:00
parent 2e452a9695
commit d5665f03d6
20 changed files with 265 additions and 48 deletions
+10 -2
View File
@@ -51,8 +51,12 @@ func ICMPRun(hostslist []string, Ping bool) []string {
common.LogError(err)
//尝试无监听icmp探测
conn, err := net.DialTimeout("ip4:icmp", "127.0.0.1", 3*time.Second)
defer func() {
if conn != nil{
conn.Close()
}
}()
if err == nil {
go conn.Close()
RunIcmp2(hostslist, chanHosts)
} else {
common.LogError(err)
@@ -138,10 +142,14 @@ func RunIcmp2(hostslist []string, chanHosts chan string) {
func icmpalive(host string) bool {
startTime := time.Now()
conn, err := net.DialTimeout("ip4:icmp", host, 6*time.Second)
defer func() {
if conn != nil{
conn.Close()
}
}()
if err != nil {
return false
}
defer conn.Close()
if err := conn.SetDeadline(startTime.Add(6 * time.Second)); err != nil {
return false
}