davserver

package
v0.0.0-...-c511dfe Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByID

type ByID []Dav

ByID implements sort.Interface for []Dav based on the Id field

func (ByID) Len

func (a ByID) Len() int

func (ByID) Less

func (a ByID) Less(i, j int) bool

func (ByID) Swap

func (a ByID) Swap(i, j int)

type Dav

type Dav struct {
	ID                   int      `json:"id"`
	Host                 string   `json:"host"`                 // to match against request Host header
	Root                 string   `json:"root"`                 // the file system directory to serve the webdav from
	Writable             bool     `json:"writable,omitempty"`   // whether if the webdav is writable (default to read only)
	Name                 string   `json:"name,omitempty"`       // name of the file service
	Icon                 string   `json:"icon,omitempty"`       // icon to display
	Color                string   `json:"color,omitempty"`      // icon's color
	Secured              bool     `json:"secured"`              // true if the handler is secured with auth
	Roles                []string `json:"roles,omitempty"`      // Roles allowed to access the file service
	EncryptionPassphrase string   `json:"passphrase,omitempty"` // passphrase to encrypt data
	UsedGB               uint64   `json:"usedgb,omitempty"`
	TotalGB              uint64   `json:"totalgb,omitempty"`
}

Dav represents a webdav file service

type Server

type Server struct {
	Mu sync.RWMutex // guards the fields below

	Davs []*dav
	// contains filtered or unexported fields
}

Server implements an http.Handler that acts as an augmented webdav server

func NewServer

func NewServer(file string, authzF authzFunc) (*Server, error)

NewServer constructs a Server that reads davs from file

func (*Server) AddDav

func (s *Server) AddDav(w http.ResponseWriter, req *http.Request)

AddDav adds an dav

func (*Server) DeleteDav

func (s *Server) DeleteDav(w http.ResponseWriter, req *http.Request)

DeleteDav adds an dav

func (*Server) LoadDavs

func (s *Server) LoadDavs() error

LoadDavs tests whether file has been modified since its last invocation and, if so, loads the dav set from file.

func (*Server) ProcessDavs

func (s *Server) ProcessDavs(w http.ResponseWriter, req *http.Request)

ProcessDavs processes davs regarding of HTTP method

func (*Server) SendDavs

func (s *Server) SendDavs(w http.ResponseWriter, req *http.Request)

SendDavs send davs as response from an http requests

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP matches the Request with a dav and, if found, serves the request with the dav's handler.

type WebdavAug

type WebdavAug struct {
	// contains filtered or unexported fields
}

WebdavAug represents an augmented webdav which enable download of directories as streamed zip files

func NewWebDavAug

func NewWebDavAug(prefix string, directory string, canWrite bool, passphrase string) WebdavAug

NewWebDavAug create an initialized WebdavAug instance

func (WebdavAug) ServeHTTP

func (wdaug WebdavAug) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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