diff --git a/libi2pd/Config.cpp b/libi2pd/Config.cpp index c0702c80..d6274828 100644 --- a/libi2pd/Config.cpp +++ b/libi2pd/Config.cpp @@ -146,6 +146,8 @@ namespace config { ("httpproxy.i2p.streaming.maxInboundSpeed", value()->default_value("1730000000"), "Max inbound speed of HTTP proxy stream in bytes/sec") ("httpproxy.i2p.streaming.profile", value()->default_value("1"), "HTTP Proxy bandwidth usage profile. 1 - bulk(high), 2- interactive(low)") ("httpproxy.i2p.streaming.maxWindowSize", value()->default_value("512"), "HTTP Proxy stream max window size. 512 by default") + ("httpproxy.i2cp.closeIdleTime", value()->default_value(0), "HTTP Proxy idle timeout in milliseconds after which destination stops building tunnels. Disabled by default(0)") + ("httpproxy.i2cp.newDestOnResume", value()->default_value(false), "HTTP Proxy generate a new local destination when resuming from idle. false by default") ; options_description socksproxy("SOCKS Proxy options"); @@ -178,6 +180,8 @@ namespace config { ("socksproxy.i2p.streaming.maxInboundSpeed", value()->default_value("1730000000"), "Max inbound speed of SOCKS proxy stream in bytes/sec") ("socksproxy.i2p.streaming.profile", value()->default_value("1"), "SOCKS Proxy bandwidth usage profile. 1 - bulk(high), 2- interactive(low)") ("socksproxy.i2p.streaming.maxWindowSize", value()->default_value("512"), "SOCKS Proxy stream max window size. 512 by default") + ("socksproxy.i2cp.closeIdleTime", value()->default_value(0), "SOCKS Proxy idle timeout in milliseconds after which destination stops building tunnels. Disabled by default(0)") + ("socksproxy.i2cp.newDestOnResume", value()->default_value(false), "SOCKS Proxy generate a new local destination when resuming from idle. false by default") ; options_description shareddest("Shared local destination options"); diff --git a/libi2pd_client/ClientContext.cpp b/libi2pd_client/ClientContext.cpp index 01abc6a9..4be490ea 100644 --- a/libi2pd_client/ClientContext.cpp +++ b/libi2pd_client/ClientContext.cpp @@ -985,6 +985,13 @@ namespace client { m_HttpProxy = new i2p::proxy::HTTPProxy("HTTP Proxy", httpProxyAddr, httpProxyPort, httpOutProxyURL, httpAddresshelper, httpSendUserAgent, localDestination); + uint64_t closeIdleTime; i2p::config::GetOption("httpproxy.i2cp.closeIdleTime", closeIdleTime); + if (closeIdleTime) + { + m_HttpProxy->SetCloseIdleTime(closeIdleTime); + bool newDestOnResume; i2p::config::GetOption("httpproxy.i2cp.newDestOnResume", newDestOnResume); + m_HttpProxy->SetNewDestOnResume(newDestOnResume); + } m_HttpProxy->Start(); } catch (std::exception& e) @@ -1040,6 +1047,13 @@ namespace client { m_SocksProxy = new i2p::proxy::SOCKSProxy("SOCKS", socksProxyAddr, socksProxyPort, socksOutProxy, socksOutProxyAddr, socksOutProxyPort, localDestination); + uint64_t closeIdleTime; i2p::config::GetOption("socksproxy.i2cp.closeIdleTime", closeIdleTime); + if (closeIdleTime) + { + m_SocksProxy->SetCloseIdleTime(closeIdleTime); + bool newDestOnResume; i2p::config::GetOption("socksproxy.i2cp.newDestOnResume", newDestOnResume); + m_SocksProxy->SetNewDestOnResume(newDestOnResume); + } m_SocksProxy->Start(); } catch (std::exception& e)