webdav

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupData

type BackupData struct {
	Config     *config.Config `json:"config"`     // 配置数据
	Stats      *proxy.Stats   `json:"stats"`      // 统计数据
	BackupTime time.Time      `json:"backupTime"` // 备份时间
	Version    string         `json:"version"`    // ccNexus 版本
}

BackupData 备份数据结构(包含配置和统计)

type BackupFile

type BackupFile struct {
	Filename string    `json:"filename"` // 文件名
	Size     int64     `json:"size"`     // 文件大小(字节)
	ModTime  time.Time `json:"modTime"`  // 修改时间
}

BackupFile 备份文件信息

type Client

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

Client WebDAV 客户端

func NewClient

func NewClient(cfg *config.WebDAVConfig) (*Client, error)

NewClient 创建 WebDAV 客户端

func (*Client) DeleteBackups

func (c *Client) DeleteBackups(filenames []string, isConfig bool) error

DeleteBackups 删除备份文件

func (*Client) DownloadBackup

func (c *Client) DownloadBackup(filename string, isConfig bool) ([]byte, error)

DownloadBackup 下载备份文件

func (*Client) ListBackups

func (c *Client) ListBackups(isConfig bool) ([]BackupFile, error)

ListBackups 列出备份文件

func (*Client) TestConnection

func (c *Client) TestConnection() *TestResult

TestConnection 测试 WebDAV 连接

func (*Client) UploadBackup

func (c *Client) UploadBackup(filename string, data []byte, isConfig bool) error

UploadBackup 上传备份文件

type ConflictInfo

type ConflictInfo struct {
	HasConflict         bool      `json:"hasConflict"`         // 是否存在冲突
	LocalEndpointCount  int       `json:"localEndpointCount"`  // 本地端点数量
	RemoteEndpointCount int       `json:"remoteEndpointCount"` // 远程端点数量
	LocalModTime        time.Time `json:"localModTime"`        // 本地修改时间
	RemoteModTime       time.Time `json:"remoteModTime"`       // 远程修改时间
	LocalPort           int       `json:"localPort"`           // 本地端口
	RemotePort          int       `json:"remotePort"`          // 远程端口
}

ConflictInfo 冲突信息

type Manager

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

Manager WebDAV 同步管理器

func NewManager

func NewManager(client *Client) *Manager

NewManager 创建同步管理器

func (*Manager) BackupConfig

func (m *Manager) BackupConfig(cfg *config.Config, stats *proxy.Stats, version string, filename string) error

BackupConfig 备份配置到 WebDAV

func (*Manager) DeleteConfigBackups

func (m *Manager) DeleteConfigBackups(filenames []string) error

DeleteConfigBackups 删除配置备份

func (*Manager) DetectConflict

func (m *Manager) DetectConflict(localConfig *config.Config, filename string) (*ConflictInfo, error)

DetectConflict 检测本地配置和远程备份之间的冲突

func (*Manager) ListConfigBackups

func (m *Manager) ListConfigBackups() ([]BackupFile, error)

ListConfigBackups 列出配置备份

func (*Manager) RestoreConfig

func (m *Manager) RestoreConfig(filename string, configPath, statsPath string) (*config.Config, *proxy.Stats, error)

RestoreConfig 从 WebDAV 恢复配置

type TestResult

type TestResult struct {
	Success bool   `json:"success"` // 是否成功
	Message string `json:"message"` // 消息
}

TestResult WebDAV 连接测试结果

Jump to

Keyboard shortcuts

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