Versions in this module Expand all Collapse all v0 v0.0.4 Jan 15, 2025 v0.0.1 Jan 15, 2025 Changes in this version + const AggregateAndProofSubnetTopicFormat + const AttestationSubnetTopicFormat + const AttesterSlashingSubnetTopicFormat + const BeaconBlocksByRangeMessageName + const BeaconBlocksByRootsMessageName + const BlobSidecarsByRangeName + const BlobSidecarsByRootName + const BlobSubnetTopicFormat + const BlockSubnetTopicFormat + const BlsToExecutionChangeSubnetTopicFormat + const ExitSubnetTopicFormat + const GoodbyeMessageName + const GossipAggregateAndProofMessage + const GossipAttestationMessage + const GossipAttesterSlashingMessage + const GossipBlobSidecarMessage + const GossipBlockMessage + const GossipBlsToExecutionChangeMessage + const GossipContributionAndProofMessage + const GossipExitMessage + const GossipProposerSlashingMessage + const GossipProtocolAndDigest + const GossipSyncCommitteeMessage + const MetadataMessageName + const PingMessageName + const ProposerSlashingSubnetTopicFormat + const RPCBlobSidecarsByRangeTopicV1 + const RPCBlobSidecarsByRootTopicV1 + const RPCBlocksByRangeTopicV1 + const RPCBlocksByRangeTopicV2 + const RPCBlocksByRootTopicV1 + const RPCBlocksByRootTopicV2 + const RPCGoodByeTopicV1 + const RPCMetaDataTopicV1 + const RPCMetaDataTopicV2 + const RPCPingTopicV1 + const RPCStatusTopicV1 + const SchemaVersionV1 + const SchemaVersionV2 + const StatusMessageName + const SyncCommitteeSubnetTopicFormat + const SyncContributionAndProofSubnetTopicFormat + var ErrMessageNotMapped = errors.New("message type is not mapped to a PubSub topic") + var GossipTypeMapping = make(map[reflect.Type]string, len(gossipTopicMappings)) + var OmitContextBytesV1 = map[string]bool + var RPCTopicMappings = map[string]interface + func AllTopics() []string + func ExtractGossipDigest(topic string) ([4]byte, error) + func GossipTopicMappings(topic string, epoch primitives.Epoch) proto.Message + func MakePeer(addr string) (*peer.AddrInfo, error) + func MsgID(genesisValidatorsRoot []byte, pmsg *pubsubpb.Message) string + func MultiAddressBuilder(ipAddr string, port uint) (ma.Multiaddr, error) + func PeersFromStringAddrs(addrs []string) ([]ma.Multiaddr, error) + func SerializeENR(record *enr.Record) (string, error) + func TopicDeconstructor(topic string) (string, string, string, error) + func TopicFromMessage(msg string, epoch primitives.Epoch) (string, error) + func VerifyTopicMapping(topic string, msg interface{}) error + type Broadcaster interface + Broadcast func(context.Context, proto.Message) error + BroadcastAttestation func(ctx context.Context, subnet uint64, att *ethpb.Attestation) error + BroadcastBlob func(ctx context.Context, subnet uint64, blob *ethpb.SignedBlobSidecar) error + BroadcastSyncCommitteeMessage func(ctx context.Context, subnet uint64, sMsg *ethpb.SyncCommitteeMessage) error + type Config struct + AllowListCIDR string + BootstrapNodeAddr []string + ClockWaiter startup.ClockWaiter + DB db.ReadOnlyDatabase + DataDir string + DenyListCIDR []string + Discv5BootStrapAddr []string + EnableUPnP bool + HostAddress string + HostDNS string + LocalIP string + MaxPeers uint + MetaDataDir string + NoDiscovery bool + PrivateKey string + RelayNodeAddr string + StateNotifier statefeed.Notifier + StaticPeerID bool + StaticPeers []string + TCPPort uint + UDPPort uint + type ConnectionHandler interface + AddConnectionHandler func(f func(ctx context.Context, id peer.ID) error, ...) + AddDisconnectionHandler func(f func(ctx context.Context, id peer.ID) error) + type EncodingProvider interface + Encoding func() encoder.NetworkEncoding + type Listener interface + Close func() + LocalNode func() *enode.LocalNode + Lookup func(enode.ID) []*enode.Node + Ping func(*enode.Node) error + RandomNodes func() enode.Iterator + RequestENR func(*enode.Node) (*enode.Node, error) + Resolve func(*enode.Node) *enode.Node + Self func() *enode.Node + type MetadataProvider interface + Metadata func() metadata.Metadata + MetadataSeq func() uint64 + type P2P interface + type PeerManager interface + AddPingMethod func(reqFunc func(ctx context.Context, id peer.ID) error) + Disconnect func(peer.ID) error + DiscoveryAddresses func() ([]multiaddr.Multiaddr, error) + ENR func() *enr.Record + FindPeersWithSubnet func(ctx context.Context, topic string, subIndex uint64, threshold int) (bool, error) + Host func() host.Host + PeerID func() peer.ID + RefreshENR func() + type PeersProvider interface + Peers func() *peers.Status + type PubSubProvider interface + PubSub func() *pubsub.PubSub + type PubSubTopicUser interface + JoinTopic func(topic string, opts ...pubsub.TopicOpt) (*pubsub.Topic, error) + LeaveTopic func(topic string) error + PublishToTopic func(ctx context.Context, topic string, data []byte, opts ...pubsub.PubOpt) error + SubscribeToTopic func(topic string, opts ...pubsub.SubOpt) (*pubsub.Subscription, error) + type RPCTopic string + func (r RPCTopic) MessageType() string + func (r RPCTopic) ProtocolPrefix() string + func (r RPCTopic) Version() string + type Sender interface + Send func(context.Context, interface{}, string, peer.ID) (network.Stream, error) + type SenderEncoder interface + type Service struct + func NewService(ctx context.Context, cfg *Config) (*Service, error) + func (_ *Service) Encoding() encoder.NetworkEncoding + func (_ *Service) InterceptPeerDial(_ peer.ID) (allow bool) + func (_ *Service) InterceptSecured(_ network.Direction, _ peer.ID, _ network.ConnMultiaddrs) (allow bool) + func (_ *Service) InterceptUpgraded(_ network.Conn) (allow bool, reason control.DisconnectReason) + func (s *Service) AddConnectionHandler(reqFunc, goodByeFunc func(ctx context.Context, id peer.ID) error) + func (s *Service) AddDisconnectionHandler(handler func(ctx context.Context, id peer.ID) error) + func (s *Service) AddPingMethod(reqFunc func(ctx context.Context, id peer.ID) error) + func (s *Service) Broadcast(ctx context.Context, msg proto.Message) error + func (s *Service) BroadcastAttestation(ctx context.Context, subnet uint64, att *ethpb.Attestation) error + func (s *Service) BroadcastBlob(ctx context.Context, subnet uint64, blob *ethpb.SignedBlobSidecar) error + func (s *Service) BroadcastSyncCommitteeMessage(ctx context.Context, subnet uint64, sMsg *ethpb.SyncCommitteeMessage) error + func (s *Service) CanSubscribe(topic string) bool + func (s *Service) Connect(pi peer.AddrInfo) error + func (s *Service) Disconnect(pid peer.ID) error + func (s *Service) DiscoveryAddresses() ([]multiaddr.Multiaddr, error) + func (s *Service) ENR() *enr.Record + func (s *Service) FilterIncomingSubscriptions(_ peer.ID, subs []*pubsubpb.RPC_SubOpts) ([]*pubsubpb.RPC_SubOpts, error) + func (s *Service) FindPeersWithSubnet(ctx context.Context, topic string, index uint64, threshold int) (bool, error) + func (s *Service) Host() host.Host + func (s *Service) InfoHandler(w http.ResponseWriter, _ *http.Request) + func (s *Service) InterceptAccept(n network.ConnMultiaddrs) (allow bool) + func (s *Service) InterceptAddrDial(pid peer.ID, m multiaddr.Multiaddr) (allow bool) + func (s *Service) JoinTopic(topic string, opts ...pubsub.TopicOpt) (*pubsub.Topic, error) + func (s *Service) LeaveTopic(topic string) error + func (s *Service) Metadata() metadata.Metadata + func (s *Service) MetadataSeq() uint64 + func (s *Service) PeerID() peer.ID + func (s *Service) Peers() *peers.Status + func (s *Service) PubSub() *pubsub.PubSub + func (s *Service) PublishToTopic(ctx context.Context, topic string, data []byte, opts ...pubsub.PubOpt) error + func (s *Service) RefreshENR() + func (s *Service) Send(ctx context.Context, message interface{}, baseTopic string, pid peer.ID) (network.Stream, error) + func (s *Service) SetStreamHandler(topic string, handler network.StreamHandler) + func (s *Service) Start() + func (s *Service) Started() bool + func (s *Service) Status() error + func (s *Service) Stop() error + func (s *Service) SubscribeToTopic(topic string, opts ...pubsub.SubOpt) (*pubsub.Subscription, error) + type SetStreamHandler interface + SetStreamHandler func(topic string, handler network.StreamHandler)