cli

package
v0.0.0-...-7570391 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const GrpcChunkLen = 32 * 1024

Variables

View Source
var ErrNoLocalPathDefined = errors.New("No local root path is defined.")
View Source
var ErrUnknownVhost = errors.New("Unknown vhost.")
View Source
var Log = logger.Registry().Category("cli")

Functions

func Attr

func Attr(ctx context.Context, cfg *CliConfig, args []string) error

func Get

func Get(ctx context.Context, cfg *CliConfig, args []string) error

func Ls

func Ls(ctx context.Context, w io.Writer, cfg *CliConfig, args []string) error

func NewWriter

func NewWriter(pathstr string, ofs ...Option) (io.WriteCloser, error)

func NewWriterHttpForTesting

func NewWriterHttpForTesting(cinfo *ConnectionInfo, id uint64) (io.WriteCloser, error)

func Put

func Put(ctx context.Context, cfg *CliConfig, args []string) error

func TLSConfigFromCert

func TLSConfigFromCert(cert *x509.Certificate) (*tls.Config, error)

Types

type CliConfig

type CliConfig struct {
	Host map[string]*Host

	Fe     FeConfig
	Webdav WebdavConfig

	LocalRootPath string
	TrashDirPath  string
}

func NewConfig

func NewConfig(configdir string) (*CliConfig, error)

func (*CliConfig) ResolveLocalPath

func (cfg *CliConfig) ResolveLocalPath(relpath string) (string, error)

type ConnectionInfo

type ConnectionInfo struct {
	ApiEndpoint string
	TLSConfig   *tls.Config
}

func ConnectionInfoFromHost

func ConnectionInfoFromHost(h *Host) *ConnectionInfo

func QueryConnectionInfo

func QueryConnectionInfo(cfg *CliConfig, vhost string) (*ConnectionInfo, error)

func (*ConnectionInfo) DialGrpc

func (ci *ConnectionInfo) DialGrpc(ctx context.Context) (*grpc.ClientConn, error)

type FeConfig

type FeConfig struct {
	ListenAddr    string
	WebUIRootPath string `toml:"webui_root_path"`

	Certs     []*x509.Certificate
	CertsFile string
	Key       crypto.PrivateKey
	KeyFile   string

	BasicAuthUser     string
	BasicAuthPassword string
}

type Host

type Host struct {
	ApiEndpoint string

	// FIXME: Remove ExpectedCertFile
	ExpectedCertFile   string
	OverrideServerName string

	CACert     *x509.Certificate
	CACertFile string `toml:"ca_cert_file"`
	Certs      []*x509.Certificate
	CertsFile  string
	Key        crypto.PrivateKey
	KeyFile    string
}

type Option

type Option func(*options)

func AllowOverwrite

func AllowOverwrite(b bool) Option

AllowOverwrite allows NewWriter to open an existing file.

func ForceGrpc

func ForceGrpc() Option

func WithCliConfig

func WithCliConfig(cfg *CliConfig) Option

func WithContext

func WithContext(ctx context.Context) Option

type Reader

type Reader interface {
	io.ReadCloser
	Size() int64
}

func NewReader

func NewReader(pathstr string, options ...Option) (Reader, error)

func NewReaderHttpForTesting

func NewReaderHttpForTesting(cinfo *ConnectionInfo, id uint64) (Reader, error)

type WebdavConfig

type WebdavConfig struct {
	ListenAddr string

	NoTls     bool
	Certs     []*x509.Certificate
	CertsFile string
	Key       crypto.PrivateKey
	KeyFile   string

	BasicAuthUser     string
	BasicAuthPassword string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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