sentinel

package
v3.0.0-alpha5.0...-c974331 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: LGPL-3.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const SSZSnappyCodec = "ssz_snappy"

Variables

View Source
var AttesterSlashingSsz = GossipTopic{
	Name:     gossip.TopicNameAttesterSlashing,
	CodecStr: SSZSnappyCodec,
}
View Source
var BeaconAggregateAndProofSsz = GossipTopic{
	Name:     gossip.TopicNameBeaconAggregateAndProof,
	CodecStr: SSZSnappyCodec,
}
View Source
var BeaconBlockSsz = GossipTopic{
	Name:     gossip.TopicNameBeaconBlock,
	CodecStr: SSZSnappyCodec,
}
View Source
var BlsToExecutionChangeSsz = GossipTopic{
	Name:     gossip.TopicNameBlsToExecutionChange,
	CodecStr: SSZSnappyCodec,
}
View Source
var LightClientFinalityUpdateSsz = GossipTopic{
	Name:     gossip.TopicNameLightClientFinalityUpdate,
	CodecStr: SSZSnappyCodec,
}
View Source
var LightClientOptimisticUpdateSsz = GossipTopic{
	Name:     gossip.TopicNameLightClientOptimisticUpdate,
	CodecStr: SSZSnappyCodec,
}
View Source
var ProposerSlashingSsz = GossipTopic{
	Name:     gossip.TopicNameProposerSlashing,
	CodecStr: SSZSnappyCodec,
}
View Source
var SyncCommitteeContributionAndProofSsz = GossipTopic{
	Name:     gossip.TopicNameSyncCommitteeContributionAndProof,
	CodecStr: SSZSnappyCodec,
}
View Source
var VoluntaryExitSsz = GossipTopic{
	Name:     gossip.TopicNameVoluntaryExit,
	CodecStr: SSZSnappyCodec,
}

Functions

This section is empty.

Types

type Gater

type Gater struct {
	// contains filtered or unexported fields
}

func NewGater

func NewGater(cfg *SentinelConfig) (g *Gater, err error)

func (*Gater) InterceptAccept

func (g *Gater) InterceptAccept(n network.ConnMultiaddrs) (allow bool)

InterceptAccept tests whether an incipient inbound connection is allowed.

This is called by the upgrader, or by the transport directly (e.g. QUIC, Bluetooth), straight after it has accepted a connection from its socket.

func (*Gater) InterceptAddrDial

func (g *Gater) InterceptAddrDial(_ peer.ID, n multiaddr.Multiaddr) (allow bool)

InterceptAddrDial tests whether we're permitted to dial the specified multiaddr for the given peer.

This is called by the network.Network implementation after it has resolved the peer's addrs, and prior to dialling each.

func (*Gater) InterceptPeerDial

func (g *Gater) InterceptPeerDial(p peer.ID) (allow bool)

InterceptPeerDial tests whether we're permitted to Dial the specified peer. This is called by the network.Network implementation when dialling a peer.

func (*Gater) InterceptSecured

func (g *Gater) InterceptSecured(_ network.Direction, _ peer.ID, _ network.ConnMultiaddrs) (allow bool)

InterceptSecured tests whether a given connection, now authenticated, is allowed.

This is called by the upgrader, after it has performed the security handshake, and before it negotiates the muxer, or by the directly by the transport, at the exact same checkpoint.

func (*Gater) InterceptUpgraded

func (g *Gater) InterceptUpgraded(_ network.Conn) (allow bool, reason control.DisconnectReason)

InterceptUpgraded tests whether a fully capable connection is allowed.

At this point, the connection a multiplexer has been selected. When rejecting a connection, the gater can return a DisconnectReason. Refer to the godoc on the ConnectionGater type for more information.

NOTE: the go-libp2p implementation currently IGNORES the disconnect reason.

type GossipManager

type GossipManager struct {
	// contains filtered or unexported fields
}

func NewGossipManager

func NewGossipManager(
	ctx context.Context,
) *GossipManager

construct a new gossip manager that will handle packets with the given handlerfunc

func (*GossipManager) AddSubscription

func (s *GossipManager) AddSubscription(topic string, sub *GossipSubscription)

func (*GossipManager) Close

func (g *GossipManager) Close()

func (*GossipManager) GetMatchingSubscription

func (s *GossipManager) GetMatchingSubscription(match string) *GossipSubscription

func (*GossipManager) Recv

func (s *GossipManager) Recv() <-chan *GossipMessage

func (*GossipManager) Start

func (g *GossipManager) Start(ctx context.Context)

