metainforequester

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtensionBitDht                          = 0 // http://www.bittorrent.org/beps/bep_0005.html
	ExtensionBitFast                         = 2 // http://www.bittorrent.org/beps/bep_0006.html
	ExtensionBitV2                           = 7 // "Hybrid torrent legacy to v2 upgrade"
	ExtensionBitAzureusExtensionNegotiation1 = 16
	ExtensionBitAzureusExtensionNegotiation2 = 17
	ExtensionBitLtep                         = 20 // LibTorrent Extension Protocol, http://www.bittorrent.org/beps/bep_0010.html
	ExtensionBitLocationAwareProtocol        = 43 // https://wiki.theory.org/BitTorrent_Location-aware_Protocol_1
	ExtensionBitAzureusMessagingProtocol     = 63 // https://www.bittorrent.org/beps/bep_0004.html

)

https://www.bittorrent.org/beps/bep_0004.html https://wiki.theory.org/BitTorrentSpecification.html#Reserved_Bytes

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RequestTimeout time.Duration
	KeyMutexSize   int
}

func NewDefaultConfig

func NewDefaultConfig() Config

type ExtensionBit

type ExtensionBit uint

type HandshakeInfo

type HandshakeInfo struct {
	PeerID            protocol.ID
	PeerExtensionBits PeerExtensionBits
}

type Params

type Params struct {
	fx.In
	Config Config
	Logger *zap.SugaredLogger
}

type PeerExtensionBits

type PeerExtensionBits [8]byte

func NewPeerExtensionBits

func NewPeerExtensionBits(bits ...ExtensionBit) (ret PeerExtensionBits)

func (PeerExtensionBits) GetBit

func (pex PeerExtensionBits) GetBit(bit ExtensionBit) bool

func (PeerExtensionBits) WithBit

type Requester

type Requester interface {
	Request(context.Context, protocol.ID, netip.AddrPort) (Response, error)
}

type Response

type Response struct {
	HandshakeInfo
	Info metainfo.Info
}

type Result

type Result struct {
	fx.Out
	Requester           Requester
	RequestDuration     prometheus.Collector `group:"prometheus_collectors"`
	RequestSuccessTotal prometheus.Collector `group:"prometheus_collectors"`
	RequestErrorTotal   prometheus.Collector `group:"prometheus_collectors"`
	RequestConcurrency  prometheus.Collector `group:"prometheus_collectors"`
}

func New

func New(p Params) Result

Jump to

Keyboard shortcuts

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