Documentation ¶
Overview ¶
package sentinel
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 GossipSubscription
- type GossipTopic
- type Sentinel
- func (s *Sentinel) Config() *SentinelConfig
- func (s *Sentinel) ConnectWithPeer(ctx context.Context, info peer.AddrInfo) (err error)
- func (s *Sentinel) GetPeersCount() int
- func (s *Sentinel) GossipManager() *GossipManager
- func (s *Sentinel) HasTooManyPeers() bool
- func (s *Sentinel) Host() host.Host
- func (s *Sentinel) Peers() *peers.Pool
- func (s *Sentinel) PeersList() []peer.AddrInfo
- func (s *Sentinel) RecvGossip() <-chan *pubsub.Message
- 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, opts ...pubsub.TopicOpt) (sub *GossipSubscription, err error)
- func (s *Sentinel) Unsubscribe(topic GossipTopic, opts ...pubsub.TopicOpt) (err error)
- type SentinelConfig
- type TopicName
Constants ¶
const SSZSnappyCodec = "ssz_snappy"
Variables ¶
var AttesterSlashingSsz = GossipTopic{ Name: AttesterSlashingTopic, CodecStr: SSZSnappyCodec, }
var BeaconAggregateAndProofSsz = GossipTopic{ Name: BeaconAggregateAndProofTopic, CodecStr: SSZSnappyCodec, }
var BeaconBlockSsz = GossipTopic{ Name: BeaconBlockTopic, CodecStr: SSZSnappyCodec, }
var BlsToExecutionChangeSsz = GossipTopic{ Name: BlsToExecutionChangeTopic, CodecStr: SSZSnappyCodec, }
var ProposerSlashingSsz = GossipTopic{ Name: ProposerSlashingTopic, CodecStr: SSZSnappyCodec, }
var VoluntaryExitSsz = GossipTopic{ Name: VoluntaryExitTopic, 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 *pubsub.Message
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) Listen ¶
func (sub *GossipSubscription) Listen() (err error)
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, db persistence.RawBeaconBlockChain, logger log.Logger, ) (*Sentinel, error)
This is just one of the examples from the libp2p repository.
func (*Sentinel) Config ¶
func (s *Sentinel) Config() *SentinelConfig
func (*Sentinel) ConnectWithPeer ¶
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) GossipManager ¶
func (s *Sentinel) GossipManager() *GossipManager
func (*Sentinel) HasTooManyPeers ¶
func (*Sentinel) RecvGossip ¶
func (*Sentinel) ReqRespHandler ¶
func (*Sentinel) SubscribeGossip ¶
func (s *Sentinel) SubscribeGossip(topic GossipTopic, 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 GenesisConfig *clparams.GenesisConfig 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 }
type TopicName ¶
type TopicName string
const ( BeaconBlockTopic TopicName = "beacon_block" BeaconAggregateAndProofTopic TopicName = "beacon_aggregate_and_proof" VoluntaryExitTopic TopicName = "voluntary_exit" ProposerSlashingTopic TopicName = "proposer_slashing" AttesterSlashingTopic TopicName = "attester_slashing" BlsToExecutionChangeTopic TopicName = "bls_to_execution_change" BlobSidecarTopic TopicName = "blob_sidecar_%d" // This topic needs an index )
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 |