Browse Source

fill caps for SSU

pull/46/head
orignal 11 years ago
parent
commit
53230a4051
  1. 22
      RouterContext.cpp
  2. 21
      RouterInfo.cpp

22
RouterContext.cpp

@ -32,17 +32,19 @@ namespace i2p
{ {
i2p::data::Identity ident; i2p::data::Identity ident;
ident = m_Keys; ident = m_Keys;
m_RouterInfo.SetRouterIdentity (ident);
//m_RouterInfo.AddSSUAddress ("127.0.0.1", 17007, m_RouterInfo.GetIdentHash ()); i2p::data::RouterInfo routerInfo;
m_RouterInfo.AddNTCPAddress ("127.0.0.1", 17007); // TODO: routerInfo.SetRouterIdentity (ident);
m_RouterInfo.SetProperty ("caps", "LR"); //routerInfo.AddSSUAddress ("127.0.0.1", 17007, routerInfo.GetIdentHash ());
m_RouterInfo.SetProperty ("coreVersion", "0.9.8.1"); routerInfo.AddNTCPAddress ("127.0.0.1", 17007); // TODO:
m_RouterInfo.SetProperty ("netId", "2"); routerInfo.SetProperty ("caps", "LR");
m_RouterInfo.SetProperty ("router.version", "0.9.8.1"); routerInfo.SetProperty ("coreVersion", "0.9.8.1");
m_RouterInfo.SetProperty ("start_uptime", "90m"); routerInfo.SetProperty ("netId", "2");
routerInfo.SetProperty ("router.version", "0.9.8.1");
m_RouterInfo.CreateBuffer (); routerInfo.SetProperty ("start_uptime", "90m");
routerInfo.CreateBuffer ();
m_RouterInfo = routerInfo;
} }
void RouterContext::OverrideNTCPAddress (const char * host, int port) void RouterContext::OverrideNTCPAddress (const char * host, int port)

21
RouterInfo.cpp

@ -133,7 +133,7 @@ namespace data
{ {
// introducers // introducers
size_t l = strlen(key); size_t l = strlen(key);
unsigned char index = key[l-1]; // TODO: unsigned char index = key[l-1] - '0'; // TODO:
key[l-1] = 0; key[l-1] = 0;
if (index >= address.introducers.size ()) if (index >= address.introducers.size ())
address.introducers.resize (index + 1); address.introducers.resize (index + 1);
@ -214,12 +214,10 @@ namespace data
else if (address.transportStyle == eTransportSSU) else if (address.transportStyle == eTransportSSU)
{ {
WriteString ("SSU", s); WriteString ("SSU", s);
// wtite intro key // caps
WriteString ("key", properties); WriteString ("caps", properties);
properties << '='; properties << '=';
char value[64]; WriteString ("BC", properties); // TODO:
ByteStreamToBase64 (address.key, 32, value, 64);
WriteString (value, properties);
properties << ';'; properties << ';';
} }
else else
@ -229,6 +227,17 @@ namespace data
properties << '='; properties << '=';
WriteString (address.host.to_string (), properties); WriteString (address.host.to_string (), properties);
properties << ';'; properties << ';';
if (address.transportStyle == eTransportSSU)
{
// wtite intro key
WriteString ("key", properties);
properties << '=';
char value[64];
size_t l = ByteStreamToBase64 (address.key, 32, value, 64);
value[l] = 0;
WriteString (value, properties);
properties << ';';
}
WriteString ("port", properties); WriteString ("port", properties);
properties << '='; properties << '=';
WriteString (boost::lexical_cast<std::string>(address.port), properties); WriteString (boost::lexical_cast<std::string>(address.port), properties);

Loading…
Cancel
Save