peers

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxPeers = 64
	MaxBadResponses = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

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

Item is an item in the pool

func (*Item) Add

func (i *Item) Add(n int) int

func (*Item) Id

func (i *Item) Id() peer.ID

func (*Item) Score

func (i *Item) Score() int

func (*Item) String

func (i *Item) String() string

type PeeredObject

type PeeredObject[T any] struct {
	Peer string
	Data T
}

type Pool

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

PeerPool is a pool of peers

func NewPool

func NewPool() *Pool

func (*Pool) AddPeer

func (p *Pool) AddPeer(pid peer.ID)

func (*Pool) BanStatus

func (p *Pool) BanStatus(pid peer.ID) bool

func (*Pool) RemovePeer

func (p *Pool) RemovePeer(pid peer.ID)

func (*Pool) Request

func (p *Pool) Request() (pid *Item, done func(), err error)

Request a peer from the pool caller MUST call the done function when done with peer IFF err != nil

func (*Pool) SetBanStatus

func (p *Pool) SetBanStatus(pid peer.ID, banned bool)

Jump to

Keyboard shortcuts

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