pex

package
v0.0.0-...-8abdde7 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package PEX implements the data structures used by BitTorrent peer exchange.

Index

Constants

View Source
const (
	Encrypt    = 0x01
	UploadOnly = 0x02
	Outgoing   = 0x10
)

PEX flags

Variables

This section is empty.

Functions

func Find

func Find(p Peer, l []Peer) int

Find find a peer in a list of peers.

func FormatCompact

func FormatCompact(peers []Peer) (ipv4 []byte, flags4 []byte, ipv6 []byte, flags6 []byte)

FormatCompact formats a list of PEX peers in compact format.

Types

type Peer

type Peer struct {
	Addr  netip.AddrPort
	Flags byte
}

Peer represents a peer known or announced over PEX.

func ParseCompact

func ParseCompact(data []byte, flags []byte, ipv6 bool) []Peer

ParseCompact parses a list of PEX peers in compact format.

Jump to

Keyboard shortcuts

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