rainrpc

package
v1.6.1-0...-b16536f Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package rainrpc provides a RPC client implementation for communicating with Rain session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddTorrentOptions

type AddTorrentOptions struct {
	ID                string
	Stopped           bool
	StopAfterDownload bool
}

AddTorrentOptions contains optional parameters for adding a new Torrent.

type Client

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

Client is a JSON-RPC 2.0 client for calling methods of a remote Session.

func NewClient

func NewClient(addr string) *Client

NewClient returns a new Client for remote address.

func (*Client) AddPeer

func (c *Client) AddPeer(id string, addr string) error

AddPeer adds a new peer the a torrent.

func (*Client) AddTorrent

func (c *Client) AddTorrent(f io.Reader, options *AddTorrentOptions) (*rpctypes.Torrent, error)

AddTorrent adds a new torrent by reading .torrent file.

func (*Client) AddTracker

func (c *Client) AddTracker(id string, uri string) error

AddTracker adds a new tracker to a torrent.

func (*Client) AddURI

func (c *Client) AddURI(uri string, options *AddTorrentOptions) (*rpctypes.Torrent, error)

AddURI adds a new torrent from a HTTP or magnet link.

func (*Client) Addr

func (c *Client) Addr() string

Addr returns the address of remote Session.

func (*Client) AnnounceTorrent

func (c *Client) AnnounceTorrent(id string) error

AnnounceTorrent forces the torrent to re-announce to trackers and DHT.

func (*Client) CleanDatabase

func (c *Client) CleanDatabase() error

CleanDatabase removes invalid records in session database.

func (*Client) Close

func (c *Client) Close() error

Close the client.

func (*Client) GetMagnet

func (c *Client) GetMagnet(id string) (string, error)

GetMagnet returns the torrent as a magnet link.

func (*Client) GetSessionStats

func (c *Client) GetSessionStats() (*rpctypes.SessionStats, error)

GetSessionStats returns statistics about the remote Session.

func (*Client) GetTorrent

func (c *Client) GetTorrent(id string) ([]byte, error)

GetTorrent returns the bytes of a .torrent file.

func (*Client) GetTorrentPeers

func (c *Client) GetTorrentPeers(id string) ([]rpctypes.Peer, error)

GetTorrentPeers returns the list of connected peers of a torrent.

func (*Client) GetTorrentStats

func (c *Client) GetTorrentStats(id string) (*rpctypes.Stats, error)

GetTorrentStats returns statistics about a torrent.

func (*Client) GetTorrentTrackers

func (c *Client) GetTorrentTrackers(id string) ([]rpctypes.Tracker, error)

GetTorrentTrackers returns the list of tracker in the torrent.

func (*Client) GetTorrentWebseeds

func (c *Client) GetTorrentWebseeds(id string) ([]rpctypes.Webseed, error)

GetTorrentWebseeds returns the WebSeed sources of a torrent.

func (*Client) ListTorrents

func (c *Client) ListTorrents() ([]rpctypes.Torrent, error)

ListTorrents returns the list of torrents in remote Session.

func (*Client) MoveTorrent

func (c *Client) MoveTorrent(id, target string) error

MoveTorrent moves the torrent to another Session.

func (*Client) RemoveTorrent

func (c *Client) RemoveTorrent(id string) error

RemoveTorrent removes a torrent from remote Session and deletes its data.

func (*Client) ServerVersion

func (c *Client) ServerVersion() (string, error)

ServerVersion returns the Rain version on remote server.

func (*Client) SetTimeout

func (c *Client) SetTimeout(d time.Duration)

func (*Client) StartAllTorrents

func (c *Client) StartAllTorrents() error

StartAllTorrents starts all torrents in the Session.

func (*Client) StartTorrent

func (c *Client) StartTorrent(id string) error

StartTorrent starts the torrent.

func (*Client) StopAllTorrents

func (c *Client) StopAllTorrents() error

StopAllTorrents stops all the torrents in the session.

func (*Client) StopTorrent

func (c *Client) StopTorrent(id string) error

StopTorrent stops the torrent.

func (*Client) VerifyTorrent

func (c *Client) VerifyTorrent(id string) error

VerifyTorrent stops the torrent and verifies all of the pieces on disk. After verification is done, the torrent stays in stopped state.

Jump to

Keyboard shortcuts

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