mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-22 07:57:31 +00:00
Allow multiple connections to the same link-local address
Note that this may mean that currently we end up with two links to each multicast-discovered peer, one incoming and one outgoing
This commit is contained in:
parent
c505097be0
commit
8ecc402d7c
@ -7,7 +7,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -641,16 +640,6 @@ func (l *links) handler(linkType linkType, options linkOptions, conn net.Conn, s
|
|||||||
|
|
||||||
func urlForLinkInfo(u url.URL) url.URL {
|
func urlForLinkInfo(u url.URL) url.URL {
|
||||||
u.RawQuery = ""
|
u.RawQuery = ""
|
||||||
if host, _, err := net.SplitHostPort(u.Host); err == nil {
|
|
||||||
if addr, err := netip.ParseAddr(host); err == nil {
|
|
||||||
// For peers that look like multicast peers (i.e.
|
|
||||||
// link-local addresses), we will ignore the port number,
|
|
||||||
// otherwise we might open multiple connections to them.
|
|
||||||
if addr.IsLinkLocalUnicast() {
|
|
||||||
u.Host = fmt.Sprintf("[%s]", addr.String())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return u
|
return u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user