Document nostr-nat ephemeral UDP transport MTU choice

Adopted ephemeral UDP transports created by adopt_established_traversal()
default to UdpConfig::default() (MTU=1280, IPv6 minimum) when the
bootstrap runtime hands a socket without an explicit transport_config
override. This is by design: NAT-traversal middlebox MTU is unpredictable
and the IPv6 minimum is the only value guaranteed by spec to survive
arbitrary paths.

Add an explanatory comment at the call site so future readers find the
rationale without spelunking through ISSUE-2026-0013, and so any future
change to the inheritance behavior is a deliberate decision rather than
an accidental refactor.

No behavior change.
This commit is contained in:
Johnathan Corgan
2026-05-02 01:39:52 +00:00
parent 8448e38510
commit da5d23ccb7

View File

@@ -1689,6 +1689,13 @@ impl Node {
self.register_identity(peer_node_addr, peer_identity.pubkey_full());
let transport_id = self.allocate_transport_id();
// Adopted ephemeral UDP transports use UdpConfig::default() when the
// bootstrap runtime doesn't pass an override. Default MTU resolves to
// 1280 (IPv6 minimum), which is the only value guaranteed to survive
// arbitrary NAT-traversal middlebox paths. Inheriting from the named
// [transports.udp] config (Option 3 in ISSUE-2026-0013) would track
// operator config more closely but risks regressions on hostile paths;
// accepted as-is until a concrete use case justifies the change.
let mut transport = crate::transport::udp::UdpTransport::new(
transport_id,
traversal.transport_name.clone(),