Documentation ¶
Index ¶
- Constants
- func CleanLocalConfig(name string) error
- func ConnectDevices(s1 *Syncthing, s2 *Syncthing) error
- func GetConfigBytes(cfg *config.Configuration, outputType string) (configByte []byte, err error)
- func GetConfigFilePath(homeDirectory string) string
- func GetHomeDirectory() (string, error)
- func GetSyncthingBinPath() string
- func InitLocalConfig() *config.Configuration
- func InstallSyncthing() error
- func IsInstalled() bool
- func NewAPIClient() *http.Client
- func ParsePortFromAddress(addr string) string
- func SyncFolder(s1 *Syncthing, s2 *Syncthing, dir1 string, dir2 string) error
- type Client
- type ConfigSavedEvent
- type GeneralEvent
- type Status
- type Syncthing
- func (s *Syncthing) ApplyConfig() error
- func (s *Syncthing) CleanupSyncthing() error
- func (s *Syncthing) GetConfig() (*config.Configuration, error)
- func (s *Syncthing) GetConfigSavedEvents() ([]*ConfigSavedEvent, error)
- func (s *Syncthing) GetDeviceAddressPort() string
- func (s *Syncthing) GetMostRecentEvent() (*GeneralEvent, error)
- func (s *Syncthing) IsRunning() bool
- func (s *Syncthing) NewClient() *Client
- func (s *Syncthing) Ping() (bool, error)
- func (s *Syncthing) PullLatestConfig() error
- func (s *Syncthing) SetDeviceAddress(addr string) (err error)
- func (s *Syncthing) StartLocalSyncthing() error
- func (s *Syncthing) StopLocalSyncthing()
- func (s *Syncthing) WaitForConfigApply(timeout time.Duration) error
- func (s *Syncthing) WaitForStartup(timeout time.Duration) error
- func (s *Syncthing) WriteLocalConfig() error
Constants ¶
View Source
const ( GET = "GET" POST = "POST" PUT = "PUT" )
View Source
const ( DefaultLocalPort = "8386" DefaultRemotePort = "8384" DefaultRemoteAPIAddress = "127.0.0.1:8384" DefaultApiKey = "envd" DefaultLocalDeviceAddress = "tcp://127.0.0.1:22000" DefaultRemoteDeviceAddress = "tcp://127.0.0.1:22001" )
View Source
const ( XML = "xml" JSON = "json" )
View Source
const ConfigSaved = "ConfigSaved"
Variables ¶
This section is empty.
Functions ¶
func CleanLocalConfig ¶
func ConnectDevices ¶
func GetConfigBytes ¶
func GetConfigBytes(cfg *config.Configuration, outputType string) (configByte []byte, err error)
Get syncthing configuration in bytes with format XML or JSON
func GetConfigFilePath ¶
func GetHomeDirectory ¶
func GetSyncthingBinPath ¶
func GetSyncthingBinPath() string
func InitLocalConfig ¶
func InitLocalConfig() *config.Configuration
func InstallSyncthing ¶
func InstallSyncthing() error
func IsInstalled ¶
func IsInstalled() bool
func NewAPIClient ¶
func ParsePortFromAddress ¶
Types ¶
type ConfigSavedEvent ¶
type GeneralEvent ¶
type Syncthing ¶
type Syncthing struct { Name string Cmd *exec.Cmd Config *config.Configuration PrevConfig config.Configuration // Unapplied config HomeDirectory string Port string DeviceID protocol.DeviceID Client *Client ApiKey string DeviceAddress string // contains filtered or unexported fields }
func InitializeLocalSyncthing ¶
Initializes the local syncthing instance
func InitializeRemoteSyncthing ¶
Initializes the remote syncthing instance
func (*Syncthing) ApplyConfig ¶
Applies the config to the syncthing instance and waits for the config to be applied
func (*Syncthing) CleanupSyncthing ¶
func (*Syncthing) GetConfig ¶
func (s *Syncthing) GetConfig() (*config.Configuration, error)
Fetches the latest configuration from the syncthing rest api
func (*Syncthing) GetConfigSavedEvents ¶
func (s *Syncthing) GetConfigSavedEvents() ([]*ConfigSavedEvent, error)
Fetches the latest config saved events using the syncthing rest api starting from the latest event id
func (*Syncthing) GetDeviceAddressPort ¶
func (*Syncthing) GetMostRecentEvent ¶
func (s *Syncthing) GetMostRecentEvent() (*GeneralEvent, error)
Fetches the most recent event using the syncthing rest api
func (*Syncthing) PullLatestConfig ¶
Fetches the latest configuration from the syncthing rest api and applies it to the syncthing struct
func (*Syncthing) SetDeviceAddress ¶
This method can only be called when the devices are not connected
func (*Syncthing) StartLocalSyncthing ¶
func (*Syncthing) StopLocalSyncthing ¶
func (s *Syncthing) StopLocalSyncthing()
func (*Syncthing) WaitForConfigApply ¶
func (*Syncthing) WriteLocalConfig ¶
Click to show internal directories.
Click to hide internal directories.