syncthing

package
v0.7.0-rc.10 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package syncthing owns loopback access to the pinned Syncthing daemon.

Index

Constants

View Source
const GUIBase = "http://127.0.0.1:8384"

Variables

This section is empty.

Functions

func WithMutationLock

func WithMutationLock(action func() error) error

WithMutationLock coordinates VPN processes using the stable root-owned board directory. No credential file is locked or written. Contention refuses promptly. External Web UI/API writers do not participate in this advisory lock.

Types

type BackupFolder

type BackupFolder struct {
	ID      string            `json:"id"`
	Path    string            `json:"path"`
	Type    string            `json:"type"`
	Marker  string            `json:"markerName"`
	Devices []json.RawMessage `json:"devices"`
}

BackupFolder keeps unmodeled per-device fields intact when PATCH replaces the devices array. In particular, encryption passwords and introduction metadata must survive pairing another receiver.

func (BackupFolder) HasDevice

func (f BackupFolder) HasDevice(id string) bool

type Client

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

Client is immutable after construction and may serve concurrent reads. Credentials are supplied by the caller's existing privilege boundary.

func NewClient

func NewClient(key string) *Client

func (*Client) AddDevice

func (c *Client) AddDevice(ctx context.Context, id string) error

func (*Client) BackupDelivery

func (c *Client) BackupDelivery(ctx context.Context, devices []Device) (map[string]Delivery, error)

BackupDelivery reports, for every device, whether it holds the backup folder as this node shares it. A device's view is known only while it is connected: Syncthing forgets it on disconnect, so an offline device is never up to date here. Any failed read fails the whole answer.

func (*Client) BackupFolder

func (c *Client) BackupFolder(ctx context.Context, localID string) (BackupFolder, error)

func (*Client) CanonicalID

func (c *Client) CanonicalID(ctx context.Context, input string) (string, error)

CanonicalID delegates checksum and protocol parsing to the pinned daemon.

func (*Client) ConfirmPrivacy

func (c *Client) ConfirmPrivacy(ctx context.Context) error

ConfirmPrivacy requires explicit fields; missing values are not evidence of disabled discovery or reporting. It observes configuration without repairing it.

func (*Client) ListDevices

func (c *Client) ListDevices(ctx context.Context) ([]Device, error)

func (*Client) LocalID

func (c *Client) LocalID(ctx context.Context) (string, error)

func (*Client) RemoveDevice

func (c *Client) RemoveDevice(ctx context.Context, id string) error

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, endpoint, body string) (string, error)

Request never follows redirects or consults proxy environment variables. Error bodies are discarded because they may contain configuration secrets.

func (*Client) ShareBackup

func (c *Client) ShareBackup(ctx context.Context, f BackupFolder, id string) error

type Delivery

type Delivery struct {
	State     DeliveryState
	Percent   int
	Connected bool
	LastSeen  time.Time
}

Delivery is one device's state. Percent is set while receiving. LastSeen is Syncthing's record of the last connection or disconnection, zero if none.

type DeliveryState

type DeliveryState int

DeliveryState is what a paired device holds of the backup folder, as far as this node's Syncthing knows right now.

const (
	DeliveryNotShared DeliveryState = iota
	DeliveryUpToDate
	DeliveryReceiving
	DeliveryNotConnected
	DeliveryNotAccepted
	DeliveryPaused
	DeliveryChecking
	// DeliveryOutOfSync: a device changed the folder, so the newest version
	// is no longer the node's copy and no device can be said to hold it.
	DeliveryOutOfSync
)

type Device

type Device struct {
	Name         string
	DeviceID     string
	BackupKnown  bool
	BackupShared bool
}

Jump to

Keyboard shortcuts

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