|
@ -169,30 +169,25 @@ func (m *mdnsService) handleEntry(e *mdns.ServiceEntry) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var maddr ma.Multiaddr |
|
|
var addr net.IP |
|
|
if e.AddrV4 != nil { |
|
|
if e.AddrV4 != nil { |
|
|
maddr, err = manet.FromNetAddr(&net.TCPAddr{ |
|
|
addr = e.AddrV4 |
|
|
IP: e.AddrV4, |
|
|
|
|
|
Port: e.Port, |
|
|
|
|
|
}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Warning("Error parsing multiaddr from mdns entry: ", err) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else if e.AddrV6 != nil { |
|
|
} else if e.AddrV6 != nil { |
|
|
maddr, err = manet.FromNetAddr(&net.TCPAddr{ |
|
|
addr = e.AddrV6 |
|
|
IP: e.AddrV6, |
|
|
|
|
|
Port: e.Port, |
|
|
|
|
|
}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Warning("Error parsing multiaddr from mdns entry: ", err) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
log.Warning("Error parsing multiaddr from mdns entry: no IP address found") |
|
|
log.Warning("Error parsing multiaddr from mdns entry: no IP address found") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
maddr, err := manet.FromNetAddr(&net.TCPAddr{ |
|
|
|
|
|
IP: addr, |
|
|
|
|
|
Port: e.Port, |
|
|
|
|
|
}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Warning("Error parsing multiaddr from mdns entry: ", err) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
pi := peer.AddrInfo{ |
|
|
pi := peer.AddrInfo{ |
|
|
ID: mpeer, |
|
|
ID: mpeer, |
|
|
Addrs: []ma.Multiaddr{maddr}, |
|
|
Addrs: []ma.Multiaddr{maddr}, |
|
|