api

package
v0.0.0-...-c5c666b Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(globalCtx context.Context, addr string, rootPath string) *API

func (*API) AddTorrentByHash

func (a *API) AddTorrentByHash(hash, rootDir string) error

func (*API) AddTorrentByMeta

func (a *API) AddTorrentByMeta(meta []byte, rootDir string) error

func (*API) CheckTorrentHeader

func (a *API) CheckTorrentHeader(hash string) (bool, error)

func (*API) CreateTorrent

func (a *API) CreateTorrent(dir, description string) (string, error)

func (*API) GetInfo

func (a *API) GetInfo(hash string) (*TorrentInfo, error)

func (*API) GetPeers

func (a *API) GetPeers(hash string) ([]Peer, error)

func (*API) GetPlainFiles

func (a *API) GetPlainFiles(hash string) ([]PlainFile, error)

func (*API) GetSpeedLimits

func (a *API) GetSpeedLimits() (*SpeedLimits, error)

func (*API) GetTorrentFiles

func (a *API) GetTorrentFiles(hash string) ([]*File, error)

func (*API) GetTorrentMeta

func (a *API) GetTorrentMeta(hash string) ([]byte, error)

func (*API) GetTorrents

func (a *API) GetTorrents() []*Torrent

func (*API) RemoveTorrent

func (a *API) RemoveTorrent(hash string, withFiles, onlyNotInitiated bool) error

func (*API) SetActive

func (a *API) SetActive(hash string, active bool) error

func (*API) SetOnListRefresh

func (a *API) SetOnListRefresh(handler func())

func (*API) SetPriorities

func (a *API) SetPriorities(hash string, list []string, priority int) error

func (*API) SetSpeedLimits

func (a *API) SetSpeedLimits(limits *SpeedLimits) error

func (*API) SetSpeedRefresh

func (a *API) SetSpeedRefresh(handler func(Speed))

func (*API) SyncTorrents

func (a *API) SyncTorrents() error

type File

type File struct {
	Name  string
	Size  string
	Child []*File
	Path  string
	// contains filtered or unexported fields
}

type Peer

type Peer struct {
	IP       string
	ADNL     string
	Upload   string
	Download string
}

type PlainFile

type PlainFile struct {
	Path       string
	Name       string
	Size       string
	Downloaded string
	Progress   float64
}

type Speed

type Speed struct {
	Upload   string
	Download string
}

type SpeedLimits

type SpeedLimits struct {
	Download int64
	Upload   int64
}

type StorageClient

type StorageClient interface {
	GetTorrents(ctx context.Context) (*client.TorrentsList, error)
	AddByHash(ctx context.Context, hash []byte, dir string) (*client.TorrentFull, error)
	AddByMeta(ctx context.Context, meta []byte, dir string) (*client.TorrentFull, error)
	CreateTorrent(ctx context.Context, dir, description string) (*client.TorrentFull, error)
	GetTorrentFull(ctx context.Context, hash []byte) (*client.TorrentFull, error)
	GetTorrentMeta(ctx context.Context, hash []byte) ([]byte, error)
	GetPeers(ctx context.Context, hash []byte) (*client.PeersList, error)
	RemoveTorrent(ctx context.Context, hash []byte, withFiles bool) error
	SetActive(ctx context.Context, hash []byte, active bool) error
	SetFilePriority(ctx context.Context, hash []byte, name string, priority int32) error
	GetSpeedLimits(ctx context.Context) (*client.SpeedLimits, error)
	SetSpeedLimits(ctx context.Context, download, upload int64) error
}

type Torrent

type Torrent struct {
	ID             string
	Name           string
	Size           string
	DownloadedSize string
	Progress       float64
	State          string
	Upload         string
	Download       string
	Path           string
	// contains filtered or unexported fields
}

type TorrentInfo

type TorrentInfo struct {
	Description string
	Size        string
	Downloaded  string
	TimeLeft    string
	Progress    float64
	State       string
	Upload      string
	Download    string
	Path        string
	Peers       int
	AddedAt     string
}

Jump to

Keyboard shortcuts

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