This commit is contained in:
mikhail4021 2014-02-23 21:54:36 +04:00
parent 885dc6603f
commit 2deb4118bc
31 changed files with 783 additions and 212 deletions

View file

@ -32,6 +32,14 @@ namespace data
eTransportSSU
};
struct Introducer
{
boost::asio::ip::address iHost;
int iPort;
uint8_t iKey[32];
uint32_t iTag;
};
struct Address
{
TransportStyle transportStyle;
@ -39,7 +47,9 @@ namespace data
int port;
uint64_t date;
uint8_t cost;
uint8_t key[32]; // into key for SSU
// SSU only
uint8_t key[32]; // intro key for SSU
std::vector<Introducer> introducers;
};
RouterInfo (const char * filename);
@ -54,8 +64,8 @@ namespace data
const char * GetIdentHashAbbreviation () const { return m_IdentHashAbbreviation; };
uint64_t GetTimestamp () const { return m_Timestamp; };
std::vector<Address>& GetAddresses () { return m_Addresses; };
Address * GetNTCPAddress (bool v4only = true);
Address * GetSSUAddress (bool v4only = true);
const Address * GetNTCPAddress (bool v4only = true) const;
const Address * GetSSUAddress (bool v4only = true) const;
const RoutingKey& GetRoutingKey () const { return m_RoutingKey; };
void AddNTCPAddress (const char * host, int port);
@ -65,6 +75,7 @@ namespace data
bool IsNTCP (bool v4only = true) const;
bool IsSSU (bool v4only = true) const;
bool IsCompatible (const RouterInfo& other) const { return m_SupportedTransports & other.m_SupportedTransports; };
bool UsesIntroducer () const;
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
bool IsUnreachable () const { return m_IsUnreachable; };
@ -91,7 +102,7 @@ namespace data
size_t ReadString (char * str, std::istream& s);
void WriteString (const std::string& str, std::ostream& s);
void UpdateIdentHashBase64 ();
Address * GetAddress (TransportStyle s, bool v4only);
const Address * GetAddress (TransportStyle s, bool v4only) const;
private: