client

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADNL

type ADNL interface {
	QueryADNL(ctx context.Context, payload, response tl.Serializable) error
}

type AddByHash

type AddByHash struct {
	Hash          []byte `tl:"int256"`
	RootDir       string `tl:"string"`
	StartDownload bool   `tl:"bool"`
	AllowUpload   bool   `tl:"bool"`
	Priorities    []any  `tl:"vector struct boxed [storage.priorityAction.all,storage.priorityAction.idx,storage.priorityAction.name]"`
	Flags         uint32 `tl:"int"`
}

type AddByMeta

type AddByMeta struct {
	Meta          []byte `tl:"bytes"`
	RootDir       string `tl:"string"`
	StartDownload bool   `tl:"bool"`
	AllowUpload   bool   `tl:"bool"`
	Priorities    []any  `tl:"vector struct boxed [storage.priorityAction.all,storage.priorityAction.idx,storage.priorityAction.name]"`
	Flags         uint32 `tl:"int"`
}

type CreateTorrent

type CreateTorrent struct {
	Path        string `tl:"string"`
	Description string `tl:"string"`
	AllowUpload bool   `tl:"bool"`
	CopyInside  bool   `tl:"bool"`
	Flags       uint32 `tl:"int"`
}

type DaemonError

type DaemonError struct {
	Message string `tl:"string"`
}

type Double

type Double struct {
	Value float64
}

func (*Double) Parse

func (d *Double) Parse(data []byte) (_ []byte, err error)

func (*Double) Serialize

func (d *Double) Serialize() ([]byte, error)

type FileInfo

type FileInfo struct {
	Name           string `tl:"string"`
	Size           int64  `tl:"long"`
	Flags          uint32 `tl:"int"`
	Priority       int32  `tl:"int"`
	DownloadedSize int64  `tl:"long"`
}

type GetPeers

type GetPeers struct {
	Hash  []byte `tl:"int256"`
	Flags uint32 `tl:"int"`
}

type GetSpeedLimits

type GetSpeedLimits struct {
	Flags uint32 `tl:"int"`
}

type GetTorrentFull

type GetTorrentFull struct {
	Hash  []byte `tl:"int256"`
	Flags uint32 `tl:"int"`
}

type GetTorrentMeta

type GetTorrentMeta struct {
	Hash  []byte `tl:"int256"`
	Flags uint32 `tl:"int"`
}

type GetTorrents

type GetTorrents struct {
	Flags uint32 `tl:"int"`
}

type MetaFile

type MetaFile struct {
	Hash []byte
	Info storage.TorrentInfo
}

func (*MetaFile) Parse

func (d *MetaFile) Parse(data []byte) (_ []byte, err error)

func (*MetaFile) Serialize

func (d *MetaFile) Serialize() ([]byte, error)

type Peer

type Peer struct {
	ADNL          []byte `tl:"int256"`
	IP            string `tl:"string"`
	DownloadSpeed Double `tl:"struct"`
	UploadSpeed   Double `tl:"struct"`
	ReadyParts    int64  `tl:"long"`
}

type PeersList

type PeersList struct {
	Peers         []Peer `tl:"vector struct"`
	DownloadSpeed Double `tl:"struct"`
	UploadSpeed   Double `tl:"struct"`
	TotalParts    int64  `tl:"long"`
}

type PriorityActionAll

type PriorityActionAll struct {
	Priority int32 `tl:"int"`
}

type PriorityActionIndex

type PriorityActionIndex struct {
	Index    int64 `tl:"long"`
	Priority int32 `tl:"int"`
}

type PriorityActionName

type PriorityActionName struct {
	Name     string `tl:"string"`
	Priority int32  `tl:"int"`
}

type PriorityStatusPending

type PriorityStatusPending struct{}

type PriorityStatusSet

type PriorityStatusSet struct{}

type RemoveTorrent

