Documentation ¶
Index ¶
- Constants
- Variables
- func CompressData(data []byte) []byte
- func DecryptData(input []byte, password string) []byte
- func DecryptDataArmored(input []byte, password string) []byte
- func EncryptData(input []byte, password string) []byte
- func EncryptDataArmored(input []byte, password string) []byte
- func FileExists(filename string) bool
- func FixSlashes(input string) string
- func FormatFileSize(bytes uint64) string
- func GetDecryptCommand(inputFile string, outputFile string, passwordFile string) string
- func GetHashSum(data []byte) string
- func GetNewDocumentKey() string
- func InitLogger(logDirectory string, quiet bool, verbose bool)
- func MustWriteFile(filename string, data []byte)
- func MustWriteFileAtomic(filename string, data []byte)
- func PanicIfErr(err error)
- func ParseHumanRange(input string) (time.Duration, error)
- func UncompressData(data []byte) []byte
- type Globfile
- type LoggerConfig
Constants ¶
const (
// TmpSuffix is the suffix for all temporary files.
TmpSuffix = ".tmp"
)
Variables ¶
var ( // Trace is a logging interface for trace-level information. Trace *log.Logger // Info is a logging interface for info-level information. Info *log.Logger // Warning is a logging interface for warning-level information. Warning *log.Logger // Error is a logging interface for error-level information. Error *log.Logger // CurrentLoggerConfig holds the currently in use LoggerConfig. CurrentLoggerConfig LoggerConfig // DefaultLoggerConfig is a LoggerConfig where some logging levels are printed // to the console (errors to stderr, others to stdout). DefaultLoggerConfig = LoggerConfig{ Trace: []io.Writer{ioutil.Discard}, Info: []io.Writer{os.Stdout}, Warning: []io.Writer{os.Stdout}, Error: []io.Writer{os.Stderr}, } )
Functions ¶
func CompressData ¶
CompressData compresses bytes with the gzip algorithm.
func DecryptData ¶
DecryptData decrypts data using OpenPGP decryption.
func DecryptDataArmored ¶
DecryptDataArmored decrypts armored data using OpenPGP decryption.
func EncryptData ¶
EncryptData encrypts data using symmetric OpenPGP encryption.
func EncryptDataArmored ¶
EncryptDataArmored encrypts data using symmetric OpenPGP encryption. The result will be armored OpenPGP output.
func FileExists ¶
FileExists checks if a specified path (file or directory) exists.
func FixSlashes ¶
FixSlashes replaces all \ with / in a string.
func FormatFileSize ¶
FormatFileSize converts file sizes in human-readable formats.
func GetDecryptCommand ¶
GetDecryptCommand returns a Windows console command to decrypt a specific file that was encrypted with OpenPGP.
func GetHashSum ¶
GetHashSum returns the hash sum for data using the preferred algorithm (currently SHA-256).
func GetNewDocumentKey ¶
func GetNewDocumentKey() string
GetNewDocumentKey returns 32 random bytes, encoded as a 64 byte hex string.
func InitLogger ¶
InitLogger initializes the logging configuration.
func MustWriteFile ¶
MustWriteFile writes data to filename. It panics if there is an error.
func MustWriteFileAtomic ¶
MustWriteFileAtomic first writes the data to a temporary file, then renames it.
func ParseHumanRange ¶
ParseHumanRange parses human time ranges into time.Durations.
func UncompressData ¶
UncompressData uncompresses bytes with the gzip algorithm.
Types ¶
type Globfile ¶
type Globfile struct {
// contains filtered or unexported fields
}
Globfile holds a list of globs to match against.
func NewGlobfile ¶
NewGlobfile reads globs from filename and returns a Globfile struct.