mountfs

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 13 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 mountfs 把多个本地目录组合成一个虚拟文件系统:根目录只读,按挂载名称列出各目录, 每个挂载可单独设为只读。FTP 与 WebDAV 用户挂载多个目录时使用。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Afero

func Afero(mounts []Mount) afero.Fs

Afero 返回由 mounts 组成的 afero.Fs,挂载列表需已通过 Validate。

func RootAfero added in v0.6.8

func RootAfero(dir string) afero.Fs

RootAfero 返回限定在 dir 内的 afero.Fs。修改属主(FTP 的 SITE CHOWN)一律拒绝: 文件服务以 Gately 进程身份读写,允许改属主等于让客户端把文件交给任意系统用户。

func RootDAV added in v0.6.8

func RootDAV(dir string) xwebdav.FileSystem

RootDAV 返回限定在 dir 内的 webdav.FileSystem。

func Validate

func Validate(mounts []Mount) error

Validate 校验并规范化挂载列表:名称非空、不含路径分隔符且不重复,目录为绝对路径。

func WebDAV

func WebDAV(mounts []Mount) xwebdav.FileSystem

WebDAV 返回由 mounts 组成的 webdav.FileSystem,挂载列表需已通过 Validate。

Types

type Mount

type Mount struct {
	// Name 是虚拟根目录下显示的目录名
	Name string `json:"name"`
	// Path 是本地目录(绝对路径)
	Path     string `json:"path"`
	ReadOnly bool   `json:"readOnly"`
}

Mount 是用户可访问的一个目录。

type ReadOnlyDAV

type ReadOnlyDAV struct{ xwebdav.FileSystem }

ReadOnlyDAV 包装 webdav.FileSystem,拒绝所有写操作。

func (ReadOnlyDAV) Mkdir

func (ReadOnlyDAV) OpenFile

func (r ReadOnlyDAV) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (xwebdav.File, error)

func (ReadOnlyDAV) RemoveAll

func (ReadOnlyDAV) RemoveAll(context.Context, string) error

func (ReadOnlyDAV) Rename

Jump to

Keyboard shortcuts

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