Add Stack.ResetNetwork

This commit is contained in:
世界 2026-07-19 17:41:50 +08:00
parent 79084fa798
commit b59636919c
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
7 changed files with 64 additions and 5 deletions

View file

@ -86,6 +86,15 @@ func (n *TCPNat) checkTimeout() {
n.addrAccess.Unlock()
}
func (n *TCPNat) Purge() {
n.addrAccess.Lock()
n.portAccess.Lock()
clear(n.addrMap)
clear(n.portMap)
n.portAccess.Unlock()
n.addrAccess.Unlock()
}
func (n *TCPNat) LookupBack(port uint16) *TCPSession {
n.portAccess.RLock()
session := n.portMap[port]