mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00: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
25 lines
693 B
Go
25 lines
693 B
Go
package stdnet
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/pion/transport/v3"
|
|
|
|
nbnet "github.com/netbirdio/netbird/client/net"
|
|
)
|
|
|
|
// Dial connects to the address on the named network.
|
|
func (n *Net) Dial(network, address string) (net.Conn, error) {
|
|
return nbnet.NewDialer().Dial(network, address)
|
|
}
|
|
|
|
// DialUDP connects to the address on the named UDP network.
|
|
func (n *Net) DialUDP(network string, laddr, raddr *net.UDPAddr) (transport.UDPConn, error) {
|
|
return nbnet.DialUDP(network, laddr, raddr)
|
|
}
|
|
|
|
// DialTCP connects to the address on the named TCP network.
|
|
func (n *Net) DialTCP(network string, laddr, raddr *net.TCPAddr) (transport.TCPConn, error) {
|
|
return nbnet.DialTCP(network, laddr, raddr)
|
|
}
|