Documentation
¶
Overview ¶
Package webdav 实现 WebDAV 文件服务:多用户、每个用户映射到一个或多个目录,可设为只读。
Index ¶
- Constants
- type CertSource
- type Module
- func (m *Module) ID() string
- func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)
- func (m *Module) Init(env module.Env) error
- func (m *Module) Routes(r module.Router)
- func (m *Module) Start(context.Context) error
- func (m *Module) Stop() error
- func (m *Module) Title() string
- type Settings
- type User
Constants ¶
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 (*Module) ImportLucky ¶
func (m *Module) ImportLucky(doc luckyimport.Document, opts luckyimport.Options) (*luckyimport.Report, error)
ImportLucky 实现 luckyimport.Importer,迁移监听参数与用户(导入后默认停用)。 Lucky 用户的挂载列表转换为多目录用户;与 Gately 中已有用户同名的用户跳过,已有用户保持不变。
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 bool `json:"sharedUsers"`
}
Settings 是模块配置。
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 账号。