Network

A network type.

Synopsis

Declared in <netaddress.h>

enum Network;

Description

NOTE

An address may belong to more than one network, for example 10.0.0.1 belongs to both NET_UNROUTABLE and NET_IPV4. Keep these sequential starting from 0 and NET_MAX as the last entry. We have loops like for (int i = 0; i < NET_MAX; ++i) that expect to iterate over all enum values and also GetExtNetwork() "extends" this enum by introducing standalone constants starting from NET_MAX.

Members

NameDescription
NET_UNROUTABLE Addresses from these networks are not publicly routable on the global Internet.
NET_IPV4 IPv4
NET_IPV6 IPv6
NET_ONION TOR (v2 or v3)
NET_I2P I2P
NET_CJDNS CJDNS
NET_INTERNAL A set of addresses that represent the hash of a string or FQDN. We use them in AddrMan to keep track of which DNS seeds were used.
NET_MAX Dummy value to indicate the number of NET_* constants.

Non-Member Functions

NameDescription
GetNetworkNameGet the canonical name of a network.
GetProxyGet the proxy configured for a given network, if any.
ParseNetworkParse a network name into its Network enumerator.
QueryDefaultGatewayQuery the OS for the default gateway for network. This only makes sense for NET_IPV4 and NET_IPV6. Returns std::nullopt if it cannot be found, or there is no support for this OS.
SetProxySet the proxy used to reach a given network.