Log the transport id and local address when adopting a traversal socket

The "Adopted NAT traversal socket" line carried only the peer npub, which
left two questions unanswerable from a capture.

An operator cannot join a host socket table against our adoption events
without the local address, so there was no way to confirm which socket a
stuck connected-UDP activation was contending with. And an adopted
transport inherits accept_connections from the configured UDP transport,
so it can admit peers beyond the one it was punched for: without the
transport id, several peers sharing one adopted transport and several
separate adopted transports produce identical log output.

Both fields already existed on BootstrapHandoffResult, so this only binds
the value the match arm was discarding.
This commit is contained in:
Johnathan Corgan
2026-07-29 23:22:52 +00:00
parent f5be8ec07d
commit f82ee44f70
+14 -2
View File
@@ -759,8 +759,20 @@ impl Node {
}
}
match self.adopt_established_traversal(traversal).await {
Ok(_) => {
info!(peer_npub = %peer_npub, "Adopted NAT traversal socket");
Ok(handoff) => {
// `local_addr` lets an operator join a host socket
// table (ss/netstat) against our adoption events.
// `transport_id` separates several peers sharing one
// adopted transport from several adopted transports:
// an adopted transport inherits `accept_connections`,
// so it can admit peers beyond the one it was punched
// for, and the two cases are otherwise identical here.
info!(
peer_npub = %peer_npub,
transport_id = %handoff.transport_id,
local_addr = %handoff.local_addr,
"Adopted NAT traversal socket"
);
}
Err(err) => {
warn!(peer_npub = %peer_npub, error = %err, "Failed to adopt NAT traversal");