Documentation ¶
Index ¶
- Constants
- Variables
- func MessageOriginatorPid(msg MessageP2P) string
- func MessageOriginatorSeq(msg MessageP2P) string
- func PeerIdToShortString(pid core.PeerID) string
- type BroadcastMethod
- type ChannelLoadBalancer
- type ConnectedPeersInfo
- type ConnectionsHandler
- type Debugger
- type IdentityGenerator
- type Logger
- type MessageHandler
- type MessageP2P
- type MessageProcessor
- type Messenger
- type NetworkShardingCollector
- type NetworkType
- type P2PKeyConverter
- type P2PSigningHandler
- type PeerDenialEvaluator
- type PeerShardResolver
- type PeersRatingHandler
- type PeersRatingMonitor
- type PreferredPeersHolderHandler
- type SendableData
- type SyncTimer
Constants ¶
const ConnectionWatcherTypePrint = p2p.ConnectionWatcherTypePrint
ConnectionWatcherTypePrint - new connection found will be printed in the log file
const DefaultWithScaleResourceLimiter = p2p.DefaultWithScaleResourceLimiter
DefaultWithScaleResourceLimiter defines the default & autoscale resource limiter
const ListsSharder = p2p.ListsSharder
ListsSharder is the variant that uses lists
const LocalHostListenAddrWithIp4AndTcp = p2p.LocalHostListenAddrWithIp4AndTcp
LocalHostListenAddrWithIp4AndTcp defines the local host listening ip v.4 address and TCP
const NilListSharder = p2p.NilListSharder
NilListSharder is the variant that will not do connection trimming
Variables ¶
var ErrNilMessage = p2p.ErrNilMessage
ErrNilMessage signals that a nil message has been received
var ErrNilPreferredPeersHolder = p2p.ErrNilPreferredPeersHolder
ErrNilPreferredPeersHolder signals that a nil preferred peers holder was provided
var ErrNilStatusHandler = errors.New("nil status handler")
ErrNilStatusHandler signals that a nil status handler has been provided
Functions ¶
func MessageOriginatorPid ¶
func MessageOriginatorPid(msg MessageP2P) string
MessageOriginatorPid will output the message peer id in a pretty format If it can, it will display the last displayLastPidChars (12) characters from the pid
func MessageOriginatorSeq ¶
func MessageOriginatorSeq(msg MessageP2P) string
MessageOriginatorSeq will output the sequence number as hex
func PeerIdToShortString ¶
PeerIdToShortString trims the first displayLastPidChars characters of the provided peer ID after converting the peer ID to string using the Pretty functionality
Types ¶
type BroadcastMethod ¶ added in v1.6.0
type BroadcastMethod = p2p.BroadcastMethod
BroadcastMethod defines the broadcast method of the message
type ChannelLoadBalancer ¶
type ChannelLoadBalancer interface { AddChannel(channel string) error RemoveChannel(channel string) error GetChannelOrDefault(channel string) chan *SendableData CollectOneElementFromChannels() *SendableData Close() error IsInterfaceNil() bool }
ChannelLoadBalancer defines what a load balancer that uses chans should do
type ConnectedPeersInfo ¶
type ConnectedPeersInfo = p2p.ConnectedPeersInfo
ConnectedPeersInfo represents the DTO structure used to output the metrics for connected peers
type ConnectionsHandler ¶ added in v1.6.0
type ConnectionsHandler = p2p.ConnectionsHandler
ConnectionsHandler defines the behaviour of a component able to handle connections
type Debugger ¶ added in v1.6.2
Debugger represent a p2p debugger able to print p2p statistics (messages received/sent per topic)
type IdentityGenerator ¶
type IdentityGenerator interface { CreateRandomP2PIdentity() ([]byte, core.PeerID, error) IsInterfaceNil() bool }
IdentityGenerator represent an entity able to create a random p2p identity
type MessageHandler ¶ added in v1.6.0
type MessageHandler = p2p.MessageHandler
MessageHandler defines the behaviour of a component able to send and process messages
type MessageP2P ¶
type MessageP2P = p2p.MessageP2P
MessageP2P defines what a p2p message can do (should return)
type MessageProcessor ¶
type MessageProcessor = p2p.MessageProcessor
MessageProcessor is the interface used to describe what a receive message processor should do All implementations that will be called from Messenger implementation will need to satisfy this interface If the function returns a non nil value, the received message will not be propagated to its connected peers
type NetworkShardingCollector ¶
type NetworkShardingCollector interface { UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32) IsInterfaceNil() bool }
NetworkShardingCollector defines the updating methods used by the network sharding component The interface assures that the collected data will be used by the p2p network sharding components
type NetworkType ¶ added in v1.6.0
type NetworkType = p2p.NetworkType
NetworkType defines the type of the network a messenger is running on
const FullArchiveNetwork NetworkType = "full archive"
FullArchiveNetwork defines the full archive network
const MainNetwork NetworkType = "main"
MainNetwork defines the main network
type P2PKeyConverter ¶ added in v1.6.0
type P2PKeyConverter interface { ConvertPeerIDToPublicKey(keyGen crypto.KeyGenerator, pid core.PeerID) (crypto.PublicKey, error) ConvertPublicKeyToPeerID(pk crypto.PublicKey) (core.PeerID, error) IsInterfaceNil() bool }
P2PKeyConverter defines what a p2p key converter can do
type P2PSigningHandler ¶ added in v1.6.0
type P2PSigningHandler interface { Verify(message MessageP2P) error Serialize(messages []MessageP2P) ([]byte, error) Deserialize(messagesBytes []byte) ([]MessageP2P, error) IsInterfaceNil() bool }
P2PSigningHandler defines the behaviour of a component able to verify p2p message signature
type PeerDenialEvaluator ¶
type PeerDenialEvaluator = p2p.PeerDenialEvaluator
PeerDenialEvaluator defines the behavior of a component that is able to decide if a peer ID is black listed or not TODO merge this interface with the PeerShardResolver => P2PProtocolHandler ? TODO move antiflooding inside network messenger
type PeerShardResolver ¶
type PeerShardResolver = p2p.PeerShardResolver
PeerShardResolver is able to resolve the link between the provided PeerID and the shardID
type PeersRatingHandler ¶
type PeersRatingHandler interface { IncreaseRating(pid core.PeerID) DecreaseRating(pid core.PeerID) GetTopRatedPeersFromList(peers []core.PeerID, minNumOfPeersExpected int) []core.PeerID IsInterfaceNil() bool }
PeersRatingHandler represents an entity able to handle peers ratings
type PeersRatingMonitor ¶ added in v1.6.0
type PeersRatingMonitor = p2p.PeersRatingMonitor
PeersRatingMonitor represents an entity able to provide peers ratings
type PreferredPeersHolderHandler ¶
type PreferredPeersHolderHandler interface { PutConnectionAddress(peerID core.PeerID, address string) PutShardID(peerID core.PeerID, shardID uint32) Get() map[uint32][]core.PeerID Contains(peerID core.PeerID) bool Remove(peerID core.PeerID) Clear() IsInterfaceNil() bool }
PreferredPeersHolderHandler defines the behavior of a component able to handle preferred peers operations
type SendableData ¶
SendableData represents the struct used in data throttler implementation