cloudsync

package
v1.7.20 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 33 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

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLocalData = errors.New("no ccl configuration or OAuth credentials found to sync")

Functions

func GoogleDriveUnavailable added in v1.7.0

func GoogleDriveUnavailable() error

GoogleDriveUnavailable explains why this build cannot log in to Google Drive (a development build has no OAuth client), or is nil when it can.

func HasActiveProfile

func HasActiveProfile() (bool, error)

func KeyModeDescription

func KeyModeDescription(mode string) string

KeyModeDescription describes how this device unlocks the active profile.

func PrimaryRemoteAlias

func PrimaryRemoteAlias() (string, error)

func RenameRemote

func RenameRemote(alias, newAlias string) error

func SetPrimaryRemote

func SetPrimaryRemote(alias string) error

func SetRemoteMirror

func SetRemoteMirror(alias string, enabled bool) error

func WithPastedRedirect added in v1.5.24

func WithPastedRedirect(ctx context.Context, in io.Reader) context.Context

WithPastedRedirect makes Google Drive login in ctx print the authorization URL instead of opening a browser, and read the address the browser was redirected to from in. Hosts without a browser (SSH, Cloud Shell) need this: Google's device flow rejects the drive.appdata scope, and the 127.0.0.1 redirect only reaches ccl from a browser on the same machine.

Types

type Diagnostic

type Diagnostic struct {
	Level   string
	Message string
}

type DiagnosticReport

type DiagnosticReport struct {
	Configured bool
	ProfileID  string
	Remotes    int
	Checks     []Diagnostic
}

func DiagnoseLocal

func DiagnoseLocal() DiagnosticReport

DiagnoseLocal runs the local cloud-sync health checks in fixed order. Each diagnose* step appends to the report; steps may halt the pipeline by returning false when later checks would be meaningless.

type LoginResult

type LoginResult struct {
	RemoteDir string
	DeviceID  string
	Alias     string
	Provider  string
	Existing  bool
	KeyMode   string
}

func LoginGoogleDriveNamed

func LoginGoogleDriveNamed(
	ctx context.Context,
	alias string,
	notice interface{ Write([]byte) (int, error) },
) (LoginResult, error)

LoginGoogleDriveNamed connects a Google account under a local alias. On a device without a profile it opens (or creates) the one stored in that account; otherwise it attaches the account to the active profile.

func LoginICloudNamed

func LoginICloudNamed(alias string) (LoginResult, error)

type LogoutOptions

type LogoutOptions struct {
	Revoke       bool
	DeleteRemote bool
	ForceLocal   bool
}

type LogoutResult

type LogoutResult struct {
	Alias         string
	Provider      string
	NewPrimary    string
	RemoteDeleted bool
	TokenRevoked  bool
	LocalOnly     bool
}

func LogoutRemote

func LogoutRemote(ctx context.Context, alias string, options LogoutOptions) (LogoutResult, error)

type Manager

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

func Load

func Load() (*Manager, error)

func LoadRemote

func LoadRemote(alias string) (*Manager, error)

LoadRemote loads a cloud remote. An empty alias selects the primary remote.

func (*Manager) Pull

func (m *Manager) Pull(tagValue string, force bool) (PullResult, error)

func (*Manager) Status

func (m *Manager) Status() (Status, error)

func (*Manager) Tag

func (m *Manager) Tag(value string) (TagResult, error)

type PartialPushError

type PartialPushError struct {
	Message string
}

func (*PartialPushError) Error

func (err *PartialPushError) Error() string

func (*PartialPushError) ExitCode

func (*PartialPushError) ExitCode() int

type PullResult

type PullResult struct {
	Tag        string
	Hash       string
	ID         string
	Downloaded bool
	BackupPath string
}

type PushResult

type PushResult struct {
	Tag      string
	Hash     string
	ID       string
	Uploaded bool
}

type RemoteInfo

type RemoteInfo struct {
	ID          string
	Alias       string
	Provider    string
	ProfileID   string
	Primary     bool
	Mirror      bool
	Enabled     bool
	SignedIn    bool
	RemoteLabel string
	AccountHint string
}

func ListRemotes

func ListRemotes() ([]RemoteInfo, error)

ListRemotes returns the locally configured cloud remotes in stable order. It does not contact any provider.

type RemotePushOutcome

type RemotePushOutcome struct {
	Alias  string
	Result PushResult
	Err    error
}

func PushRemotes

func PushRemotes(to string, all, force, bestEffort bool) ([]RemotePushOutcome, error)

PushRemotes pushes one prepared encrypted snapshot to one or more remotes. All targets are preflighted before the first write unless bestEffort is set.

type Status

type Status struct {
	Alias          string
	Primary        bool
	Mirror         bool
	Provider       string
	KeyMode        string
	RemoteDir      string
	DeviceID       string
	LocalHash      string
	PendingTag     string
	RemoteTag      string
	RemoteID       string
	RemoteHash     string
	RemoteDeviceID string
	RemoteCreated  time.Time
	LastOperation  string
	LastSyncAt     time.Time
	State          string
}

type TagResult

type TagResult struct {
	Tag  string
	Hash string
}

Jump to

Keyboard shortcuts

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