Limited relaying/storing of foreign addresses

Introduce a boolean variable for each "network" (ipv4, ipv6, tor, i2p),
and track whether we are likely to able to connect to it. Addresses in
"addr" messages outside of our network get limited relaying and are not
stored in addrman.
This commit is contained in:
Pieter Wuille
2012-04-10 20:22:04 +02:00
parent d32148567f
commit 090e5b40f1
5 changed files with 60 additions and 4 deletions

View File

@@ -17,6 +17,19 @@ extern int nConnectTimeout;
#undef SetPort
#endif
enum Network
{
NET_UNROUTABLE,
NET_IPV4,
NET_IPV6,
NET_TOR,
NET_I2P,
NET_MAX
};
enum Network ParseNetwork(std::string net);
/** IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) */
class CNetAddr
{
@@ -48,6 +61,7 @@ class CNetAddr
bool IsRoutable() const;
bool IsValid() const;
bool IsMulticast() const;
enum Network GetNetwork() const;
std::string ToString() const;
std::string ToStringIP() const;
int GetByte(int n) const;