peer_exchange

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const CacheCleanWindow = 200
View Source
const MaxCacheSize = 1000
View Source
const PeerExchangeID_v20alpha1 = libp2pProtocol.ID("/vac/waku/peer-exchange/2.0.0-alpha1")

PeerExchangeID_v20alpha1 is the current Waku Peer Exchange protocol identifier

Variables

View Source
var (
	ErrNoPeersAvailable = errors.New("no suitable remote peers")
	ErrInvalidId        = errors.New("invalid request id")
)

Functions

This section is empty.

Types

type PeerExchangeOption

type PeerExchangeOption func(*PeerExchangeParameters)

func DefaultOptions

func DefaultOptions(host host.Host) []PeerExchangeOption

DefaultOptions are the default options to be used when using the lightpush protocol

func WithAutomaticPeerSelection

func WithAutomaticPeerSelection(fromThesePeers ...peer.ID) PeerExchangeOption

WithAutomaticPeerSelection is an option used to randomly select a peer from the peer store to obtains peers from. If a list of specific peers is passed, the peer will be chosen from that list assuming it supports the chosen protocol, otherwise it will chose a peer from the node peerstore

func WithFastestPeerSelection

func WithFastestPeerSelection(ctx context.Context, fromThesePeers ...peer.ID) PeerExchangeOption

WithFastestPeerSelection is an option used to select a peer from the peer store with the lowest ping. If a list of specific peers is passed, the peer will be chosen from that list assuming it supports the chosen protocol, otherwise it will chose a peer from the node peerstore

func WithPeer

func WithPeer(p peer.ID) PeerExchangeOption

WithPeer is an option used to specify the peerID to push a waku message to

type PeerExchangeParameters

type PeerExchangeParameters struct {
	// contains filtered or unexported fields
}

type WakuPeerExchange

type WakuPeerExchange struct {
	// contains filtered or unexported fields
}

func NewWakuPeerExchange

func NewWakuPeerExchange(h host.Host, disc *discv5.DiscoveryV5, log *zap.Logger) *WakuPeerExchange

NewWakuPeerExchange returns a new instance of WakuPeerExchange struct

func (*WakuPeerExchange) Request

func (wakuPX *WakuPeerExchange) Request(ctx context.Context, numPeers int, opts ...PeerExchangeOption) error

func (*WakuPeerExchange) Start

func (wakuPX *WakuPeerExchange) Start(ctx context.Context) error

Start inits the peer exchange protocol

func (*WakuPeerExchange) Stop

func (wakuPX *WakuPeerExchange) Stop()

Stop unmounts the peer exchange protocol

Jump to

Keyboard shortcuts

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