Versions in this module Expand all Collapse all v1 v1.41.2 Mar 27, 2022 Changes in this version + func Read(r io.Reader, data interface{}) error + func Write(w io.Writer, data interface{}) error + type Action int32 + const ActionAnnounce + const ActionConnect + const ActionError + const ActionScrape + const ConnectRequestConnectionId + type AnnounceEvent int32 + func (e AnnounceEvent) String() string + type AnnounceRequest struct + Downloaded int64 + Event AnnounceEvent + IPAddress uint32 + InfoHash [20]byte + Key int32 + Left int64 + NumWant int32 + PeerId [20]byte + Port uint16 + Uploaded int64 + type AnnounceResponseHeader struct + Interval int32 + Leechers int32 + Seeders int32 + type AnnounceResponsePeers interface + NodeAddrs func() []krpc.NodeAddr + type Client struct + Dispatcher *Dispatcher + Writer io.Writer + func (cl *Client) Announce(ctx context.Context, req AnnounceRequest, opts Options, ...) (respHdr AnnounceResponseHeader, peers AnnounceResponsePeers, err error) + func (cl *Client) Scrape(ctx context.Context, ihs []InfoHash) (out ScrapeResponse, err error) + type ConnClient struct + Client Client + func NewConnClient(opts NewConnClientOpts) (cc *ConnClient, err error) + func (cc *ConnClient) Announce(ctx context.Context, req AnnounceRequest, opts Options) (h AnnounceResponseHeader, nas AnnounceResponsePeers, err error) + func (cc *ConnClient) Close() error + func (cc *ConnClient) LocalAddr() net.Addr + type ConnectionId = int64 + type ConnectionRequest struct + Action Action + ConnectionId ConnectionId + TransactionId TransactionId + type ConnectionResponse struct + ConnectionId ConnectionId + type DispatchedResponse struct + Addr net.Addr + Body []byte + Header ResponseHeader + type Dispatcher struct + func (me *Dispatcher) Dispatch(b []byte, addr net.Addr) error + func (me *Dispatcher) NewTransaction(h TransactionResponseHandler) Transaction + type InfoHash = [20]byte + type NewConnClientOpts struct + Host string + Ipv6 *bool + Logger log.Logger + Network string + type Options struct + RequestUri string + func (opts Options) Encode() (ret []byte) + type RequestHeader struct + Action Action + ConnectionId ConnectionId + TransactionId TransactionId + type ResponseHeader struct + Action Action + TransactionId TransactionId + type ScrapeInfohashResult struct + Completed int32 + Leechers int32 + Seeders int32 + type ScrapeRequest []InfoHash + type ScrapeResponse []ScrapeInfohashResult + type Transaction struct + func (t *Transaction) End() + func (t *Transaction) Id() TransactionId + type TransactionId = int32 + func RandomTransactionId() TransactionId + type TransactionResponseHandler func(dr DispatchedResponse)