http

package
v1.33.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: MPL-2.0 Imports: 18 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnounceOpt

type AnnounceOpt struct {
	UserAgent  string
	HostHeader string
	ClientIp4  net.IP
	ClientIp6  net.IP
}

type AnnounceRequest

type AnnounceRequest = udp.AnnounceRequest

type AnnounceResponse

type AnnounceResponse struct {
	Interval int32 // Minimum seconds the local peer should wait before next announce.
	Leechers int32
	Seeders  int32
	Peers    []Peer
}

type Client

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

func NewClient

func NewClient(url_ *url.URL, opts NewClientOpts) Client

func (Client) Announce

func (cl Client) Announce(ctx context.Context, ar AnnounceRequest, opt AnnounceOpt) (ret AnnounceResponse, err error)

func (Client) Close

func (cl Client) Close() error

type HttpResponse

type HttpResponse struct {
	FailureReason string `bencode:"failure reason"`
	Interval      int32  `bencode:"interval"`
	TrackerId     string `bencode:"tracker id"`
	Complete      int32  `bencode:"complete"`
	Incomplete    int32  `bencode:"incomplete"`
	Peers         Peers  `bencode:"peers"`
	// BEP 7
	Peers6 krpc.CompactIPv6NodeAddrs `bencode:"peers6"`
}

type NewClientOpts

type NewClientOpts struct {
	Proxy          ProxyFunc
	ServerName     string
	AllowKeepAlive bool
}

type Peer

type Peer struct {
	IP   net.IP
	Port int
	ID   []byte
}

func (*Peer) FromDictInterface

func (p *Peer) FromDictInterface(d map[string]interface{})

Set from the non-compact form in BEP 3.

func (Peer) FromNodeAddr

func (p Peer) FromNodeAddr(na krpc.NodeAddr) Peer

func (Peer) String

func (p Peer) String() string

type Peers

type Peers []Peer

func (*Peers) UnmarshalBencode

func (me *Peers) UnmarshalBencode(b []byte) (err error)

type ProxyFunc

type ProxyFunc func(*http.Request) (*url.URL, error)

Jump to

Keyboard shortcuts

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