Documentation ¶
Index ¶
- Constants
- Variables
- func AllStringVal(val string, s ...string) bool
- func AnyStringVal(val string, s ...string) bool
- func ApplyTimeoutMultiplier(timeout int) int
- func AvailableAccel() []string
- func ByteSliceAllNull(b []byte) bool
- func ByteSliceContains(b [][]byte, l []byte) bool
- func CommandExists(cmd string) bool
- func ConfigLinesMd5Password(lines []string, passwordPattern *regexp.Regexp) []string
- func CopyAsset(s, d string) error
- func CopyFile(s, d string) error
- func DirectoryExists(d string) bool
- func ExpandPath(p string) string
- func FileExists(f string) bool
- func GetEnvIntOrDefault(k string, d int) int
- func GetEnvStrOrDefault(k, d string) string
- func GetPreferredIP() string
- func GetQemuPath() string
- func GetTimeoutMultiplier() int
- func IntSliceContains(s []int, i int) bool
- func IntSliceUniqify(s []int) []int
- func Md5Crypt(password []byte) []byte
- func ResolveFile(f string) (string, error)
- func StringSliceContains(s string, l []string) bool
- type LockingWriterReader
- type Spinner
Constants ¶
const ( MaxBuffer = 65535 FilePerms = 0666 QemuImgCmd = "qemu-img" DockerCmd = "docker" QemuImgContainer = "ghcr.io/hellt/qemu-img:latest" ISOBinary = "genisoimage" DarwinISOBinary = "mkisofs" ISOBinaryContainer = "ghcr.io/hellt/cdrkit:1.11.11-r3" )
Variables ¶
var ErrAllocationError = errors.New("allocationError")
ErrAllocationError is an error returned when boxen encounters an issue allocating resources to a virtual machine.
var ErrCommandError = errors.New("commandError")
ErrCommandError is an error returned when a command fails to execute.
var ErrConsoleError = errors.New("consoleError")
ErrConsoleError is an error returned when connecting to a device console produces an error, or when a console operation fails.
var ErrIgnoredOption = errors.New("ignoredOption")
ErrIgnoredOption is an error returned when any option is not applicable for the given operation -- when this error is returned it is *usually* safe to ignore.
var ErrInspectionError = errors.New("inspectionError")
ErrInspectionError is an error returned when an issue "inspecting" an instance is encountered.
var ErrInstanceError = errors.New("instanceError")
ErrInstanceError is an error returned when a "well-formed"/created instance (as in, an instance that gets to the point of starting) encounters an error.
var ErrProvisionError = errors.New("provisionError")
ErrProvisionError is an error returned when provisioning a virtual machine in the local configuration fails.
var ErrValidationError = errors.New("validationError")
ErrValidationError is an error returned when validating provided information, usually from a user, is encountered.
Functions ¶
func AllStringVal ¶ added in v0.0.1
AllStringVal returns true if all strings in variadic s matches the string val.
func AnyStringVal ¶ added in v0.0.1
AnyStringVal returns true if any string in variadic s matches the string val.
func ApplyTimeoutMultiplier ¶
ApplyTimeoutMultiplier returns the timeout, as an integer, after being multiplied by the environment variable BOXEN_TIMEOUT_MULTIPLIER.
func AvailableAccel ¶
func AvailableAccel() []string
func ByteSliceAllNull ¶
ByteSliceAllNull checks if a byte slice contains onlyl null bytes.
func ByteSliceContains ¶
ByteSliceContains checks if slice of bytes contains a given byte subslice.
func CommandExists ¶ added in v0.0.2
CommandExists checks if a command `cmd` exists in the PATH.
func ConfigLinesMd5Password ¶ added in v0.0.2
ConfigLinesMd5Password accepts a slice of config lines and replaces the plain-text password with a md5 encrypted password. It does this by using the provided passwordPattern to find lines that contain passwords.
func DirectoryExists ¶
DirectoryExists checks if a given path exists (and is a directory).
func ExpandPath ¶
ExpandPath expands user home path in provided path p.
func FileExists ¶
FileExists checks if a given file exists (and is not a directory).
func GetEnvIntOrDefault ¶
func GetEnvStrOrDefault ¶
func GetPreferredIP ¶
func GetPreferredIP() string
GetPreferredIP returns the IP address the host machine prefers for outbound requests.
func GetQemuPath ¶
func GetQemuPath() string
func GetTimeoutMultiplier ¶
func GetTimeoutMultiplier() int
GetTimeoutMultiplier returns either 1, or the integer value of the environment variable BOXEN_TIMEOUT_MULTIPLIER.
func IntSliceContains ¶
IntSliceContains is a convenience function to check if a provided int i is in an int slice s.
func IntSliceUniqify ¶
IntSliceUniqify removes any duplicated entries in a slice of integers s.
func Md5Crypt ¶
Md5Crypt "encrypts" a provided password byte slice. This is *not* good encryption by any stretch! This exists in this library to encrypt plain text passwords for JunOS such that they can be sent to the JunOS device(s) over telnet without requiring any prompting.
func ResolveFile ¶
ResolveFile resolves provided file path.
func StringSliceContains ¶
StringSliceContains checks if slice of strings contains a given string.
Types ¶
type LockingWriterReader ¶
type LockingWriterReader struct {
// contains filtered or unexported fields
}
LockingWriterReader is a simple type that satisfies io.Writer, but also allows for reads. It does this with a lock as well, so it is safe to use with long-running commands. It also allows for reading from stderr (for example) while the process is still running without any race issues.
func NewLockingWriterReader ¶
func NewLockingWriterReader() *LockingWriterReader
NewLockingWriterReader returns a new instance of LockingWriterReader.
func (*LockingWriterReader) Read ¶
func (lw *LockingWriterReader) Read() ([]byte, error)
Read safely reads (with a rlock) from the buffer in LockingWriterReader instance.