Documentation ¶
Overview ¶
Package rc provides remote control of a Syncthing process via the REST API.
Index ¶
- Constants
- func AwaitSync(folder string, ps ...*Process)
- func InSync(folder string, ps ...*Process) bool
- type ConnectionStats
- type Event
- type Model
- type Process
- func (p *Process) AwaitStartup()
- func (p *Process) ConfigInSync() (bool, error)
- func (p *Process) Connections() (map[string]ConnectionStats, error)
- func (p *Process) Events(since int) ([]Event, error)
- func (p *Process) Get(path string) ([]byte, error)
- func (p *Process) GetConfig() (config.Configuration, error)
- func (p *Process) ID() protocol.DeviceID
- func (p *Process) LogTo(filename string) error
- func (p *Process) Model(folder string) (Model, error)
- func (p *Process) PauseDevice(dev protocol.DeviceID) error
- func (p *Process) Post(path string, data io.Reader) ([]byte, error)
- func (p *Process) PostConfig(cfg config.Configuration) error
- func (p *Process) Rescan(folder string) error
- func (p *Process) RescanDelay(folder string, delaySeconds int) error
- func (p *Process) RescanSub(folder string, sub string, delaySeconds int) error
- func (p *Process) RescanSubs(folder string, subs []string, delaySeconds int) error
- func (p *Process) ResumeDevice(dev protocol.DeviceID) error
- func (p *Process) Start(bin string, args ...string) error
- func (p *Process) Stop() (*os.ProcessState, error)
- func (p *Process) SystemStatus() (SystemStatus, error)
- func (p *Process) SystemVersion() (SystemVersion, error)
- type SystemStatus
- type SystemVersion
Constants ¶
const APIKey = "592A47BC-A7DF-4C2F-89E0-A80B3E5094EE"
APIKey is set via the STGUIAPIKEY variable when we launch the binary, to ensure that we have API access regardless of authentication settings.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionStats ¶ added in v0.12.4
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
func NewProcess ¶
NewProcess returns a new Process talking to Syncthing at the specified address. Example: NewProcess("127.0.0.1:8082")
func (*Process) AwaitStartup ¶
func (p *Process) AwaitStartup()
AwaitStartup waits for the Syncthing process to start and perform initial scans of all folders.
func (*Process) ConfigInSync ¶
func (*Process) Connections ¶ added in v0.12.4
func (p *Process) Connections() (map[string]ConnectionStats, error)
func (*Process) Get ¶
Get performs an HTTP GET and returns the bytes and/or an error. Any non-200 return code is returned as an error.
func (*Process) LogTo ¶
LogTo creates the specified log file and ensures that stdout and stderr from the Start()ed process is redirected there. Must be called before Start().
func (*Process) PauseDevice ¶ added in v0.12.4
func (*Process) Post ¶
Post performs an HTTP POST and returns the bytes and/or an error. Any non-200 return code is returned as an error.
func (*Process) PostConfig ¶
func (p *Process) PostConfig(cfg config.Configuration) error
func (*Process) RescanSubs ¶
func (*Process) ResumeDevice ¶ added in v0.12.4
func (*Process) Start ¶
Start runs the specified Syncthing binary with the given arguments. Syncthing should be configured to provide an API on the address given to NewProcess. Event processing is started.
func (*Process) Stop ¶
func (p *Process) Stop() (*os.ProcessState, error)
Stop stops the running Syncthing process. If the process was logging to a local file (set by LogTo), the log file will be opened and checked for panics and data races. The presence of either will be signalled in the form of a returned error.
func (*Process) SystemStatus ¶ added in v0.13.0
func (p *Process) SystemStatus() (SystemStatus, error)
func (*Process) SystemVersion ¶ added in v0.13.0
func (p *Process) SystemVersion() (SystemVersion, error)