Documentation
¶
Overview ¶
Package enginetest has helpers for tests that need a BitTorrent swarm: a seeder serving generated content on loopback, and client settings that keep anacrolix off the network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Offline ¶
func Offline(tc *torrent.ClientConfig)
Offline keeps a client off the network: loopback IPv4 only, no DHT, UPnP, local service discovery, trackers or WebTorrent.
Types ¶
type Seeder ¶
type Seeder struct {
Client *torrent.Client
// Metainfo is the .torrent file.
Metainfo []byte
// Hash is the infohash, lowercase hex.
Hash string
// Name is the torrent's name, the root folder or single file.
Name string
// Addr is the seeder's peer address, host:port.
Addr string
// Content maps each file's path inside the torrent to its data.
Content map[string][]byte
}
Seeder is an anacrolix client seeding one generated torrent.
func NewSeeder ¶
NewSeeder generates files (path to size) under a root folder named name and seeds them on loopback until the test ends.
func StartSeeder ¶
func StartSeeder(dir, name string, files map[string]int, configure func(*torrent.ClientConfig)) (*Seeder, error)
StartSeeder generates files (path to size) under dir/name and seeds them; with no files it seeds what is already there. configure adjusts the client, such as where it listens; Close the client when done.