aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.h
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2012-04-10 20:22:04 +0200
committerPieter Wuille <[email protected]>2012-05-11 15:29:19 +0200
commit090e5b40f1b3ac9ac6209f8996da4d686686a2ac (patch)
treec26367aef8abd697b3f035e2340dcb407cd3424f /src/netbase.h
parentPreliminary support for Tor/I2P hidden services (diff)
downloaddiscoin-090e5b40f1b3ac9ac6209f8996da4d686686a2ac.tar.xz
discoin-090e5b40f1b3ac9ac6209f8996da4d686686a2ac.zip
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.
Diffstat (limited to 'src/netbase.h')
-rw-r--r--src/netbase.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/netbase.h b/src/netbase.h
index 1b6d8d59b..998f8eaf1 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;