mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
rpc: Add listen address to incoming connections in getpeerinfo
This adds the listening address on which incoming connections were received to the CNode and CNodeStats structures. The address is reported in `getpeerinfo`. This can be useful for distinguishing connections received on different listening ports (e.g. when using a different listening port for Tor hidden service connections) or different networks.
This commit is contained in:
10
src/net.h
10
src/net.h
@@ -504,8 +504,12 @@ public:
|
||||
double dPingTime;
|
||||
double dPingWait;
|
||||
double dMinPing;
|
||||
// Our address, as reported by the peer
|
||||
std::string addrLocal;
|
||||
// Address of this peer
|
||||
CAddress addr;
|
||||
// Bind address of our side of the connection
|
||||
CAddress addrBind;
|
||||
};
|
||||
|
||||
|
||||
@@ -586,7 +590,10 @@ public:
|
||||
std::atomic<int64_t> nLastRecv;
|
||||
const int64_t nTimeConnected;
|
||||
std::atomic<int64_t> nTimeOffset;
|
||||
// Address of this peer
|
||||
const CAddress addr;
|
||||
// Bind address of our side of the connection
|
||||
const CAddress addrBind;
|
||||
std::atomic<int> nVersion;
|
||||
// strSubVer is whatever byte array we read from the wire. However, this field is intended
|
||||
// to be printed out, displayed to humans in various forms and so on. So we sanitize it and
|
||||
@@ -676,7 +683,7 @@ public:
|
||||
CAmount lastSentFeeFilter;
|
||||
int64_t nextSendTimeFeeFilter;
|
||||
|
||||
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const std::string &addrNameIn = "", bool fInboundIn = false);
|
||||
CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress &addrBindIn, const std::string &addrNameIn = "", bool fInboundIn = false);
|
||||
~CNode();
|
||||
|
||||
private:
|
||||
@@ -695,6 +702,7 @@ private:
|
||||
mutable CCriticalSection cs_addrName;
|
||||
std::string addrName;
|
||||
|
||||
// Our address, as reported by the peer
|
||||
CService addrLocal;
|
||||
mutable CCriticalSection cs_addrLocal;
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user