server

package
v0.0.0-...-7a3841b Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WebDAVMethods = []string{
	"OPTIONS",
	"GET",
	"HEAD",
	"POST",
	"DELETE",
	"PUT",
	"MKCOL",
	"COPY",
	"MOVE",
	"LOCK",
	"UNLOCK",
	"PROPFIND",
	"PROPPATCH",
}

WebDAVMethods http

Functions

func GetInstancePath

func GetInstancePath() (string, error)

GetInstancePath get instance path

func NotFound

func NotFound(w http.ResponseWriter, r *http.Request)

NotFound 404 action

func PathExist

func PathExist(path string) (bool, error)

PathExist check path exists

func UserPwd

func UserPwd(salt, uid, pwd string) string

UserPwd UserPwd

Types

type Config

type Config struct {
	PassSalt string

	Listen string
	Prefix string

	StlCrt string //https
	StlKey string

	RootPath string

	Users map[string]*User
}

Config config

type Server

type Server struct {
	Cfg *Config

	DavHandlers map[string]*webdav.Handler

	Users *sync.Map //[uid]User

	Router *httprouter.Router

	Sesstions *sessions.FilesystemStore
}

Server gdav server

func NewServer

func NewServer(cfg *Config) (svr *Server, err error)

NewServer make gdav server

func (*Server) BasicAuth

func (svr *Server) BasicAuth(w http.ResponseWriter, r *http.Request) *User

BasicAuth auth uid login

func (*Server) HandleFunc

func (svr *Server) HandleFunc(w http.ResponseWriter, r *http.Request)

HandleFunc handle req

func (*Server) RegRouter

func (svr *Server) RegRouter()

RegRouter RegRouter

func (*Server) Run

func (svr *Server) Run()

Run go run

func (*Server) Start

func (svr *Server) Start()

Start start

type User

type User struct {
	UID   string
	Pwd   string
	Root  string   // default .
	Hides []string // ref .gitingroe

	WebDav *webdav.Handler
}

User web auth

func (*User) HandleLimits

func (user *User) HandleLimits(w http.ResponseWriter, r *http.Request) (isLimit bool, err error)

HandleLimits handle limit bool,is limit for path

Jump to

Keyboard shortcuts

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