libtorrent

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTorrent added in v1.0.0

func CreateTorrent(files []string, out string, root string, name string, private bool, pieceLength int, comment string, trackers []string, webseeds []string) (string, error)

@param files: include this file or directory in torrent @param out: save generated torrent to this `FILE` @param root: file paths given become relative to the root @param name: set name of torrent. required if you specify more than one file. @param private: create torrent for private trackers @param pieceLength: override default piece length. by default, piece length calculated automatically based on the total size of files. given in KB. must be multiple of 16. @param comment: set comment of torrent @param trackers: add tracker `URL` @param webseeds: add web seed `URL`

func GetAvailablePort

func GetAvailablePort(portRange string) (int, error)

func GetPublicIP added in v1.0.0

func GetPublicIP(ip string) (net.IP, error)

Types

type TorrentServer

type TorrentServer struct {
	Target string
	// 下载路径
	DataDir string
	// 是否为做种节点,如是则调大连接数等参数。
	IsServe bool
	// 是否通过 *.resume 文件恢复下载
	IsResume bool
	// 下载完成做种的最大时间,超过后做种停止。单位为秒。默认为 0s。
	//		- 如 isServe = true,那么 maxSeedingSeconds 如等于 0,则代表永不停止(此逻辑上层暂时没有使用)
	//		- 如 isServe = false,那么 maxSeedingSeconds 如等于 0,则代表不做种
	MaxSeedingSeconds int
	// 当注册到 Tracker 的所有节点下载完成后,是否自动停止做种。(和 isServe 互斥)
	SeedingAutoStop bool
	// Global download speed limit in MB/s.
	SpeedLimitDownload float64
	// Global upload speed limit in MB/s.
	SpeedLimitUpload float64
}

func (*TorrentServer) Run added in v1.1.0

func (s *TorrentServer) Run() error

Jump to

Keyboard shortcuts

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