Versions in this module Expand all Collapse all v0 v0.4.0 Jun 5, 2020 Changes in this version + type Client struct + func NewClient(cfg *Config) (*Client, error) + func (cl *Client) AddFromFile(filename string) (*Torrent, error) + func (cl *Client) AddFromInfoHash(infohash [20]byte) (*Torrent, error) + func (cl *Client) AddFromMagnet(uri string) (*Torrent, error) + func (cl *Client) AddFromParser(p metainfo.Parser) (*Torrent, error) + func (cl *Client) Close() + func (cl *Client) ID() []byte + func (cl *Client) ListenPort() int + func (cl *Client) Torrents() []*Torrent + type Config struct + BaseDir string + DialTimeout time.Duration + DisableDHT bool + DisableTrackers bool + HandshakeTiemout time.Duration + MaxEstablishedConns int + MaxOnFlightReqs int + OpenStorage storage.Open + RejectIncomingConnections bool + SelectorF func() PieceSelector + func DefaultConfig() (*Config, error) + type DefaultPieceSelector struct + func (dfs *DefaultPieceSelector) Less(p1, p2 *Piece) bool + func (dfs *DefaultPieceSelector) OnPieceDownload(_ int) + func (dfs *DefaultPieceSelector) SetTorrent(_ *Torrent) + type Peer struct + P tracker.Peer + Source PeerSource + type PeerSource byte + const SourceDHT + const SourceIncoming + const SourceTracker + const SourceUser + type Piece struct + func (p *Piece) Blocks() int + func (p *Piece) CompletedBlocks() int + func (p *Piece) Data() (b []byte, err error) + func (p *Piece) Index() int + func (p *Piece) PendingBlocks() int + func (p *Piece) Rarity() int + func (p *Piece) Torrent() *Torrent + func (p *Piece) UnrequestedBlocks() int + func (p *Piece) Verified() bool + type PieceSelector interface + Less func(p1, p2 *Piece) bool + OnPieceDownload func(i int) + SetTorrent func(t *Torrent) + func NewDefaultPieceSelector() PieceSelector + type Stats struct + BlocksDownloaded int + BlocksUploaded int + BytesDownloaded int + BytesLeft int + BytesUploaded int + func (s *Stats) String() string + type Torrent struct + ClosedC chan struct{} + DownloadedDataC chan struct{} + InfoC chan struct{} + func (t *Torrent) AddPeers(peers ...Peer) error + func (t *Torrent) Close() + func (t *Torrent) Closed() bool + func (t *Torrent) DisableDataDownload() error + func (t *Torrent) EnableDataDownload() error + func (t *Torrent) HaveAllPieces() bool + func (t *Torrent) Info() *metainfo.InfoDict + func (t *Torrent) Metainfo() *metainfo.MetaInfo + func (t *Torrent) Pieces() []Piece + func (t *Torrent) Seeding() bool + func (t *Torrent) StartDataTransfer() error + func (t *Torrent) Stats() Stats + func (t *Torrent) Swarm() []Peer + func (t *Torrent) WriteStatus(w io.Writer) v0.2.0 May 27, 2020