fix(identify): do not add p2p and relayed addrs to observed addr manager (#990)
This commit is contained in:
parent
7ce2afba13
commit
6cdd4c911b
|
@ -21,6 +21,7 @@ import ../protobuf/minprotobuf,
|
||||||
../peerid,
|
../peerid,
|
||||||
../crypto/crypto,
|
../crypto/crypto,
|
||||||
../multiaddress,
|
../multiaddress,
|
||||||
|
../multicodec,
|
||||||
../protocols/protocol,
|
../protocols/protocol,
|
||||||
../utility,
|
../utility,
|
||||||
../errors,
|
../errors,
|
||||||
|
@ -187,8 +188,12 @@ proc identify*(self: Identify,
|
||||||
info.peerId = peer
|
info.peerId = peer
|
||||||
|
|
||||||
info.observedAddr.withValue(observed):
|
info.observedAddr.withValue(observed):
|
||||||
if not self.observedAddrManager.addObservation(observed):
|
# Currently, we use the ObservedAddrManager only to find our dialable external NAT address. Therefore, addresses
|
||||||
debug "Observed address is not valid", observedAddr = observed
|
# like "...\p2p-circuit\p2p\..." and "\p2p\..." are not useful to us.
|
||||||
|
if observed.contains(multiCodec("p2p-circuit")).get(false) or P2PPattern.matchPartial(observed):
|
||||||
|
trace "Not adding address to ObservedAddrManager.", observed
|
||||||
|
elif not self.observedAddrManager.addObservation(observed):
|
||||||
|
trace "Observed address is not valid.", observedAddr = observed
|
||||||
return info
|
return info
|
||||||
|
|
||||||
proc new*(T: typedesc[IdentifyPush], handler: IdentifyPushHandler = nil): T {.public.} =
|
proc new*(T: typedesc[IdentifyPush], handler: IdentifyPushHandler = nil): T {.public.} =
|
||||||
|
|
Loading…
Reference in New Issue