util

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package util provides utility functions for the cmd packages.

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoDefaultIP = errors.New("no suitable IP address")

NoDefaultIP means no suitable non-loopback address can be found.

Functions

func DefaultLocalIP4

func DefaultLocalIP4() (net.IP, error)

DefaultLocalIP4 returns an IPv4 address that this host can be reached on. Will return NoDefaultIP if no suitable address can be found.

func Env added in v0.2.1

func Env(key string, defaultValue string) string

Env returns an environment variable or a default value if not specified.

func GetEnv added in v0.2.1

func GetEnv(key string) (string, bool)

GetEnv returns an environment value if specified

func IsEnvironmentArgument added in v0.3.1

func IsEnvironmentArgument(s string) bool

func PromptForPasswordString added in v0.3.1

func PromptForPasswordString(r io.Reader, format string, a ...interface{}) string

TODO not tested on other platforms

func PromptForString added in v0.3.1

func PromptForString(r io.Reader, format string, a ...interface{}) string

func WaitForSuccessfulDial added in v0.2.1

func WaitForSuccessfulDial(network, address string, timeout, interval time.Duration, retries int) error

WaitForDial attempts to connect to the given address, closing and returning nil on the first successful connection.

Types

type Environment added in v0.3.1

type Environment map[string]string

func ParseEnvironmentArguments added in v0.3.1

func ParseEnvironmentArguments(s []string) (Environment, []string, []error)

type Mux

type Mux interface {
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

Mux is a standard mux interface for HTTP

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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