webseed

package
v0.0.0-...-6e19431 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooFast = errors.New("making requests too fast")

Functions

func EscapePath

func EscapePath(pathComps []string) string

Escapes path name components suitable for appending to a webseed URL. This works for converting S3 object keys to URLs too.

Contrary to the name, this actually does a QueryEscape, rather than a PathEscape. This works better with most S3 providers.

Types

type Client

type Client struct {
	HttpClient *http.Client
	Url        string

	// The pieces we can request with the Url. We're more likely to ban/block at the file-level
	// given that's how requests are mapped to webseeds, but the torrent.Client works at the piece
	// level. We can map our file-level adjustments to the pieces here. This probably need to be
	// private in the future, if Client ever starts removing pieces.
	Pieces              roaring.Bitmap
	ResponseBodyWrapper ResponseBodyWrapper
	PathEscaper         PathEscaper
	// contains filtered or unexported fields
}

func (*Client) SetInfo

func (me *Client) SetInfo(info *metainfo.Info)

func (*Client) StartNewRequest

func (ws *Client) StartNewRequest(r RequestSpec) Request

type ErrBadResponse

type ErrBadResponse struct {
	Msg      string
	Response *http.Response
}

func (ErrBadResponse) Error

func (me ErrBadResponse) Error() string

type PathEscaper

type PathEscaper func(pathComps []string) string

type Request

type Request struct {
	Result chan RequestResult
	// contains filtered or unexported fields
}

func (Request) Cancel

func (r Request) Cancel()

type RequestResult

type RequestResult struct {
	Bytes []byte
	Err   error
}

type RequestSpec

type RequestSpec = segments.Extent

type ResponseBodyWrapper

type ResponseBodyWrapper func(io.Reader) io.Reader

Jump to

Keyboard shortcuts

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