Skip to content

Conversation

@sanity
Copy link
Collaborator

@sanity sanity commented Nov 15, 2025

Summary

  • normalize inbound handshake metadata so sender records are replaced with the socket we actually observe unless the envelope is ObservedAddress
  • when relaying connect requests, treat loopback/private addresses the same as unspecified ones so we always produce ObservedAddress events for joiners that mis-advertise themselves
  • add regression coverage that proves relays now emit observed addresses for private joiners and add reusable address classification helpers that respect the repo's MSRV

Testing

  • cargo test -p freenet relay_emits_observed_address_for_private_joiner
  • cargo clippy --all-targets --all-features

extract_sender_from_message_mut(&mut peer_conn.msg)
{
if sender_mut.peer.addr.ip().is_unspecified() {
let sender_ip = new_peer_id.addr.ip();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldnt need to do this, if we need to do this then we must rethink this a bit. We shouldnt have a public IP until is given back by the gateway.

bincode::deserialize(data).map_err(|err| ConnectionError::Serialization(Some(err)))
}

fn is_publicly_routable(ip: IpAddr) -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldnt need to do this, seems like a hack.

}
}

fn is_publicly_routable(ip: IpAddr) -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate functiom.

@sanity sanity linked an issue Nov 15, 2025 that may be closed by this pull request
@sanity
Copy link
Collaborator Author

sanity commented Nov 15, 2025

Closing in favor of a redesigned fix: we need to make the joiner address optional and fill it in at the gateway, not mutate sender metadata at the transport layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connect handshake advertises loopback/private addresses to remote peers

3 participants