|
void | Init (const Options &connOptions) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) |
|
| CConnman (const Config &configIn, uint64_t seed0, uint64_t seed1, AddrMan &addrmanIn, bool network_active=true) |
|
| ~CConnman () |
|
bool | Start (CScheduler &scheduler, const Options &options) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex |
|
void | StopThreads () |
|
void | StopNodes () |
|
void | Stop () |
|
void | Interrupt () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) |
|
bool | GetNetworkActive () const |
|
bool | GetUseAddrmanOutgoing () const |
|
void | SetNetworkActive (bool active) |
|
void | OpenNetworkConnection (const CAddress &addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound, const char *strDest, ConnectionType conn_type) |
|
bool | CheckIncomingNonce (uint64_t nonce) |
|
bool | ForNode (NodeId id, std::function< bool(CNode *pnode)> func) |
|
void | PushMessage (CNode *pnode, CSerializedNetMsg &&msg) |
|
void | ForEachNode (const NodeFn &func) |
|
void | ForEachNode (const NodeFn &func) const |
|
std::vector< CAddress > | GetAddresses (size_t max_addresses, size_t max_pct, std::optional< Network > network) const |
| Return all or many randomly selected addresses, optionally by network.
|
|
std::vector< CAddress > | GetAddresses (CNode &requestor, size_t max_addresses, size_t max_pct) |
| Cache is used to minimize topology leaks, so it should be used for all non-trusted calls, for example, p2p.
|
|
void | SetTryNewOutboundPeer (bool flag) |
|
bool | GetTryNewOutboundPeer () const |
|
void | StartExtraBlockRelayPeers () |
|
int | GetExtraFullOutboundCount () const |
|
int | GetExtraBlockRelayCount () const |
|
bool | AddNode (const std::string &node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) |
|
bool | RemoveAddedNode (const std::string &node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) |
|
std::vector< AddedNodeInfo > | GetAddedNodeInfo () const EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) |
|
bool | AddConnection (const std::string &address, ConnectionType conn_type) |
| Attempts to open a connection.
|
|
size_t | GetNodeCount (NumConnections num) const |
|
void | GetNodeStats (std::vector< CNodeStats > &vstats) const |
|
bool | DisconnectNode (const std::string &node) |
|
bool | DisconnectNode (const CSubNet &subnet) |
|
bool | DisconnectNode (const CNetAddr &addr) |
|
bool | DisconnectNode (NodeId id) |
|
ServiceFlags | GetLocalServices () const |
| Used to convey which local services we are offering peers during node connection.
|
|
uint64_t | GetMaxOutboundTarget () const |
|
std::chrono::seconds | GetMaxOutboundTimeframe () const |
|
bool | OutboundTargetReached (bool historicalBlockServingLimit) const |
| check if the outbound target is reached.
|
|
uint64_t | GetOutboundTargetBytesLeft () const |
| response the bytes left in the current max outbound cycle in case of no limit, it will always response 0
|
|
std::chrono::seconds | GetMaxOutboundTimeLeftInCycle () const |
| returns the time in second left in the current max outbound cycle in case of no limit, it will always return 0
|
|
uint64_t | GetTotalBytesRecv () const |
|
uint64_t | GetTotalBytesSent () const |
|
CSipHasher | GetDeterministicRandomizer (uint64_t id) const |
| Get a unique deterministic randomizer.
|
|
unsigned int | GetReceiveFloodSize () const |
|
void | WakeMessageHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) |
|
bool | ShouldRunInactivityChecks (const CNode &node, std::chrono::seconds now) const |
| Return true if we should disconnect the peer for failing an inactivity check.
|
|
|
bool | BindListenPort (const CService &bindAddr, bilingual_str &strError, NetPermissionFlags permissions) |
|
bool | Bind (const CService &addr, unsigned int flags, NetPermissionFlags permissions) |
|
bool | InitBinds (const Options &options) |
|
void | ThreadOpenAddedConnections () EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) |
|
void | AddAddrFetch (const std::string &strDest) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex) |
|
void | ProcessAddrFetch () EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex) |
|
void | ThreadOpenConnections (std::vector< std::string > connect, std::function< void(const CAddress &, ConnectionType)> mockOpenConnection) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex |
|
void | ThreadMessageHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) |
|
void | ThreadI2PAcceptIncoming () |
|
void | AcceptConnection (const ListenSocket &hListenSocket) |
|
void | CreateNodeFromAcceptedSocket (SOCKET hSocket, NetPermissionFlags permissionFlags, const CAddress &addr_bind, const CAddress &addr) |
| Create a CNode object from a socket that has just been accepted and add the node to the m_nodes member.
|
|
void | DisconnectNodes () |
|
void | NotifyNumConnectionsChanged () |
|
bool | InactivityCheck (const CNode &node) const |
| Return true if the peer is inactive and should be disconnected.
|
|
bool | GenerateSelectSet (std::set< SOCKET > &recv_set, std::set< SOCKET > &send_set, std::set< SOCKET > &error_set) |
|
void | SocketEvents (std::set< SOCKET > &recv_set, std::set< SOCKET > &send_set, std::set< SOCKET > &error_set) |
|
void | SocketHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) |
|
void | ThreadSocketHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) |
|
void | ThreadDNSAddressSeed () EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex |
|
uint64_t | CalculateKeyedNetGroup (const CAddress &ad) const |
|
CNode * | FindNode (const CNetAddr &ip) |
|
CNode * | FindNode (const CSubNet &subNet) |
|
CNode * | FindNode (const std::string &addrName) |
|
CNode * | FindNode (const CService &addr) |
|
bool | AlreadyConnectedToAddress (const CAddress &addr) |
| Determine whether we're already connected to a given address, in order to avoid initiating duplicate connections.
|
|
bool | AttemptToEvictConnection () |
| Try to find a connection to evict when the node is full.
|
|
CNode * | ConnectNode (CAddress addrConnect, const char *pszDest, bool fCountFailure, ConnectionType conn_type) |
|
void | AddWhitelistPermissionFlags (NetPermissionFlags &flags, const CNetAddr &addr) const |
|
void | DeleteNode (CNode *pnode) |
|
NodeId | GetNewNodeId () |
|
size_t | SocketSendData (CNode &node) const EXCLUSIVE_LOCKS_REQUIRED(node.cs_vSend) |
|
void | DumpAddresses () |
|
void | RecordBytesRecv (uint64_t bytes) |
|
void | RecordBytesSent (uint64_t bytes) |
|
std::vector< CAddress > | GetCurrentBlockRelayOnlyConns () const |
| Return vector of current BLOCK_RELAY peers.
|
|
uint64_t nTotalBytesSent | GUARDED_BY (cs_totalBytesSent) |
|
uint64_t nMaxOutboundTotalBytesSentInCycle | GUARDED_BY (cs_totalBytesSent) |
|
std::chrono::seconds nMaxOutboundCycleStartTime | GUARDED_BY (cs_totalBytesSent) |
|
uint64_t nMaxOutboundLimit | GUARDED_BY (cs_totalBytesSent) |
|
std::deque< std::string > m_addr_fetches | GUARDED_BY (m_addr_fetches_mutex) |
|
std::vector< std::string > m_added_nodes | GUARDED_BY (m_added_nodes_mutex) |
|
std::vector< CNode * > m_nodes | GUARDED_BY (m_nodes_mutex) |
|
bool fMsgProcWake | GUARDED_BY (mutexMsgProc) |
| flag for waking the message processor.
|
|
Definition at line 843 of file net.h.
Cache is used to minimize topology leaks, so it should be used for all non-trusted calls, for example, p2p.
A non-malicious call (from RPC or a peer with addr permission) should call the function without a parameter to avoid using the cache.
Definition at line 3176 of file net.cpp.
Addr responses stored in different caches per (network, local socket) prevent cross-network node identification.
If a node for example is multi-homed under Tor and IPv6, a single cache (or no cache at all) would let an attacker to easily detect that it is the same node by comparing responses. Indexing by local socket prevents leakage when a node has multiple listening addresses on the same network.
The used memory equals to 1000 CAddress records (or around 40 bytes) per distinct Network (up to 5) we have/had an inbound peer from, resulting in at most ~196 KB. Every separate local socket may add up to ~196 KB extra.
Definition at line 1243 of file net.h.