transport

package
v0.0.0-...-0aa804a Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoUSBMounts = errors.New("no suitable USB devices")

Functions

func FindStringInSlice

func FindStringInSlice(slice []string, val string) (int, bool)

func RemoveFTPSecret

func RemoveFTPSecret(configs ...FTPConfig)

func RemoveMatrixSecret

func RemoveMatrixSecret(configs ...MatrixConfig)

func RemoveS3Secret

func RemoveS3Secret(configs ...S3Config)

func RemoveWebDAVSecret

func RemoveWebDAVSecret(configs ...WebDAVConfig)

Types

type Config

type Config struct {
	S3     []S3Config     `json:"s3" yaml:"s3"`
	WebDAV []WebDAVConfig `json:"webDAV" yaml:"webdav"`
	Ftp    []FTPConfig    `json:"ftp" yaml:"ftp"`
	USB    []USBConfig    `json:"usb" yaml:"usb"`
}

func Filter

func Filter(config Config, exchanges []string) Config

func RemoveSecret

func RemoveSecret(config Config) Config

type Exchange

type Exchange interface {
	ID() string

	/** Connect to the transport using local as folder where download/upload files are */
	Connect(remoteRoot string, onUpdate chan Exchange) error
	Disconnect()

	List(since time.Time) ([]Item, error)

	/** Pull the requested file (full local) from the transport to the storage folder */
	Push(file, loc string) (int64, error)

	/** Pull the requested location from the transport to the storage folder*/
	Pull(loc, file string) (int64, error)

	/** Delete all files matching pattern and older than specified time */
	Delete(pattern string, before time.Time) error

	Name() string
	String() string
}

func GetExchanges

func GetExchanges(config Config) []Exchange

type FTPConfig

type FTPConfig struct {
	Name     string `json:"name" yaml:"name"`
	URL      string `json:"url" yaml:"url"`
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
	Timeout  int    `json:"timeout" yaml:"timeout"`
}

type FTPExchange

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

func (*FTPExchange) Connect

func (exchange *FTPExchange) Connect(remoteRoot string, _ chan Exchange) error

func (*FTPExchange) Delete

func (exchange *FTPExchange) Delete(pattern string, before time.Time) error

func (*FTPExchange) Disconnect

func (exchange *FTPExchange) Disconnect()

func (*FTPExchange) ID

func (exchange *FTPExchange) ID() string

func (*FTPExchange) List

func (exchange *FTPExchange) List(since time.Time) ([]Item, error)

func (*FTPExchange) Name

func (exchange *FTPExchange) Name() string

func (*FTPExchange) Pull

func (exchange *FTPExchange) Pull(loc, file string) (int64, error)

func (*FTPExchange) Push

func (exchange *FTPExchange) Push(file string, loc string) (int64, error)

func (*FTPExchange) String

func (exchange *FTPExchange) String() string

type Item

type Item struct {
	Loc     string
	ModTime time.Time
}

type MatrixConfig

type MatrixConfig struct {
	Name       string `json:"name" yaml:"name"`
	HomeServer string `json:"homeServer"`
	UserId     string `json:"userId"`
	AccessKey  string `json:"accessKey"`
	RoomId     string `json:"roomId"`

	Endpoint string `json:"endpoint" yaml:"endpoint"`
	Bucket   string `json:"bucket" yaml:"bucket"`
	Secret   string `json:"secret" yaml:"secret"`
	UseSSL   bool   `json:"useSSL" yaml:"useSSL"`
	Location string `json:"location" yaml:"location"`
}

type MatrixExchange

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

func (*MatrixExchange) Config

func (exchange *MatrixExchange) Config(withPrivateKeys bool) interface{}

func (*MatrixExchange) Connect

func (exchange *MatrixExchange) Connect(remoteRoot string, _ chan Exchange) error

func (*MatrixExchange) Delete

func (exchange *MatrixExchange) Delete(pattern string, before time.Time) error

func (*MatrixExchange) Disconnect

func (exchange *MatrixExchange) Disconnect()

func (*MatrixExchange) ID

func (exchange *MatrixExchange) ID() string

func (*MatrixExchange) List

func (exchange *MatrixExchange) List(since time.Time) ([]Item, error)

func (*MatrixExchange) Name

func (exchange *MatrixExchange) Name() string

