enable non-public address port mapping announcement
@@ -732,9 +732,6 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr {
continue
}
- // Did the router give us a routable public addr?
- if manet.IsPublicAddr(mappedMaddr) {
- // Yes, use it.
extMaddr := mappedMaddr
if rest != nil {
extMaddr = ma.Join(extMaddr, rest)
@@ -742,10 +739,16 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr {
// Add in the mapped addr.
finalAddrs = append(finalAddrs, extMaddr)
+
+ // Did the router give us a routable public addr?
+ if manet.IsPublicAddr(mappedMaddr) {
+ //well done
continue
}
- // No. Ok, let's try our observed addresses.
+ // No.
+ // in case router give us a wrong address.
+ // also add observed addresses
// Now, check if we have any observed addresses that
// differ from the one reported by the router. Routers
@@ -776,6 +779,7 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr {
}
finalAddrs = append(finalAddrs, observedAddrs...)
}
+
return dedupAddrs(finalAddrs)
}
