mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-08 13:00:11 +02:00
625a63e7c2
- prevent leaks for connections made the first ~10 milliseconds when Gluetun starts - seems critical, but in practice this very rarely happen and it very hard to reproduce
18 lines
258 B
Go
18 lines
258 B
Go
package netlink
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ti-mo/conntrack"
|
|
)
|
|
|
|
func (n *NetLink) FlushConntrack() error {
|
|
conn, err := conntrack.Dial(nil)
|
|
if err != nil {
|
|
return fmt.Errorf("dialing conntrack: %w", err)
|
|
}
|
|
defer conn.Close()
|
|
|
|
return conn.Flush()
|
|
}
|