type RemoveTorrent struct {
	Hash        []byte `tl:"int256"`
	RemoveFiles bool   `tl:"bool"`
}

type SetActiveDownload

type SetActiveDownload struct {
	Hash   []byte `tl:"int256"`
	Active bool   `tl:"bool"`
}

type SetActiveUpload

type SetActiveUpload struct {
	Hash   []byte `tl:"int256"`
	Active bool   `tl:"bool"`
}

type SetFilePriorityByName

type SetFilePriorityByName struct {
	Hash     []byte `tl:"int256"`
	Name     string `tl:"string"`
	Priority int32  `tl:"int"`
}

type SetSpeedLimits

type SetSpeedLimits struct {
	Flags    uint32  `tl:"int"`
	Download *Double `tl:"struct"`
	Upload   *Double `tl:"struct"`
}

type SpeedLimits

type SpeedLimits struct {
	Download Double `tl:"struct"`
	Upload   Double `tl:"struct"`
}

type StorageClient

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

func NewStorageClient

func NewStorageClient(client ADNL) *StorageClient

func (*StorageClient) AddByHash

func (s *StorageClient) AddByHash(ctx context.Context, hash []byte, dir string) (*TorrentFull, error)

func (*StorageClient) AddByMeta

func (s *StorageClient) AddByMeta(ctx context.Context, meta []byte, dir string) (*TorrentFull, error)

func (*StorageClient) CreateTorrent

func (s *StorageClient) CreateTorrent(ctx context.Context, dir, description string) (*TorrentFull, error)

func (*StorageClient) GetPeers

func (s *StorageClient) GetPeers(ctx context.Context, hash []byte) (*PeersList, error)

func (*StorageClient) GetSpeedLimits

func (s *StorageClient) GetSpeedLimits(ctx context.Context) (*SpeedLimits, error)

func (*StorageClient) GetTorrentFull

func (s *StorageClient) GetTorrentFull(ctx context.Context, hash []byte) (*TorrentFull, error)

func (*StorageClient) GetTorrentMeta

func (s *StorageClient) GetTorrentMeta(ctx context.Context, hash []byte) ([]byte, error)

func (*StorageClient) GetTorrents

func (s *StorageClient) GetTorrents(ctx context.Context) (*TorrentsList, error)

func (*StorageClient) RemoveTorrent

func (s *StorageClient) RemoveTorrent(ctx context.Context, hash []byte, withFiles bool) error

func (*StorageClient) SetActive

func (s *StorageClient) SetActive(ctx context.Context, hash []byte, active bool) error

func (*StorageClient) SetFilePriority

func (s *StorageClient) SetFilePriority(ctx context.Context, hash []byte, name string, priority int32) error

func (*StorageClient) SetSpeedLimits

func (s *StorageClient) SetSpeedLimits(ctx context.Context, download, upload int64) error

type Success

type Success struct{}

type Torrent

type Torrent struct {
	Hash           []byte
	Flags          uint32
	TotalSize      *uint64 // 0
	Description    *string // 0
	FilesCount     *uint64 // 1
	IncludedSize   *uint64 // 1
	DirName        *string // 1
	AddedAt        uint32
	DownloadedSize uint64
	RootDir        string
	ActiveDownload bool
	ActiveUpload   bool
	Completed      bool
	DownloadSpeed  float64
	UploadSpeed    float64
	FatalError     *string // 2
}

func (*Torrent) Parse

func (t *Torrent) Parse(data []byte) (_ []byte, err error)

func (*Torrent) Serialize

func (t *Torrent) Serialize() ([]byte, error)

type TorrentFull

type TorrentFull struct {
	Torrent Torrent    `tl:"struct"`
	Files   []FileInfo `tl:"vector struct"`
}

type TorrentMeta

type TorrentMeta struct {
	Meta []byte `tl:"bytes"`
}

type TorrentsList

type TorrentsList struct {
	Torrents []Torrent `tl:"vector struct"`
}

Jump to

Keyboard shortcuts

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