mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-06-22 05:48:20 +02:00
implemented ssu2.firewalled4 and ssu2.firewalled6 params
Some checks failed
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Building container for linux/386 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / buster (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
Some checks failed
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Building container for linux/386 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / buster (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
This commit is contained in:
parent
46154dabd5
commit
4828d93257
4 changed files with 11 additions and 1 deletions
|
@ -305,6 +305,8 @@ namespace config {
|
||||||
("ssu2.mtu4", value<uint16_t>()->default_value(0), "MTU for ipv4 address (default: detect)")
|
("ssu2.mtu4", value<uint16_t>()->default_value(0), "MTU for ipv4 address (default: detect)")
|
||||||
("ssu2.mtu6", value<uint16_t>()->default_value(0), "MTU for ipv6 address (default: detect)")
|
("ssu2.mtu6", value<uint16_t>()->default_value(0), "MTU for ipv6 address (default: detect)")
|
||||||
("ssu2.proxy", value<std::string>()->default_value(""), "Socks5 proxy URL for SSU2 transport")
|
("ssu2.proxy", value<std::string>()->default_value(""), "Socks5 proxy URL for SSU2 transport")
|
||||||
|
("ssu2.firewalled4", value<bool>()->default_value(false), "Set ipv4 network status to Firewalled even if OK (default: disabled)")
|
||||||
|
("ssu2.firewalled6", value<bool>()->default_value(false), "Set ipv6 network status to Firewalled even if OK (default: disabled)")
|
||||||
;
|
;
|
||||||
|
|
||||||
options_description nettime("Time sync options");
|
options_description nettime("Time sync options");
|
||||||
|
|
|
@ -25,7 +25,8 @@ namespace transport
|
||||||
m_TerminationTimer (GetService ()), m_CleanupTimer (GetService ()), m_ResendTimer (GetService ()),
|
m_TerminationTimer (GetService ()), m_CleanupTimer (GetService ()), m_ResendTimer (GetService ()),
|
||||||
m_IntroducersUpdateTimer (GetService ()), m_IntroducersUpdateTimerV6 (GetService ()),
|
m_IntroducersUpdateTimer (GetService ()), m_IntroducersUpdateTimerV6 (GetService ()),
|
||||||
m_IsPublished (true), m_IsSyncClockFromPeers (true), m_PendingTimeOffset (0),
|
m_IsPublished (true), m_IsSyncClockFromPeers (true), m_PendingTimeOffset (0),
|
||||||
m_Rng(i2p::util::GetMonotonicMicroseconds ()%1000000LL), m_IsThroughProxy (false)
|
m_Rng(i2p::util::GetMonotonicMicroseconds ()%1000000LL), m_IsForcedFirewalled4 (false),
|
||||||
|
m_IsForcedFirewalled6 (false), m_IsThroughProxy (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +80,7 @@ namespace transport
|
||||||
if (address->IsV4 ())
|
if (address->IsV4 ())
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
i2p::config::GetOption ("ssu2.firewalled4", m_IsForcedFirewalled4);
|
||||||
LogPrint (eLogDebug, "SSU2: Opening IPv4 socket at Start");
|
LogPrint (eLogDebug, "SSU2: Opening IPv4 socket at Start");
|
||||||
OpenSocket (boost::asio::ip::udp::endpoint (m_AddressV4, port));
|
OpenSocket (boost::asio::ip::udp::endpoint (m_AddressV4, port));
|
||||||
boost::asio::post (m_ReceiveService.GetService (),
|
boost::asio::post (m_ReceiveService.GetService (),
|
||||||
|
@ -91,6 +93,7 @@ namespace transport
|
||||||
if (address->IsV6 ())
|
if (address->IsV6 ())
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
i2p::config::GetOption ("ssu2.firewalled6", m_IsForcedFirewalled6);
|
||||||
LogPrint (eLogDebug, "SSU2: Opening IPv6 socket at Start");
|
LogPrint (eLogDebug, "SSU2: Opening IPv6 socket at Start");
|
||||||
OpenSocket (boost::asio::ip::udp::endpoint (m_AddressV6, port));
|
OpenSocket (boost::asio::ip::udp::endpoint (m_AddressV6, port));
|
||||||
boost::asio::post (m_ReceiveService.GetService (),
|
boost::asio::post (m_ReceiveService.GetService (),
|
||||||
|
|
|
@ -79,6 +79,7 @@ namespace transport
|
||||||
bool UsesProxy () const { return m_IsThroughProxy; };
|
bool UsesProxy () const { return m_IsThroughProxy; };
|
||||||
bool IsSupported (const boost::asio::ip::address& addr) const;
|
bool IsSupported (const boost::asio::ip::address& addr) const;
|
||||||
uint16_t GetPort (bool v4) const;
|
uint16_t GetPort (bool v4) const;
|
||||||
|
bool IsForcedFirewalled (bool v4) const { return v4 ? m_IsForcedFirewalled4 : m_IsForcedFirewalled6; }
|
||||||
bool IsConnectedRecently (const boost::asio::ip::udp::endpoint& ep, bool max = true);
|
bool IsConnectedRecently (const boost::asio::ip::udp::endpoint& ep, bool max = true);
|
||||||
void AddConnectedRecently (const boost::asio::ip::udp::endpoint& ep, uint64_t ts);
|
void AddConnectedRecently (const boost::asio::ip::udp::endpoint& ep, uint64_t ts);
|
||||||
std::mt19937& GetRng () { return m_Rng; }
|
std::mt19937& GetRng () { return m_Rng; }
|
||||||
|
@ -208,6 +209,7 @@ namespace transport
|
||||||
i2p::crypto::AEADChaCha20Poly1305Encryptor m_Encryptor;
|
i2p::crypto::AEADChaCha20Poly1305Encryptor m_Encryptor;
|
||||||
i2p::crypto::AEADChaCha20Poly1305Decryptor m_Decryptor;
|
i2p::crypto::AEADChaCha20Poly1305Decryptor m_Decryptor;
|
||||||
i2p::crypto::ChaCha20Context m_ChaCha20;
|
i2p::crypto::ChaCha20Context m_ChaCha20;
|
||||||
|
bool m_IsForcedFirewalled4, m_IsForcedFirewalled6;
|
||||||
|
|
||||||
// proxy
|
// proxy
|
||||||
bool m_IsThroughProxy;
|
bool m_IsThroughProxy;
|
||||||
|
|
|
@ -90,6 +90,9 @@ namespace transport
|
||||||
if (htobe64 (((uint64_t)nonce << 32) | nonce) == GetSourceConnID ())
|
if (htobe64 (((uint64_t)nonce << 32) | nonce) == GetSourceConnID ())
|
||||||
{
|
{
|
||||||
m_PeerTestResendTimer.cancel (); // cancel delayed msg 6 if any
|
m_PeerTestResendTimer.cancel (); // cancel delayed msg 6 if any
|
||||||
|
if (GetServer ().IsForcedFirewalled (GetRemoteEndpoint ().address().is_v4()))
|
||||||
|
// we assume that msg 5 was not received if forced firewalled
|
||||||
|
return;
|
||||||
m_IsConnectedRecently = GetServer ().IsConnectedRecently (GetRemoteEndpoint ());
|
m_IsConnectedRecently = GetServer ().IsConnectedRecently (GetRemoteEndpoint ());
|
||||||
if (GetAddress ())
|
if (GetAddress ())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue