Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrConnectionTimeout = errors.New("restic: respository connection timeout")
)
Functions ¶
func ResticCheck ¶
func ResticCheck() error
ResticCheck checks if "restic" command is available in system path
Types ¶
type LocalRepository ¶
type LocalRepository struct { Id int Name string Password string Destination string Encryption *LocalRepositoryEnc }
Id: Unique identifier for the local repository Name: Name of the local repository Password: Password for the local repository PasswordEnc: Encrypted password for the local repository Destination: Destination path for the local repository
func (*LocalRepository) GenEnc ¶
func (r *LocalRepository) GenEnc(key [32]byte) error
GenEnc generates the encryption for the local repository using the provided key. It encrypts the repository password using the key and stores the encrypted value in the Encryption.PasswordEnc field. If an error occurs during encryption, it returns an error with a descriptive message.
type LocalRepositoryEnc ¶
type LocalRepositoryEnc struct {
PasswordEnc string
}
LocalRepositoryEnc represents a local repository with encrypted password.
type Repository ¶
type RepositoryService ¶
type RepositoryService struct { DB *sql.DB // DB is the database connection. EncKey [32]byte // EncKey is the encryption key used for the repository. Repository Repository // Repository is the underlying repository. }
RepositoryService represents a service that interacts with a repository.
func (*RepositoryService) Connect ¶
func (service *RepositoryService) Connect() error
Connect establishes a connection to the repository. It returns an error if the connection fails.
func (*RepositoryService) Create ¶
func (service *RepositoryService) Create(userId int) error
Create creates a new repository. It calls the newRepo method of the RepositoryService to initialize the repository. If an error occurs during the creation process, it returns an error with a formatted message.
func (*RepositoryService) Types ¶
func (service *RepositoryService) Types() ([]string, error)
Types returns a list of repository types.
type RepositoryStatus ¶
type RepositoryStatusService ¶
func (*RepositoryStatusService) List ¶
func (service *RepositoryStatusService) List() ([]RepositoryStatus, error)
list returns the status of each repository. It returns a slice of RepositoryStatus or an error if the query fails.
type S3Repository ¶
type S3Repository struct { Id int Name string Password string Destination string AccessKeyId string SecretAccessKey string Region string ConfigId int Encryption *S3RepositoryEnc }
Id represents the unique identifier of the S3 repository. Name represents the name of the S3 repository. Password represents the password for accessing the S3 repository. Destination represents the target location where the S3 repository is stored. AccessKeyId represents the access key ID for authenticating with the S3 repository. SecretAccessKey represents the secret access key for authenticating with the S3 repository. Region represents the AWS region where the S3 repository is located. ConfigId represents the configuration identifier associated with the S3 repository. Encryption represents the encryption settings for the S3 repository.
func (*S3Repository) GenEnc ¶
func (r *S3Repository) GenEnc(encKey [32]byte) error
GenEnc generates encrypted versions of the S3 repository's access key ID, secret access key, and password. It takes an encryption key as input and encrypts the values using the encryptor package. The encrypted values are then stored in the Encryption struct of the S3Repository. If any encryption operation fails, an error is returned.
type S3RepositoryEnc ¶
Encrypted access key ID for S3 repository Encrypted secret access key for S3 repository Encrypted password for S3 repository
type SftpRepository ¶
type SftpRepository struct { Id int Name string Password string Destination string User string Host string Pem string ConfigId int Encryption *SftpRepositoryEnc }
Id represents the unique identifier of the SFTP repository Name represents the name of the SFTP repository Password represents the password for the SFTP repository Destination represents the destination path for the SFTP repository User represents the username for the SFTP repository Host represents the host address for the SFTP repository Pem represents the PEM file path for the SFTP repository ConfigId represents the configuration ID for the SFTP repository Encryption represents the encryption settings for the SFTP repository
func (*SftpRepository) GenEnc ¶
func (r *SftpRepository) GenEnc(encKey [32]byte) error
GenEnc generates encryption for the SftpRepository using the provided encryption key. It encrypts the repository's PEM and password using the given encryption key. The encrypted values are stored in the repository's Encryption struct. If an error occurs during encryption, it returns an error with a descriptive message.
type SftpRepositoryEnc ¶
PemEnc is the encrypted PEM key used for SFTP authentication. PasswordEnc is the encrypted password used for SFTP authentication.