aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2018-10-04 23:13:21 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-10-04 23:13:21 +0800
commit18950591196c1294a94520ec0737d0c1dbaa0802 (patch)
tree26b0ed0d6f89a1e7b439df0a0a6a3e60287dd440 /p2p
parent127553253e8d21cfbcd38edf3119ce81275c0454 (diff)
downloaddexon-18950591196c1294a94520ec0737d0c1dbaa0802.tar.gz
dexon-18950591196c1294a94520ec0737d0c1dbaa0802.tar.zst
dexon-18950591196c1294a94520ec0737d0c1dbaa0802.zip
p2p: add enode URL to PeerInfo (#17838)
Diffstat (limited to 'p2p')
-rw-r--r--p2p/peer.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/p2p/peer.go b/p2p/peer.go
index b61cced54..af019d07a 100644
--- a/p2p/peer.go
+++ b/p2p/peer.go
@@ -425,9 +425,10 @@ func (rw *protoRW) ReadMsg() (Msg, error) {
// peer. Sub-protocol independent fields are contained and initialized here, with
// protocol specifics delegated to all connected sub-protocols.
type PeerInfo struct {
- ID string `json:"id"` // Unique node identifier (also the encryption key)
- Name string `json:"name"` // Name of the node, including client type, version, OS, custom data
- Caps []string `json:"caps"` // Sum-protocols advertised by this particular peer
+ Enode string `json:"enode"` // Node URL
+ ID string `json:"id"` // Unique node identifier
+ Name string `json:"name"` // Name of the node, including client type, version, OS, custom data
+ Caps []string `json:"caps"` // Protocols advertised by this peer
Network struct {
LocalAddress string `json:"localAddress"` // Local endpoint of the TCP data connection
RemoteAddress string `json:"remoteAddress"` // Remote endpoint of the TCP data connection
@@ -447,6 +448,7 @@ func (p *Peer) Info() *PeerInfo {
}
// Assemble the generic peer metadata
info := &PeerInfo{
+ Enode: p.Node().String(),
ID: p.ID().String(),
Name: p.Name(),
Caps: caps,