gowebdav

package module
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-webdav

package main

import (
	gowebdav "github.com/zijiren233/go-webdav"
)

func main() {
	ser := gowebdav.NewWebdav()
	ser.DefaultClient("", ".")
	ser.Run(":8080")
}

package main

import (
	gowebdav "github.com/zijiren233/go-webdav"
)

func main() {
	ser := gowebdav.NewWebdav()
	ser.DefaultClient("/prefix1", ".")
	c := ser.DefaultClient("/prefix2", "../")
	c.AddUser("admin", "admin", gowebdav.O_RDWR)
	ser.Run(":8080")
}

Documentation

Index

Constants

View Source
const (
	O_RDWR   mode = syscall.O_RDONLY
	O_WRONLY mode = syscall.O_WRONLY
	O_RDONLY mode = syscall.O_RDWR
)

Variables

View Source
var CORSDefault = CORSConfig{
	Allow_Origin:      "*",
	Max_Age:           "86400",
	Allow_Methods:     "*",
	Allow_Headers:     "*",
	Allow_Credentials: "true",
}

Functions

func Defaulthandle added in v0.4.1

func Defaulthandle(client *Cli) gin.HandlerFunc

func Logger added in v0.4.0

func Logger() gin.HandlerFunc

Perfection of gin logger middleware

Types

type CORSConfig added in v0.4.1

type CORSConfig struct {
	Allow_Origin, Max_Age, Allow_Methods, Allow_Headers, Allow_Credentials string
}

type Cli added in v0.4.1

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

func (*Cli) FS added in v0.4.1

func (client *Cli) FS() *webdav.Handler

func (*Cli) GlobalReadOnly added in v0.4.1

func (client *Cli) GlobalReadOnly()

It only takes effect if no user is set

func (*Cli) SetCORS added in v0.4.1

func (client *Cli) SetCORS(config CORSConfig)

func (*Cli) UnSetReadOnly added in v0.4.1

func (client *Cli) UnSetReadOnly()

It only takes effect if no user is set

type Client

type Client interface {
	GlobalReadOnly()
	UnSetReadOnly()

	SetCORS(config CORSConfig)

	FS() *webdav.Handler
	// contains filtered or unexported methods
}

type HandlerFunc added in v0.4.1

type HandlerFunc func(*Cli) gin.HandlerFunc

type Server

type Server interface {
	// All client path prefix levels must match
	DefaultClient(pathPrefix, filePath string) Client
	// All client path prefix levels must match
	Client(pathPrefix, filePath string, handlerFunc HandlerFunc) Client
	// All client path prefix levels must match
	DefaultClientWithMemFS(pathPrefix string) Client
	// All client path prefix levels must match
	ClientWithMemFS(pathPrefix string, handlerFunc HandlerFunc) Client
	Run(addr ...string) error
	RunTLS(addr string, certFile string, keyFile string) error
	// Fill in the domain name to automatically apply for a certificate and run on port 443
	RunAUTOTLS(domain ...string) error
	// http -auto-> https
	SSLRedirect(SSLHost string)
	GinEngine() *gin.Engine
}

func NewWebdav

func NewWebdav() Server

All client path prefix levels must match

func NewWebdavWithGin added in v0.2.0

func NewWebdavWithGin(engine *gin.Engine) Server

All client path prefix levels must match

type SortFileInfo added in v0.5.0

type SortFileInfo []fs.FileInfo

func (SortFileInfo) Len added in v0.5.0

func (x SortFileInfo) Len() int

func (SortFileInfo) Less added in v0.5.0

func (x SortFileInfo) Less(i, j int) bool

func (SortFileInfo) Swap added in v0.5.0

func (x SortFileInfo) Swap(i, j int)

Jump to

Keyboard shortcuts

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