mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-05 00:53:58 -04:00
- Move `util/grpc` and `util/net` to `client` so `internal` packages can be accessed - Add methods to return the next best interface after the NetBird interface. - Use `IP_UNICAST_IF` sock opt to force the outgoing interface for the NetBird `net.Dialer` and `net.ListenerConfig` to avoid routing loops. The interface is picked by the new route lookup method. - Some refactoring to avoid import cycles - Old behavior is available through `NB_USE_LEGACY_ROUTING=true` env var
23 lines
550 B
Go
23 lines
550 B
Go
//go:build !ios
|
|
|
|
package udpmux
|
|
|
|
import (
|
|
nbnet "github.com/netbirdio/netbird/client/net"
|
|
)
|
|
|
|
func (m *SingleSocketUDPMux) notifyAddressRemoval(addr string) {
|
|
// Kernel mode: direct nbnet.PacketConn (SharedSocket wrapped with nbnet)
|
|
if conn, ok := m.params.UDPConn.(*nbnet.PacketConn); ok {
|
|
conn.RemoveAddress(addr)
|
|
return
|
|
}
|
|
|
|
// Userspace mode: UDPConn wrapper around nbnet.PacketConn
|
|
if wrapped, ok := m.params.UDPConn.(*UDPConn); ok {
|
|
if conn, ok := wrapped.GetPacketConn().(*nbnet.PacketConn); ok {
|
|
conn.RemoveAddress(addr)
|
|
}
|
|
}
|
|
}
|