From 76a481a759dc9632519fc0e0c4d359d69128e818 Mon Sep 17 00:00:00 2001 From: HardenedSteel <19209715+HardenedSteel@users.noreply.github.com> Date: Sat, 13 Dec 2025 05:22:24 +0300 Subject: [PATCH] feat: change published port if full-cone If we're behind full-cone NAT; update our published port number while keeping our listening port number, so other peers can connect us even we're behind NAT. --- libi2pd/SSU2Session.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libi2pd/SSU2Session.cpp b/libi2pd/SSU2Session.cpp index 9244681a..c8086270 100644 --- a/libi2pd/SSU2Session.cpp +++ b/libi2pd/SSU2Session.cpp @@ -1838,14 +1838,20 @@ namespace transport if (i2p::context.GetTesting ()) i2p::context.SetError (eRouterErrorSymmetricNAT); else if (m_State == eSSU2SessionStatePeerTest) + { i2p::context.SetError (eRouterErrorFullConeNAT); + i2p::context.UpdatePort((int)ep.port ()); + } } else { if (i2p::context.GetTestingV6 ()) i2p::context.SetErrorV6 (eRouterErrorSymmetricNAT); else if (m_State == eSSU2SessionStatePeerTest) + { i2p::context.SetErrorV6 (eRouterErrorFullConeNAT); + i2p::context.UpdatePort((int)ep.port ()); + } } } else