|
std::map< CNetAddr, LocalServiceInfo > mapLocalHost | GUARDED_BY (g_maplocalhost_mutex) |
|
uint16_t | GetListenPort () |
|
bool | GetLocal (CService &addr, const CNetAddr *paddrPeer) |
|
static std::vector< CAddress > | convertSeed6 (const std::vector< SeedSpec6 > &vSeedsIn) |
| Convert the pnSeed6 array into usable address objects.
|
|
CService | GetLocalAddress (const CNetAddr &addrPeer) |
|
static int | GetnScore (const CService &addr) |
|
bool | IsPeerAddrLocalGood (CNode *pnode) |
|
std::optional< CService > | GetLocalAddrForPeer (CNode &node) |
| Returns a local address that we should advertise to this peer.
|
|
bool | AddLocal (const CService &addr, int nScore) |
|
bool | AddLocal (const CNetAddr &addr, int nScore) |
|
void | RemoveLocal (const CService &addr) |
|
void | SetReachable (enum Network net, bool reachable) |
| Mark a network as reachable or unreachable (no automatic connects to it)
|
|
bool | IsReachable (enum Network net) |
|
bool | IsReachable (const CNetAddr &addr) |
|
bool | SeenLocal (const CService &addr) |
| vote for a local address
|
|
bool | IsLocal (const CService &addr) |
| check whether a given address is potentially local
|
|
static CAddress | GetBindAddress (SOCKET sock) |
| Get the bind address for a socket as CAddress.
|
|
std::string | ConnectionTypeAsString (ConnectionType conn_type) |
| Convert ConnectionType enum to a string value.
|
|
static bool | ReverseCompareNodeMinPingTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
static bool | ReverseCompareNodeTimeConnected (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
static bool | CompareNetGroupKeyed (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
static bool | CompareNodeBlockTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
static bool | CompareNodeTXTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
static bool | CompareNodeProofTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
static bool | CompareNodeBlockRelayOnlyTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
static bool | CompareNodeAvailabilityScore (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
|
template<typename T , typename Comparator > |
static void | EraseLastKElements (std::vector< T > &elements, Comparator comparator, size_t k, std::function< bool(const NodeEvictionCandidate &)> predicate=[](const NodeEvictionCandidate &n) { return true;}) |
| Sort an array by the specified comparator, then erase the last K elements where predicate is true.
|
|
void | ProtectEvictionCandidatesByRatio (std::vector< NodeEvictionCandidate > &eviction_candidates) |
| Protect desirable or disadvantaged inbound peers from eviction by ratio.
|
|
std::optional< NodeId > | SelectNodeToEvict (std::vector< NodeEvictionCandidate > &&vEvictionCandidates) |
| Select an inbound peer to evict after filtering out (protecting) peers having distinct, difficult-to-forge characteristics.
|
|
void | Discover () |
| Look up IP addresses from all interfaces on the machine and add them to the list of local addresses to self-advertise.
|
|
std::string | getSubVersionEB (uint64_t MaxBlockSize) |
| This function convert MaxBlockSize from byte to MB with a decimal precision one digit rounded down E.g.
|
|
std::string | userAgent (const Config &config) |
|
void | CaptureMessageToFile (const CAddress &addr, const std::string &msg_type, Span< const uint8_t > data, bool is_incoming) |
| Dump binary message to file, with timestamp.
|
|
std::string getSubVersionEB |
( |
uint64_t |
MaxBlockSize | ) |
|
This function convert MaxBlockSize from byte to MB with a decimal precision one digit rounded down E.g.
1660000 -> 1.6 2010000 -> 2.0 1000000 -> 1.0 230000 -> 0.2 50000 -> 0.0
NB behavior for EB<1MB not standardized yet still the function applies the same algo used for EB greater or equal to 1MB
Definition at line 3417 of file net.cpp.
Protect desirable or disadvantaged inbound peers from eviction by ratio.
This function protects half of the peers which have been connected the longest, to replicate the non-eviction implicit behavior and preclude attacks that start later.
Half of these protected spots (1/4 of the total) are reserved for the following categories of peers, sorted by longest uptime, even if they're not longest uptime overall:
- onion peers connected via our tor control service
- localhost peers, as manually configured hidden services not using
-bind=addr[:port]=onion
will not be detected as inbound onion connections
- I2P peers
This helps protect these privacy network peers, which tend to be otherwise disadvantaged under our eviction criteria for their higher min ping times relative to IPv4/IPv6 peers, and favorise the diversity of peer connections.
Definition at line 1042 of file net.cpp.
Select an inbound peer to evict after filtering out (protecting) peers having distinct, difficult-to-forge characteristics.
The protection logic picks out fixed numbers of desirable peers per various criteria, followed by (mostly) ratios of desirable or disadvantaged peers. If any eviction candidates remain, the selection logic chooses a peer to evict.
Definition at line 1137 of file net.cpp.
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 84 of file net.cpp.