Skip to content

Commit

Permalink
changed peer data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dvovk committed Oct 13, 2023
1 parent 0fab1d0 commit 121c99a
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions internal/erigon_node/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,27 @@ type Versions struct {
GitCommit string `json:"gitCommit"`
}

type PeerNetworkInfo struct {
LocalAddress string `json:"localAddress"` // Local endpoint of the TCP data connection
RemoteAddress string `json:"remoteAddress"` // Remote endpoint of the TCP data connection
Inbound bool `json:"inbound"`
Trusted bool `json:"trusted"`
Static bool `json:"static"`
}

type PeerInfo struct {
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
Inbound bool `json:"inbound"`
Trusted bool `json:"trusted"`
Static bool `json:"static"`
} `json:"network"`
Protocols map[string]interface{} `json:"protocols"` // Sub-protocol specific metadata fields
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
ErrorCount int `json:"errorCount"` // Number of errors
LastSeenError string `json:"lastSeenError"` // Last seen error
Type string `json:"type"` // Type of connection
Caps []string `json:"caps"` // Protocols advertised by this peer
Network PeerNetworkInfo `json:"network"`
Protocols map[string]interface{} `json:"protocols"` // Sub-protocol specific metadata fields
BytesIn int `json:"bytesIn"` // Number of bytes received from the peer
BytesOut int `json:"bytesOut"` // Number of bytes sent to the peer
}

type PeersInfo []PeerInfo
Expand Down

0 comments on commit 121c99a

Please sign in to comment.