enr

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	Signature []byte // Cryptographic signature of record contents
	Sequence  uint64 // The sequence number. Nodes should increase the number whenever the record changes and republish the record.
	IDScheme  string // name of identity scheme, e.g. “v4”

	PrivateKey *secp256k1.PrivateKey
	PublicKey  *secp256k1.PublicKey

	Ip      net.IP
	TcpPort uint16
	UdpPort uint16

	Ip6      net.IP
	Tcp6Port uint16 // IPv6-specific TCP port. If omitted, same as TcpPort.
	Udp6Port uint16 // IPv6-specific UDP port. If omitted, same as UdpPort.

	SentPing     time.Time
	SentPingHash [32]byte
	ReceivedPong time.Time
	ReceivedPing time.Time
}

An Ethereum Node Record contains network information about a node on the dsicv5 p2p network. The specification is detailed in https://eips.ethereum.org/EIPS/eip-778.

func ParseV4

func ParseV4(s string) (*Record, error)

func UnmarshalText

func UnmarshalText(str string) (Record, error)

Given a text encoding of an Ethereum Node Record, which is formatted as the base-64 encoding of its RLP content prefixed by enr:, this method decodes it into an Record struct.

func (*Record) ID

func (r *Record) ID() [32]byte

func (*Record) MarshalRLP

func (r *Record) MarshalRLP(prv *secp256k1.PrivateKey) ([]byte, error)

func (Record) MarshalText

func (r Record) MarshalText(prv *secp256k1.PrivateKey) ([]byte, error)

func (*Record) String

func (r *Record) String() string

func (Record) TCPAddr

func (r Record) TCPAddr() *net.TCPAddr

func (Record) UDPAddr

func (r Record) UDPAddr() *net.UDPAddr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL