Documentation ¶
Index ¶
- Constants
- Variables
- type Gater
- func (g *Gater) InterceptAccept(n network.ConnMultiaddrs) (allow bool)
- func (g *Gater) InterceptAddrDial(_ peer.ID, n multiaddr.Multiaddr) (allow bool)
- func (g *Gater) InterceptPeerDial(p peer.ID) (allow bool)
- func (g *Gater) InterceptSecured(_ network.Direction, _ peer.ID, _ network.ConnMultiaddrs) (allow bool)
- func (g *Gater) InterceptUpgraded(_ network.Conn) (allow bool, reason control.DisconnectReason)
- type GossipManager
- type GossipMessage
- type GossipSubscription
- type GossipTopic
- type Sentinel
- func (s *Sentinel) Config() *SentinelConfig
- func (s *Sentinel) ConnectWithPeer(ctx context.Context, info peer.AddrInfo, sem *semaphore.Weighted) (err error)
- func (s *Sentinel) GetPeersCount() (active int, connected int, disconnected int)
- func (s *Sentinel) GetPeersInfos() *sentinelrpc.PeersInfoResponse
- func (s *Sentinel) GossipManager() *GossipManager
- func (s *Sentinel) HasTooManyPeers() bool
- func (s *Sentinel) Host() host.Host
- func (s *Sentinel) Identity() (pid, enrStr string, p2pAddresses, discoveryAddresses []string, ...)
- func (s *Sentinel) Peers() *peers.Pool
- func (s *Sentinel) PeersList() []peer.AddrInfo
- func (s *Sentinel) RecvGossip() <-chan *GossipMessage
- func (s *Sentinel) ReqRespHandler() http.Handler
- func (s *Sentinel) SetStatus(status *cltypes.Status)
- func (s *Sentinel) Start() error
- func (s *Sentinel) Status() *cltypes.Status
- func (s *Sentinel) Stop()
- func (s *Sentinel) String() string
- func (s *Sentinel) SubscribeGossip(topic GossipTopic, expiration time.Time, opts ...pubsub.TopicOpt) (sub *GossipSubscription, err error)
- func (s *Sentinel) Unsubscribe(topic GossipTopic, opts ...pubsub.TopicOpt) (err error)
- type SentinelConfig
Constants ¶
const SSZSnappyCodec = "ssz_snappy"
Variables ¶
var AttesterSlashingSsz = GossipTopic{ Name: gossip.TopicNameAttesterSlashing, CodecStr: SSZSnappyCodec, }
var BeaconAggregateAndProofSsz = GossipTopic{ Name: gossip.TopicNameBeaconAggregateAndProof, CodecStr: SSZSnappyCodec, }
var BeaconBlockSsz = GossipTopic{ Name: gossip.TopicNameBeaconBlock, CodecStr: SSZSnappyCodec, }
var BlsToExecutionChangeSsz = GossipTopic{ Name: gossip.TopicNameBlsToExecutionChange, CodecStr: SSZSnappyCodec, }
var LightClientFinalityUpdateSsz = GossipTopic{ Name: gossip.TopicNameLightClientFinalityUpdate, CodecStr: SSZSnappyCodec, }
var LightClientOptimisticUpdateSsz = GossipTopic{ Name: gossip.TopicNameLightClientOptimisticUpdate, CodecStr: SSZSnappyCodec, }
var ProposerSlashingSsz = GossipTopic{ Name: gossip.TopicNameProposerSlashing, CodecStr: SSZSnappyCodec, }
var SyncCommitteeContributionAndProofSsz = GossipTopic{ Name: gossip.TopicNameSyncCommitteeContributionAndProof, CodecStr: SSZSnappyCodec, }
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 ¶
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 ¶
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 ¶
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 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 ¶
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 (*Sentinel) GetPeersInfos ¶
func (s *Sentinel) GetPeersInfos() *sentinelrpc.PeersInfoResponse
func (*Sentinel) GossipManager ¶
func (s *Sentinel) GossipManager() *GossipManager
func (*Sentinel) HasTooManyPeers ¶
func (*Sentinel) RecvGossip ¶
func (s *Sentinel) RecvGossip() <-chan *GossipMessage
func (*Sentinel) ReqRespHandler ¶
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 }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
package httpreqresp encapsulates eth2 beacon chain resp-resp into http
|
package httpreqresp encapsulates eth2 beacon chain resp-resp into http |