util

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2015 License: Apache-2.0 Imports: 6 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

func Env(key string, defaultValue string) string

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

func GetEnv

func GetEnv(key string) (string, bool)

GetEnv returns an environment value if specified

func WaitForSuccessfulDial

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 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