Documentation
¶
Overview ¶
Package utils provides utility functions for the obscure application
Index ¶
- Constants
- func CheckIfGCSObjectExists(bucket, object string) (bool, error)
- func CheckIfIDriveObjectExists(bucket, key string) (bool, error)
- func CheckIfS3CompatibleObjectExists(providerKey, bucket, key string) (bool, error)
- func CheckIfS3ObjectExists(bucket, key string) (bool, error)
- func CheckIfStorjObjectExists(bucket, object string) (bool, error)
- func CompressDirectoryToZstd(srcDir string) (*bytes.Buffer, error)
- func DecompressZstdToDirectory(reader io.Reader, outputDir string) error
- func DecryptStream(encStream io.Reader, password string) (io.Reader, error)
- func DeleteFromIDrive(bucket, key string) error
- func DeleteFromS3Compatible(providerKey, bucket, key string) error
- func DeriveKey(password string, salt []byte) ([]byte, error)
- func DownloadFromB2Stream(objectKey string) (io.ReadCloser, int64, error)
- func DownloadFromGCSStream(objectKey string) (io.ReadCloser, int64, error)
- func DownloadFromIDriveStream(bucket, key string) (io.ReadCloser, error)
- func DownloadFromS3CompatibleStream(providerKey, bucket, key string) (io.ReadCloser, error)
- func DownloadFromS3Stream(bucket, key string) (io.ReadCloser, error)
- func DownloadFromStorjStream(bucket, object string) (io.ReadCloser, error)
- func EncryptBuffer(plainBuf *bytes.Buffer, password string) (*bytes.Buffer, error)
- func EncryptStream(w io.Writer, password string) (io.WriteCloser, error)
- func ExtractSaltFromEncryptedFile(filepath string) ([]byte, error)
- func ExtractTarArchive(reader io.Reader, outputDir string) error
- func FetchUserDefaultProvider(email string) (string, error)
- func GenerateSalt() ([]byte, error)
- func GetGCSClient() (*storage.Client, error)
- func GetIDriveClient() (*s3.Client, error)
- func GetIDriveObjectSize(bucket, key string) (int64, error)
- func GetObjectSize(bucket, key string) (int64, error)
- func GetS3Client() *s3.Client
- func GetS3CompatibleClient(providerKey string) (*s3.Client, error)
- func GetS3CompatibleObjectSize(providerKey, bucket, key string) (int64, error)
- func GetStorjObjectSize(bucket, object string) (int64, error)
- func GetUserID() (string, error)
- func ListIDriveObjects(bucket, prefix string) ([]string, error)
- func ListS3CompatibleObjects(providerKey, bucket, prefix string) ([]string, error)
- func NewCompressWriter(w io.Writer) io.WriteCloser
- func PromptEmail(prompt string) (string, error)
- func PromptForCloudProvider() (string, error)
- func PromptLine(prompt string) (string, error)
- func PromptPassword(prompt string) (string, error)
- func PromptPasswordConfirm(prompt string) (string, error)
- func PromptUsername(prompt string) (string, error)
- func ReadDirectoryAsBytes(dirPath string) ([]byte, error)
- func UploadToGCSBackend(encryptedData []byte, username, tag, version, backendURL, authToken string, ...) error
- func UploadToIDrive(bucket, key string, reader io.Reader, metadata map[string]string) error
- func UploadToS3Compatible(providerKey, bucket, key string, reader io.Reader, metadata map[string]string) error
- type BackupInfo
- type ProgressBuffer
- type ProgressReader
- type ProgressWriter
- type StorageProvider
Constants ¶
const (
KeyLength = 32
)
Variables ¶
This section is empty.
Functions ¶
func CheckIfGCSObjectExists ¶
func CheckIfIDriveObjectExists ¶
CheckIfIDriveObjectExists checks if an object exists in IDrive E2
func CheckIfS3CompatibleObjectExists ¶
CheckIfS3CompatibleObjectExists checks if an object exists in S3-compatible storage
func CheckIfS3ObjectExists ¶
func CompressDirectoryToZstd ¶
CompressDirectoryToZstd creates a .tar.zst archive from a directory
func DecompressZstdToDirectory ¶
DecompressZstdToDirectory extracts a .tar.zst archive into a directory
func DecryptStream ¶
DecryptStream decrypts a streamed .obscure backup from S3. Format assumed: [16-byte salt][12-byte nonce][ciphertext...]
func DeleteFromIDrive ¶
DeleteFromIDrive deletes an object from IDrive E2
func DeleteFromS3Compatible ¶
DeleteFromS3Compatible deletes an object from S3-compatible storage
func DownloadFromB2Stream ¶
func DownloadFromB2Stream(objectKey string) (io.ReadCloser, int64, error)
DownloadFromB2Stream downloads a file from B2 and returns a reader and file size
func DownloadFromGCSStream ¶
func DownloadFromGCSStream(objectKey string) (io.ReadCloser, int64, error)
func DownloadFromIDriveStream ¶
func DownloadFromIDriveStream(bucket, key string) (io.ReadCloser, error)
DownloadFromIDriveStream downloads a file from IDrive E2 and returns a reader
func DownloadFromS3CompatibleStream ¶
func DownloadFromS3CompatibleStream(providerKey, bucket, key string) (io.ReadCloser, error)
DownloadFromS3CompatibleStream downloads a file from S3-compatible storage and returns a reader
func DownloadFromS3Stream ¶
func DownloadFromS3Stream(bucket, key string) (io.ReadCloser, error)
func DownloadFromStorjStream ¶
func DownloadFromStorjStream(bucket, object string) (io.ReadCloser, error)
func EncryptBuffer ¶
func EncryptStream ¶
EncryptStream creates a writer that encrypts data using AES-GCM
func ExtractTarArchive ¶
ExtractTarArchive extracts a tar archive from a reader to the specified directory
func GenerateSalt ¶
func GetGCSClient ¶
func GetIDriveClient ¶
GetIDriveClient creates an S3 client configured for IDrive E2
func GetIDriveObjectSize ¶
GetIDriveObjectSize gets the size of an object in IDrive E2
func GetObjectSize ¶
func GetS3Client ¶
func GetS3CompatibleClient ¶
GetS3CompatibleClient creates an S3 client configured for any S3-compatible service
func GetS3CompatibleObjectSize ¶
GetS3CompatibleObjectSize gets the size of an object in S3-compatible storage
func GetStorjObjectSize ¶
func ListIDriveObjects ¶
ListIDriveObjects lists objects in IDrive E2 with a prefix
func ListS3CompatibleObjects ¶
ListS3CompatibleObjects lists objects in S3-compatible storage with a prefix
func NewCompressWriter ¶
func NewCompressWriter(w io.Writer) io.WriteCloser
NewCompressWriter creates a zstd compression writer
func PromptEmail ¶
PromptEmail prompts for an email address
func PromptForCloudProvider ¶
func PromptLine ¶
PromptLine prompts for a single line of input
func PromptPassword ¶
PromptPassword prompts for a password
func PromptPasswordConfirm ¶
PromptPasswordConfirm prompts for a password and confirmation, returning the password if they match
func PromptUsername ¶
func ReadDirectoryAsBytes ¶
ReadDirectoryAsBytes reads a directory and returns its contents as a byte slice
func UploadToGCSBackend ¶
func UploadToIDrive ¶
UploadToIDrive uploads a file to IDrive E2
Types ¶
type BackupInfo ¶
type ProgressBuffer ¶
type ProgressBuffer struct {
// contains filtered or unexported fields
}
func NewProgressBuffer ¶
func NewProgressBuffer(data []byte, description string, barWidth int) *ProgressBuffer
type ProgressReader ¶
type ProgressReader struct { Reader io.Reader Description string TotalBytes int64 ReadBytes int64 BarWidth int LastPrint time.Time StartTime time.Time // Add start time tracking }
func NewProgressReader ¶
type ProgressWriter ¶
type ProgressWriter struct { Writer io.Writer Description string BarWidth int TotalBytes int64 // contains filtered or unexported fields }