mirror of
https://github.com/netbirdio/netbird.git
synced 2026-03-31 06:24:18 -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
21 lines
431 B
Go
21 lines
431 B
Go
package net
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
// Dialer extends the standard net.Dialer with the ability to execute hooks before
|
|
// and after connections. This can be used to bypass the VPN for connections using this dialer.
|
|
type Dialer struct {
|
|
*net.Dialer
|
|
}
|
|
|
|
// NewDialer returns a customized net.Dialer with overridden Control method
|
|
func NewDialer() *Dialer {
|
|
dialer := &Dialer{
|
|
Dialer: &net.Dialer{},
|
|
}
|
|
dialer.init()
|
|
return dialer
|
|
}
|