optimize
This commit is contained in:
parent
02cc3c3d9e
commit
cb0f58f297
2
cap.go
2
cap.go
@ -47,7 +47,7 @@ func printPacketInfo(packet gopacket.Packet) {
|
||||
defer ipMutex.Unlock()
|
||||
if !isIPInList(ip.SrcIP) {
|
||||
ipList.PushBack(ip.SrcIP)
|
||||
log.Printf("已添加源 IP: %s 到链表\n", ip.SrcIP)
|
||||
log.Printf("\033[31m 已添加源 IP: %s 到链表 \033[0m\n", ip.SrcIP)
|
||||
|
||||
}
|
||||
}
|
||||
|
10
main.go
10
main.go
@ -178,7 +178,7 @@ func runMainProcess() { // 主进程逻辑
|
||||
}
|
||||
|
||||
log.Printf("Ip 链表长度:%d\n", ipList.Len()) // 链表长度
|
||||
time.Sleep(3 * time.Second)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
ipMutex.Unlock() // 链表解锁互斥锁
|
||||
|
||||
@ -192,13 +192,15 @@ func runMainProcess() { // 主进程逻辑
|
||||
for {
|
||||
|
||||
if ipset_len, _ := NumIPSet(SIG_NAME); ipset_len >= 65534 {
|
||||
log.Printf("ipset %s 列表已满 %dd\n", SIG_NAME, ipset_len)
|
||||
//log.Printf("ipset %s 列表已满 %dd\n", SIG_NAME, ipset_len)
|
||||
log.Printf("\033[31m ipset %s 列表已满 %d \033[0m\n", SIG_NAME, ipset_len)
|
||||
|
||||
// 创建新的 ipset 集合
|
||||
SIG++
|
||||
|
||||
if SIG >= MAX_SIG {
|
||||
log.Printf("已创建 %d 个集合!!!", MAX_SIG)
|
||||
//log.Printf("已创建 %d 个集合!!!", MAX_SIG)
|
||||
log.Printf("\033[31m 已创建 %d 个集合!!! \033[0m\n", MAX_SIG)
|
||||
}
|
||||
|
||||
SIG_NAME = fmt.Sprintf("root%d", SIG)
|
||||
@ -208,7 +210,7 @@ func runMainProcess() { // 主进程逻辑
|
||||
|
||||
}
|
||||
|
||||
time.Sleep(3 * time.Second)
|
||||
time.Sleep(7 * time.Second)
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user