Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identify: also match observed against listening addresses #1255

Merged
merged 1 commit into from
Dec 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions p2p/protocol/identify/obsaddr.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ func (oas *ObservedAddrManager) maybeRecordObservation(conn network.Conn, observ

// We should reject the connection if the observation doesn't match the
// transports of one of our advertised addresses.
if !HasConsistentTransport(observed, oas.host.Addrs()) {
if !HasConsistentTransport(observed, oas.host.Addrs()) &&
!HasConsistentTransport(observed, oas.host.Network().ListenAddresses()) {
log.Debugw(
"observed multiaddr doesn't match the transports of any announced addresses",
"from", conn.RemoteMultiaddr(),
Expand Down Expand Up @@ -555,7 +556,7 @@ func (oas *ObservedAddrManager) Close() error {
// Here, we use the root multiaddr address. This is mostly
// IP addresses. In practice, this is what we want.
func observerGroup(m ma.Multiaddr) string {
//TODO: If IPv6 rolls out we should mark /64 routing zones as one group
// TODO: If IPv6 rolls out we should mark /64 routing zones as one group
first, _ := ma.SplitFirst(m)
return string(first.Bytes())
}
Expand Down