syncthing

package
v0.0.0-...-60f4931 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProgressPending progressPhase = iota
	ProgressDone
	ProgressError
)
View Source
const (
	Marker = ".blimp_syncthing"

	// I don't want to use the standard syncthing port, in case one of our users
	// wants to run syncthing in docker compose.  It doesn't look like anything
	// actually uses this port so we should be good w.r.t. conflicts.  The "right"
	// thing to do, would be to use a unix socket in the CLI, and then conflicts
	// aren't possible.
	Port            = 22022
	APIPort         = 8384
	TunneledAPIPort = 8385

	CLIDeviceID    = "ROHA7NN-4KWKQ3Q-CHJMZBK-6UD7Z6D-ZTWQR5C-TYLN6WG-Q2EQJAI-JU73EQN"
	RemoteDeviceID = "K6QHA3P-VGHXBZE-2NILDY3-Y4E2EUU-7DCSOVF-DFVCQRM-P5BVGMB-LDLP6QA"
)

Variables

This section is empty.

Functions

func ArgsToMap

func ArgsToMap(args []string) map[string]string

func MakeMarkers

func MakeMarkers(folders map[string]string) error

func MakeServer

func MakeServer(folders map[string]string) string

func MapToArgs

func MapToArgs(m map[string]string) []string

Types

type APIClient

type APIClient struct {
	Address string
}

func (APIClient) GetCompletion

func (api APIClient) GetCompletion(folder, device string) (completion Completion, err error)

func (APIClient) GetConnections

func (api APIClient) GetConnections() (conns Connections, err error)

func (APIClient) GetStatus

func (api APIClient) GetStatus(folder string) (status Status, err error)

func (APIClient) OverrideVersion

func (api APIClient) OverrideVersion(folder string) error

func (APIClient) Ping

func (api APIClient) Ping() error

func (APIClient) Reset

func (api APIClient) Reset() error

func (APIClient) Restart

func (api APIClient) Restart() error

type BindVolume

type BindVolume struct {
	LocalPath string
	Masks     []string
}

BindVolume represents a bind volume used by a single service, along with any subdirectories that are masked off by native volumes mounted into this service.

type Client

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

func NewClient

func NewClient(volumes []BindVolume) Client

func (Client) GetIDPathMap

func (c Client) GetIDPathMap() map[string]string

func (Client) Run

func (c Client) Run(ctx context.Context, ncc node.ControllerClient,
	auth *auth.BlimpAuth, tunnelManager tunnel.Manager) ([]byte, error)

func (Client) WriteConfig

func (c Client) WriteConfig(idPathMap map[string]string) error

type Completion

type Completion struct {
	NeedBytes   int `json:"needBytes"`
	NeedDeletes int `json:"needDeletes"`
	NeedItems   int `json:"needItems"`
}

type Connection

type Connection struct {
	Connected bool `json:"connected"`
}

type Connections

type Connections struct {
	Connections map[string]Connection `json:"connections"`
}

type Mount

type Mount struct {
	Path string
	// Include should only be set if Ignore is nil and SyncAll is false.
	Include []string
	// Ignore overrides SyncAll for specific files or directories. Ignore should
	// only be set if Include is nil and SyncAll is true.
	Ignore  []string
	SyncAll bool
}

func (Mount) GetStignore

func (m Mount) GetStignore() (stignore string, needed bool)

GetStignore returns the stignore file needed to include only the paths in `Mount.Include`. In order to sync subdirectories, we have to add explicit rules allowing each parent directory, and ignoring all other files in the parent directory. For example, to sync the directory /foo/bar/, we have to use a stignore of the form: ``` !/foo/bar # Include the target directory. /foo/ # Exclude all other files in /foo, but not /foo itself. !/foo # Include /foo. ``` If we didn't have the latter two rules, /foo/bar wouldn't get synced, since the directory /foo would never get created. See this issue for more information: https://github.com/syncthing/syncthing/issues/2091.

func (Mount) ID

func (m Mount) ID() string

func (Mount) Includes

func (m Mount) Includes(child string) bool

Includes returns whether the mount already includes the given child.

type Status

type Status struct {
	State string `json:"state"`
}

Jump to

Keyboard shortcuts

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