buildutil

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePrivateKeyToPEM

func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte

EncodePrivateKeyToPEM encodes Private Key from RSA to PEM format

func EncodePublicKeyToSSH

func EncodePublicKeyToSSH(pubkey *rsa.PublicKey) ([]byte, error)

EncodePublicKeyToSSH takes a rsa.PublicKey and return bytes suitable for writing to .pub file returns in the format "ssh-rsa ..."

func GenerateRSAPrivateKey

func GenerateRSAPrivateKey(size int) (*rsa.PrivateKey, error)

GenerateRSAPrivateKey creates a RSA Private Key of specified byte size

func GenerateSSHKeyPair

func GenerateSSHKeyPair(size int) (privkey string, pubkey string, err error)

GenerateSSHKeyPair is a small helper function that just returns an SSH key pair of a given size easily

func IsBuildError

func IsBuildError(e error) bool

IsBuildError is a convenience function to tell you if an Error is a BuildErro

func Throw

func Throw(err error, reason string, vars *V) error

Throw creates a build error with some additional information that will be passed to the user.

func WriteKeyfile

func WriteKeyfile(keyBytes []byte, saveFileTo string) error

WriteKeyfile writes keys to a file

Types

type BuildError

type BuildError []BuildIssue

BuildError represents a chain of build errors

func (BuildError) Bottom

func (b BuildError) Bottom() *BuildIssue

Bottom retrieves the the last element in the build error stack

func (BuildError) Error

func (b BuildError) Error() string

Error implements the error interface

func (BuildError) Stack

func (b BuildError) Stack(addition BuildError) BuildError

Stack pushes a new Call stack (n) down onto the original Call stack (c)

func (BuildError) String

func (b BuildError) String() string

String implements the stringer interface

func (BuildError) Top

func (b BuildError) Top() *BuildIssue

Top retrieves the the first element in the build error stack

type BuildIssue

type BuildIssue struct {
	Source error
	Reason string
	Vars   V
}

BuildIssue is specially crafted error to help in debugging

func (BuildIssue) Error

func (b BuildIssue) Error() string

Error implements the error interface

func (BuildIssue) String

func (b BuildIssue) String() string

String implements the stringer interface

type V

type V map[string]interface{}

V is a short type for declaring vars

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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