types

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: GPL-3.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

AllAgents is a list of all agents.

View Source
var PeerDirections = []string{
	"inbound",
	"outbound",
}

PeerDirections represents all possible peer directions.

View Source
var PeerStates = []string{
	"disconnected",
	"connected",
	"connecting",
	"disconnecting",
}

PeerStates represents all possible peer states.

Functions

This section is empty.

Types

type Agent

type Agent string

Agent is a peer's agent.

const (
	// AgentUnknown is an unknown agent.
	AgentUnknown Agent = "unknown"
	// AgentLighthouse is a Lighthouse agent.
	AgentLighthouse Agent = "lighthouse"
	// AgentNimbus is a Nimbus agent.
	AgentNimbus Agent = "nimbus"
	// AgentTeku is a Teku agent.
	AgentTeku Agent = "teku"
	// AgentPrysm is a Prysm agent.
	AgentPrysm Agent = "prysm"
	// AgentLodestar is a Lodestar agent.
	AgentLodestar Agent = "lodestar"
)

func AgentFromString

func AgentFromString(agent string) Agent

AgentFromString returns the agent from the given string.

type AgentCount

type AgentCount struct {
	Unknown    int `json:"unknown"`
	Lighthouse int `json:"lighthouse"`
	Nimbus     int `json:"nimbus"`
	Teku       int `json:"teku"`
	Prysm      int `json:"prysm"`
	Lodestar   int `json:"lodestar"`
}

AgentCount represents the number of peers with each agent.

type DepositSnapshot added in v0.24.0

type DepositSnapshot struct {
	Finalized            []phase0.Root `json:"finalized"`
	DepositRoot          phase0.Root   `json:"deposit_root"`
	DepositCount         uint64        `json:"deposit_count"`
	ExecutionBlockHash   phase0.Root   `json:"execution_block_hash"`
	ExecutionBlockHeight uint64        `json:"execution_block_height"`
}

DepositSnapshot represents an EIP-4881 deposit snapshot.

func (*DepositSnapshot) MarshalJSON added in v0.24.0

func (d *DepositSnapshot) MarshalJSON() ([]byte, error)

func (*DepositSnapshot) UnmarshalJSON added in v0.24.0

func (d *DepositSnapshot) UnmarshalJSON(input []byte) error

type DepositSnapshotJSON added in v0.24.0

type DepositSnapshotJSON struct {
	Finalized            []string `json:"finalized"`
	DepositRoot          string   `json:"deposit_root"`
	DepositCount         uint64   `json:"deposit_count,string"`
	ExecutionBlockHash   string   `json:"execution_block_hash"`
	ExecutionBlockHeight uint64   `json:"execution_block_height,string"`
}

type Peer

type Peer struct {
	PeerID             string `json:"peer_id"`
	ENR                string `json:"enr"`
	LastSeenP2PAddress string `json:"last_seen_p2p_address"`
	State              string `json:"state"`
	Direction          string `json:"direction"`
	Agent              string `json:"agent"`
}

Peer represents a peer.

func (*Peer) DeriveAgent

func (p *Peer) DeriveAgent() Agent

DeriveAgent returns the agent of the peer.

type PeerCount

type PeerCount struct {
	Disconnected  string `json:"disconnected"`
	Connected     string `json:"connected"`
	Connecting    string `json:"connecting"`
	Disconnecting string `json:"disconnecting"`
}

PeerCount represents the number of peers in each state.

type Peers

type Peers []Peer

Peers represents a list of peers.

func (*Peers) AgentCount

func (p *Peers) AgentCount() AgentCount

AgentCount represents the number of peers with each agent.

func (*Peers) ByAgent

func (p *Peers) ByAgent(agent Agent) Peers

ByAgent returns the peers with the given agent.

func (*Peers) ByDirection

func (p *Peers) ByDirection(direction string) Peers

ByDirection returns the peers with the given direction.

func (*Peers) ByState

func (p *Peers) ByState(state string) Peers

ByState returns the peers with the given state.

func (*Peers) ByStateAndDirection

func (p *Peers) ByStateAndDirection(state, direction string) Peers

ByStateAndDirection returns the peers with the given state and direction.

Jump to

Keyboard shortcuts

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