From 3e3f92c616b6e0e7a8343cd2f574a5496274edba Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 27 Oct 2022 15:02:54 -0400 Subject: [PATCH] set and check proxy status for ipv6 if presented --- libi2pd/RouterContext.cpp | 2 +- libi2pd/Transports.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libi2pd/RouterContext.cpp b/libi2pd/RouterContext.cpp index 423bcfd7..6dd3a30d 100644 --- a/libi2pd/RouterContext.cpp +++ b/libi2pd/RouterContext.cpp @@ -463,7 +463,7 @@ namespace i2p updated = true; } if (host.is_v6 () && address->IsV6 () && address->ssu && - (!address->ssu->mtu || updated)) + (!address->ssu->mtu || updated) && m_StatusV6 != eRouterStatusProxy) { // update MTU auto mtu = i2p::util::net::GetMTU (host); diff --git a/libi2pd/Transports.cpp b/libi2pd/Transports.cpp index 676cd876..84decfab 100644 --- a/libi2pd/Transports.cpp +++ b/libi2pd/Transports.cpp @@ -167,6 +167,8 @@ namespace transport m_PeerTestTimer = new boost::asio::deadline_timer (*m_Service); } + bool ipv4; i2p::config::GetOption("ipv4", ipv4); + bool ipv6; i2p::config::GetOption("ipv6", ipv6); i2p::config::GetOption("nat", m_IsNAT); m_X25519KeysPairSupplier.Start (); m_IsRunning = true; @@ -190,6 +192,8 @@ namespace transport m_NTCP2Server->UseProxy(proxytype, proxyurl.host, proxyurl.port, proxyurl.user, proxyurl.pass); i2p::context.SetStatus (eRouterStatusProxy); + if (ipv6) + i2p::context.SetStatusV6 (eRouterStatusProxy); } else LogPrint(eLogError, "Transports: Unsupported NTCP2 proxy URL ", ntcp2proxy); @@ -227,7 +231,11 @@ namespace transport if (proxyurl.parse (ssu2proxy) && proxyurl.schema == "socks") { if (m_SSU2Server->SetProxy (proxyurl.host, proxyurl.port)) + { i2p::context.SetStatus (eRouterStatusProxy); + if (ipv6) + i2p::context.SetStatusV6 (eRouterStatusProxy); + } else LogPrint(eLogError, "Transports: Can't set SSU2 proxy ", ssu2proxy); } @@ -237,7 +245,6 @@ namespace transport } // bind to interfaces - bool ipv4; i2p::config::GetOption("ipv4", ipv4); if (ipv4) { std::string address; i2p::config::GetOption("address4", address); @@ -254,7 +261,6 @@ namespace transport } } - bool ipv6; i2p::config::GetOption("ipv6", ipv6); if (ipv6) { std::string address; i2p::config::GetOption("address6", address);