Documentation
¶
Overview ¶
Package syncthing owns loopback access to the pinned Syncthing daemon.
Index ¶
- Constants
- func WithMutationLock(action func() error) error
- type BackupFolder
- type Client
- func (c *Client) AddDevice(ctx context.Context, id string) error
- func (c *Client) BackupDelivery(ctx context.Context, devices []Device) (map[string]Delivery, error)
- func (c *Client) BackupFolder(ctx context.Context, localID string) (BackupFolder, error)
- func (c *Client) CanonicalID(ctx context.Context, input string) (string, error)
- func (c *Client) ConfirmPrivacy(ctx context.Context) error
- func (c *Client) ListDevices(ctx context.Context) ([]Device, error)
- func (c *Client) LocalID(ctx context.Context) (string, error)
- func (c *Client) RemoveDevice(ctx context.Context, id string) error
- func (c *Client) Request(ctx context.Context, method, endpoint, body string) (string, error)
- func (c *Client) ShareBackup(ctx context.Context, f BackupFolder, id string) error
- type Delivery
- type DeliveryState
- type Device
Constants ¶
const GUIBase = "http://127.0.0.1:8384"
Variables ¶
This section is empty.
Functions ¶
func WithMutationLock ¶
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 (*Client) BackupDelivery ¶
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 (*Client) CanonicalID ¶
CanonicalID delegates checksum and protocol parsing to the pinned daemon.
func (*Client) ConfirmPrivacy ¶
ConfirmPrivacy requires explicit fields; missing values are not evidence of disabled discovery or reporting. It observes configuration without repairing it.
func (*Client) Request ¶
Request never follows redirects or consults proxy environment variables. Error bodies are discarded because they may contain configuration secrets.
func (*Client) ShareBackup ¶
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 ( 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 )