Documentation
¶
Index ¶
- Constants
- Variables
- func GetMessage(idx int64, units *progress.Units) string
- func Hash(path string) (ret string, err error)
- func IsDirectory(path string) (bool, error)
- func ProgressBar(x, y int64, desc string) string
- func ScaleBar(from, to, sum int) string
- type Torrent
- func (t *Torrent) Birth() mclock.AbsTime
- func (t *Torrent) BytesRequested() int64
- func (t *Torrent) Cited() int32
- func (t *Torrent) CitedDec()
- func (t *Torrent) CitedInc()
- func (t *Torrent) Close()
- func (t *Torrent) InfoHash() string
- func (t *Torrent) IsSeeding() bool
- func (t *Torrent) Leech() error
- func (t *Torrent) Lock()
- func (t *Torrent) Pause()
- func (t *Torrent) Paused() bool
- func (t *Torrent) Pending() bool
- func (t *Torrent) QuotaFull() bool
- func (t *Torrent) RLock()
- func (t *Torrent) RUnlock()
- func (t *Torrent) Ready() bool
- func (t *Torrent) Running() bool
- func (t *Torrent) Seed() bool
- func (t *Torrent) SetBytesRequested(bytesRequested int64)
- func (t *Torrent) Spec() *torrent.TorrentSpec
- func (t *Torrent) Start() error
- func (t *Torrent) Status() int
- func (t *Torrent) Stop()
- func (t *Torrent) Stopping() bool
- func (t *Torrent) Unlock()
- func (t *Torrent) WriteTorrent() error
- type TorrentManager
- func (tm *TorrentManager) AddLocalSeedFile(ih string) bool
- func (tm *TorrentManager) Candidate() int
- func (tm *TorrentManager) Close() error
- func (tm *TorrentManager) Congress() int
- func (tm *TorrentManager) Drop(ih string) error
- func (tm *TorrentManager) Exists(ih string, rawSize uint64) (bool, uint64, mclock.AbsTime, error)
- func (tm *TorrentManager) GetFile(ctx context.Context, infohash, subpath string) (data []byte, err error)
- func (tm *TorrentManager) GlobalTrackers() [][]string
- func (tm *TorrentManager) IsDownloading(ih string) bool
- func (tm *TorrentManager) IsPending(ih string) bool
- func (tm *TorrentManager) IsSeeding(ih string) bool
- func (tm *TorrentManager) ListAllTorrents() map[string]map[string]int
- func (tm *TorrentManager) LocalPort() int
- func (tm *TorrentManager) Metrics() time.Duration
- func (tm *TorrentManager) Nominee() int
- func (tm *TorrentManager) PauseLocalSeedFile(ih string) error
- func (tm *TorrentManager) ResumeLocalSeedFile(ih string) error
- func (tm *TorrentManager) Search(ctx context.Context, hex string, request uint64) error
- func (tm *TorrentManager) Start() (err error)
Constants ¶
View Source
const ( ProgressBarLen = 10 ScaleBarLen = 10 )
View Source
const ( TORRENT = "torrent" SEED_PRE = "s-" )
Variables ¶
View Source
var ( // ErrInactiveTorrent is for torrent should be actived ErrInactiveTorrent = errors.New("torrent is inactive") //ErrUnfinished is for the file not downloaded ErrUnfinished = errors.New("download not completed") ErrTorrentNotFound = errors.New("torrent not found") ErrInvalidRawSize = errors.New("invalid raw size") )
Functions ¶
func IsDirectory ¶
func ProgressBar ¶
Types ¶
type Torrent ¶
func NewTorrent ¶
func (*Torrent) BytesRequested ¶
func (*Torrent) SetBytesRequested ¶
func (*Torrent) Spec ¶
func (t *Torrent) Spec() *torrent.TorrentSpec
func (*Torrent) WriteTorrent ¶
type TorrentManager ¶
type TorrentManager struct { //boostFetcher *BoostDataFetcher DataDir string TmpDataDir string Updates time.Duration // contains filtered or unexported fields }
func NewTorrentManager ¶
func (*TorrentManager) AddLocalSeedFile ¶
func (tm *TorrentManager) AddLocalSeedFile(ih string) bool
can only call by fs.go: 'SeedingLocal()'
func (*TorrentManager) Candidate ¶
func (tm *TorrentManager) Candidate() int
func (*TorrentManager) Close ¶
func (tm *TorrentManager) Close() error
func (*TorrentManager) Congress ¶
func (tm *TorrentManager) Congress() int
func (*TorrentManager) Drop ¶
func (tm *TorrentManager) Drop(ih string) error
func (*TorrentManager) GlobalTrackers ¶
func (tm *TorrentManager) GlobalTrackers() [][]string
func (*TorrentManager) IsDownloading ¶
func (tm *TorrentManager) IsDownloading(ih string) bool
func (*TorrentManager) IsPending ¶
func (tm *TorrentManager) IsPending(ih string) bool
func (*TorrentManager) IsSeeding ¶
func (tm *TorrentManager) IsSeeding(ih string) bool
func (*TorrentManager) ListAllTorrents ¶
func (tm *TorrentManager) ListAllTorrents() map[string]map[string]int
divide localSeed/on-chain Files return status of torrents
func (*TorrentManager) LocalPort ¶
func (tm *TorrentManager) LocalPort() int
func (*TorrentManager) Metrics ¶
func (tm *TorrentManager) Metrics() time.Duration
func (*TorrentManager) Nominee ¶
func (tm *TorrentManager) Nominee() int
func (*TorrentManager) PauseLocalSeedFile ¶
func (tm *TorrentManager) PauseLocalSeedFile(ih string) error
only files in map:localSeedFile can be paused!
func (*TorrentManager) ResumeLocalSeedFile ¶
func (tm *TorrentManager) ResumeLocalSeedFile(ih string) error
only files in map:localSeedFile can be resumed!
func (*TorrentManager) Start ¶
func (tm *TorrentManager) Start() (err error)
Click to show internal directories.
Click to hide internal directories.