commons

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: GPL-3.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultIP is hte default ip address to use
	DefaultIP = "127.0.0.1"
	// DefaultTCP is the default tcp port used in SSV
	DefaultTCP = 12001
	// DefaultUDP is the default udp port used in SSV
	DefaultUDP = 13001
)
View Source
const (

	// UnknownSubnet is used when a validator public key is invalid
	UnknownSubnet = "unknown"
)

Variables

This section is empty.

Functions

func AddOptions added in v1.1.0

func AddOptions(opts []libp2p.Option) []libp2p.Option

AddOptions implementation

func BuildMultiAddress added in v0.2.0

func BuildMultiAddress(ipAddr, protocol string, port uint, id peer.ID) (ma.Multiaddr, error)

BuildMultiAddress creates a multiaddr from the given params

func CheckAddress added in v0.2.0

func CheckAddress(addr string) error

CheckAddress checks that some address is accessible and returns error accordingly

func ConvertFromInterfacePrivKey added in v0.3.0

func ConvertFromInterfacePrivKey(privkey crypto.PrivKey) (*ecdsa.PrivateKey, error)

ConvertFromInterfacePrivKey converts crypto.PrivKey back to ecdsa.PrivateKey

func ConvertFromInterfacePubKey added in v0.3.0

func ConvertFromInterfacePubKey(pubKey crypto.PubKey) *ecdsa.PublicKey

ConvertFromInterfacePubKey converts crypto.PubKey to ecdsa.PublicKey

func ConvertToInterfacePrivkey added in v0.3.0

func ConvertToInterfacePrivkey(privkey *ecdsa.PrivateKey) (crypto.PrivKey, error)

ConvertToInterfacePrivkey converts ecdsa.PrivateKey to crypto.PrivKey

func ConvertToInterfacePubkey added in v0.3.0

func ConvertToInterfacePubkey(pubkey *ecdsa.PublicKey) (crypto.PubKey, error)

ConvertToInterfacePubkey converts ecdsa.PublicKey to crypto.PubKey

func DecodeNetworkMsg added in v1.1.0

func DecodeNetworkMsg(data []byte) (*spectypes.SSVMessage, error)

DecodeNetworkMsg decodes network message

func EncodeNetworkMsg added in v1.1.0

func EncodeNetworkMsg(msg *spectypes.SSVMessage) ([]byte, error)

EncodeNetworkMsg encodes network message

func GenNetworkKey added in v0.2.0

func GenNetworkKey() (*ecdsa.PrivateKey, error)

GenNetworkKey generates a new network key

func GetTopicBaseName added in v1.1.0

func GetTopicBaseName(topicName string) string

GetTopicBaseName return the base topic name of the topic, w/o ssv prefix

func GetTopicFullName added in v1.1.0

func GetTopicFullName(baseName string) string

GetTopicFullName returns the topic full name, including prefix

func IPAddr added in v0.2.0

func IPAddr() (net.IP, error)

IPAddr returns the external IP address

func ProtocolID added in v1.1.0

func ProtocolID(prot p2pprotocol.SyncProtocol) (protocol.ID, int)

ProtocolID returns the protocol id of the given protocol, and the amount of peers for distribution

func SubnetTopicID added in v1.1.0

func SubnetTopicID(subnet int) string

SubnetTopicID returns the topic to use for the given subnet

func Subnets added in v1.1.0

func Subnets() int

Subnets returns the subnets count for this fork

func Topics added in v1.1.0

func Topics() []string

Topics returns the available topics for this fork.

func ValidatorSubnet added in v1.1.0

func ValidatorSubnet(validatorPKHex string) int

ValidatorSubnet returns the subnet for the given validator

func ValidatorTopicID added in v1.1.0

func ValidatorTopicID(pkByts []byte) []string

ValidatorTopicID returns the topic to use for the given validator

Types

type MsgIDFunc added in v1.1.0

type MsgIDFunc func(msg []byte) string

MsgIDFunc is the function that maps a message to a msg_id

func MsgID added in v1.1.0

func MsgID() MsgIDFunc

MsgID returns msg_id for the given message

Jump to

Keyboard shortcuts

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