webdav

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 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.

Documentation

Overview

Package webdav 实现 WebDAV 文件服务:多用户、每个用户映射到一个或多个目录,可设为只读。

Index

Constants

View Source
const ID = "webdav"

ID 是模块标识。

Variables

This section is empty.

Functions

This section is empty.

Types

type CertSource

type CertSource interface {
	GetCertificate(*tls.ClientHelloInfo) (*tls.Certificate, error)
}

CertSource 提供 HTTPS 证书。

type Module

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

Module 是 WebDAV 模块。

func New

func New(certs CertSource) *Module

New 创建模块。

func (*Module) ID

func (m *Module) ID() string

ID 实现 module.Module。

func (*Module) ImportLucky

func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)

ImportLucky 实现 luckyimport.Importer,迁移监听参数与用户(导入后默认停用)。 Lucky 用户的挂载列表转换为多目录用户;与 Gately 中已有用户同名的用户跳过,已有用户保持不变。

func (*Module) Init

func (m *Module) Init(env module.Env) error

Init 实现 module.Module。

func (*Module) Routes

func (m *Module) Routes(r module.Router)

Routes 实现 module.Module。

func (*Module) Start

func (m *Module) Start(context.Context) error

Start 实现 module.Module。

func (*Module) Stop

func (m *Module) Stop() error

Stop 实现 module.Module。

func (*Module) Title

func (m *Module) Title() string

Title 实现 module.Module。

type Settings

type Settings struct {
	Enable   bool   `json:"enable"`
	ListenIP string `json:"listenIp"`
	Port     int    `json:"port"`
	// TLS 时证书由证书模块按 SNI 提供
	TLS   bool   `json:"tls"`
	Users []User `json:"users"`
	// SharedUsers 为 true 时文件服务共享用户(见 fileusers 包)也可登录,与本地用户同名时只按本地用户校验
	SharedUsers bool `json:"sharedUsers"`
}

Settings 是模块配置。

func (*Settings) Validate

func (s *Settings) Validate() error

Validate 校验配置。

type User

type User struct {
	Name     string `json:"name"`
	Password string `json:"password"`
	// Root 为该用户可访问的目录(绝对路径),ReadOnly 作用于该目录;Mounts 非空时二者不再使用
	Root     string `json:"root"`
	ReadOnly bool   `json:"readOnly"`
	// Mounts 为多个目录:登录后根目录按名称列出各目录,每个目录可单独设为只读
	Mounts []mountfs.Mount `json:"mounts,omitempty"`
}

User 是一个 WebDAV 账号。

Jump to

Keyboard shortcuts

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