rc

package
v1.43.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package rc implements a remote control server and registry for rclone

To register your internal calls, call rc.Add(path, function). Your function should take ane return a Param. It can also return an error. Use rc.NewError to wrap an existing error along with an http response type if another response other than 500 internal error is required on error.

Index

Constants

This section is empty.

Variables

View Source
var DefaultOpt = Options{
	HTTPOptions: httplib.DefaultOpt,
	Enabled:     false,
}

DefaultOpt is the default values used for Options

Functions

func Add

func Add(call Call)

Add a function to the global registry

func Start

func Start(opt *Options)

Start the remote control server if configured

func WriteJSON

func WriteJSON(w io.Writer, out Params) error

WriteJSON writes JSON in out to w

Types

type Call

type Call struct {
	Path  string // path to activate this RC
	Fn    Func   `json:"-"` // function to call
	Title string // help for the function
	Help  string // multi-line markdown formatted help
}

Call defines info about a remote control function and is used in the Add function to create new entry points.

type Func

type Func func(in Params) (out Params, err error)

Func defines a type for a remote control function

type Options

type Options struct {
	HTTPOptions httplib.Options
	Enabled     bool
}

Options contains options for the remote control server

type Params

type Params map[string]interface{}

Params is the input and output type for the Func

type Registry

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

Registry holds the list of all the registered remote control functions

func NewRegistry

func NewRegistry() *Registry

NewRegistry makes a new registry for remote control functions

Directories

Path Synopsis
Package rcflags implements command line flags to set up the remote control
Package rcflags implements command line flags to set up the remote control

Jump to

Keyboard shortcuts

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