tar

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTarFile

func IsTarFile(path string) bool

IsTarFile checks if a file path appears to be a TAR archive

Types

type GPGHandler

type GPGHandler struct {
	KeyID       string
	KeyringPath string
}

GPGHandler handles GPG encryption, decryption, signing, and verification

func NewGPGHandler

func NewGPGHandler(keyringPath, keyID string) (*GPGHandler, error)

NewGPGHandler creates a new GPG handler

func (*GPGHandler) Decrypt

func (g *GPGHandler) Decrypt(reader io.Reader) (io.Reader, error)

Decrypt decrypts GPG-encrypted data

func (*GPGHandler) Encrypt

func (g *GPGHandler) Encrypt(writer io.Writer) (io.WriteCloser, error)

Encrypt encrypts data using GPG and returns a WriteCloser

func (*GPGHandler) IsEncrypted

func (g *GPGHandler) IsEncrypted(data []byte) bool

IsEncrypted checks if data appears to be GPG encrypted

func (*GPGHandler) ListKeys

func (g *GPGHandler) ListKeys() ([]string, error)

ListKeys lists available GPG keys

func (*GPGHandler) Sign

func (g *GPGHandler) Sign(filePath, signaturePath string) error

Sign creates a detached GPG signature for a file

func (*GPGHandler) Verify

func (g *GPGHandler) Verify(filePath, signaturePath string) error

Verify verifies a detached GPG signature

type TarArchive

type TarArchive struct {
	Path    string
	Options TarOptions
	// contains filtered or unexported fields
}

TarArchive represents a TAR archive with optional encryption and signing

func New

func New(path string, options TarOptions) (*TarArchive, error)

New creates a new TarArchive instance

func (*TarArchive) Create

func (ta *TarArchive) Create(sourceDir string) error

Create creates a TAR archive from the specified source directory

func (*TarArchive) Extract

func (ta *TarArchive) Extract(destDir string) error

Extract extracts the TAR archive to the specified destination directory

func (*TarArchive) GetFileExtension

func (ta *TarArchive) GetFileExtension() string

GetFileExtension returns the appropriate file extension for the archive

func (*TarArchive) IsEncrypted

func (ta *TarArchive) IsEncrypted() (bool, error)

IsEncrypted checks if the TAR archive appears to be encrypted

func (*TarArchive) List

func (ta *TarArchive) List() ([]TarFileInfo, error)

List returns a list of files in the TAR archive

type TarFileInfo

type TarFileInfo struct {
	Name    string
	Size    int64
	ModTime time.Time
	IsDir   bool
	Mode    os.FileMode
}

FileInfo represents a file in the TAR archive

type TarOptions

type TarOptions struct {
	Compression bool   // Use gzip compression
	GPGEncrypt  bool   // Encrypt the TAR file with GPG
	GPGSign     bool   // Sign the TAR file with GPG
	GPGKeyID    string // GPG key ID for encryption/signing
	GPGKeyring  string // Path to GPG keyring
	Verbose     bool   // Verbose output
}

TarOptions holds configuration for TAR operations

func ParseTarOptions

func ParseTarOptions(path string) TarOptions

ParseTarOptions determines TAR options from file extension

Jump to

Keyboard shortcuts

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