p2p

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 5 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 FullArchiveMode = p2p.FullArchiveMode

FullArchiveMode defines the node operation as a full archive mode

View Source
const ListenAddrWithIp4AndTcp = "/ip4/0.0.0.0/tcp/"

ListenAddrWithIp4AndTcp defines the listening address with ip v.4 and TCP

View Source
const ListenLocalhostAddrWithIp4AndTcp = "/ip4/127.0.0.1/tcp/"

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

View Source
const ListsSharder = p2p.ListsSharder

ListsSharder is the variant that uses lists

View Source
const NilListSharder = p2p.NilListSharder

NilListSharder is the variant that will not do connection trimming

View Source
const NormalOperation = p2p.NormalOperation

NormalOperation defines the normal mode operation: either seeder, observer or validator

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 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 IdentityGenerator

type IdentityGenerator interface {
	CreateRandomP2PIdentity() ([]byte, core.PeerID, error)
	IsInterfaceNil() bool
}

IdentityGenerator represent an entity able to create a random p2p identity

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 NodeOperation

type NodeOperation = p2p.NodeOperation

NodeOperation defines the p2p node operation

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 represent an entity able to handle new notifications on a new peer on a topic

type PeersRatingHandler

type PeersRatingHandler interface {
	AddPeer(pid core.PeerID)
	IncreaseRating(pid core.PeerID)
	DecreaseRating(pid core.PeerID)
	GetTopRatedPeersFromList(peers []core.PeerID, minNumOfPeersExpected int) []core.PeerID
	IsInterfaceNil() bool
}

PeersRatingHandler represent an entity able to handle 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 represent 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