Versions in this module Expand all Collapse all v0 v0.0.1 Aug 23, 2024 Changes in this version + const ConnectionWatcherTypeDisabled + const ConnectionWatcherTypeEmpty + const ConnectionWatcherTypePrint + const DefaultAutoscaleResourceLimiter + const DefaultWithScaleResourceLimiter + const InfiniteResourceLimiter + const ListsSharder + const LocalHostListenAddrWithIp4AndTcp + const NilListSharder + const OneListSharder + const WrongP2PMessageBlacklistDuration + var ErrAlreadySeenMessage = errors.New("already seen this message") + var ErrChannelCanNotBeDeleted = errors.New("channel can not be deleted") + var ErrChannelCanNotBeReAdded = errors.New("channel can not be re added") + var ErrChannelDoesNotExist = errors.New("channel does not exist") + var ErrEmptyBufferToSend = errors.New("empty buffer to send") + var ErrEndPortIsSmallerThanStartPort = errors.New("ending port value is smaller than the starting port value") + var ErrInvalidConfig = errors.New("invalid config") + var ErrInvalidDurationProvided = errors.New("invalid time.Duration provided") + var ErrInvalidEndingPortValue = errors.New("invalid ending port value") + var ErrInvalidPortValue = errors.New("invalid port value") + var ErrInvalidPortsRangeString = errors.New("invalid ports range string") + var ErrInvalidQUICAddress = errors.New("invalid QUIC address") + var ErrInvalidSeedersReconnectionInterval = errors.New("invalid seeders reconnection interval") + var ErrInvalidStartingPortValue = errors.New("invalid starting port value") + var ErrInvalidTCPAddress = errors.New("invalid TCP address") + var ErrInvalidValue = errors.New("invalid value") + var ErrInvalidWSAddress = errors.New("invalid WebSocket address") + var ErrInvalidWebTransportAddress = errors.New("invalid WebTransport address") + var ErrMessageProcessorAlreadyDefined = errors.New("message processor already defined") + var ErrMessageProcessorDoesNotExists = errors.New("message processor does not exists") + var ErrMessageTooLarge = errors.New("buffer too large") + var ErrMessageTooNew = errors.New("message is too new") + var ErrMessageTooOld = errors.New("message is too old") + var ErrMessageUnmarshalError = errors.New("message unmarshal error") + var ErrNilCacher = errors.New("nil cacher") + var ErrNilChannelLoadBalancer = errors.New("nil channel load balancer") + var ErrNilConnectionMonitor = errors.New("nil connections monitor") + var ErrNilConnectionsHandler = errors.New("nil connections handler") + var ErrNilConnectionsMetric = errors.New("nil connections metric") + var ErrNilConnectionsWatcher = errors.New("nil connections watcher") + var ErrNilContext = errors.New("nil context") + var ErrNilDebugger = errors.New("nil debugger") + var ErrNilDirectSendMessageHandler = errors.New("nil direct sender message handler") + var ErrNilDirectSender = errors.New("nil direct sender") + var ErrNilFetchPeersOnTopicHandler = errors.New("nil fetch peers on topic handler") + var ErrNilHost = errors.New("nil host") + var ErrNilLogger = errors.New("nil logger") + var ErrNilMarshaller = errors.New("nil marshaller") + var ErrNilMessage = errors.New("nil message") + var ErrNilMockNet = errors.New("nil mocknet provided") + var ErrNilNetwork = errors.New("nil network") + var ErrNilP2PSigner = errors.New("nil p2p signer") + var ErrNilP2pKeyGenerator = errors.New("nil p2p key generator") + var ErrNilP2pPrivateKey = errors.New("nil p2p private key") + var ErrNilP2pSingleSigner = errors.New("nil p2p single signer") + var ErrNilPeerDenialEvaluator = errors.New("nil peer denial evaluator") + var ErrNilPeerDiscoverer = errors.New("nil peer discoverer") + var ErrNilPeerShardResolver = errors.New("nil PeerShardResolver") + var ErrNilPeerTopicNotifier = errors.New("nil peer topic notifier") + var ErrNilPeersOnChannel = errors.New("nil peers on channel") + var ErrNilPeersRatingHandler = errors.New("nil peers rating handler") + var ErrNilPreferredPeersHolder = errors.New("nil peers holder") + var ErrNilPubSub = errors.New("nil pubSub") + var ErrNilReconnecter = errors.New("nil reconnecter") + var ErrNilSharder = errors.New("nil sharder") + var ErrNilSyncTimer = errors.New("nil sync timer") + var ErrNilThrottler = errors.New("nil throttler") + var ErrNilTopic = errors.New("nil topic") + var ErrNilValidator = errors.New("no validator has been set for this topic") + var ErrNoFreePortInRange = errors.New("no free port in range") + var ErrNoTransportsDefined = errors.New("no transports defined") + var ErrPeerDiscoveryProcessAlreadyStarted = errors.New("peer discovery is already turned on") + var ErrPeerNotDirectlyConnected = errors.New("peer is not directly connected") + var ErrTooManyGoroutines = errors.New(" number of goroutines exceeded") + var ErrUnknownResourceLimiterType = errors.New("unknown resource limiter type") + var ErrUnsupportedFields = errors.New("unsupported fields") + var ErrUnsupportedMessageVersion = errors.New("unsupported message version") + var ErrUnwantedPeer = errors.New("unwanted peer: will not initiate connection as it will get disconnected") + var ErrWrongTypeAssertion = errors.New("wrong type assertion") + var ErrWrongTypeAssertions = errors.New("wrong type assertion") + func MessageOriginatorPid(msg MessageP2P) string + func MessageOriginatorSeq(msg MessageP2P) string + func PeerIdToShortString(pid core.PeerID) string + type BroadcastMethod string + const Broadcast + const Direct + type ConnectedPeersInfo struct + CrossShardObservers map[uint32][]string + CrossShardValidators map[uint32][]string + IntraShardObservers map[uint32][]string + IntraShardValidators map[uint32][]string + NumCrossShardObservers int + NumCrossShardValidators int + NumIntraShardObservers int + NumIntraShardValidators int + NumObserversOnShard map[uint32]int + NumPreferredPeersOnShard map[uint32]int + NumValidatorsOnShard map[uint32]int + Seeders []string + SelfShardID uint32 + UnknownPeers []string + type ConnectionsHandler interface + Addresses func() []string + Bootstrap func() error + ConnectToPeer func(address string) error + ConnectedAddresses func() []string + ConnectedPeers func() []core.PeerID + ConnectedPeersOnTopic func(topic string) []core.PeerID + GetConnectedPeersInfo func() *ConnectedPeersInfo + HasCompatibleProtocolID func(address string) bool + IsConnected func(peerID core.PeerID) bool + IsConnectedToTheNetwork func() bool + IsInterfaceNil func() bool + PeerAddresses func(pid core.PeerID) []string + Peers func() []core.PeerID + SetPeerDenialEvaluator func(handler PeerDenialEvaluator) error + SetPeerShardResolver func(peerShardResolver PeerShardResolver) error + SetThresholdMinConnectedPeers func(minConnectedPeers int) error + ThresholdMinConnectedPeers func() int + WaitForConnections func(maxWaitingTime time.Duration, minNumOfPeers uint32) + type ConnectionsWatcher interface + Close func() error + IsInterfaceNil func() bool + NewKnownConnection func(pid core.PeerID, connection string) + type Debugger interface + AddIncomingMessage func(topic string, size uint64, isRejected bool) + AddOutgoingMessage func(topic string, size uint64, isRejected bool) + Close func() error + IsInterfaceNil func() bool + type DirectSender interface + IsInterfaceNil func() bool + NextSequenceNumber func() []byte + RegisterDirectMessageProcessor func(handler MessageHandler) error + Send func(topic string, buff []byte, peer core.PeerID) error + type Logger interface + Debug func(message string, args ...interface{}) + Error func(message string, args ...interface{}) + GetLevel func() logger.LogLevel + Info func(message string, args ...interface{}) + IsInterfaceNil func() bool + LogIfError func(err error, args ...interface{}) + Trace func(message string, args ...interface{}) + Warn func(message string, args ...interface{}) + type Marshaller interface + IsInterfaceNil func() bool + Marshal func(obj interface{}) ([]byte, error) + Unmarshal func(obj interface{}, buff []byte) error + type MessageHandler interface + Broadcast func(topic string, buff []byte) + BroadcastOnChannel func(channel string, topic string, buff []byte) + BroadcastOnChannelUsingPrivateKey func(channel string, topic string, buff []byte, pid core.PeerID, skBytes []byte) + BroadcastUsingPrivateKey func(topic string, buff []byte, pid core.PeerID, skBytes []byte) + CreateTopic func(name string, createChannelForTopic bool) error + HasTopic func(name string) bool + IsInterfaceNil func() bool + RegisterMessageProcessor func(topic string, identifier string, handler MessageProcessor) error + SendToConnectedPeer func(topic string, buff []byte, peerID core.PeerID) error + SetDebugger func(debugger Debugger) error + UnJoinAllTopics func() error + UnregisterAllMessageProcessors func() error + UnregisterMessageProcessor func(topic string, identifier string) error + type MessageP2P interface + BroadcastMethod func() BroadcastMethod + Data func() []byte + From func() []byte + IsInterfaceNil func() bool + Key func() []byte + Payload func() []byte + Peer func() core.PeerID + SeqNo func() []byte + Signature func() []byte + Timestamp func() int64 + Topic func() string + type MessageProcessor interface + IsInterfaceNil func() bool + ProcessReceivedMessage func(message MessageP2P, fromConnectedPeer core.PeerID, source MessageHandler) error + type Messenger interface + AddPeerTopicNotifier func(notifier PeerTopicNotifier) error + ID func() core.PeerID + IsInterfaceNil func() bool + Port func() int + Sign func(payload []byte) ([]byte, error) + SignUsingPrivateKey func(skBytes []byte, payload []byte) ([]byte, error) + Verify func(payload []byte, pid core.PeerID, signature []byte) error + type NetworkShardingCollector interface + IsInterfaceNil func() bool + UpdatePeerIDInfo func(pid core.PeerID, pk []byte, shardID uint32) + type NetworkType string + type P2PKeyConverter interface + ConvertPeerIDToPublicKey func(keyGen crypto.KeyGenerator, pid core.PeerID) (crypto.PublicKey, error) + ConvertPublicKeyToPeerID func(pk crypto.PublicKey) (core.PeerID, error) + IsInterfaceNil func() bool + type PeerCounts struct + CrossShardPeers int + IntraShardPeers int + UnknownPeers int + type PeerDenialEvaluator interface + IsDenied func(pid core.PeerID) bool + IsInterfaceNil func() bool + UpsertPeerID func(pid core.PeerID, duration time.Duration) error + type PeerDiscoverer interface + Bootstrap func() error + IsInterfaceNil func() bool + Name func() string + type PeerDiscoveryFactory interface + CreatePeerDiscoverer func() (PeerDiscoverer, error) + IsInterfaceNil func() bool + type PeerShardResolver interface + GetPeerInfo func(pid core.PeerID) core.P2PPeerInfo + IsInterfaceNil func() bool + type PeerTopicNotifier interface + IsInterfaceNil func() bool + NewPeerFound func(pid core.PeerID, topic string) + type PeersRatingHandler interface + DecreaseRating func(pid core.PeerID) + GetTopRatedPeersFromList func(peers []core.PeerID, minNumOfPeersExpected int) []core.PeerID + IncreaseRating func(pid core.PeerID) + IsInterfaceNil func() bool + type PeersRatingMonitor interface + GetConnectedPeersRatings func(connectionsHandler ConnectionsHandler) (string, error) + IsInterfaceNil func() bool + type PreferredPeersHolderHandler interface + Clear func() + Contains func(peerID core.PeerID) bool + Get func() map[uint32][]core.PeerID + IsInterfaceNil func() bool + PutConnectionAddress func(peerID core.PeerID, address string) + PutShardID func(peerID core.PeerID, shardID uint32) + Remove func(peerID core.PeerID) + type Reconnecter interface + IsInterfaceNil func() bool + ReconnectToNetwork func(ctx context.Context) + type Sharder interface + IsInterfaceNil func() bool + IsSeeder func(pid core.PeerID) bool + SetPeerShardResolver func(psp PeerShardResolver) error + SetSeeders func(addresses []string) + type SignerVerifier interface + IsInterfaceNil func() bool + Sign func(payload []byte) ([]byte, error) + Verify func(payload []byte, pid core.PeerID, signature []byte) error + type SyncTimer interface + CurrentTime func() time.Time + IsInterfaceNil func() bool