Versions in this module Expand all Collapse all v1 v1.41.2 Mar 27, 2022 Changes in this version + const PeerSourceDhtAnnouncePeer + const PeerSourceDhtGetPeers + const PeerSourceDirect + const PeerSourceIncoming + const PeerSourcePex + const PeerSourceTracker + const PiecePriorityHigh + const PiecePriorityNext + const PiecePriorityNone + const PiecePriorityNormal + const PiecePriorityNow + const PiecePriorityReadahead + const UpnpDiscoverLogTag + var DefaultNetDialer = &net.Dialer + func LoopbackListenHost(network string) string + func NewUtpSocket(network, addr string, fc firewallCallback, logger log.Logger) (utpSocket, error) + type AddTorrentOpts struct + ChunkSize pp.Integer + InfoHash InfoHash + Storage storage.ClientImpl + type AnacrolixDhtServerWrapper struct + func (me AnacrolixDhtServerWrapper) Announce(hash [20]byte, port int, impliedPort bool) (DhtAnnounce, error) + func (me AnacrolixDhtServerWrapper) Ping(addr *net.UDPAddr) + func (me AnacrolixDhtServerWrapper) Stats() interface{} + type Callbacks struct + CompletedHandshake func(*PeerConn, InfoHash) + DeletedRequest []func(PeerRequestEvent) + NewPeer []func(*Peer) + PeerClosed []func(*Peer) + PeerConnClosed func(*PeerConn) + ReadExtendedHandshake func(*PeerConn, *pp.ExtendedHandshakeMessage) + ReadMessage func(*PeerConn, *pp.Message) + ReceiveEncryptedHandshakeSkeys mse.SecretKeyIter + ReceivedRequested []func(PeerMessageEvent) + ReceivedUsefulData []func(ReceivedUsefulDataEvent) + SentRequest []func(PeerRequestEvent) + type ChunkSpec = types.ChunkSpec + type Client struct + func NewClient(cfg *ClientConfig) (cl *Client, err error) + func (cl *Client) AddDhtNodes(nodes []string) + func (cl *Client) AddDhtServer(d DhtServer) + func (cl *Client) AddDialer(d Dialer) + func (cl *Client) AddListener(l Listener) + func (cl *Client) AddMagnet(uri string) (T *Torrent, err error) + func (cl *Client) AddTorrent(mi *metainfo.MetaInfo) (T *Torrent, err error) + func (cl *Client) AddTorrentFromFile(filename string) (T *Torrent, err error) + func (cl *Client) AddTorrentInfoHash(infoHash metainfo.Hash) (t *Torrent, new bool) + func (cl *Client) AddTorrentInfoHashWithStorage(infoHash metainfo.Hash, specStorage storage.ClientImpl) (t *Torrent, new bool) + func (cl *Client) AddTorrentOpt(opts AddTorrentOpts) (t *Torrent, new bool) + func (cl *Client) AddTorrentSpec(spec *TorrentSpec) (t *Torrent, new bool, err error) + func (cl *Client) BadPeerIPs() (ips []string) + func (cl *Client) Close() (errs []error) + func (cl *Client) Closed() events.Done + func (cl *Client) ConnStats() ConnStats + func (cl *Client) DhtServers() []DhtServer + func (cl *Client) ListenAddrs() (ret []net.Addr) + func (cl *Client) Listeners() []Listener + func (cl *Client) LocalPort() (port int) + func (cl *Client) NewAnacrolixDhtServer(conn net.PacketConn) (s *dht.Server, err error) + func (cl *Client) PeerID() PeerID + func (cl *Client) String() string + func (cl *Client) Torrent(ih metainfo.Hash) (t *Torrent, ok bool) + func (cl *Client) Torrents() []*Torrent + func (cl *Client) WaitAll() bool + func (cl *Client) WriteStatus(_w io.Writer) + type ClientConfig struct + AcceptPeerConnections bool + AlwaysWantConns bool + Bep20 string + Callbacks Callbacks + ConfigureAnacrolixDhtServer func(*dht.ServerConfig) + CryptoProvides mse.CryptoMethod + CryptoSelector mse.CryptoSelector + DHTOnQuery func(query *krpc.Msg, source net.Addr) (propagate bool) + DataDir string + Debug bool + DefaultStorage storage.ClientImpl + DhtStartingNodes func(network string) dht.StartingNodesGetter + DisableAcceptRateLimiting bool + DisableAggressiveUpload bool + DisableIPv4 bool + DisableIPv4Peers bool + DisableIPv6 bool + DisablePEX bool + DisableTCP bool + DisableTrackers bool + DisableUTP bool + DisableWebseeds bool + DisableWebtorrent bool + DownloadRateLimiter *rate.Limiter + DropDuplicatePeerIds bool + DropMutuallyCompletePeers bool + EstablishedConnsPerTorrent int + ExtendedHandshakeClientVersion string + Extensions PeerExtensionBits + HTTPProxy func(*http.Request) (*url.URL, error) + HTTPUserAgent string + HalfOpenConnsPerTorrent int + HandshakesTimeout time.Duration + HeaderObfuscationPolicy HeaderObfuscationPolicy + IPBlocklist iplist.Ranger + KeepAliveTimeout time.Duration + ListenHost func(network string) string + ListenPort int + Logger log.Logger + LookupTrackerIp func(*url.URL) ([]net.IP, error) + MaxUnverifiedBytes int64 + MinDialTimeout time.Duration + MinPeerExtensions PeerExtensionBits + NoDHT bool + NoDefaultPortForwarding bool + NoUpload bool + NominalDialTimeout time.Duration + PeerID string + PeriodicallyAnnounceTorrentsToDht bool + PublicIp4 net.IP + PublicIp6 net.IP + Seed bool + TorrentPeersHighWater int + TorrentPeersLowWater int + TotalHalfOpenConns int + UploadRateLimiter *rate.Limiter + UpnpID string + func NewDefaultClientConfig() *ClientConfig + func TestingConfig(t testing.TB) *ClientConfig + func (cfg *ClientConfig) SetListenAddr(addr string) *ClientConfig + type ConnStats struct + BytesRead Count + BytesReadData Count + BytesReadUsefulData Count + BytesReadUsefulIntendedData Count + BytesWritten Count + BytesWrittenData Count + ChunksRead Count + ChunksReadUseful Count + ChunksReadWasted Count + ChunksWritten Count + MetadataChunksRead Count + PiecesDirtiedBad Count + PiecesDirtiedGood Count + func (me *ConnStats) Copy() (ret ConnStats) + type Count struct + func (me *Count) Add(n int64) + func (me *Count) Int64() int64 + func (me *Count) MarshalJSON() ([]byte, error) + func (me *Count) String() string + type DhtAnnounce interface + Close func() + Peers func() <-chan dht.PeersValues + type DhtServer interface + AddNode func(ni krpc.NodeInfo) error + Addr func() net.Addr + Announce func(hash [20]byte, port int, impliedPort bool) (DhtAnnounce, error) + ID func() [20]byte + Ping func(addr *net.UDPAddr) + Stats func() interface{} + WriteStatus func(io.Writer) + type DialContexter interface + DialContext func(ctx context.Context, network, addr string) (net.Conn, error) + type DialResult struct + Conn net.Conn + Dialer Dialer + func DialFirst(ctx context.Context, addr string, dialers []Dialer) (res DialResult) + type Dialer interface + Dial func(_ context.Context, addr string) (net.Conn, error) + DialerNetwork func() string + type File struct + func (f *File) BeginPieceIndex() int + func (f *File) BytesCompleted() (n int64) + func (f *File) Cancel() + func (f *File) DisplayPath() string + func (f *File) Download() + func (f *File) EndPieceIndex() int + func (f *File) Length() int64 + func (f *File) NewReader() Reader + func (f *File) Offset() int64 + func (f *File) Priority() (prio piecePriority) + func (f *File) SetPriority(prio piecePriority) + func (f *File) State() (ret []FilePieceState) + func (f *File) Torrent() *Torrent + func (f File) FileInfo() metainfo.FileInfo + func (f File) Path() string + type FilePieceState struct + Bytes int64 + type Handle interface + type HeaderObfuscationPolicy struct + Preferred bool + RequirePreferred bool + type InfoHash = metainfo.Hash + type IpPort = missinggo.IpPort + type Listener interface + Accept func() (net.Conn, error) + Addr func() net.Addr + type NetworkDialer struct + Dialer DialContexter + Network string + func (me NetworkDialer) Dial(ctx context.Context, addr string) (_ net.Conn, err error) + func (me NetworkDialer) DialerNetwork() string + type Peer struct + Discovery PeerSource + Network string + PeerClientName atomic.Value + PeerExtensionIDs map[pp.ExtensionName]pp.ExtensionNumber + PeerListenPort int + PeerMaxRequests maxRequests + PeerPrefersEncryption bool + RemoteAddr PeerRemoteAddr + func (p *Peer) TryAsPeerConn() (*PeerConn, bool) + type PeerConn struct + PeerExtensionBytes pp.PeerExtensionBits + PeerID PeerID + func (c *PeerConn) String() string + func (cn *PeerConn) PeerPieces() *roaring.Bitmap + type PeerExtensionBits = pp.PeerExtensionBits + type PeerID [20]byte + type PeerInfo struct + Addr PeerRemoteAddr + Id [20]byte + Source PeerSource + SupportsEncryption bool + Trusted bool + func (me *PeerInfo) FromPex(na krpc.NodeAddr, fs peer_protocol.PexPeerFlags) + type PeerMessageEvent struct + Message *pp.Message + Peer *Peer + type PeerRemoteAddr interface + String func() string + type PeerRequestEvent struct + Peer *Peer + type PeerSource string + type PeerStorer interface + PeerStore func() peer_store.Interface + type Piece struct + func (p *Piece) Info() metainfo.Piece + func (p *Piece) SetPriority(prio piecePriority) + func (p *Piece) State() PieceState + func (p *Piece) Storage() storage.Piece + func (p *Piece) String() string + func (p *Piece) UpdateCompletion() + func (p *Piece) VerifyData() + type PieceState struct + Checking bool + Hashing bool + Marking bool + Partial bool + Priority piecePriority + QueuedForHash bool + type PieceStateChange struct + Index int + type PieceStateRun struct + Length int + func (psr PieceStateRun) String() (ret string) + type PieceStateRuns []PieceStateRun + func (me PieceStateRuns) String() (s string) + type ReadaheadContext struct + ContiguousReadStartPos int64 + CurrentPos int64 + type ReadaheadFunc func(ReadaheadContext) int64 + type Reader interface + SetReadahead func(int64) + SetReadaheadFunc func(ReadaheadFunc) + SetResponsive func() + type ReceivedUsefulDataEvent = PeerMessageEvent + type Request = types.Request + type RequestIndex = request_strategy.RequestIndex + type Torrent struct + Complete chansync.Flag + func (t *Torrent) AddClientPeer(cl *Client) int + func (t *Torrent) AddPeers(pp []PeerInfo) (n int) + func (t *Torrent) AddTrackers(announceList [][]string) + func (t *Torrent) AddWebSeeds(urls []string) + func (t *Torrent) AllowDataDownload() + func (t *Torrent) AllowDataUpload() + func (t *Torrent) AnnounceToDht(s DhtServer) (done <-chan struct{}, stop func(), err error) + func (t *Torrent) BytesCompleted() int64 + func (t *Torrent) BytesMissing() (n int64) + func (t *Torrent) CancelPieces(begin, end pieceIndex) + func (t *Torrent) Closed() events.Done + func (t *Torrent) DisallowDataDownload() + func (t *Torrent) DisallowDataUpload() + func (t *Torrent) DownloadAll() + func (t *Torrent) DownloadPieces(begin, end pieceIndex) + func (t *Torrent) Drop() + func (t *Torrent) Files() []*File + func (t *Torrent) GotInfo() events.Done + func (t *Torrent) Info() (info *metainfo.Info) + func (t *Torrent) InfoHash() metainfo.Hash + func (t *Torrent) KnownSwarm() (ks []PeerInfo) + func (t *Torrent) Length() int64 + func (t *Torrent) MergeSpec(spec *TorrentSpec) error + func (t *Torrent) Metainfo() metainfo.MetaInfo + func (t *Torrent) Name() string + func (t *Torrent) NewReader() Reader + func (t *Torrent) NumPieces() pieceIndex + func (t *Torrent) PeerConns() []*PeerConn + func (t *Torrent) Piece(i pieceIndex) *Piece + func (t *Torrent) PieceBytesMissing(piece int) int64 + func (t *Torrent) PieceState(piece pieceIndex) (ps PieceState) + func (t *Torrent) PieceStateRuns() (runs PieceStateRuns) + func (t *Torrent) Seeding() (ret bool) + func (t *Torrent) SetDisplayName(dn string) + func (t *Torrent) SetInfoBytes(b []byte) (err error) + func (t *Torrent) SetMaxEstablishedConns(max int) (oldMax int) + func (t *Torrent) SetOnWriteChunkError(f func(error)) + func (t *Torrent) Stats() TorrentStats + func (t *Torrent) String() string + func (t *Torrent) SubscribePieceStateChanges() *pubsub.Subscription[PieceStateChange] + func (t *Torrent) UseSources(sources []string) + func (t *Torrent) VerifyData() + type TorrentSpec struct + ChunkSize pp.Integer + DhtNodes []string + DisableInitialPieceCheck bool + DisallowDataDownload bool + DisallowDataUpload bool + DisplayName string + InfoBytes []byte + InfoHash metainfo.Hash + PeerAddrs []string + Sources []string + Storage storage.ClientImpl + Trackers [][]string + Webseeds []string + func TorrentSpecFromMagnetUri(uri string) (spec *TorrentSpec, err error) + func TorrentSpecFromMetaInfo(mi *metainfo.MetaInfo) *TorrentSpec + func TorrentSpecFromMetaInfoErr(mi *metainfo.MetaInfo) (*TorrentSpec, error) + type TorrentStats struct + ActivePeers int + ConnectedSeeders int + HalfOpenPeers int + PendingPeers int + PiecesComplete int + TotalPeers int