type GossipMessage

type GossipMessage struct {
	From      peer.ID
	TopicName string
	Data      []byte
}

type GossipSubscription

type GossipSubscription struct {
	// contains filtered or unexported fields
}

GossipSubscription abstracts a gossip subscription to write decoded structs.

func (*GossipSubscription) Close

func (s *GossipSubscription) Close()

calls the cancel func for the subscriber and closes the topic and sub

func (*GossipSubscription) OverwriteSubscriptionExpiry

func (sub *GossipSubscription) OverwriteSubscriptionExpiry(expiry time.Time)

func (*GossipSubscription) Publish

func (g *GossipSubscription) Publish(data []byte) error

type GossipTopic

type GossipTopic struct {
	Name     string
	CodecStr string
}

func GossipSidecarTopics

func GossipSidecarTopics(maxBlobs uint64) (ret []GossipTopic)

type Sentinel

type Sentinel struct {
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	cfg *SentinelConfig,
	ethClock eth_clock.EthereumClock,
	blockReader freezeblocks.BeaconSnapshotReader,
	blobStorage blob_storage.BlobStorage,
	indiciesDB kv.RoDB,
	logger log.Logger,
	forkChoiceReader forkchoice.ForkChoiceStorageReader,
) (*Sentinel, error)

This is just one of the examples from the libp2p repository.

func (*Sentinel) Config

func (s *Sentinel) Config() *SentinelConfig

func (*Sentinel) ConnectWithPeer

func (s *Sentinel) ConnectWithPeer(ctx context.Context, info peer.AddrInfo, sem *semaphore.Weighted) (err error)

ConnectWithPeer is used to attempt to connect and add the peer to our pool it errors when if fail to connect with the peer, for instance, if it fails the handshake if it does not return an error, the peer is attempted to be added to the pool

func (*Sentinel) GetPeersCount

func (s *Sentinel) GetPeersCount() (active int, connected int, disconnected int)

func (*Sentinel) GetPeersInfos

func (s *Sentinel) GetPeersInfos() *sentinelrpc.PeersInfoResponse

func (*Sentinel) GossipManager

func (s *Sentinel) GossipManager() *GossipManager

func (*Sentinel) HasTooManyPeers

func (s *Sentinel) HasTooManyPeers() bool

func (*Sentinel) Host

func (s *Sentinel) Host() host.Host

func (*Sentinel) Identity

func (s *Sentinel) Identity() (pid, enrStr string, p2pAddresses, discoveryAddresses []string, metadata *cltypes.Metadata)

func (*Sentinel) Peers

func (s *Sentinel) Peers() *peers.Pool

func (*Sentinel) PeersList

func (s *Sentinel) PeersList() []peer.AddrInfo

func (*Sentinel) RecvGossip

func (s *Sentinel) RecvGossip() <-chan *GossipMessage

func (*Sentinel) ReqRespHandler

func (s *Sentinel) ReqRespHandler() http.Handler

func (*Sentinel) SetStatus

func (s *Sentinel) SetStatus(status *cltypes.Status)

func (*Sentinel) Start

func (s *Sentinel) Start() error

func (*Sentinel) Status

func (s *Sentinel) Status() *cltypes.Status

func (*Sentinel) Stop

func (s *Sentinel) Stop()

func (*Sentinel) String

func (s *Sentinel) String() string

func (*Sentinel) SubscribeGossip

func (s *Sentinel) SubscribeGossip(topic GossipTopic, expiration time.Time, opts ...pubsub.TopicOpt) (sub *GossipSubscription, err error)

func (*Sentinel) Unsubscribe

func (s *Sentinel) Unsubscribe(topic GossipTopic, opts ...pubsub.TopicOpt) (err error)

type SentinelConfig

type SentinelConfig struct {
	NetworkConfig *clparams.NetworkConfig
	BeaconConfig  *clparams.BeaconChainConfig
	IpAddr        string
	Port          int
	TCPPort       uint
	// Optional
	LocalIP        string
	EnableUPnP     bool
	RelayNodeAddr  string
	HostAddress    string
	HostDNS        string
	NoDiscovery    bool
	TmpDir         string
	LocalDiscovery bool

	EnableBlocks       bool
	SubscribeAllTopics bool // Capture all topics
	ActiveIndicies     uint64
	MaxPeerCount       uint64
}

Directories

Path Synopsis
package httpreqresp encapsulates eth2 beacon chain resp-resp into http
package httpreqresp encapsulates eth2 beacon chain resp-resp into http

Jump to

Keyboard shortcuts

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