webdav

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2018 License: MIT Imports: 5 Imported by: 0

README

webdav

Build Go Report Card

webdav is a simple tool that creates a WebDAV server for you. By default, it runs on a random free port and supports JSON and YAML configuration. Here is a simple YAML configuration example:

scope: /path/to/files
address: 0.0.0.0
port: 8080
tls: false
cert: cert.pem
key: key.pem
users:
  - username: admin
    password: admin
  - username: encrypted
    password: "{bcrypt}$2y$10$zEP6oofmXFeHaeMfBNLnP.DO8m.H.Mwhd24/TOX2MWLxAExXi4qgi"
  - username: basic
    password: basic
    modify:   false
    rules:
      - regex: false
      - allow: false
      - path: /some/file

You can specify the path to the configuration file using the --config flag. By default, it will search for a config.{yaml,json} file on your current working directory.

An example of how to use this with systemd is on webdav.service.example.

Download it here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*User
	Users map[string]*User
}

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 Rule

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

Rule is a dissalow/allow rule.

type User

type User struct {
	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) bool

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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