mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-12 16:26:37 +00:00
Fix connecting to discovered IPv6 address
This commit is contained in:
parent
435d3958f4
commit
258ad4352e
@ -8,9 +8,9 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ func (d *Discoverer) registerNode(addr net.Addr, node Node) bool {
|
|||||||
for _, a := range node.Addresses {
|
for _, a := range node.Addresses {
|
||||||
var nodeAddr string
|
var nodeAddr string
|
||||||
if len(a.IP) > 0 {
|
if len(a.IP) > 0 {
|
||||||
nodeAddr = fmt.Sprintf("%s:%d", net.IP(a.IP), a.Port)
|
nodeAddr = net.JoinHostPort(net.IP(a.IP).String(), strconv.Itoa(int(a.Port)))
|
||||||
} else if addr != nil {
|
} else if addr != nil {
|
||||||
ua := addr.(*net.UDPAddr)
|
ua := addr.(*net.UDPAddr)
|
||||||
ua.Port = int(a.Port)
|
ua.Port = int(a.Port)
|
||||||
@ -449,7 +449,7 @@ func (d *Discoverer) externalLookup(node protocol.NodeID) []string {
|
|||||||
|
|
||||||
var addrs []string
|
var addrs []string
|
||||||
for _, a := range pkt.This.Addresses {
|
for _, a := range pkt.This.Addresses {
|
||||||
nodeAddr := fmt.Sprintf("%s:%d", net.IP(a.IP), a.Port)
|
nodeAddr := net.JoinHostPort(net.IP(a.IP).String(), strconv.Itoa(int(a.Port)))
|
||||||
addrs = append(addrs, nodeAddr)
|
addrs = append(addrs, nodeAddr)
|
||||||
}
|
}
|
||||||
return addrs
|
return addrs
|
||||||
|
Loading…
Reference in New Issue
Block a user