From c5f50f9c2d0f1dff76069bdf844d45b44fcd9f67 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 21 Dec 2018 11:20:09 +0200 Subject: [PATCH] don't advertise the raw public address in autorelay --- p2p/host/relay/autorelay.go | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/p2p/host/relay/autorelay.go b/p2p/host/relay/autorelay.go index e97ce88321..0a40c0c250 100644 --- a/p2p/host/relay/autorelay.go +++ b/p2p/host/relay/autorelay.go @@ -203,36 +203,12 @@ func (h *AutoRelayHost) doUpdateAddrs() { addrs := h.baseAddrs() raddrs := make([]ma.Multiaddr, 0, len(addrs)+len(h.relays)) - // remove our public addresses from the list and replace them by just the public IP + // remove our public addresses from the list for _, addr := range addrs { if manet.IsPublicAddr(addr) { - ip, err := addr.ValueForProtocol(ma.P_IP4) - if err == nil { - pub, err := ma.NewMultiaddr(fmt.Sprintf("/ip4/%s", ip)) - if err != nil { - panic(err) - } - - if !containsAddr(raddrs, pub) { - raddrs = append(raddrs, pub) - } - continue - } - - ip, err = addr.ValueForProtocol(ma.P_IP6) - if err == nil { - pub, err := ma.NewMultiaddr(fmt.Sprintf("/ip6/%s", ip)) - if err != nil { - panic(err) - } - if !containsAddr(raddrs, pub) { - raddrs = append(raddrs, pub) - } - continue - } - } else { - raddrs = append(raddrs, addr) + continue } + raddrs = append(raddrs, addr) } // add relay specific addrs to the list