lib

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*User
	Auth      bool
	Debug     bool
	NoSniff   bool
	Cors      CorsCfg
	Users     map[string]*User
	LogFormat string
}

Config is the configuration of a WebDAV instance.

func (*Config) ServeHTTP

func (c *Config) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP determines if the request is for this plugin, and if all prerequisites are met.

type CorsCfg

type CorsCfg struct {
	Enabled        bool
	Credentials    bool
	AllowedHeaders []string
	AllowedHosts   []string
	AllowedMethods []string
	ExposedHeaders []string
}

CorsCfg is the CORS config.

type NoSniffFileInfo

type NoSniffFileInfo struct {
	os.FileInfo
}

NoSniffFileInfo wraps any generic FileInfo interface and bypasses mime type sniffing.

func (NoSniffFileInfo) ContentType

func (w NoSniffFileInfo) ContentType(ctx context.Context) (contentType string, err error)

type Rule

type Rule struct {
	Regex  bool
	Allow  bool
	Modify bool
	Path   string
	Regexp *regexp.Regexp
}

Rule is a dissalow/allow rule.

type User

type User struct {
	Username string
	Password string
	Scope    string
	Modify   bool
	Rules    []*Rule
	Handler  *webdav.Handler
}

User contains the settings of each user.

func (User) Allowed

func (u User) Allowed(url string, noModification bool) bool

Allowed checks if the user has permission to access a directory/file

type WebDavDir

type WebDavDir struct {
	webdav.Dir
	NoSniff bool
}

func (WebDavDir) OpenFile

func (d WebDavDir) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)

func (WebDavDir) Stat

func (d WebDavDir) Stat(ctx context.Context, name string) (os.FileInfo, error)

type WebDavFile

type WebDavFile struct {
	webdav.File
}

func (WebDavFile) Readdir

func (f WebDavFile) Readdir(count int) (fis []os.FileInfo, err error)

func (WebDavFile) Stat

func (f WebDavFile) Stat() (os.FileInfo, error)

Jump to

Keyboard shortcuts

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