mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-23 16:37:31 +00:00
Fix InterfacePeers
This commit is contained in:
parent
b8a2d9f125
commit
81839ad50d
@ -39,8 +39,7 @@ func (l *linkTCP) dial(url *url.URL, options linkOptions, sintf string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
addr.Zone = sintf
|
||||
dialer, err := l.dialerFor(addr.String(), sintf)
|
||||
dialer, err := l.dialerFor(addr, sintf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -121,13 +120,11 @@ func (l *linkTCP) getAddr() *net.TCPAddr {
|
||||
return addr
|
||||
}
|
||||
|
||||
func (l *linkTCP) dialerFor(saddr, sintf string) (*net.Dialer, error) {
|
||||
dst, err := net.ResolveTCPAddr("tcp", saddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
func (l *linkTCP) dialerFor(dst *net.TCPAddr, sintf string) (*net.Dialer, error) {
|
||||
if dst.IP.IsLinkLocalUnicast() {
|
||||
dst.Zone = sintf
|
||||
if sintf != "" {
|
||||
dst.Zone = sintf
|
||||
}
|
||||
if dst.Zone == "" {
|
||||
return nil, fmt.Errorf("link-local address requires a zone")
|
||||
}
|
||||
|
@ -55,8 +55,7 @@ func (l *linkTLS) dial(url *url.URL, options linkOptions, sintf, sni string) err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
addr.Zone = sintf
|
||||
dialer, err := l.tcp.dialerFor(addr.String(), sintf)
|
||||
dialer, err := l.tcp.dialerFor(addr, sintf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user