Documentation ¶
Index ¶
- Constants
- Variables
- type AddTorrentRequest
- type BaseRequest
- type ChangeTorrentRequest
- type Client
- func (cl *Client) AddTorrent(url string) (err error)
- func (cl *Client) DeleteTorrent(ih string) error
- func (cl *Client) GetSwarmStatus() (status swarm.SwarmStatus, err error)
- func (cl *Client) ListTorrents() (torrents swarm.TorrentsList, err error)
- func (cl *Client) RemoveTorrent(ih string) error
- func (cl *Client) SetPieceWindow(n int) (err error)
- func (cl *Client) StartTorrent(ih string) error
- func (cl *Client) StopTorrent(ih string) error
- func (cl *Client) SwarmStatus(ih string) (st swarm.TorrentStatus, err error)
- type ListTorrentStatusRequest
- type ListTorrentsRequest
- type Request
- type ResponseWriter
- type Server
- type SetPieceWindowRequest
- type SwarmCountRequest
- type TorrentStatusRequest
Constants ¶
View Source
const ParamAction = "action"
View Source
const ParamInfohash = "infohash"
View Source
const ParamMethod = "method"
View Source
const ParamN = "n"
View Source
const ParamSwarm = "swarm"
View Source
const ParamSwarms = "swarms"
View Source
const ParamURL = "url"
View Source
const RPCAddTorrent = RPCName + ".AddTorrent"
View Source
const RPCChangeTorrent = RPCName + ".ChangeTorrent"
View Source
const RPCContentType = "text/json; encoding=UTF-8"
View Source
const RPCDelTorrent = RPCName + ".DelTorrent"
View Source
const RPCListTorrentStatus = RPCName + ".SwarmStatus"
View Source
const RPCListTorrents = RPCName + ".ListTorrents"
View Source
const RPCName = "XD"
View Source
const RPCPath = "/ecksdee/api"
View Source
const RPCSetPieceWindow = RPCName + ".SetPieceWindow"
View Source
const RPCSwarmCount = RPCName + ".SwarmCount"
View Source
const RPCTorrentStatus = RPCName + ".TorrentStatus"
View Source
const TorrentChangeDelete = "delete"
View Source
const TorrentChangeRemove = "remove"
View Source
const TorrentChangeStart = "start"
View Source
const TorrentChangeStop = "stop"
Variables ¶
View Source
var ErrInvalidAction = errors.New("invalid torrent action")
View Source
var ErrNoTorrent = errors.New("no such torrent")
Functions ¶
This section is empty.
Types ¶
type AddTorrentRequest ¶
type AddTorrentRequest struct { BaseRequest URL string `json:"url"` }
func (*AddTorrentRequest) MarshalJSON ¶
func (atr *AddTorrentRequest) MarshalJSON() (data []byte, err error)
func (*AddTorrentRequest) ProcessRequest ¶
func (atr *AddTorrentRequest) ProcessRequest(sw *swarm.Swarm, w *ResponseWriter)
type BaseRequest ¶
type BaseRequest struct {
Swarm string `json:"-"`
}
type ChangeTorrentRequest ¶
type ChangeTorrentRequest struct { BaseRequest Infohash string `json:"infohash"` Action string `json:"action"` }
func (*ChangeTorrentRequest) MarshalJSON ¶
func (r *ChangeTorrentRequest) MarshalJSON() (data []byte, err error)
func (*ChangeTorrentRequest) ProcessRequest ¶
func (r *ChangeTorrentRequest) ProcessRequest(sw *swarm.Swarm, w *ResponseWriter)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddTorrent ¶
func (*Client) DeleteTorrent ¶
func (*Client) GetSwarmStatus ¶
func (cl *Client) GetSwarmStatus() (status swarm.SwarmStatus, err error)
func (*Client) ListTorrents ¶
func (cl *Client) ListTorrents() (torrents swarm.TorrentsList, err error)
func (*Client) RemoveTorrent ¶
func (*Client) SetPieceWindow ¶
func (*Client) StartTorrent ¶
func (*Client) StopTorrent ¶
func (*Client) SwarmStatus ¶
func (cl *Client) SwarmStatus(ih string) (st swarm.TorrentStatus, err error)
type ListTorrentStatusRequest ¶
type ListTorrentStatusRequest struct {
BaseRequest
}
func (*ListTorrentStatusRequest) MarshalJSON ¶
func (req *ListTorrentStatusRequest) MarshalJSON() (data []byte, err error)
func (*ListTorrentStatusRequest) ProcessRequest ¶
func (req *ListTorrentStatusRequest) ProcessRequest(sw *swarm.Swarm, w *ResponseWriter)
type ListTorrentsRequest ¶
type ListTorrentsRequest struct {
BaseRequest
}
func (*ListTorrentsRequest) MarshalJSON ¶
func (ltr *ListTorrentsRequest) MarshalJSON() (data []byte, err error)
func (*ListTorrentsRequest) ProcessRequest ¶
func (ltr *ListTorrentsRequest) ProcessRequest(sw *swarm.Swarm, w *ResponseWriter)
type Request ¶
type Request interface { // handle request on server ProcessRequest(sw *swarm.Swarm, w *ResponseWriter) // convert request to json MarshalJSON() ([]byte, error) }
type ResponseWriter ¶
type ResponseWriter struct {
// contains filtered or unexported fields
}
func (*ResponseWriter) Return ¶
func (rw *ResponseWriter) Return(obj interface{})
func (*ResponseWriter) SendError ¶
func (rw *ResponseWriter) SendError(msg string)
func (*ResponseWriter) SendJSON ¶
func (rw *ResponseWriter) SendJSON(obj interface{})
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Bittorrent Swarm RPC Handler
type SetPieceWindowRequest ¶
type SetPieceWindowRequest struct { BaseRequest N int `json:"n"` }
func (*SetPieceWindowRequest) MarshalJSON ¶
func (r *SetPieceWindowRequest) MarshalJSON() (data []byte, err error)
func (*SetPieceWindowRequest) ProcessRequest ¶
func (r *SetPieceWindowRequest) ProcessRequest(sw *swarm.Swarm, w *ResponseWriter)
type SwarmCountRequest ¶
type SwarmCountRequest struct { BaseRequest N int }
func (*SwarmCountRequest) MarshalJSON ¶
func (scr *SwarmCountRequest) MarshalJSON() (data []byte, err error)
func (*SwarmCountRequest) ProcessRequest ¶
func (scr *SwarmCountRequest) ProcessRequest(_ *swarm.Swarm, w *ResponseWriter)
type TorrentStatusRequest ¶
type TorrentStatusRequest struct { BaseRequest Infohash string `json:"infohash"` }
func (*TorrentStatusRequest) MarshalJSON ¶
func (r *TorrentStatusRequest) MarshalJSON() (data []byte, err error)
func (*TorrentStatusRequest) ProcessRequest ¶
func (r *TorrentStatusRequest) ProcessRequest(sw *swarm.Swarm, w *ResponseWriter)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.