Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Mapping between backup file URI scheme and its provider constructor AvailableProviders = map[string]BackupProviderConstructor{ "": ConstructLocalFileProvider, "file": ConstructLocalFileProvider, "kdeconnect": ConstructKDEConnectProvider, } )
Functions ¶
This section is empty.
Types ¶
type BackupProvider ¶
type BackupProvider interface { // FetchBackup returns the content of a backup file. The returned backup may // be encrypted. FetchBackup() ([]byte, error) }
BackupProvider is an interface for obtaining andOTP backup
func ConstructBackupProvider ¶
func ConstructBackupProvider(uri *url.URL) (BackupProvider, error)
ConstructBackupProvider constructs the appropriate backup provider according to the backup file URI scheme
func ConstructKDEConnectProvider ¶
func ConstructKDEConnectProvider(uri *url.URL) (BackupProvider, error)
ConstructKDEConnectProvider constructs a KDE Connect backup provider
func ConstructLocalFileProvider ¶
func ConstructLocalFileProvider(uri *url.URL) (BackupProvider, error)
ConstructLocalFileProvider constructs a local file backup provider
type BackupProviderConstructor ¶
type BackupProviderConstructor func(uri *url.URL) (BackupProvider, error)
BackupProviderConstructor is the signature of BackupProvider constructor
type KDEConnect ¶
type KDEConnect struct {
// contains filtered or unexported fields
}
KDEConnect provides andOTP backup from a file inside a KDE Connect device. Implements BackupProvider.
func NewKDEConnect ¶
func NewKDEConnect(deviceNameOrID string, filepath string) (*KDEConnect, error)
NewKDEConnectFromDeviceHostPort creates a new KDEConnect backup provider from the device's name or ID. The device's SFTP host & port will be discovered automatically.
For the device to expose the SFTP port, we'll need to manually click "Browse this device" on the KDE Connect desktop program. The device's IP can be obtained from `mount | grep kdeconnect | grep <deviceID>`, while its IP can be obtained from `ss -plnaut | grep "<device-ip>" | grep "ssh"`.
func NewKDEConnectFromDeviceHostPort ¶
func NewKDEConnectFromDeviceHostPort(host string, port string, filepath string) (*KDEConnect, error)
NewKDEConnectFromDeviceHostPort creates a new KDEConnect backup provider from the device's SFTP host & port.
func (*KDEConnect) FetchBackup ¶
func (p *KDEConnect) FetchBackup() ([]byte, error)
FetchBackup returns the content of the backup file according to the filepath
type LocalFile ¶
type LocalFile struct {
// contains filtered or unexported fields
}
LocalFile provides andOTP backup from a local file. Implements BackupProvider.
func NewLocalFile ¶
NewLocalFile creates a new LocalFile backup provider
func (*LocalFile) FetchBackup ¶
FetchBackup returns the content of the backup file according to the filepath