mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
read intro key for SSU address
This commit is contained in:
parent
8d4b98c83a
commit
3016c42e2e
@ -122,6 +122,8 @@ namespace data
|
|||||||
}
|
}
|
||||||
else if (!strcmp (key, "port"))
|
else if (!strcmp (key, "port"))
|
||||||
address.port = boost::lexical_cast<int>(value);
|
address.port = boost::lexical_cast<int>(value);
|
||||||
|
else if (!strcmp (key, "key"))
|
||||||
|
Base64ToByteStream (value, strlen (value), address.key, 32);
|
||||||
}
|
}
|
||||||
m_Addresses.push_back(address);
|
m_Addresses.push_back(address);
|
||||||
}
|
}
|
||||||
@ -289,10 +291,20 @@ namespace data
|
|||||||
}
|
}
|
||||||
|
|
||||||
RouterInfo::Address * RouterInfo::GetNTCPAddress (bool v4only)
|
RouterInfo::Address * RouterInfo::GetNTCPAddress (bool v4only)
|
||||||
|
{
|
||||||
|
return GetAddress (eTransportNTCP, v4only);
|
||||||
|
}
|
||||||
|
|
||||||
|
RouterInfo::Address * RouterInfo::GetSSUAddress (bool v4only)
|
||||||
|
{
|
||||||
|
return GetAddress (eTransportSSU, v4only);
|
||||||
|
}
|
||||||
|
|
||||||
|
RouterInfo::Address * RouterInfo::GetAddress (TransportStyle s, bool v4only)
|
||||||
{
|
{
|
||||||
for (auto& address : m_Addresses)
|
for (auto& address : m_Addresses)
|
||||||
{
|
{
|
||||||
if (address.transportStyle == eTransportNTCP)
|
if (address.transportStyle == s)
|
||||||
{
|
{
|
||||||
if (!v4only || address.host.is_v4 ())
|
if (!v4only || address.host.is_v4 ())
|
||||||
return &address;
|
return &address;
|
||||||
|
@ -39,6 +39,7 @@ namespace data
|
|||||||
int port;
|
int port;
|
||||||
uint64_t date;
|
uint64_t date;
|
||||||
uint8_t cost;
|
uint8_t cost;
|
||||||
|
uint8_t key[32]; // into key for SSU
|
||||||
};
|
};
|
||||||
|
|
||||||
RouterInfo (const char * filename);
|
RouterInfo (const char * filename);
|
||||||
@ -54,6 +55,7 @@ namespace data
|
|||||||
uint64_t GetTimestamp () const { return m_Timestamp; };
|
uint64_t GetTimestamp () const { return m_Timestamp; };
|
||||||
const std::vector<Address>& GetAddresses () const { return m_Addresses; };
|
const std::vector<Address>& GetAddresses () const { return m_Addresses; };
|
||||||
Address * GetNTCPAddress (bool v4only = true);
|
Address * GetNTCPAddress (bool v4only = true);
|
||||||
|
Address * GetSSUAddress (bool v4only = true);
|
||||||
const RoutingKey& GetRoutingKey () const { return m_RoutingKey; };
|
const RoutingKey& GetRoutingKey () const { return m_RoutingKey; };
|
||||||
|
|
||||||
void AddNTCPAddress (const char * host, int port);
|
void AddNTCPAddress (const char * host, int port);
|
||||||
@ -88,6 +90,7 @@ namespace data
|
|||||||
size_t ReadString (char * str, std::istream& s);
|
size_t ReadString (char * str, std::istream& s);
|
||||||
void WriteString (const std::string& str, std::ostream& s);
|
void WriteString (const std::string& str, std::ostream& s);
|
||||||
void UpdateIdentHashBase64 ();
|
void UpdateIdentHashBase64 ();
|
||||||
|
Address * GetAddress (TransportStyle s, bool v4only);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user