mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
[client] Add IPv6 support to usersace bind (#5147)
This commit is contained in:
@@ -154,9 +154,20 @@ func (s *SharedSocket) updateRouter() {
|
||||
}
|
||||
}
|
||||
|
||||
// LocalAddr returns an IPv4 address using the supplied port
|
||||
// LocalAddr returns the local address, preferring IPv4 for backward compatibility.
|
||||
func (s *SharedSocket) LocalAddr() net.Addr {
|
||||
// todo check impact on ipv6 discovery
|
||||
if s.conn4 != nil {
|
||||
return &net.UDPAddr{
|
||||
IP: net.IPv4zero,
|
||||
Port: s.port,
|
||||
}
|
||||
}
|
||||
if s.conn6 != nil {
|
||||
return &net.UDPAddr{
|
||||
IP: net.IPv6zero,
|
||||
Port: s.port,
|
||||
}
|
||||
}
|
||||
return &net.UDPAddr{
|
||||
IP: net.IPv4zero,
|
||||
Port: s.port,
|
||||
|
||||
Reference in New Issue
Block a user