webdavd

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package webdavd implements the WebDAV protocol

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReloadTLSCertificate

func ReloadTLSCertificate() error

ReloadTLSCertificate reloads the TLS certificate and key from the configured paths

Types

type Cache

type Cache struct {
	Users     UsersCacheConfig `json:"users" mapstructure:"users"`
	MimeTypes MimeCacheConfig  `json:"mime_types" mapstructure:"mime_types"`
}

Cache configuration

type Configuration

type Configuration struct {
	// The port used for serving FTP requests
	BindPort int `json:"bind_port" mapstructure:"bind_port"`
	// The address to listen on. A blank value means listen on all available network interfaces.
	BindAddress string `json:"bind_address" mapstructure:"bind_address"`
	// If files containing a certificate and matching private key for the server are provided the server will expect
	// HTTPS connections.
	// Certificate and key files can be reloaded on demand sending a "SIGHUP" signal on Unix based systems and a
	// "paramchange" request to the running service on Windows.
	CertificateFile    string `json:"certificate_file" mapstructure:"certificate_file"`
	CertificateKeyFile string `json:"certificate_key_file" mapstructure:"certificate_key_file"`
	// CORS configuration
	Cors Cors `json:"cors" mapstructure:"cors"`
	// Cache configuration
	Cache Cache `json:"cache" mapstructure:"cache"`
}

Configuration defines the configuration for the WevDAV server

func (*Configuration) Initialize

func (c *Configuration) Initialize(configDir string) error

Initialize configures and starts the WebDav server

type Connection

type Connection struct {
	*common.BaseConnection
	// contains filtered or unexported fields
}

Connection details for a WebDav connection.

func (*Connection) Disconnect

func (c *Connection) Disconnect() error

Disconnect closes the active transfer

func (*Connection) GetClientVersion

func (c *Connection) GetClientVersion() string

GetClientVersion returns the connected client's version.

func (*Connection) GetCommand

func (c *Connection) GetCommand() string

GetCommand returns the request method

func (*Connection) GetRemoteAddress

func (c *Connection) GetRemoteAddress() string

GetRemoteAddress return the connected client's address

func (*Connection) Mkdir

func (c *Connection) Mkdir(ctx context.Context, name string, perm os.FileMode) error

Mkdir creates a directory using the connection filesystem

func (*Connection) OpenFile

func (c *Connection) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)

OpenFile opens the named file with specified flag. This method is used for uploads and downloads but also for Stat and Readdir

func (*Connection) RemoveAll

func (c *Connection) RemoveAll(ctx context.Context, name string) error

RemoveAll removes path and any children it contains. If the path does not exist, RemoveAll returns nil (no error).

func (*Connection) Rename

func (c *Connection) Rename(ctx context.Context, oldName, newName string) error

Rename renames a file or a directory

func (*Connection) Stat

func (c *Connection) Stat(ctx context.Context, name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file/directory, or an error, if any happens

type Cors

type Cors struct {
	AllowedOrigins   []string `json:"allowed_origins" mapstructure:"allowed_origins"`
	AllowedMethods   []string `json:"allowed_methods" mapstructure:"allowed_methods"`
	AllowedHeaders   []string `json:"allowed_headers" mapstructure:"allowed_headers"`
	ExposedHeaders   []string `json:"exposed_headers" mapstructure:"exposed_headers"`
	AllowCredentials bool     `json:"allow_credentials" mapstructure:"allow_credentials"`
	Enabled          bool     `json:"enabled" mapstructure:"enabled"`
	MaxAge           int      `json:"max_age" mapstructure:"max_age"`
}

Cors configuration

type MimeCacheConfig added in v1.2.0

type MimeCacheConfig struct {
	Enabled bool `json:"enabled" mapstructure:"enabled"`
	MaxSize int  `json:"max_size" mapstructure:"max_size"`
}

MimeCacheConfig defines the cache configuration for mime types

type UsersCacheConfig added in v1.2.0

type UsersCacheConfig struct {
	ExpirationTime int `json:"expiration_time" mapstructure:"expiration_time"`
	MaxSize        int `json:"max_size" mapstructure:"max_size"`
}

UsersCacheConfig defines the cache configuration for users

Jump to

Keyboard shortcuts

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