|
|
@ -55,15 +55,7 @@ namespace client |
|
|
|
if(LoadPrivateKeys (keys, httpProxyKeys)) |
|
|
|
if(LoadPrivateKeys (keys, httpProxyKeys)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::map<std::string, std::string> params; |
|
|
|
std::map<std::string, std::string> params; |
|
|
|
std::string value; |
|
|
|
ReadI2CPOptionsFromConfig ("httpproxy.", params); |
|
|
|
if (i2p::config::GetOption("httpproxy.inbound.length", value)) |
|
|
|
|
|
|
|
params["inbound.length"] = value; |
|
|
|
|
|
|
|
if (i2p::config::GetOption("httpproxy.inbound.quantity", value)) |
|
|
|
|
|
|
|
params["inbound.quantity"] = value; |
|
|
|
|
|
|
|
if (i2p::config::GetOption("httpproxy.outbound.length", value)) |
|
|
|
|
|
|
|
params["outbound.length"] = value; |
|
|
|
|
|
|
|
if (i2p::config::GetOption("httpproxy.outbound.quantity", value)) |
|
|
|
|
|
|
|
params["outbound.quantity"] = value; |
|
|
|
|
|
|
|
localDestination = CreateNewLocalDestination (keys, false, ¶ms); |
|
|
|
localDestination = CreateNewLocalDestination (keys, false, ¶ms); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -77,8 +69,10 @@ namespace client |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
localDestination = nullptr; |
|
|
|
bool socksproxy; i2p::config::GetOption("socksproxy.enabled", socksproxy); |
|
|
|
bool socksproxy; i2p::config::GetOption("socksproxy.enabled", socksproxy); |
|
|
|
if (socksproxy) { |
|
|
|
if (socksproxy) |
|
|
|
|
|
|
|
{ |
|
|
|
std::string socksProxyKeys; i2p::config::GetOption("socksproxy.keys", socksProxyKeys); |
|
|
|
std::string socksProxyKeys; i2p::config::GetOption("socksproxy.keys", socksProxyKeys); |
|
|
|
std::string socksProxyAddr; i2p::config::GetOption("socksproxy.address", socksProxyAddr); |
|
|
|
std::string socksProxyAddr; i2p::config::GetOption("socksproxy.address", socksProxyAddr); |
|
|
|
uint16_t socksProxyPort; i2p::config::GetOption("socksproxy.port", socksProxyPort); |
|
|
|
uint16_t socksProxyPort; i2p::config::GetOption("socksproxy.port", socksProxyPort); |
|
|
@ -88,8 +82,14 @@ namespace client |
|
|
|
if (socksProxyKeys.length () > 0) |
|
|
|
if (socksProxyKeys.length () > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
i2p::data::PrivateKeys keys; |
|
|
|
i2p::data::PrivateKeys keys; |
|
|
|
LoadPrivateKeys (keys, socksProxyKeys); |
|
|
|
if (LoadPrivateKeys (keys, socksProxyKeys)) |
|
|
|
localDestination = CreateNewLocalDestination (keys, false); |
|
|
|
{ |
|
|
|
|
|
|
|
std::map<std::string, std::string> params; |
|
|
|
|
|
|
|
ReadI2CPOptionsFromConfig ("socksproxy.", params); |
|
|
|
|
|
|
|
localDestination = CreateNewLocalDestination (keys, false, ¶ms); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
LogPrint(eLogError, "Clients: failed to load SOCKS Proxy key"); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
m_SocksProxy = new i2p::proxy::SOCKSProxy(socksProxyAddr, socksProxyPort, socksOutProxyAddr, socksOutProxyPort, localDestination); |
|
|
|
m_SocksProxy = new i2p::proxy::SOCKSProxy(socksProxyAddr, socksProxyPort, socksOutProxyAddr, socksOutProxyPort, localDestination); |
|
|
@ -374,6 +374,19 @@ namespace client |
|
|
|
options[I2CP_PARAM_TAGS_TO_SEND] = GetI2CPOption (section, I2CP_PARAM_TAGS_TO_SEND, DEFAULT_TAGS_TO_SEND); |
|
|
|
options[I2CP_PARAM_TAGS_TO_SEND] = GetI2CPOption (section, I2CP_PARAM_TAGS_TO_SEND, DEFAULT_TAGS_TO_SEND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ClientContext::ReadI2CPOptionsFromConfig (const std::string& prefix, std::map<std::string, std::string>& options) const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
std::string value; |
|
|
|
|
|
|
|
if (i2p::config::GetOption(prefix + I2CP_PARAM_INBOUND_TUNNEL_LENGTH, value)) |
|
|
|
|
|
|
|
options[I2CP_PARAM_INBOUND_TUNNEL_LENGTH] = value; |
|
|
|
|
|
|
|
if (i2p::config::GetOption(prefix + I2CP_PARAM_INBOUND_TUNNELS_QUANTITY, value)) |
|
|
|
|
|
|
|
options[I2CP_PARAM_INBOUND_TUNNELS_QUANTITY] = value; |
|
|
|
|
|
|
|
if (i2p::config::GetOption(prefix + I2CP_PARAM_OUTBOUND_TUNNEL_LENGTH, value)) |
|
|
|
|
|
|
|
options[I2CP_PARAM_OUTBOUND_TUNNEL_LENGTH] = value; |
|
|
|
|
|
|
|
if (i2p::config::GetOption(prefix + I2CP_PARAM_OUTBOUND_TUNNELS_QUANTITY, value)) |
|
|
|
|
|
|
|
options[I2CP_PARAM_OUTBOUND_TUNNELS_QUANTITY] = value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ClientContext::ReadTunnels () |
|
|
|
void ClientContext::ReadTunnels () |
|
|
|
{ |
|
|
|
{ |
|
|
|
boost::property_tree::ptree pt; |
|
|
|
boost::property_tree::ptree pt; |
|
|
|