Documentation
¶
Overview ¶
Package enr provides utilities for parsing and extracting data from Ethereum Node Records (ENR). It supports parsing ENR strings and extracting various fields including network information, cryptographic keys, and Ethereum 2.0 specific metadata.
Index ¶
- type ENR
- func (e *ENR) GetAttnets() *[]byte
- func (e *ENR) GetCGC() *[]byte
- func (e *ENR) GetETH2() *[]byte
- func (e *ENR) GetEnr() string
- func (e *ENR) GetID() *string
- func (e *ENR) GetIP4() *string
- func (e *ENR) GetIP6() *string
- func (e *ENR) GetNFD() *[]byte
- func (e *ENR) GetNodeID() *string
- func (e *ENR) GetPeerID() *string
- func (e *ENR) GetQUIC4() *uint32
- func (e *ENR) GetQUIC6() *uint32
- func (e *ENR) GetSecp256k1() *[]byte
- func (e *ENR) GetSeq() *uint64
- func (e *ENR) GetSignature() *[]byte
- func (e *ENR) GetSyncnets() *[]byte
- func (e *ENR) GetTCP4() *uint32
- func (e *ENR) GetTCP6() *uint32
- func (e *ENR) GetUDP4() *uint32
- func (e *ENR) GetUDP6() *uint32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ENR ¶
type ENR struct {
// Enr is the enr of the node record.
Enr string
// Signature is the cryptographic signature of record contents
Signature *[]byte
// Seq is the sequence number, a 64-bit unsigned integer.
// Nodes should increase the number whenever the record changes and republish the record
Seq *uint64
// ID is the name of identity scheme, e.g. “v4”
ID *string
// NodeID is the node ID of the node record.
NodeID *string
// PeerID is the peer ID of the node record.
PeerID *string
// Secp256k1 is the secp256k1 public key of the node record.
Secp256k1 *[]byte
// IP4 is the IPv4 address of the node record.
IP4 *string
// IP6 is the IPv6 address of the node record.
IP6 *string
// TCP4 is the TCP port of the node record.
TCP4 *uint32
// TCP6 is the TCP port of the node record.
TCP6 *uint32
// UDP4 is the UDP port of the node record.
UDP4 *uint32
// UDP6 is the UDP port of the node record.
UDP6 *uint32
// QUIC4 is the QUIC port for IPv4 of the node record.
QUIC4 *uint32
// QUIC6 is the QUIC port for IPv6 of the node record.
QUIC6 *uint32
// Eth2 is the eth2 public key of the node record.
ETH2 *[]byte
// Attnets is the attestation subnet bitfield of the node record.
Attnets *[]byte
// Syncnets is the sync subnet bitfield of the node record.
Syncnets *[]byte
// CGC is the custody group count of the node record.
CGC *[]byte
// NFD is the next fork digest of the next scheduled fork.
NFD *[]byte
}
func Parse ¶
Parse parses an ENR record string and extracts all available fields. It returns a populated ENR struct with all parsed values or an error if parsing fails.
func (*ENR) GetAttnets ¶
GetAttnets returns the attestation subnet bitfield from the ENR record. Returns nil if the ENR is nil or the bitfield is not present.
func (*ENR) GetCGC ¶
GetCGC returns the custody group count field from the ENR record. Returns nil if the ENR is nil or the CGC field is not present.
func (*ENR) GetETH2 ¶
GetETH2 returns the Ethereum 2.0 public key from the ENR record. Returns nil if the ENR is nil or the key is not present.
func (*ENR) GetID ¶
GetID returns the identity scheme of the ENR record. Returns nil if the ENR is nil or the ID is not present.
func (*ENR) GetIP4 ¶
GetIP4 returns the IPv4 address from the ENR record. Returns nil if the ENR is nil or the IP4 address is not present.
func (*ENR) GetIP6 ¶
GetIP6 returns the IPv6 address from the ENR record. Returns nil if the ENR is nil or the IP6 address is not present.
func (*ENR) GetNFD ¶
GetNFD returns the next fork digest field from the ENR record. Returns nil if the ENR is nil or the NFD field is not present.
func (*ENR) GetNodeID ¶
GetNodeID returns the node ID of the ENR record. Returns nil if the ENR is nil or the node ID is not present.
func (*ENR) GetPeerID ¶
GetPeerID returns the libp2p peer ID derived from the ENR record. Returns nil if the ENR is nil or the peer ID is not present.
func (*ENR) GetQUIC4 ¶
GetQUIC4 returns the QUIC port for IPv4 from the ENR record. Returns nil if the ENR is nil or the port is not present.
func (*ENR) GetQUIC6 ¶
GetQUIC6 returns the QUIC port for IPv6 from the ENR record. Returns nil if the ENR is nil or the port is not present.
func (*ENR) GetSecp256k1 ¶
GetSecp256k1 returns the secp256k1 public key from the ENR record. Returns nil if the ENR is nil or the key is not present.
func (*ENR) GetSeq ¶
GetSeq returns the sequence number of the ENR record. Returns nil if the ENR is nil or the sequence number is not present.
func (*ENR) GetSignature ¶
GetSignature returns the cryptographic signature of the ENR record. Returns nil if the ENR is nil or the signature is not present.
func (*ENR) GetSyncnets ¶
GetSyncnets returns the sync subnet bitfield from the ENR record. Returns nil if the ENR is nil or the bitfield is not present.
func (*ENR) GetTCP4 ¶
GetTCP4 returns the TCP port for IPv4 from the ENR record. Returns nil if the ENR is nil or the port is not present.
func (*ENR) GetTCP6 ¶
GetTCP6 returns the TCP port for IPv6 from the ENR record. Returns nil if the ENR is nil or the port is not present.