good morning!!!!

Skip to content
Snippets Groups Projects
Commit a1f85492 authored by Kurkó Mihály's avatar Kurkó Mihály Committed by Felix Lange
Browse files

p2p: add ENR to PeerInfo (#19816)

parent e8c9579f
No related branches found
No related tags found
Loading
......@@ -427,10 +427,11 @@ 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 {
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
ENR string `json:"enr,omitempty"` // Ethereum Node Record
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
......@@ -450,12 +451,15 @@ func (p *Peer) Info() *PeerInfo {
}
// Assemble the generic peer metadata
info := &PeerInfo{
Enode: p.Node().String(),
Enode: p.Node().URLv4(),
ID: p.ID().String(),
Name: p.Name(),
Caps: caps,
Protocols: make(map[string]interface{}),
}
if p.Node().Seq() > 0 {
info.ENR = p.Node().String()
}
info.Network.LocalAddress = p.LocalAddr().String()
info.Network.RemoteAddress = p.RemoteAddr().String()
info.Network.Inbound = p.rw.is(inboundConn)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment