Bitcoin ABC  0.23.1
P2P Digital Currency
netaddress.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_NETADDRESS_H
6 #define BITCOIN_NETADDRESS_H
7 
8 #if defined(HAVE_CONFIG_H)
9 #include <config/bitcoin-config.h>
10 #endif
11 
12 #include <attributes.h>
13 #include <compat.h>
14 #include <prevector.h>
15 #include <serialize.h>
16 #include <util/strencodings.h>
17 #include <util/string.h>
18 
19 #include <tinyformat.h>
20 
21 #include <array>
22 #include <cstdint>
23 #include <ios>
24 #include <string>
25 #include <vector>
26 
32 static const int ADDRV2_FORMAT = 0x20000000;
33 
43 enum Network {
47 
50 
53 
56 
59 
62 
66 
69 };
70 
73 static const std::array<uint8_t, 12> IPV4_IN_IPV6_PREFIX{
74  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF}};
75 
80 static const std::array<uint8_t, 6> TORV2_IN_IPV6_PREFIX{
81  {0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43}};
82 
88 static const std::array<uint8_t, 6> INTERNAL_IN_IPV6_PREFIX{
89  // 0xFD + sha256("bitcoin")[0:5].
90  {0xFD, 0x6B, 0x88, 0xC0, 0x87, 0x24}};
91 
93 static constexpr size_t ADDR_IPV4_SIZE = 4;
94 
96 static constexpr size_t ADDR_IPV6_SIZE = 16;
97 
99 static constexpr size_t ADDR_TORV2_SIZE = 10;
100 
103 static constexpr size_t ADDR_TORV3_SIZE = 32;
104 
106 static constexpr size_t ADDR_I2P_SIZE = 32;
107 
109 static constexpr size_t ADDR_CJDNS_SIZE = 16;
110 
112 static constexpr size_t ADDR_INTERNAL_SIZE = 10;
113 
117 class CNetAddr {
118 protected:
124 
129 
130  // for scoped/link-local ipv6 addresses
131  uint32_t scopeId{0};
132 
133 public:
134  CNetAddr();
135  explicit CNetAddr(const struct in_addr &ipv4Addr);
136  void SetIP(const CNetAddr &ip);
137 
145 
146  bool SetInternal(const std::string &name);
147 
148  // for Tor addresses
149  bool SetSpecial(const std::string &strName);
150  // INADDR_ANY equivalent
151  bool IsBindAny() const;
152  // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0)
153  bool IsIPv4() const;
154  // IPv6 address (not mapped IPv4, not Tor)
155  bool IsIPv6() const;
156  // IPv4 private networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12)
157  bool IsRFC1918() const;
158  // IPv4 inter-network communications (198.18.0.0/15)
159  bool IsRFC2544() const;
160  // IPv4 ISP-level NAT (100.64.0.0/10)
161  bool IsRFC6598() const;
162  // IPv4 documentation addresses (192.0.2.0/24, 198.51.100.0/24,
163  // 203.0.113.0/24)
164  bool IsRFC5737() const;
165  // IPv6 documentation address (2001:0DB8::/32)
166  bool IsRFC3849() const;
167  // IPv4 autoconfig (169.254.0.0/16)
168  bool IsRFC3927() const;
169  // IPv6 6to4 tunnelling (2002::/16)
170  bool IsRFC3964() const;
171  // IPv6 unique local (FC00::/7)
172  bool IsRFC4193() const;
173  // IPv6 Teredo tunnelling (2001::/32)
174  bool IsRFC4380() const;
175  // IPv6 ORCHID (deprecated) (2001:10::/28)
176  bool IsRFC4843() const;
177  // IPv6 ORCHIDv2 (2001:20::/28)
178  bool IsRFC7343() const;
179  // IPv6 autoconfig (FE80::/64)
180  bool IsRFC4862() const;
181  // IPv6 well-known prefix for IPv4-embedded address (64:FF9B::/96)
182  bool IsRFC6052() const;
183  // IPv6 IPv4-translated address (::FFFF:0:0:0/96) (actually defined in
184  // RFC2765)
185  bool IsRFC6145() const;
186  // IPv6 Hurricane Electric - https://he.net (2001:0470::/36)
187  bool IsHeNet() const;
188  bool IsTor() const;
189  bool IsI2P() const;
190  bool IsCJDNS() const;
191  bool IsLocal() const;
192  bool IsRoutable() const;
193  bool IsInternal() const;
194  bool IsValid() const;
195 
200  bool IsAddrV1Compatible() const;
201 
202  enum Network GetNetwork() const;
203  std::string ToString() const;
204  std::string ToStringIP() const;
205  uint64_t GetHash() const;
206  bool GetInAddr(struct in_addr *pipv4Addr) const;
207  uint32_t GetNetClass() const;
208 
211  uint32_t GetLinkedIPv4() const;
213  bool HasLinkedIPv4() const;
214 
215  // The AS on the BGP path to the node we use to diversify
216  // peers in AddrMan bucketing based on the AS infrastructure.
217  // The ip->AS mapping depends on how asmap is constructed.
218  uint32_t GetMappedAS(const std::vector<bool> &asmap) const;
219 
220  std::vector<uint8_t> GetGroup(const std::vector<bool> &asmap) const;
221  std::vector<uint8_t> GetAddrBytes() const;
222  int GetReachabilityFrom(const CNetAddr *paddrPartner = nullptr) const;
223 
224  explicit CNetAddr(const struct in6_addr &pipv6Addr,
225  const uint32_t scope = 0);
226  bool GetIn6Addr(struct in6_addr *pipv6Addr) const;
227 
228  friend bool operator==(const CNetAddr &a, const CNetAddr &b);
229  friend bool operator!=(const CNetAddr &a, const CNetAddr &b) {
230  return !(a == b);
231  }
232  friend bool operator<(const CNetAddr &a, const CNetAddr &b);
233 
237  template <typename Stream> void Serialize(Stream &s) const {
238  if (s.GetVersion() & ADDRV2_FORMAT) {
240  } else {
242  }
243  }
244 
248  template <typename Stream> void Unserialize(Stream &s) {
249  if (s.GetVersion() & ADDRV2_FORMAT) {
251  } else {
253  }
254  }
255 
256  friend class CSubNet;
257 
258 private:
262  enum BIP155Network : uint8_t {
263  IPV4 = 1,
264  IPV6 = 2,
265  TORV2 = 3,
266  TORV3 = 4,
267  I2P = 5,
268  CJDNS = 6,
269  };
270 
274  static constexpr size_t V1_SERIALIZATION_SIZE = ADDR_IPV6_SIZE;
275 
281  static constexpr size_t MAX_ADDRV2_SIZE = 512;
282 
289 
300  bool SetNetFromBIP155Network(uint8_t possible_bip155_net,
301  size_t address_size);
302 
306  void SerializeV1Array(uint8_t (&arr)[V1_SERIALIZATION_SIZE]) const {
307  size_t prefix_size;
308 
309  switch (m_net) {
310  case NET_IPV6:
311  assert(m_addr.size() == sizeof(arr));
312  memcpy(arr, m_addr.data(), m_addr.size());
313  return;
314  case NET_IPV4:
315  prefix_size = sizeof(IPV4_IN_IPV6_PREFIX);
316  assert(prefix_size + m_addr.size() == sizeof(arr));
317  memcpy(arr, IPV4_IN_IPV6_PREFIX.data(), prefix_size);
318  memcpy(arr + prefix_size, m_addr.data(), m_addr.size());
319  return;
320  case NET_ONION:
321  if (m_addr.size() == ADDR_TORV3_SIZE) {
322  break;
323  }
324  prefix_size = sizeof(TORV2_IN_IPV6_PREFIX);
325  assert(prefix_size + m_addr.size() == sizeof(arr));
326  memcpy(arr, TORV2_IN_IPV6_PREFIX.data(), prefix_size);
327  memcpy(arr + prefix_size, m_addr.data(), m_addr.size());
328  return;
329  case NET_INTERNAL:
330  prefix_size = sizeof(INTERNAL_IN_IPV6_PREFIX);
331  assert(prefix_size + m_addr.size() == sizeof(arr));
332  memcpy(arr, INTERNAL_IN_IPV6_PREFIX.data(), prefix_size);
333  memcpy(arr + prefix_size, m_addr.data(), m_addr.size());
334  return;
335  case NET_I2P:
336  break;
337  case NET_CJDNS:
338  break;
339  case NET_UNROUTABLE:
340  case NET_MAX:
341  assert(false);
342  } // no default case, so the compiler can warn about missing cases
343 
344  // Serialize TORv3, I2P and CJDNS as all-zeros.
345  memset(arr, 0x0, V1_SERIALIZATION_SIZE);
346  }
347 
351  template <typename Stream> void SerializeV1Stream(Stream &s) const {
352  uint8_t serialized[V1_SERIALIZATION_SIZE];
353 
354  SerializeV1Array(serialized);
355 
356  s << serialized;
357  }
358 
362  template <typename Stream> void SerializeV2Stream(Stream &s) const {
363  if (IsInternal()) {
364  // Serialize NET_INTERNAL as embedded in IPv6. We need to
365  // serialize such addresses from addrman.
366  s << static_cast<uint8_t>(BIP155Network::IPV6);
369  return;
370  }
371 
372  s << static_cast<uint8_t>(GetBIP155Network());
373  s << m_addr;
374  }
375 
379  void UnserializeV1Array(uint8_t (&arr)[V1_SERIALIZATION_SIZE]) {
380  // Use SetLegacyIPv6() so that m_net is set correctly. For example
381  // ::FFFF:0102:0304 should be set as m_net=NET_IPV4 (1.2.3.4).
382  SetLegacyIPv6(arr);
383  }
384 
388  template <typename Stream> void UnserializeV1Stream(Stream &s) {
389  uint8_t serialized[V1_SERIALIZATION_SIZE];
390 
391  s >> serialized;
392 
393  UnserializeV1Array(serialized);
394  }
395 
399  template <typename Stream> void UnserializeV2Stream(Stream &s) {
400  uint8_t bip155_net;
401  s >> bip155_net;
402 
403  size_t address_size;
404  s >> COMPACTSIZE(address_size);
405 
406  if (address_size > MAX_ADDRV2_SIZE) {
407  throw std::ios_base::failure(strprintf(
408  "Address too long: %u > %u", address_size, MAX_ADDRV2_SIZE));
409  }
410 
411  scopeId = 0;
412 
413  if (SetNetFromBIP155Network(bip155_net, address_size)) {
414  m_addr.resize(address_size);
415  s >> MakeSpan(m_addr);
416 
417  if (m_net != NET_IPV6) {
418  return;
419  }
420 
421  // Do some special checks on IPv6 addresses.
422 
423  // Recognize NET_INTERNAL embedded in IPv6, such addresses are not
424  // gossiped but could be coming from addrman, when unserializing
425  // from disk.
428  memmove(m_addr.data(),
432  return;
433  }
434 
437  return;
438  }
439 
440  // IPv4 and TORv2 are not supposed to be embedded in IPv6 (like in
441  // V1 encoding). Unserialize as !IsValid(), thus ignoring them.
442  } else {
443  // If we receive an unknown BIP155 network id (from the future?)
444  // then ignore the address - unserialize as !IsValid().
445  s.ignore(address_size);
446  }
447 
448  // Mimic a default-constructed CNetAddr object which is !IsValid() and
449  // thus will not be gossiped, but continue reading next addresses from
450  // the stream.
451  m_net = NET_IPV6;
453  }
454 };
455 
456 class CSubNet {
457 protected:
461  uint8_t netmask[16];
463  bool valid;
464 
465  bool SanityCheck() const;
466 
467 public:
468  CSubNet();
469  CSubNet(const CNetAddr &addr, uint8_t mask);
470  CSubNet(const CNetAddr &addr, const CNetAddr &mask);
471 
472  // constructor for single ip subnet (<ipv4>/32 or <ipv6>/128)
473  explicit CSubNet(const CNetAddr &addr);
474 
475  bool Match(const CNetAddr &addr) const;
476 
477  std::string ToString() const;
478  bool IsValid() const;
479 
480  friend bool operator==(const CSubNet &a, const CSubNet &b);
481  friend bool operator!=(const CSubNet &a, const CSubNet &b) {
482  return !(a == b);
483  }
484  friend bool operator<(const CSubNet &a, const CSubNet &b);
485 
487  READWRITE(obj.network);
488  if (obj.network.IsIPv4()) {
489  // Before D9176, CSubNet used the last 4 bytes of netmask to store
490  // the relevant bytes for an IPv4 mask. For compatiblity reasons,
491  // keep doing so in serialized form.
492  uint8_t dummy[12] = {0};
493  READWRITE(dummy);
494  READWRITE(MakeSpan(obj.netmask).first(4));
495  } else {
496  READWRITE(obj.netmask);
497  }
498  READWRITE(obj.valid);
499  // Mark invalid if the result doesn't pass sanity checking.
500  SER_READ(obj, if (obj.valid) obj.valid = obj.SanityCheck());
501  }
502 };
503 
505 class CService : public CNetAddr {
506 protected:
507  // host order
508  uint16_t port;
509 
510 public:
511  CService();
512  CService(const CNetAddr &ip, unsigned short port);
513  CService(const struct in_addr &ipv4Addr, unsigned short port);
514  explicit CService(const struct sockaddr_in &addr);
515  unsigned short GetPort() const;
516  bool GetSockAddr(struct sockaddr *paddr, socklen_t *addrlen) const;
517  bool SetSockAddr(const struct sockaddr *paddr);
518  friend bool operator==(const CService &a, const CService &b);
519  friend bool operator!=(const CService &a, const CService &b) {
520  return !(a == b);
521  }
522  friend bool operator<(const CService &a, const CService &b);
523  std::vector<uint8_t> GetKey() const;
524  std::string ToString() const;
525  std::string ToStringPort() const;
526  std::string ToStringIPPort() const;
527 
528  CService(const struct in6_addr &ipv6Addr, unsigned short port);
529  explicit CService(const struct sockaddr_in6 &addr);
530 
532  READWRITEAS(CNetAddr, obj);
534  }
535 };
536 
537 bool SanityCheckASMap(const std::vector<bool> &asmap);
538 
539 #endif // BITCOIN_NETADDRESS_H
int GetReachabilityFrom(const CNetAddr *paddrPartner=nullptr) const
Calculates a metric for how reachable (*this) is from a given partner.
Definition: netaddress.cpp:829
bool HasLinkedIPv4() const
Whether this address has a linked IPv4 address (see GetLinkedIPv4()).
Definition: netaddress.cpp:658
friend class CSubNet
Definition: netaddress.h:256
void resize(size_type new_size)
Definition: prevector.h:416
bool SetNetFromBIP155Network(uint8_t possible_bip155_net, size_t address_size)
Set m_net from the provided BIP155 network id and size after validation.
Definition: netaddress.cpp:59
void assign(size_type n, const T &val)
Definition: prevector.h:326
void Serialize(Stream &s) const
Serialize to a stream.
Definition: netaddress.h:237
bool IsLocal() const
Definition: netaddress.cpp:412
bool IsRFC4380() const
Definition: netaddress.cpp:350
A set of addresses that represent the hash of a string or FQDN.
Definition: netaddress.h:65
Dummy value to indicate the number of NET_* constants.
Definition: netaddress.h:68
void SetIP(const CNetAddr &ip)
Definition: netaddress.cpp:125
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition: tinyformat.h:1201
static constexpr size_t ADDR_TORV3_SIZE
Size of TORv3 address (in bytes).
Definition: netaddress.h:103
IPv4.
Definition: netaddress.h:49
static constexpr size_t MAX_ADDRV2_SIZE
Maximum size of an address as defined in BIP155 (in bytes).
Definition: netaddress.h:281
bool IsIPv6() const
Definition: netaddress.cpp:305
prevector< ADDR_IPV6_SIZE, uint8_t > m_addr
Raw representation of the network address.
Definition: netaddress.h:123
std::vector< uint8_t > GetGroup(const std::vector< bool > &asmap) const
Get the canonical identifier of our network group.
Definition: netaddress.cpp:743
void Unserialize(Stream &s)
Unserialize from a stream.
Definition: netaddress.h:248
#define COMPACTSIZE(obj)
Definition: serialize.h:597
uint16_t port
Definition: netaddress.h:508
static constexpr size_t ADDR_IPV4_SIZE
Size of IPv4 address (in bytes).
Definition: netaddress.h:93
static const std::array< uint8_t, 6 > INTERNAL_IN_IPV6_PREFIX
Prefix of an IPv6 address when it contains an embedded "internal" address.
Definition: netaddress.h:88
bool IsInternal() const
Definition: netaddress.cpp:496
SERIALIZE_METHODS(CSubNet, obj)
Definition: netaddress.h:486
CNetAddr network
Network (base) address.
Definition: netaddress.h:459
bool IsBindAny() const
Definition: netaddress.cpp:293
bool GetInAddr(struct in_addr *pipv4Addr) const
Try to get our IPv4 address.
Definition: netaddress.cpp:630
std::string ToString() const
Definition: netaddress.cpp:608
void UnserializeV1Array(uint8_t(&arr)[V1_SERIALIZATION_SIZE])
Unserialize from a pre-ADDRv2/BIP155 format from an array.
Definition: netaddress.h:379
void UnserializeV2Stream(Stream &s)
Unserialize from a ADDRv2 / BIP155 format.
Definition: netaddress.h:399
#define READWRITEAS(type, obj)
Definition: serialize.h:180
bool SanityCheckASMap(const std::vector< bool > &asmap)
bool GetIn6Addr(struct in6_addr *pipv6Addr) const
Try to get our IPv6 address.
Definition: netaddress.cpp:649
enum Network GetNetwork() const
Definition: netaddress.cpp:521
I2P.
Definition: netaddress.h:58
void UnserializeV1Stream(Stream &s)
Unserialize from a pre-ADDRv2/BIP155 format from a stream.
Definition: netaddress.h:388
bool IsRFC2544() const
Definition: netaddress.cpp:315
value_type * data()
Definition: prevector.h:610
bool IsRFC4862() const
Definition: netaddress.cpp:355
uint32_t GetMappedAS(const std::vector< bool > &asmap) const
Definition: netaddress.cpp:699
bool IsValid() const
Definition: netaddress.cpp:438
static constexpr size_t ADDR_CJDNS_SIZE
Size of CJDNS address (in bytes).
Definition: netaddress.h:109
bool IsCJDNS() const
Check whether this object represents a CJDNS address.
Definition: netaddress.cpp:408
friend bool operator!=(const CNetAddr &a, const CNetAddr &b)
Definition: netaddress.h:229
friend bool operator!=(const CSubNet &a, const CSubNet &b)
Definition: netaddress.h:481
bool IsIPv4() const
Definition: netaddress.cpp:301
bool IsRFC5737() const
Definition: netaddress.cpp:327
uint32_t scopeId
Definition: netaddress.h:131
bool IsI2P() const
Check whether this object represents an I2P address.
Definition: netaddress.cpp:401
static constexpr size_t ADDR_IPV6_SIZE
Size of IPv6 address (in bytes).
Definition: netaddress.h:96
static const int ADDRV2_FORMAT
A flag that is ORed into the protocol version to designate that addresses should be serialized in (un...
Definition: netaddress.h:32
bool IsRFC6145() const
Definition: netaddress.cpp:365
void SerializeV1Array(uint8_t(&arr)[V1_SERIALIZATION_SIZE]) const
Serialize in pre-ADDRv2/BIP155 format to an array.
Definition: netaddress.h:306
static constexpr size_t ADDR_I2P_SIZE
Size of I2P address (in bytes).
Definition: netaddress.h:106
bool IsRFC6052() const
Definition: netaddress.cpp:343
static constexpr size_t ADDR_TORV2_SIZE
Size of TORv2 address (in bytes).
Definition: netaddress.h:99
std::vector< uint8_t > GetAddrBytes() const
Definition: netaddress.cpp:798
friend bool operator!=(const CService &a, const CService &b)
Definition: netaddress.h:519
std::string ToStringIP() const
Definition: netaddress.cpp:548
const char * name
Definition: rest.cpp:43
BIP155Network GetBIP155Network() const
Get the BIP155 network id of this address.
Definition: netaddress.cpp:28
BIP155Network
BIP155 network ids recognized by this software.
Definition: netaddress.h:262
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netaddress.h:505
void SerializeV1Stream(Stream &s) const
Serialize in pre-ADDRv2/BIP155 format to a stream.
Definition: netaddress.h:351
Network
A network type.
Definition: netaddress.h:43
bool IsRFC3849() const
Definition: netaddress.cpp:334
bool IsRoutable() const
Definition: netaddress.cpp:484
uint64_t GetHash() const
Definition: netaddress.cpp:807
bool valid
Is this value valid? (only used to signal parse errors)
Definition: netaddress.h:463
Network address.
Definition: netaddress.h:117
friend bool operator<(const CNetAddr &a, const CNetAddr &b)
Definition: netaddress.cpp:616
bool IsRFC1918() const
Definition: netaddress.cpp:309
bool IsRFC6598() const
Definition: netaddress.cpp:323
bool IsHeNet() const
Definition: netaddress.cpp:384
bool IsRFC3927() const
Definition: netaddress.cpp:319
friend bool operator==(const CNetAddr &a, const CNetAddr &b)
Definition: netaddress.cpp:612
static const std::array< uint8_t, 6 > TORV2_IN_IPV6_PREFIX
Prefix of an IPv6 address when it contains an embedded TORv2 address.
Definition: netaddress.h:80
void SerializeV2Stream(Stream &s) const
Serialize as ADDRv2 / BIP155.
Definition: netaddress.h:362
Serialization wrapper class for custom integers and enums.
Definition: serialize.h:623
IPv6.
Definition: netaddress.h:52
TOR (v2 or v3)
Definition: netaddress.h:55
NODISCARD bool HasPrefix(const T1 &obj, const std::array< uint8_t, PREFIX_LEN > &prefix)
Check whether a container begins with the given prefix.
Definition: string.h:80
bool SetSpecial(const std::string &strName)
Parse a TOR address and set this object to it.
Definition: netaddress.cpp:234
bool IsRFC7343() const
Definition: netaddress.cpp:378
size_type size() const
Definition: prevector.h:386
bool IsRFC4843() const
Definition: netaddress.cpp:372
static const std::array< uint8_t, 12 > IPV4_IN_IPV6_PREFIX
Prefix of an IPv6 address when it contains an embedded IPv4 address.
Definition: netaddress.h:73
static constexpr size_t ADDR_INTERNAL_SIZE
Size of "internal" (NET_INTERNAL) address (in bytes).
Definition: netaddress.h:112
#define SER_READ(obj, code)
Definition: serialize.h:182
A Span is an object that can refer to a contiguous sequence of objects.
Definition: span.h:27
uint32_t GetLinkedIPv4() const
For IPv4, mapped IPv4, SIIT translated IPv4, Teredo, 6to4 tunneled addresses, return the relevant IPv...
Definition: netaddress.cpp:663
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class...
Definition: serialize.h:591
bool SetInternal(const std::string &name)
Create an "internal" address that represents a name or FQDN.
Definition: netaddress.cpp:188
Network m_net
Network to which this address belongs.
Definition: netaddress.h:128
#define READWRITE(...)
Definition: serialize.h:179
bool IsRFC4193() const
Definition: netaddress.cpp:361
bool IsAddrV1Compatible() const
Check if the current object can be serialized in pre-ADDRv2/BIP155 format.
Definition: netaddress.cpp:500
CJDNS.
Definition: netaddress.h:61
uint32_t GetNetClass() const
Definition: netaddress.cpp:681
SERIALIZE_METHODS(CService, obj)
Definition: netaddress.h:531
bool IsTor() const
Check whether this object represents a TOR address.
Definition: netaddress.cpp:394
static constexpr size_t V1_SERIALIZATION_SIZE
Size of CNetAddr when serialized as ADDRv1 (pre-BIP155) (in bytes).
Definition: netaddress.h:274
void SetLegacyIPv6(Span< const uint8_t > ipv6)
Set from a legacy IPv6 address.
Definition: netaddress.cpp:156
bool IsRFC3964() const
Definition: netaddress.cpp:339
Span< A > constexpr MakeSpan(A(&a)[N])
MakeSpan for arrays:
Definition: span.h:172
CNetAddr()
Construct an unspecified IPv6 network address (::/128).
Definition: netaddress.cpp:123
Addresses from these networks are not publicly routable on the global Internet.
Definition: netaddress.h:46