node

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-3.0 Imports: 24 Imported by: 4

Documentation

Overview

Package node defines a gRPC node service implementation, providing useful endpoints for checking a node's sync status, peer info, genesis data, and version information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetIdentityResponse added in v4.2.0

type GetIdentityResponse struct {
	Data *Identity `json:"data"`
}

type GetPeerCountResponse added in v4.2.0

type GetPeerCountResponse struct {
	Data *PeerCount `json:"data"`
}

type GetPeerResponse added in v4.2.0

type GetPeerResponse struct {
	Data *Peer `json:"data"`
}

type GetPeersResponse added in v4.2.0

type GetPeersResponse struct {
	Data []*Peer `json:"data"`
}

type GetVersionResponse added in v4.2.0

type GetVersionResponse struct {
	Data *Version `json:"data"`
}

type Identity added in v4.2.0

type Identity struct {
	PeerId             string    `json:"peer_id"`
	Enr                string    `json:"enr"`
	P2PAddresses       []string  `json:"p2p_addresses"`
	DiscoveryAddresses []string  `json:"discovery_addresses"`
	Metadata           *Metadata `json:"metadata"`
}

type Metadata added in v4.2.0

type Metadata struct {
	SeqNumber string `json:"seq_number"`
	Attnets   string `json:"attnets"`
}

type Peer added in v4.2.0

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"`
}

type PeerCount added in v4.2.0

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

type Server

type Server struct {
	SyncChecker               sync.Checker
	OptimisticModeFetcher     blockchain.OptimisticModeFetcher
	Server                    *grpc.Server
	BeaconDB                  db.ReadOnlyDatabase
	PeersFetcher              p2p.PeersProvider
	PeerManager               p2p.PeerManager
	MetadataProvider          p2p.MetadataProvider
	GenesisTimeFetcher        blockchain.TimeFetcher
	HeadFetcher               blockchain.HeadFetcher
	ExecutionChainInfoFetcher execution.ChainInfoFetcher
}

Server defines a server implementation of the gRPC Node service, providing RPC endpoints for verifying a beacon node's sync status, genesis and version information.

func (*Server) GetHealth

func (s *Server) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth returns node health status in http status codes. Useful for load balancers.

func (*Server) GetIdentity

func (s *Server) GetIdentity(w http.ResponseWriter, r *http.Request)

GetIdentity retrieves data about the node's network presence.

func (*Server) GetPeer

func (s *Server) GetPeer(w http.ResponseWriter, r *http.Request)

GetPeer retrieves data about the given peer.

func (*Server) GetPeerCount added in v4.2.0

func (s *Server) GetPeerCount(w http.ResponseWriter, r *http.Request)

GetPeerCount retrieves number of known peers.

func (*Server) GetPeers added in v4.2.0

func (s *Server) GetPeers(w http.ResponseWriter, r *http.Request)

GetPeers retrieves data about the node's network peers.

func (*Server) GetSyncStatus

func (s *Server) GetSyncStatus(w http.ResponseWriter, r *http.Request)

GetSyncStatus requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to.

func (*Server) GetVersion

func (*Server) GetVersion(w http.ResponseWriter, r *http.Request)

GetVersion requests that the beacon node identify information about its implementation in a format similar to a HTTP User-Agent field.

type SyncStatusResponse added in v4.1.0

type SyncStatusResponse struct {
	Data *SyncStatusResponseData `json:"data"`
}

type SyncStatusResponseData added in v4.1.0

type SyncStatusResponseData struct {
	HeadSlot     string `json:"head_slot"`
	SyncDistance string `json:"sync_distance"`
	IsSyncing    bool   `json:"is_syncing"`
	IsOptimistic bool   `json:"is_optimistic"`
	ElOffline    bool   `json:"el_offline"`
}

type Version added in v4.2.0

type Version struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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