func (*MatrixExchange) Pull

func (exchange *MatrixExchange) Pull(loc string, file string) (int64, error)

func (*MatrixExchange) Push

func (exchange *MatrixExchange) Push(file, loc string) (int64, error)

func (*MatrixExchange) String

func (exchange *MatrixExchange) String() string

type S3Config

type S3Config struct {
	Name      string `json:"name" yaml:"name"`
	Endpoint  string `json:"endpoint" yaml:"endpoint"`
	Bucket    string `json:"bucket" yaml:"bucket"`
	AccessKey string `json:"accessKey" yaml:"accessKey"`
	Secret    string `json:"secret" yaml:"secret"`
	UseSSL    bool   `json:"useSSL" yaml:"useSSL"`
	Location  string `json:"location" yaml:"location"`
}

type S3Exchange

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

func (*S3Exchange) Config

func (exchange *S3Exchange) Config(withPrivateKeys bool) interface{}

func (*S3Exchange) Connect

func (exchange *S3Exchange) Connect(remoteRoot string, _ chan Exchange) error

func (*S3Exchange) Delete

func (exchange *S3Exchange) Delete(pattern string, before time.Time) error

func (*S3Exchange) Disconnect

func (exchange *S3Exchange) Disconnect()

func (*S3Exchange) ID

func (exchange *S3Exchange) ID() string

func (*S3Exchange) List

func (exchange *S3Exchange) List(since time.Time) ([]Item, error)

func (*S3Exchange) Name

func (exchange *S3Exchange) Name() string

func (*S3Exchange) Pull

func (exchange *S3Exchange) Pull(loc string, file string) (int64, error)

func (*S3Exchange) Push

func (exchange *S3Exchange) Push(file, loc string) (int64, error)

func (*S3Exchange) String

func (exchange *S3Exchange) String() string

type USBConfig

type USBConfig struct {
	Name string `json:"name" yaml:"name"`
}

type USBExchange

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

func (*USBExchange) Connect

func (exchange *USBExchange) Connect(remoteRoot string, onUpdate chan Exchange) error

func (*USBExchange) Delete

func (exchange *USBExchange) Delete(string, time.Time) error

func (*USBExchange) Disconnect

func (exchange *USBExchange) Disconnect()

func (*USBExchange) ID

func (exchange *USBExchange) ID() string

func (*USBExchange) List

func (exchange *USBExchange) List(since time.Time) ([]Item, error)

func (*USBExchange) Name

func (exchange *USBExchange) Name() string

func (*USBExchange) Pull

func (exchange *USBExchange) Pull(loc, file string) (int64, error)

func (*USBExchange) Push

func (exchange *USBExchange) Push(file, loc string) (int64, error)

func (*USBExchange) String

func (exchange *USBExchange) String() string

type WebDAVConfig

type WebDAVConfig struct {
	Name     string `json:"name" yaml:"name"`
	URL      string `json:"url" yaml:"url"`
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
	Timeout  int    `json:"timeout" yaml:"timeout"`
}

type WebDAVExchange

type WebDAVExchange struct {
	UUID string
	// contains filtered or unexported fields
}

func (*WebDAVExchange) Config

func (exchange *WebDAVExchange) Config(withPrivateKeys bool) interface{}

func (*WebDAVExchange) Connect

func (exchange *WebDAVExchange) Connect(remoteRoot string, _ chan Exchange) error

func (*WebDAVExchange) Delete

func (exchange *WebDAVExchange) Delete(pattern string, before time.Time) error

func (*WebDAVExchange) Disconnect

func (exchange *WebDAVExchange) Disconnect()

func (*WebDAVExchange) ID

func (exchange *WebDAVExchange) ID() string

func (*WebDAVExchange) List

func (exchange *WebDAVExchange) List(since time.Time) ([]Item, error)

func (*WebDAVExchange) Name

func (exchange *WebDAVExchange) Name() string

func (*WebDAVExchange) Pull

func (exchange *WebDAVExchange) Pull(loc, file string) (int64, error)

func (*WebDAVExchange) Push

func (exchange *WebDAVExchange) Push(file, loc string) (int64, error)

func (*WebDAVExchange) String

func (exchange *WebDAVExchange) String() string

Jump to

Keyboard shortcuts

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