metadata

package
v0.0.0-...-9d1b2fd Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MaxMetadataSize = 10 * 1024 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Leech

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

func NewLeech

func NewLeech(infoHash [20]byte, peerAddr *net.TCPAddr, clientID []byte, ev LeechEventHandlers) *Leech

func (*Leech) Do

func (l *Leech) Do(deadline time.Time)

func (*Leech) OnError

func (l *Leech) OnError(err error)

type LeechEventHandlers

type LeechEventHandlers struct {
	OnSuccess func(Metadata)        // must be supplied. args: metadata
	OnError   func([20]byte, error) // must be supplied. args: infohash, error
}

type Metadata

type Metadata struct {
	InfoHash []byte
	// Name should be thought of "Title" of the torrent. For single-file torrents, it is the name
	// of the file, and for multi-file torrents, it is the name of the root directory.
	Name         string
	TotalSize    uint64
	DiscoveredOn int64
	// Files must be populated for both single-file and multi-file torrents!
	Files []persistence.File
}

type Sink

type Sink struct {
	PeerID []byte
	// contains filtered or unexported fields
}

func NewSink

func NewSink(deadline time.Duration, maxNLeeches int) *Sink

func (*Sink) Drain

func (ms *Sink) Drain() <-chan Metadata

func (*Sink) Sink

func (ms *Sink) Sink(res dht.Result)

func (*Sink) Terminate

func (ms *Sink) Terminate()

Jump to

Keyboard shortcuts

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