@@ -427,10 +427,11 @@ func (rw *protoRW) ReadMsg() (Msg, error) {
427
427
// peer. Sub-protocol independent fields are contained and initialized here, with
428
428
// protocol specifics delegated to all connected sub-protocols.
429
429
type PeerInfo struct {
430
- Enode string `json:"enode"` // Node URL
431
- ID string `json:"id"` // Unique node identifier
432
- Name string `json:"name"` // Name of the node, including client type, version, OS, custom data
433
- Caps []string `json:"caps"` // Protocols advertised by this peer
430
+ ENR string `json:"enr,omitempty"` // Ethereum Node Record
431
+ Enode string `json:"enode"` // Node URL
432
+ ID string `json:"id"` // Unique node identifier
433
+ Name string `json:"name"` // Name of the node, including client type, version, OS, custom data
434
+ Caps []string `json:"caps"` // Protocols advertised by this peer
434
435
Network struct {
435
436
LocalAddress string `json:"localAddress"` // Local endpoint of the TCP data connection
436
437
RemoteAddress string `json:"remoteAddress"` // Remote endpoint of the TCP data connection
@@ -450,12 +451,15 @@ func (p *Peer) Info() *PeerInfo {
450
451
}
451
452
// Assemble the generic peer metadata
452
453
info := & PeerInfo {
453
- Enode : p .Node ().String (),
454
+ Enode : p .Node ().URLv4 (),
454
455
ID : p .ID ().String (),
455
456
Name : p .Name (),
456
457
Caps : caps ,
457
458
Protocols : make (map [string ]interface {}),
458
459
}
460
+ if p .Node ().Seq () > 0 {
461
+ info .ENR = p .Node ().String ()
462
+ }
459
463
info .Network .LocalAddress = p .LocalAddr ().String ()
460
464
info .Network .RemoteAddress = p .RemoteAddr ().String ()
461
465
info .Network .Inbound = p .rw .is (inboundConn )
0 commit comments