#include <net.h>
#include <addrdb.h>
#include <addrman.h>
#include <banman.h>
#include <clientversion.h>
#include <common/args.h>
#include <compat/compat.h>
#include <consensus/consensus.h>
#include <crypto/sha256.h>
#include <i2p.h>
#include <logging.h>
#include <memusage.h>
#include <net_permissions.h>
#include <netaddress.h>
#include <netbase.h>
#include <node/eviction.h>
#include <node/interface_ui.h>
#include <protocol.h>
#include <random.h>
#include <scheduler.h>
#include <util/fs.h>
#include <util/sock.h>
#include <util/strencodings.h>
#include <util/thread.h>
#include <util/threadinterrupt.h>
#include <util/trace.h>
#include <util/translation.h>
#include <util/vector.h>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <optional>
#include <unordered_map>
#include <math.h>
Go to the source code of this file.
◆ BindFlags
Used to pass flags to the Bind() function.
| Enumerator |
|---|
| BF_NONE | |
| BF_REPORT_ERROR | |
| BF_DONT_ADVERTISE | Do not call AddLocal() for our special addresses, e.g., for incoming Tor connections, to prevent gossiping them over the network.
|
Definition at line 92 of file net.cpp.
◆ AddLocal() [1/2]
| bool AddLocal |
( |
const CService & |
addr_, |
|
|
int |
nScore |
|
) |
| |
◆ AddLocal() [2/2]
| bool AddLocal |
( |
const CNetAddr & |
addr, |
|
|
int |
nScore |
|
) |
| |
◆ CaptureMessageToFile()
| static void CaptureMessageToFile |
( |
const CAddress & |
addr, |
|
|
const std::string & |
msg_type, |
|
|
Span< const unsigned char > |
data, |
|
|
bool |
is_incoming |
|
) |
| |
|
static |
◆ ConvertSeeds()
| static std::vector<CAddress> ConvertSeeds |
( |
const std::vector< uint8_t > & |
vSeedsIn | ) |
|
|
static |
Convert the serialized seeds into usable address objects.
Definition at line 191 of file net.cpp.
◆ Discover()
Look up IP addresses from all interfaces on the machine and add them to the list of local addresses to self-advertise.
The loopback interface is skipped and only the first address from each interface is used.
Definition at line 3046 of file net.cpp.
◆ GetBindAddress()
◆ GetListenPort()
| uint16_t GetListenPort |
( |
| ) |
|
◆ GetLocal()
◆ GetLocalAddress()
◆ GetLocalAddrForPeer()
Returns a local address that we should advertise to this peer.
Definition at line 237 of file net.cpp.
◆ GetnScore()
| static int GetnScore |
( |
const CService & |
addr | ) |
|
|
static |
◆ GUARDED_BY()
◆ IsLocal()
check whether a given address is potentially local
Definition at line 325 of file net.cpp.
◆ IsPeerAddrLocalGood()
| static bool IsPeerAddrLocalGood |
( |
CNode * |
pnode | ) |
|
|
static |
◆ MakeTransport()
| static std::unique_ptr<Transport> MakeTransport |
( |
NodeId |
id, |
|
|
bool |
use_v2transport, |
|
|
bool |
inbound |
|
) |
| |
|
staticnoexcept |
◆ RemoveLocal()
| void RemoveLocal |
( |
const CService & |
addr | ) |
|
◆ SeenLocal()
vote for a local address
Definition at line 314 of file net.cpp.
◆ ANCHORS_DATABASE_FILENAME
| const char* const ANCHORS_DATABASE_FILENAME = "anchors.dat" |
Anchor IP address database file name.
Definition at line 61 of file net.cpp.
◆ CaptureMessage
◆ DNSSEEDS_DELAY_FEW_PEERS
| constexpr std::chrono::seconds DNSSEEDS_DELAY_FEW_PEERS {11} |
|
static |
How long to delay before querying DNS seeds.
If we have more than THRESHOLD entries in addrman, then it's likely that we got those addresses from having previously connected to the P2P network, and that we'll be able to successfully reconnect to the P2P network via contacting one of them. So if that's the case, spend a little longer trying to connect to known peers before querying the DNS seeds.
Definition at line 78 of file net.cpp.
◆ DNSSEEDS_DELAY_MANY_PEERS
| constexpr std::chrono::minutes DNSSEEDS_DELAY_MANY_PEERS {5} |
|
static |
◆ DNSSEEDS_DELAY_PEER_THRESHOLD
| constexpr int DNSSEEDS_DELAY_PEER_THRESHOLD = 1000 |
|
static |
◆ DNSSEEDS_TO_QUERY_AT_ONCE
| constexpr int DNSSEEDS_TO_QUERY_AT_ONCE = 3 |
|
static |
Number of DNS seeds to query when the number of connections is low.
Definition at line 67 of file net.cpp.
◆ DUMP_PEERS_INTERVAL
| constexpr std::chrono::minutes DUMP_PEERS_INTERVAL {15} |
|
static |
◆ EXTRA_NETWORK_PEER_INTERVAL
| constexpr auto EXTRA_NETWORK_PEER_INTERVAL {5min} |
|
static |
Frequency to attempt extra connections to reachable networks we're not connected to yet.
Definition at line 89 of file net.cpp.
◆ fDiscover
◆ FEELER_SLEEP_WINDOW
| constexpr auto FEELER_SLEEP_WINDOW {1s} |
|
static |
◆ fListen
◆ g_maplocalhost_mutex
◆ instance_of_cnetcleanup
◆ MAX_BLOCK_RELAY_ONLY_ANCHORS
| constexpr size_t MAX_BLOCK_RELAY_ONLY_ANCHORS = 2 |
|
static |
Maximum number of block-relay-only anchor connections.
Definition at line 58 of file net.cpp.
◆ MAX_UPLOAD_TIMEFRAME
| constexpr std::chrono::seconds MAX_UPLOAD_TIMEFRAME {60 * 60 * 24} |
|
static |
The default timeframe for -maxuploadtarget.
1 day.
Definition at line 83 of file net.cpp.
◆ NET_MESSAGE_TYPE_OTHER
| const std::string NET_MESSAGE_TYPE_OTHER = "*other*" |
◆ RANDOMIZER_ID_ADDRCACHE
| const uint64_t RANDOMIZER_ID_ADDRCACHE = 0x1cf2e4ddd306dda9ULL |
|
static |
◆ RANDOMIZER_ID_LOCALHOSTNONCE
| const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL |
|
static |
◆ RANDOMIZER_ID_NETGROUP
| const uint64_t RANDOMIZER_ID_NETGROUP = 0x6c0edd8036ef4036ULL |
|
static |
◆ SELECT_TIMEOUT_MILLISECONDS
| const uint64_t SELECT_TIMEOUT_MILLISECONDS = 50 |
|
static |
◆ strSubVersion
| std::string strSubVersion |
Subversion as sent to the P2P network in version messages.
Definition at line 118 of file net.cpp.