Documentation ¶
Index ¶
- func CreateLocalNode(privKey *ecdsa.PrivateKey, storagePath string, ipAddr net.IP, ...) (*enode.LocalNode, error)
- func GetForkVersionEntry(record *enr.Record) (forksprotocol.ForkVersion, error)
- func GetOperatorIDEntry(record *enr.Record) (string, error)
- func GetSubnetsEntry(record *enr.Record) ([]byte, error)
- func SetForkVersionEntry(node *enode.LocalNode, forkv string) error
- func SetNodeTypeEntry(node *enode.LocalNode, nodeType NodeType) error
- func SetOperatorIDEntry(node *enode.LocalNode, operatorID string) error
- func SetSubnetsEntry(node *enode.LocalNode, subnets []byte) error
- func UpdateSubnets(node *enode.LocalNode, count int, added []int64, removed []int64) error
- type ForkVersionEntry
- type NodeInfo
- type NodeMetadata
- type NodeType
- type NodeTypeEntry
- type OperatorIDEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateLocalNode ¶
func CreateLocalNode(privKey *ecdsa.PrivateKey, storagePath string, ipAddr net.IP, udpPort, tcpPort int) (*enode.LocalNode, error)
CreateLocalNode create a new enode.LocalNode instance
func GetForkVersionEntry ¶
func GetForkVersionEntry(record *enr.Record) (forksprotocol.ForkVersion, error)
GetForkVersionEntry extracts the value of operator-id entry ('oid')
func GetOperatorIDEntry ¶
GetOperatorIDEntry extracts the value of operator-id entry ('oid')
func GetSubnetsEntry ¶
GetSubnetsEntry extracts the value of subnets entry from some record
func SetForkVersionEntry ¶
SetForkVersionEntry adds operator-id entry ('oid') to the node
func SetNodeTypeEntry ¶
SetNodeTypeEntry adds operator-public-key-hash entry ('oid') to the node
func SetOperatorIDEntry ¶
SetOperatorIDEntry adds operator-id entry ('oid') to the node
func SetSubnetsEntry ¶
SetSubnetsEntry adds subnets entry to our enode.LocalNode
Types ¶
type ForkVersionEntry ¶
type ForkVersionEntry string
ForkVersionEntry holds the fork version of the node
func (*ForkVersionEntry) DecodeRLP ¶
func (fv *ForkVersionEntry) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder, required because fork version is a string
func (ForkVersionEntry) ENRKey ¶
func (fv ForkVersionEntry) ENRKey() string
ENRKey implements enr.Entry, returns the entry key
type NodeInfo ¶
type NodeInfo struct { // ForkVersion is the fork version used by the node ForkVersion forksprotocol.ForkVersion // NetworkID is the id of the node's network NetworkID string // Metadata holds node's general information Metadata *NodeMetadata }
NodeInfo holds node's information such as network information. it implements record.Record so we can safely sign, exchange and verify the data. for more information see record.Envelope
func NewNodeInfo ¶
func NewNodeInfo(forkVersion forksprotocol.ForkVersion, networkID string) *NodeInfo
NewNodeInfo creates a new node info
func (*NodeInfo) Domain ¶
Domain is the "signature domain" used when signing and verifying an record.Record
func (*NodeInfo) MarshalRecord ¶
MarshalRecord converts a Record instance to a []byte, so that it can be used as an Envelope payload
func (*NodeInfo) UnmarshalRecord ¶
UnmarshalRecord unmarshals a []byte payload into an instance of a particular Record type
type NodeMetadata ¶
type NodeMetadata struct { // NodeVersion is the ssv-node version, it is a required field NodeVersion string // OperatorID holds a hash of the operator public key, based on operator key OperatorID string // ExecutionNode is the "name/version" of the eth1 node ExecutionNode string // ConsensusNode is the "name/version" of the beacon node ConsensusNode string }
NodeMetadata holds node's general information
func (*NodeMetadata) Decode ¶
func (nm *NodeMetadata) Decode(data []byte) error
Decode decodes a raw payload into metadata TODO: switch to SSZ
func (*NodeMetadata) Encode ¶
func (nm *NodeMetadata) Encode() ([]byte, error)
Encode encodes the metadata into bytes TODO: switch to SSZ
type NodeType ¶
type NodeType int32
NodeType indicate node operation type. In purpose for distinguish between different types of peers
func GetNodeTypeEntry ¶
GetNodeTypeEntry extracts the value of operator-public-key-hash entry ('oid')
type NodeTypeEntry ¶
type NodeTypeEntry uint16
NodeTypeEntry holds the node type
func (NodeTypeEntry) ENRKey ¶
func (nte NodeTypeEntry) ENRKey() string
ENRKey implements enr.Entry, returns the entry key
type OperatorIDEntry ¶
type OperatorIDEntry string
OperatorIDEntry holds the operator id
func (*OperatorIDEntry) DecodeRLP ¶
func (oid *OperatorIDEntry) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder, required because operator id is a string
func (OperatorIDEntry) ENRKey ¶
func (oid OperatorIDEntry) ENRKey() string
ENRKey implements enr.Entry, returns the entry key