peers

package
v3.0.0-alpha5.0...-c974331 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	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) LenBannedPeers

func (p *Pool) LenBannedPeers() int

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