peer

package
v0.0.0-...-f1c669a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTTPClient = func() *http.Client {
	transport := config.DefaultHTTPTransport.Clone()
	transport.Proxy = config.Tunnel.GetProxy(config.TUNNEL_TYPE_NONE)
	return &http.Client{
		Transport: transport,
		Timeout:   60 * time.Second,
	}
}()

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	BaseURL    *url.URL
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewAPIClient

func NewAPIClient(conf *APIClientConfig) *APIClient

func (APIClient) CheckMagnet

func (*APIClient) HaltCheckMagnet

func (c *APIClient) HaltCheckMagnet()

func (*APIClient) IsHaltedCheckMagnet

func (c *APIClient) IsHaltedCheckMagnet() bool

func (APIClient) Request

func (c APIClient) Request(method, path string, params request.Context, v ResponseEnvelop) (*http.Response, error)

func (APIClient) TrackMagnet

type APIClientConfig

type APIClientConfig struct {
	BaseURL    string
	APIKey     string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

type CheckMagnetParams

type CheckMagnetParams struct {
	store.CheckMagnetParams
	StoreName  store.StoreName
	StoreToken string
}

type Ctx

type Ctx = request.Ctx

type Response

type Response[D any] struct {
	Data  D              `json:"data,omitempty"`
	Error *ResponseError `json:"error,omitempty"`
}

func (Response[any]) GetError

func (r Response[any]) GetError() error

type ResponseEnvelop

type ResponseEnvelop interface {
	GetError() error
}

type ResponseError

type ResponseError struct {
	Code       core.ErrorCode `json:"code"`
	Message    string         `json:"message"`
	StatusCode int            `json:"status_code"`
}

func (*ResponseError) Error

func (e *ResponseError) Error() string

type TrackMagnetData

type TrackMagnetData struct{}

type TrackMagnetParams

type TrackMagnetParams struct {
	store.Ctx
	StoreName  store.StoreName `json:"-"`
	StoreToken string          `json:"-"`

	// single
	Hash   string             `json:"hash"`
	Files  []store.MagnetFile `json:"files"`
	IsMiss bool               `json:"is_miss"`
	SId    string             `json:"sid"`

	// bulk
	FilesByHash map[string][]store.MagnetFile `json:"files_by_hash"`
}

Jump to

Keyboard shortcuts

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