commands

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 2

Documentation

Overview

Package commands implements the processing of the command line flags and processing of the encryption operation.

Index

Constants

View Source
const (
	// DefaultNetwork is set to the HTTPs relay from drand, you can also use Cloudflare relay or any other relay.
	DefaultNetwork = "https://api.drand.sh/"
	// DefaultChain is set to the League of Entropy quicknet chainhash.
	DefaultChain = "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971"
)

Default settings.

Variables

View Source
var ErrDuplicateDuration = errors.New("you cannot use the same duration unit specifier twice in one duration")
View Source
var ErrInvalidDurationFormat = errors.New("unsupported duration type or malformed duration - note: drand can only support as short as seconds")
View Source
var ErrInvalidDurationValue = errors.New("the duration you entered is either in the past or was too large and would cause an overflow")

Functions

func Encrypt

func Encrypt(flags Flags, dst io.Writer, src io.Reader, network *http.Network) error

Encrypt performs the encryption operation. This requires the implementation of an encoder for reading/writing to disk, a network for making calls to the drand network, and an encrypter for encrypting/decrypting the data.

func PrintUsage

func PrintUsage(log *log.Logger)

PrintUsage displays the usage information.

Types

type Flags

type Flags struct {
	Encrypt  bool
	Decrypt  bool
	Force    bool
	Network  string
	Chain    string
	Round    uint64
	Duration string
	Output   string
	Armor    bool
	Metadata bool
}

Flags represent the values from the command line.

func Parse

func Parse() (Flags, error)

Parse will parse the environment variables and command line flags. The command line flags will overwrite environment variables. Validation takes place.

Jump to

Keyboard shortcuts

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