addrutil

package
v0.2.4-0...-f8342f3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnrEntries = map[string]func() (enr.Entry, func() string){
	"secp256k1": func() (enr.Entry, func() string) {
		res := new(enode.Secp256k1)
		return res, func() string {
			var out [64]byte
			copy(out[:32], res.X.Bytes())
			copy(out[32:], res.Y.Bytes())
			return hex.EncodeToString(out[:])
		}
	},
	"tcp": func() (enr.Entry, func() string) {
		res := new(enr.TCP)
		return res, func() string {
			return fmt.Sprintf("%d", *res)
		}
	},
	"tcp6": func() (enr.Entry, func() string) {
		res := new(enr.TCP6)
		return res, func() string {
			return fmt.Sprintf("%d", *res)
		}
	},
	"udp": func() (enr.Entry, func() string) {
		res := new(enr.UDP)
		return res, func() string {
			return fmt.Sprintf("%d", *res)
		}
	},
	"udp6": func() (enr.Entry, func() string) {
		res := new(enr.UDP6)
		return res, func() string {
			return fmt.Sprintf("%d", *res)
		}
	},
	"id": func() (enr.Entry, func() string) {
		res := new(enr.ID)
		return res, func() string {
			return string(*res)
		}
	},
	"ip": func() (enr.Entry, func() string) {
		res := new(enr.IP)
		return res, func() string {
			return ((*net.IP)(res)).String()
		}
	},
	"ip6": func() (enr.Entry, func() string) {
		res := new(enr.IPv6)
		return res, func() string {
			return ((*net.IP)(res)).String()
		}
	},
	"eth2": func() (enr.Entry, func() string) {
		res := new(Eth2ENREntry)
		return res, func() string {
			return res.String()
		}
	},
	"attnets": func() (enr.Entry, func() string) {
		res := new(AttnetsENREntry)
		return res, func() string {
			return res.String()
		}
	},
}

Functions

func EnodeToMultiAddr

func EnodeToMultiAddr(node *enode.Node) (ma.Multiaddr, error)

func EnodesToMultiAddrs

func EnodesToMultiAddrs(nodes []*enode.Node) ([]ma.Multiaddr, error)

func EnrToEnode

func EnrToEnode(record *enr.Record, verifySig bool) (*enode.Node, error)

func EnrToString

func EnrToString(record *enr.Record) (string, error)

func MakeENR

func MakeENR(ip net.IP, tcpPort uint16, udpPort uint16, priv *crypto.Secp256k1PrivateKey) *enr.Record

Create an ENR. All arguments are optional.

func ParseEnode

func ParseEnode(v string) (*enode.Node, error)

func ParseEnr

func ParseEnr(v string) (*enr.Record, error)

func ParseEnrAttnets

func ParseEnrAttnets(n *enode.Node) (attnetbits *beacon.AttnetBits, exists bool, err error)

func ParseEnrBytes

func ParseEnrBytes(v string) ([]byte, error)

func ParseEnrEth2Data

func ParseEnrEth2Data(n *enode.Node) (data *beacon.Eth2Data, exists bool, err error)

func ParseEnrOrEnode

func ParseEnrOrEnode(v string) (*enode.Node, error)

func ParseNodeID

func ParseNodeID(v string) (enode.ID, error)

func ParseNodeIDOrEnrOrEnode

func ParseNodeIDOrEnrOrEnode(v string) (enode.ID, error)

func ParsePrivateKey

func ParsePrivateKey(v string) (*crypto.Secp256k1PrivateKey, error)

func ParsePubkey

func ParsePubkey(v string) (*ecdsa.PublicKey, error)

func PeerIDFromPubkey

func PeerIDFromPubkey(pubkey *ecdsa.PublicKey) peer.ID

func PrivKeysEqual

func PrivKeysEqual(a *crypto.Secp256k1PrivateKey, b *crypto.Secp256k1PrivateKey) (ok bool, err error)

Types

type AttnetsENREntry

type AttnetsENREntry []byte

func NewAttnetsENREntry

func NewAttnetsENREntry(dat *beacon.AttnetBits) AttnetsENREntry

func (AttnetsENREntry) AttnetBits

func (aee AttnetsENREntry) AttnetBits() (beacon.AttnetBits, error)

func (AttnetsENREntry) ENRKey

func (aee AttnetsENREntry) ENRKey() string

func (AttnetsENREntry) String

func (aee AttnetsENREntry) String() string

type Eth2ENREntry

type Eth2ENREntry []byte

func NewEth2DataEntry

func NewEth2DataEntry(dat *beacon.Eth2Data) Eth2ENREntry

func (Eth2ENREntry) ENRKey

func (eee Eth2ENREntry) ENRKey() string

func (Eth2ENREntry) Eth2Data

func (eee Eth2ENREntry) Eth2Data() (*beacon.Eth2Data, error)

func (Eth2ENREntry) String

func (eee Eth2ENREntry) String() string

Jump to

Keyboard shortcuts

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