mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-25 04:31:52 +08:00
perf: 四项扫描性能优化
- SO_LINGER=0 快速释放连接,减少 TIME_WAIT 堆积 - 服务探测超时自适应,RTT 采样约束读超时上限 - 端口扫描结果流式传递,pipeline 并行端口扫描和插件执行 - ICMP 批量预构建包和地址,减少发送循环开销
This commit is contained in:
@@ -56,6 +56,11 @@ func (s *ScanSession) DialTCP(ctx context.Context, network, address string, time
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// SO_LINGER=0: 连接关闭时立即发送 RST,避免 TIME_WAIT 堆积
|
||||
if tc, ok := conn.(*net.TCPConn); ok {
|
||||
_ = tc.SetLinger(0)
|
||||
}
|
||||
|
||||
s.State.IncrementTCPSuccessPacketCount()
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user