diff --git a/RouterContext.cpp b/RouterContext.cpp index 2b8c9c1d..6279ee21 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -32,17 +32,19 @@ namespace i2p { i2p::data::Identity ident; ident = m_Keys; - m_RouterInfo.SetRouterIdentity (ident); - //m_RouterInfo.AddSSUAddress ("127.0.0.1", 17007, m_RouterInfo.GetIdentHash ()); - m_RouterInfo.AddNTCPAddress ("127.0.0.1", 17007); // TODO: - m_RouterInfo.SetProperty ("caps", "LR"); - m_RouterInfo.SetProperty ("coreVersion", "0.9.8.1"); - m_RouterInfo.SetProperty ("netId", "2"); - m_RouterInfo.SetProperty ("router.version", "0.9.8.1"); - m_RouterInfo.SetProperty ("start_uptime", "90m"); + i2p::data::RouterInfo routerInfo; + routerInfo.SetRouterIdentity (ident); + //routerInfo.AddSSUAddress ("127.0.0.1", 17007, routerInfo.GetIdentHash ()); + routerInfo.AddNTCPAddress ("127.0.0.1", 17007); // TODO: + routerInfo.SetProperty ("caps", "LR"); + routerInfo.SetProperty ("coreVersion", "0.9.8.1"); + routerInfo.SetProperty ("netId", "2"); + routerInfo.SetProperty ("router.version", "0.9.8.1"); + routerInfo.SetProperty ("start_uptime", "90m"); + routerInfo.CreateBuffer (); - m_RouterInfo.CreateBuffer (); + m_RouterInfo = routerInfo; } void RouterContext::OverrideNTCPAddress (const char * host, int port) diff --git a/RouterInfo.cpp b/RouterInfo.cpp index ae5e03e3..cd97d89d 100644 --- a/RouterInfo.cpp +++ b/RouterInfo.cpp @@ -133,7 +133,7 @@ namespace data { // introducers size_t l = strlen(key); - unsigned char index = key[l-1]; // TODO: + unsigned char index = key[l-1] - '0'; // TODO: key[l-1] = 0; if (index >= address.introducers.size ()) address.introducers.resize (index + 1); @@ -214,12 +214,10 @@ namespace data else if (address.transportStyle == eTransportSSU) { WriteString ("SSU", s); - // wtite intro key - WriteString ("key", properties); + // caps + WriteString ("caps", properties); properties << '='; - char value[64]; - ByteStreamToBase64 (address.key, 32, value, 64); - WriteString (value, properties); + WriteString ("BC", properties); // TODO: properties << ';'; } else @@ -229,6 +227,17 @@ namespace data properties << '='; WriteString (address.host.to_string (), 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); properties << '='; WriteString (boost::lexical_cast(address.port), properties);