Documentation ¶
Overview ¶
Package webdavd implements the WebDAV protocol
Index ¶
- func ReloadTLSCertificate() error
- type Cache
- type Configuration
- type Connection
- func (c *Connection) Disconnect() error
- func (c *Connection) GetClientVersion() string
- func (c *Connection) GetCommand() string
- func (c *Connection) GetRemoteAddress() string
- func (c *Connection) Mkdir(ctx context.Context, name string, perm os.FileMode) error
- func (c *Connection) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)
- func (c *Connection) RemoveAll(ctx context.Context, name string) error
- func (c *Connection) Rename(ctx context.Context, oldName, newName string) error
- func (c *Connection) Stat(ctx context.Context, name string) (os.FileInfo, error)
- type Cors
- type MimeCacheConfig
- type UsersCacheConfig
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) 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).
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