Documentation
¶
Index ¶
- func CheckConfigPermissions(path string) ([]string, []error)
- func DefaultConfigPath() string
- func ResolveS3Provider(provider string) string
- type Config
- type ConfigError
- type DaemonConfig
- type MountEntry
- type S3Config
- type SMBConfig
- type SSHFSConfig
- type SSHTunnelConfig
- type SortingConfig
- type StringOrSlice
- type WebDAVConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckConfigPermissions ¶
CheckConfigPermissions 检查配置文件是否具有安全权限
func ResolveS3Provider ¶ added in v0.2.0
Types ¶
type Config ¶
type Config struct {
Mounts []MountEntry `yaml:"mounts" mapstructure:"mounts"`
Include []string `yaml:"include,omitempty" mapstructure:"include"`
Sorting *SortingConfig `yaml:"sorting,omitempty" mapstructure:"sorting"`
Daemon *DaemonConfig `yaml:"daemon,omitempty" mapstructure:"daemon"`
}
func (*Config) FindByName ¶
func (c *Config) FindByName(name string) (*MountEntry, bool)
FindByName 按名称查找挂载条目
func (*Config) GetMountEntryNames ¶
GetMountEntryNames 返回所有挂载条目名称
func (*Config) SetMountStatus ¶
SetMountStatus 更新条目的挂载状态
type ConfigError ¶
ConfigError 配置加载或验证错误
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
func (*ConfigError) Unwrap ¶
func (e *ConfigError) Unwrap() error
type DaemonConfig ¶
type DaemonConfig struct {
LogTarget string `yaml:"log_target,omitempty" mapstructure:"log_target"`
LogFile string `yaml:"log_file,omitempty" mapstructure:"log_file"`
SocketPath string `yaml:"socket_path,omitempty" mapstructure:"socket_path"`
}
func (*DaemonConfig) GetLogTarget ¶
func (d *DaemonConfig) GetLogTarget() string
func (*DaemonConfig) Normalize ¶
func (d *DaemonConfig) Normalize() error
func (*DaemonConfig) Validate ¶
func (d *DaemonConfig) Validate() error
type MountEntry ¶
type MountEntry struct {
Name string `yaml:"name" mapstructure:"name" validate:"required"`
Type string `yaml:"type" mapstructure:"type" validate:"required"`
MountDirPath string `yaml:"mount_dir_path" mapstructure:"mount_dir_path" validate:"required"`
SMB *SMBConfig `yaml:"smb,omitempty" mapstructure:"smb"`
SSHFS *SSHFSConfig `yaml:"sshfs,omitempty" mapstructure:"sshfs"`
WebDAV *WebDAVConfig `yaml:"webdav,omitempty" mapstructure:"webdav"`
S3 *S3Config `yaml:"s3,omitempty" mapstructure:"s3"`
SSHTunnel *SSHTunnelConfig `yaml:"ssh_tunnel,omitempty" mapstructure:"ssh_tunnel"`
Options map[string]interface{} `yaml:"options,omitempty" mapstructure:"options"`
IsMounted bool `yaml:"-" mapstructure:"-"`
}
MountEntry 单个挂载配置(支持多种协议)
func (*MountEntry) EnsureMountDir ¶
func (m *MountEntry) EnsureMountDir() error
EnsureMountDir 如果挂载目录的父目录不存在则创建
func (*MountEntry) GetMountPath ¶
func (m *MountEntry) GetMountPath() string
func (*MountEntry) HasPassword ¶
func (m *MountEntry) HasPassword() bool
func (*MountEntry) ValidateDriverConfig ¶
func (m *MountEntry) ValidateDriverConfig() error
ValidateDriverConfig 根据 type 字段检查对应的配置块是否存在
type S3Config ¶ added in v0.2.0
type S3Config struct {
Provider string `yaml:"provider" mapstructure:"provider" validate:"required"`
Bucket string `yaml:"bucket" mapstructure:"bucket" validate:"required"`
Path string `yaml:"path,omitempty" mapstructure:"path"`
Region string `yaml:"region,omitempty" mapstructure:"region"`
Endpoint string `yaml:"endpoint,omitempty" mapstructure:"endpoint"`
AccessKeyID string `yaml:"access_key_id,omitempty" mapstructure:"access_key_id"`
SecretAccessKey string `yaml:"secret_access_key,omitempty" mapstructure:"secret_access_key"`
SessionToken string `yaml:"session_token,omitempty" mapstructure:"session_token"`
EnvAuth bool `yaml:"env_auth,omitempty" mapstructure:"env_auth"`
ForcePathStyle *bool `yaml:"force_path_style,omitempty" mapstructure:"force_path_style"`
}
type SMBConfig ¶
type SMBConfig struct {
Addr string `yaml:"addr" mapstructure:"addr" validate:"required"`
Port int `yaml:"port,omitempty" mapstructure:"port" validate:"omitempty,min=1,max=65535"`
Username string `yaml:"username" mapstructure:"username" validate:"required"`
Password string `yaml:"password,omitempty" mapstructure:"password"`
}
SMBConfig SMB/CIFS配置
type SSHFSConfig ¶
type SSHFSConfig struct {
Host string `yaml:"host" mapstructure:"host" validate:"required"`
RemotePath string `yaml:"remote_path" mapstructure:"remote_path" validate:"required"`
}
SSHFSConfig SSHFS配置
type SSHTunnelConfig ¶
type SSHTunnelConfig struct {
Host string `yaml:"host" mapstructure:"host" validate:"required"`
}
type SortingConfig ¶
type SortingConfig struct {
By StringOrSlice `yaml:"by" mapstructure:"by"`
}
type StringOrSlice ¶
type StringOrSlice []string
func (*StringOrSlice) UnmarshalYAML ¶
func (s *StringOrSlice) UnmarshalYAML(value *yaml.Node) error
type WebDAVConfig ¶
Click to show internal directories.
Click to hide internal directories.