rc

package
v1.12.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: MPL-2.0 Imports: 22 Imported by: 1

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) PauseAll added in v0.14.41

func (p *Process) PauseAll() 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) RemoteInSync added in v1.10.0

func (p *Process) RemoteInSync(folder string, dev protocol.DeviceID) (bool, 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) ResumeAll added in v0.14.41

func (p *Process) ResumeAll() 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.

func (*Process) Stopped added in v1.3.0

func (p *Process) Stopped() chan struct{}

Stopped returns a channel that will be closed when Syncthing has stopped.

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)

type SystemStatus added in v0.13.0

type SystemStatus struct {
	Alloc         int64
	Goroutines    int
	MyID          protocol.DeviceID
	PathSeparator string
	StartTime     time.Time
	Sys           int64
	Themes        []string
	Tilde         string
	Uptime        int
}

type SystemVersion added in v0.13.0

type SystemVersion struct {
	Arch        string
	Codename    string
	LongVersion string
	OS          string
	Version     string
}

Jump to

Keyboard shortcuts

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