From 090e5b40f1b3ac9ac6209f8996da4d686686a2ac Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 10 Apr 2012 20:22:04 +0200 Subject: 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. --- src/netbase.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/netbase.h') diff --git a/src/netbase.h b/src/netbase.h index 1b6d8d59bb..998f8eaf14 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -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; -- cgit v1.2.3