rainrpc

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: MIT Imports: 5 Imported by: 1

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 added in v0.8.7

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 added in v0.4.0

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 added in v0.4.0

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 added in v0.16.0

func (c *Client) Addr() string

Addr returns the address of remote Session.

func (*Client) AnnounceTorrent added in v0.10.0

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

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

func (*Client) CleanDatabase added in v1.1.0

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 added in v0.16.0

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

GetMagnet returns the torrent as a magnet link.

func (*Client) GetSessionStats added in v0.3.0

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

GetSessionStats returns statistics about the remote Session.

func (*Client) GetTorrent added in v0.16.0

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 added in v0.7.0

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 added in v0.15.0

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 added in v0.2.0

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

ServerVersion returns the Rain version on remote server.

func (*Client) StartAllTorrents added in v0.4.0

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 added in v0.4.0

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 added in v0.10.0

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