Documentation
¶
Overview ¶
Package backup 负责配置备份的打包、加密、解析与保留策略,供手动导出、定时备份与恢复共用。
Index ¶
- Constants
- Variables
- func Build(dir, password string, now time.Time) ([]byte, error)
- func Collect(dir string) (map[string][]byte, error)
- func Decrypt(data []byte, password string) ([]byte, error)
- func Encrypt(data []byte, password string) ([]byte, error)
- func IsBackupName(name string) bool
- func IsEncrypted(data []byte) bool
- func Name(now time.Time, encrypted bool) string
- func Parse(data []byte, password string) (map[string][]byte, error)
- func Pick(names []string, keep int) []string
- func Zip(files map[string][]byte, now time.Time) ([]byte, error)
Constants ¶
View Source
const ( // NamePrefix 是备份文件名前缀,保留策略只处理带此前缀的文件 NamePrefix = "gately-backup-" // ExtZip 是未加密备份的扩展名 ExtZip = ".zip" // ExtEncrypted 是加密备份的扩展名 ExtEncrypted = ".zip.enc" )
文件名约定
Variables ¶
View Source
var ErrBadPassword = errors.New("备份口令错误或文件已损坏")
ErrBadPassword 表示口令错误或备份已损坏。
View Source
var ErrPasswordRequired = errors.New("备份已加密,需要提供备份口令")
ErrPasswordRequired 表示备份已加密但未提供口令。
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.