Skip to content

Commit

Permalink
Use Interface listen address as well
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Aug 1, 2024
1 parent ee0e8d3 commit 2666c46
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion p2p/protocol/identify/obsaddr.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,23 @@ func (o *ObservedAddrManager) appendInferredAddrs(twToObserverSets map[string][]
twToObserverSets[localTWStr] = append(twToObserverSets[localTWStr], o.getTopExternalAddrs(localTWStr)...)
}
}
for _, a := range o.listenAddrs() {
lAddrs, err := o.interfaceListenAddrs()
if err != nil {
log.Warnw("failed to get interface resolved listen addrs. Using just the listen addrs", "error", err)
lAddrs = nil
}
lAddrs = append(lAddrs, o.listenAddrs()...)
seenTWs := make(map[string]struct{})
for _, a := range lAddrs {
if _, ok := o.localAddrs[string(a.Bytes())]; ok {
// We already have this address in the list
continue
}
if _, ok := seenTWs[string(a.Bytes())]; ok {
// We've already added this
continue
}
seenTWs[string(a.Bytes())] = struct{}{}
a = o.normalize(a)
t, err := thinWaistForm(a)
if err != nil {
Expand Down

0 comments on commit 2666c46

Please sign in to comment.