commons

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: GPL-3.0 Imports: 24 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 DecodeNetworkMsg added in v1.1.0

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

DecodeNetworkMsg decodes network message

func DecodeSignedSSVMessage added in v1.2.0

func DecodeSignedSSVMessage(encoded []byte) ([]byte, spectypes.OperatorID, []byte, error)

DecodeSignedSSVMessage deserializes signed message bytes messsage, op id and a signature

func ECDSAPrivFromInterface added in v1.2.0

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

ECDSAPrivFromInterface converts crypto.PrivKey back to ecdsa.PrivateKey

func ECDSAPrivToInterface added in v1.2.0

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

ECDSAPrivToInterface converts ecdsa.PrivateKey to crypto.PrivKey

func ECDSAPubFromInterface added in v1.2.0

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

ECDSAPubFromInterface converts crypto.PubKey to ecdsa.PublicKey

func ECDSAPubToInterface added in v1.2.0

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

ECDSAPubToInterface converts ecdsa.PublicKey to crypto.PubKey

func EncodeNetworkMsg added in v1.1.0

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

EncodeNetworkMsg encodes network message

func EncodeSignedSSVMessage added in v1.2.0

func EncodeSignedSSVMessage(message []byte, operatorID spectypes.OperatorID, signature []byte) []byte

EncodeSignedSSVMessage serializes the message, op id and signature into bytes

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 RSAPrivToInterface added in v1.2.0

func RSAPrivToInterface(privkey *rsa.PrivateKey) (crypto.PrivKey, error)

RSAPrivToInterface converts rsa.PrivateKey to crypto.PrivKey

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