pexlist

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLength = 25

MaxLength is the maximum number of items to keep in the RecentlySeen list.

Variables

This section is empty.

Functions

This section is empty.

Types

type PEXList

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

PEXList contains the list of peer address for sending them to a peer at certain interval. List contains 2 separate lists for added and dropped addresses.

func New

func New() *PEXList

New returns a new empty PEXList.

func NewWithRecentlySeen added in v1.8.10

func NewWithRecentlySeen(rs []tracker.CompactPeer) *PEXList

NewWithRecentlySeen returns a new PEXList with given peers added to the dropped part.

func (*PEXList) Add

func (l *PEXList) Add(addr *net.TCPAddr)

Add adds the address to the added part and removes from dropped part.

func (*PEXList) Drop

func (l *PEXList) Drop(addr *net.TCPAddr)

Drop adds the address to the dropped part and removes from added part.

func (*PEXList) Flush

func (l *PEXList) Flush() (added, dropped string)

Flush returns added and dropped parts and empty the list.

type RecentlySeen added in v1.8.10

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

RecentlySeen is a peer address list that keeps the last `MaxLength` items.

func (*RecentlySeen) Add added in v1.8.10

func (l *RecentlySeen) Add(addr *net.TCPAddr)

Add a new address to the list.

func (*RecentlySeen) Len added in v1.8.10

func (l *RecentlySeen) Len() int

Len returns the number of addresses in the list.

func (*RecentlySeen) Peers added in v1.8.10

func (l *RecentlySeen) Peers() []tracker.CompactPeer

Peers returns the addresses in the list.

Jump to

Keyboard shortcuts

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