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:
Neil Alexander 2024-07-20 11:31:08 +01:00
parent c505097be0
commit 8ecc402d7c
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -7,7 +7,6 @@ import (
"fmt"
"io"
"net"
"net/netip"
"net/url"
"strconv"
"strings"
@ -641,16 +640,6 @@ func (l *links) handler(linkType linkType, options linkOptions, conn net.Conn, s
func urlForLinkInfo(u url.URL) url.URL {
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
}