rc

package
Version: v0.12.17 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2016 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package rc provides remote control of a Syncthing process via the REST API.

Index

Constants

View Source
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

func AwaitSync

func AwaitSync(folder string, ps ...*Process)

func InSync

func InSync(folder string, ps ...*Process) bool

Types

type ConnectionStats added in v0.12.4

type ConnectionStats struct {
	Address       string
	Type          string
	Connected     bool
	Paused        bool
	ClientVersion string
	InBytesTotal  int64
	OutBytesTotal int64
}

type Event

type Event struct {
	ID   int
	Time time.Time
	Type string
	Data interface{}
}

type Model

type Model struct {
	GlobalBytes   int
	GlobalDeleted int
	GlobalFiles   int
	InSyncBytes   int
	InSyncFiles   int
	Invalid       string
	LocalBytes    int
	LocalDeleted  int
	LocalFiles    int
	NeedBytes     int
	NeedFiles     int
	State         string
	StateChanged  time.Time
	Version       int
}

type Process

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

func NewProcess

func NewProcess(addr string) *Process

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 (p *Process) ConfigInSync() (bool, error)

func (*Process) Connections added in v0.12.4

func (p *Process) Connections() (map[string]ConnectionStats, error)

func (*Process) Events

func (p *Process) Events(since int) ([]Event, error)

func (*Process) Get

func (p *Process) Get(path string) ([]byte, error)

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) GetConfig

func (p *Process) GetConfig() (config.Configuration, error)

func (*Process) ID

func (p *Process) ID() protocol.DeviceID

func (*Process) LogTo

func (p *Process) LogTo(filename string) error

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) Model

func (p *Process) Model(folder string) (Model, error)

func (*Process) PauseDevice added in v0.12.4

func (p *Process) PauseDevice(dev protocol.DeviceID) error

func (*Process) Post

func (p *Process) Post(path string, data io.Reader) ([]byte, error)

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) Rescan

func (p *Process) Rescan(folder string) error

func (*Process) RescanDelay

func (p *Process) RescanDelay(folder string, delaySeconds int) error

func (*Process) RescanSub

func (p *Process) RescanSub(folder string, sub string, delaySeconds int) error

func (*Process) RescanSubs

func (p *Process) RescanSubs(folder string, subs []string, delaySeconds int) error

func (*Process) ResumeDevice added in v0.12.4

func (p *Process) ResumeDevice(dev protocol.DeviceID) error

func (*Process) Start

func (p *Process) Start(bin string, args ...string) error

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL