syncthing

package
v0.0.0-...-b5ba5ed Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig(path string, myID protocol.DeviceID, evLogger events.Logger, noDefaultFolder, skipPortProbing bool) (config.Wrapper, error)

func EnsureDir

func EnsureDir(dir string, mode fs.FileMode) error

func GenerateCertificate

func GenerateCertificate(certFile, keyFile string) (tls.Certificate, error)

func LoadConfigAtStartup

func LoadConfigAtStartup(path string, cert tls.Certificate, evLogger events.Logger, allowNewerConfig, noDefaultFolder, skipPortProbing bool) (config.Wrapper, error)

LoadConfigAtStartup loads an existing config. If it doesn't yet exist, it creates a default one, without the default folder if noDefaultFolder is true. Otherwise it checks the version, and archives and upgrades the config if necessary or returns an error, if the version isn't compatible.

func LoadOrGenerateCertificate

func LoadOrGenerateCertificate(certFile, keyFile string) (tls.Certificate, error)

func OpenDBBackend

func OpenDBBackend(path string, tuning config.Tuning) (backend.Backend, error)

Types

type App

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

func New

func New(cfg config.Wrapper, dbBackend backend.Backend, evLogger events.Logger, cert tls.Certificate, opts Options) (*App, error)

func (*App) Error

func (a *App) Error() error

Error returns an error if one occurred while running the app. It does not wait for the app to stop before returning.

func (*App) Start

func (a *App) Start() error

Start executes the app and returns once all the startup operations are done, e.g. the API is ready for use. Must be called once only.

func (*App) Stop

func (a *App) Stop(stopReason svcutil.ExitStatus) svcutil.ExitStatus

Stop stops the app and sets its exit status to given reason, unless the app was already stopped before. In any case it returns the effective exit status.

func (*App) Wait

func (a *App) Wait() svcutil.ExitStatus

Wait blocks until the app stops running. Also returns if the app hasn't been started yet.

type Options

type Options struct {
	AuditWriter    io.Writer
	NoUpgrade      bool
	ProfilerAddr   string
	ResetDeltaIdxs bool
	Verbose        bool
	// null duration means use default value
	DBRecheckInterval    time.Duration
	DBIndirectGCInterval time.Duration
}

Jump to

Keyboard shortcuts

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