mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
cmd/stdiscosrc: Handle address family indicator on other schemes than tcp
This commit is contained in:
parent
a0514bb1a7
commit
441230ff77
@ -18,6 +18,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -334,13 +335,14 @@ func fixupAddresses(remote net.IP, addresses []string) []string {
|
|||||||
|
|
||||||
ip := net.ParseIP(host)
|
ip := net.ParseIP(host)
|
||||||
if host == "" || ip.IsUnspecified() {
|
if host == "" || ip.IsUnspecified() {
|
||||||
// Do not use IPv6 remote address if requested scheme is tcp4
|
// Do not use IPv6 remote address if requested scheme is ...4
|
||||||
if uri.Scheme == "tcp4" && remote.To4() == nil {
|
// (i.e., tcp4, kcp4, etc.)
|
||||||
|
if strings.HasSuffix(uri.Scheme, "4") && remote.To4() == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not use IPv4 remote address if requested scheme is tcp6
|
// Do not use IPv4 remote address if requested scheme is ...6
|
||||||
if uri.Scheme == "tcp6" && remote.To4() != nil {
|
if strings.HasSuffix(uri.Scheme, "6") && remote.To4() != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user