p2p

package
v1.7.13-patch2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2024 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const ConnectionWatcherTypePrint = p2p.ConnectionWatcherTypePrint

ConnectionWatcherTypePrint - new connection found will be printed in the log file

View Source
const DefaultWithScaleResourceLimiter = p2p.DefaultWithScaleResourceLimiter

DefaultWithScaleResourceLimiter defines the default & autoscale resource limiter

View Source
const ListsSharder = p2p.ListsSharder

ListsSharder is the variant that uses lists

View Source
const LocalHostListenAddrWithIp4AndTcp = p2p.LocalHostListenAddrWithIp4AndTcp

LocalHostListenAddrWithIp4AndTcp defines the local host listening ip v.4 address and TCP

View Source
const NilListSharder = p2p.NilListSharder

NilListSharder is the variant that will not do connection trimming

Variables

View Source
var ErrNilMessage = p2p.ErrNilMessage

ErrNilMessage signals that a nil message has been received

View Source
var ErrNilPreferredPeersHolder = p2p.ErrNilPreferredPeersHolder

ErrNilPreferredPeersHolder signals that a nil preferred peers holder was provided

View Source
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

func PeerIdToShortString(pid core.PeerID) string

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

type Debugger = p2p.Debugger

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 Logger added in v1.6.0

type Logger = p2p.Logger

Logger defines the behavior of a data logger component

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 Messenger

type Messenger = p2p.Messenger

Messenger is the main struct used for communication with other 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 PeerTopicNotifier

type PeerTopicNotifier = p2p.PeerTopicNotifier

PeerTopicNotifier represents an entity able to handle new notifications on a new peer on a topic

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

type SendableData struct {
	Buff  []byte
	Topic string
}

SendableData represents the struct used in data throttler implementation

type SyncTimer

type SyncTimer interface {
	CurrentTime() time.Time
	IsInterfaceNil() bool
}

SyncTimer represents an entity able to tell the current time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL