mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
send base64 adress from outbound non-quiet BOB connections
This commit is contained in:
parent
392075bf60
commit
047a371050
3
BOB.cpp
3
BOB.cpp
|
@ -155,10 +155,9 @@ namespace client
|
||||||
{
|
{
|
||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
auto conn = std::make_shared<I2PTunnelConnection> (this, stream, new boost::asio::ip::tcp::socket (GetService ()), m_Endpoint);
|
auto conn = std::make_shared<I2PTunnelConnection> (this, stream, new boost::asio::ip::tcp::socket (GetService ()), m_Endpoint, m_IsQuiet);
|
||||||
AddConnection (conn);
|
AddConnection (conn);
|
||||||
conn->Connect ();
|
conn->Connect ();
|
||||||
// TODO:
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,15 @@ namespace client
|
||||||
{
|
{
|
||||||
I2PTunnelConnection::I2PTunnelConnection (I2PTunnel * owner,
|
I2PTunnelConnection::I2PTunnelConnection (I2PTunnel * owner,
|
||||||
boost::asio::ip::tcp::socket * socket, const i2p::data::LeaseSet * leaseSet):
|
boost::asio::ip::tcp::socket * socket, const i2p::data::LeaseSet * leaseSet):
|
||||||
m_Socket (socket), m_Owner (owner), m_RemoteEndpoint (socket->remote_endpoint ())
|
m_Socket (socket), m_Owner (owner), m_RemoteEndpoint (socket->remote_endpoint ()),
|
||||||
|
m_IsQuiet (true)
|
||||||
{
|
{
|
||||||
m_Stream = m_Owner->GetLocalDestination ()->CreateStream (*leaseSet);
|
m_Stream = m_Owner->GetLocalDestination ()->CreateStream (*leaseSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
I2PTunnelConnection::I2PTunnelConnection (I2PTunnel * owner, std::shared_ptr<i2p::stream::Stream> stream,
|
I2PTunnelConnection::I2PTunnelConnection (I2PTunnel * owner, std::shared_ptr<i2p::stream::Stream> stream,
|
||||||
boost::asio::ip::tcp::socket * socket, const boost::asio::ip::tcp::endpoint& target):
|
boost::asio::ip::tcp::socket * socket, const boost::asio::ip::tcp::endpoint& target, bool quiet):
|
||||||
m_Socket (socket), m_Stream (stream), m_Owner (owner), m_RemoteEndpoint (target)
|
m_Socket (socket), m_Stream (stream), m_Owner (owner), m_RemoteEndpoint (target), m_IsQuiet (quiet)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +126,16 @@ namespace client
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint ("I2PTunnel connected");
|
LogPrint ("I2PTunnel connected");
|
||||||
StreamReceive ();
|
if (m_IsQuiet)
|
||||||
|
StreamReceive ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// send destination first like received from I2P
|
||||||
|
std::string dest = m_Stream->GetRemoteIdentity ().ToBase64 ();
|
||||||
|
dest += "\n";
|
||||||
|
memcpy (m_StreamBuffer, dest.c_str (), dest.size ());
|
||||||
|
HandleStreamReceive (boost::system::error_code (), dest.size ());
|
||||||
|
}
|
||||||
Receive ();
|
Receive ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ namespace client
|
||||||
public:
|
public:
|
||||||
|
|
||||||
I2PTunnelConnection (I2PTunnel * owner, boost::asio::ip::tcp::socket * socket,
|
I2PTunnelConnection (I2PTunnel * owner, boost::asio::ip::tcp::socket * socket,
|
||||||
const i2p::data::LeaseSet * leaseSet);
|
const i2p::data::LeaseSet * leaseSet); // to I2P
|
||||||
I2PTunnelConnection (I2PTunnel * owner, std::shared_ptr<i2p::stream::Stream> stream, boost::asio::ip::tcp::socket * socket,
|
I2PTunnelConnection (I2PTunnel * owner, std::shared_ptr<i2p::stream::Stream> stream, boost::asio::ip::tcp::socket * socket,
|
||||||
const boost::asio::ip::tcp::endpoint& target);
|
const boost::asio::ip::tcp::endpoint& target, bool quiet = true); // from I2P
|
||||||
~I2PTunnelConnection ();
|
~I2PTunnelConnection ();
|
||||||
|
|
||||||
void I2PConnect (const uint8_t * msg = nullptr, size_t len = 0);
|
void I2PConnect (const uint8_t * msg = nullptr, size_t len = 0);
|
||||||
|
@ -51,6 +51,7 @@ namespace client
|
||||||
std::shared_ptr<i2p::stream::Stream> m_Stream;
|
std::shared_ptr<i2p::stream::Stream> m_Stream;
|
||||||
I2PTunnel * m_Owner;
|
I2PTunnel * m_Owner;
|
||||||
boost::asio::ip::tcp::endpoint m_RemoteEndpoint;
|
boost::asio::ip::tcp::endpoint m_RemoteEndpoint;
|
||||||
|
bool m_IsQuiet; // don't send destination
|
||||||
};
|
};
|
||||||
|
|
||||||
class I2PTunnel
|
class I2PTunnel
|
||||||
|
|
Loading…
Reference in a new issue