mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
[NTCP2] fix socks proxy support
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
27d69894d4
commit
1aa0da3382
6 changed files with 109 additions and 121 deletions
|
@ -176,7 +176,7 @@ namespace transport
|
|||
|
||||
if (proxyurl.schema == "http")
|
||||
proxytype = NTCPServer::eHTTPProxy;
|
||||
m_NTCPServer->UseProxy(proxytype, proxyurl.host, proxyurl.port) ;
|
||||
m_NTCPServer->UseProxy(proxytype, proxyurl.host, proxyurl.port);
|
||||
m_NTCPServer->Start();
|
||||
if(!m_NTCPServer->NetworkIsReady())
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ namespace transport
|
|||
return;
|
||||
}
|
||||
// create NTCP2. TODO: move to acceptor
|
||||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||
if (ntcp2)
|
||||
{
|
||||
if(!ntcp2proxy.empty())
|
||||
|
@ -209,7 +209,7 @@ namespace transport
|
|||
if (proxyurl.schema == "http")
|
||||
proxytype = NTCP2Server::eHTTPProxy;
|
||||
|
||||
m_NTCP2Server->UseProxy(proxytype, proxyurl.host, proxyurl.port) ;
|
||||
m_NTCP2Server->UseProxy(proxytype, proxyurl.host, proxyurl.port);
|
||||
m_NTCP2Server->Start();
|
||||
}
|
||||
else
|
||||
|
@ -424,36 +424,36 @@ namespace transport
|
|||
{
|
||||
if (peer.router) // we have RI already
|
||||
{
|
||||
if (!peer.numAttempts) // NTCP2
|
||||
{
|
||||
peer.numAttempts++;
|
||||
if (m_NTCP2Server) // we support NTCP2
|
||||
{
|
||||
// NTCP2 have priority over NTCP
|
||||
auto address = peer.router->GetNTCP2Address (true, !context.SupportsV6 ()); // published only
|
||||
if (address)
|
||||
{
|
||||
auto s = std::make_shared<NTCP2Session> (*m_NTCP2Server, peer.router);
|
||||
if (!peer.numAttempts) // NTCP2
|
||||
{
|
||||
peer.numAttempts++;
|
||||
if (m_NTCP2Server) // we support NTCP2
|
||||
{
|
||||
// NTCP2 have priority over NTCP
|
||||
auto address = peer.router->GetNTCP2Address (true, !context.SupportsV6 ()); // published only
|
||||
if (address)
|
||||
{
|
||||
auto s = std::make_shared<NTCP2Session> (*m_NTCP2Server, peer.router);
|
||||
|
||||
if(m_NTCP2Server->UsingProxy())
|
||||
{
|
||||
NTCP2Server::RemoteAddressType remote = NTCP2Server::eIP4Address;
|
||||
std::string addr = address->host.to_string();
|
||||
if(m_NTCP2Server->UsingProxy())
|
||||
{
|
||||
NTCP2Server::RemoteAddressType remote = NTCP2Server::eIP4Address;
|
||||
std::string addr = address->host.to_string();
|
||||
|
||||
if(address->host.is_v6())
|
||||
remote = NTCP2Server::eIP6Address;
|
||||
if(address->host.is_v6())
|
||||
remote = NTCP2Server::eIP6Address;
|
||||
|
||||
m_NTCP2Server->ConnectWithProxy(addr, address->port, remote, s);
|
||||
}
|
||||
else
|
||||
m_NTCP2Server->Connect (address->host, address->port, s);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_NTCP2Server->ConnectWithProxy(addr, address->port, remote, s);
|
||||
}
|
||||
else
|
||||
m_NTCP2Server->Connect (address->host, address->port, s);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (peer.numAttempts == 1) // NTCP1
|
||||
{
|
||||
peer.numAttempts++;
|
||||
peer.numAttempts++;
|
||||
auto address = peer.router->GetNTCPAddress (!context.SupportsV6 ());
|
||||
if (address && m_NTCPServer)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue