bget

package module
v0.0.0-...-d617ca5 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

bget

bget是一个实现了BitTorrent协议的package,目前只是初步完成还有一些需要完善测试的的地方。

已实现的BEP:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIdentFormat   = errors.New("Ident format error")
	ErrVersionFormat = errors.New("version format error")

	ErrCreateTaskRepeat = errors.New("repeat task, task has been created")
	ErrTaskNotFound     = errors.New("can't find this task")
)

Errors

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Version     string
	Ident       string
	IP          string
	Port        int
	DHTPort     int
	Folder      string
	Cache       int64
	MaxDownload int
	Options     OptionsConfiguration
}

Configuration is Configuration of Download

func NewConfig

func NewConfig() *Configuration

NewConfig create a default configure

type Download

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

Download is top-level instance

func New

func New(cfg *Configuration) (*Download, error)

New creates an instance of Download

func (*Download) Add

func (d *Download) Add(task, path string) (id string, err error)

Add add a new task to the instance

func (*Download) Close

func (d *Download) Close()

Close close the download instance

func (*Download) GetFileList

func (d *Download) GetFileList(task string) ([]meta.FileInfo, error)

GetFileList get all files of the task

func (*Download) SetFile

func (d *Download) SetFile(task string, option map[int]bool)

SetFile set all files of the task download or not by option

func (*Download) Start

func (d *Download) Start(task string)

Start start a task, it will block until task finish or occur errors

func (*Download) Stop

func (d *Download) Stop(task string)

Stop stop a task

type OptionsConfiguration

type OptionsConfiguration struct {
	Ident   string
	IP      string
	Port    int
	DHTPort int
}

OptionsConfiguration is Options Configuration of download

Directories

Path Synopsis
common

Jump to

Keyboard shortcuts

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