Improve conntrack

This commit is contained in:
世界
2023-09-20 14:12:08 +08:00
parent 85c8f00885
commit 12dd1ac87f
22 changed files with 223 additions and 57 deletions

View File

@@ -174,9 +174,7 @@ func (t *Transport) interfaceUpdated(int) {
func (t *Transport) fetchServers0(ctx context.Context, iface *net.Interface) error {
var listener net.ListenConfig
listener.Control = control.Append(listener.Control, control.BindToInterfaceFunc(t.router.InterfaceFinder(), func(network string, address string) (interfaceName string, interfaceIndex int) {
return iface.Name, iface.Index
}))
listener.Control = control.Append(listener.Control, control.BindToInterface(t.router.InterfaceFinder(), iface.Name, iface.Index))
listener.Control = control.Append(listener.Control, control.ReuseAddr())
packetConn, err := listener.ListenPacket(t.ctx, "udp4", "0.0.0.0:68")
if err != nil {