sharing

package
v0.0.0-...-4af7ccb Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerElectionAlgorithm

type PeerElectionAlgorithm func(candidate1 Peers, candidate2 Peers) Peers
var MostLeechedNonZeroSeeders PeerElectionAlgorithm = func(candidate1 Peers, candidate2 Peers) Peers {
	if candidate1.seed == candidate2.seed {
		return mostLeeched(candidate1, candidate2)
	}
	if candidate1.seed == 0 && candidate2.seed > 0 {
		return candidate2
	}
	if candidate2.seed == 0 && candidate1.seed > 0 {
		return candidate1
	}

	return mostLeeched(candidate1, candidate2)
}

MostLeechedNonZeroSeeders return the torrent with the most leechers. Peers with 0 seeders are not considered valid candidates

var MostSeededNonZeroLeechers PeerElectionAlgorithm = func(candidate1 Peers, candidate2 Peers) Peers {
	if candidate1.leech == candidate2.leech {
		return mostSeeded(candidate1, candidate2)
	}
	if candidate1.leech == 0 && candidate2.leech > 0 {
		return candidate2
	}
	if candidate2.leech == 0 && candidate1.leech > 0 {
		return candidate1
	}

	return mostSeeded(candidate1, candidate2)
}

MostSeededNonZeroLeechers return the torrent with the most seeders. Peers with 0 leechers are not considered valid candidates

type Peers

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

func (Peers) Leechers

func (p Peers) Leechers() int

func (Peers) Seeders

func (p Peers) Seeders() int

type SharedTorrent

type SharedTorrent interface {
}

type State

type State int
const (
	Downloading State = 0
	Seeding     State = 1
	Paused      State = 2
)

type Swarm

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

func NewSwarm

func NewSwarm() *Swarm

Jump to

Keyboard shortcuts

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