utils

package
v0.0.0-...-9489dbf Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2017 License: MPL-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeRaw

func DecodeRaw(raw interface{}, result interface{}) error

DecodeRaw decodes a raw interface into the target structure

func GetIP

func GetIP(specList []string) (string, error)

GetIP determines the IP address of the container

func GetTimeout

func GetTimeout(timeoutFmt string) (time.Duration, error)

GetTimeout converts a properly formatted string to a Duration, returning an error if the Duration can't be parsed

func IPFromInterfaces

func IPFromInterfaces(raw interface{}) (string, error)

IPFromInterfaces ...

func ParseDuration

func ParseDuration(duration interface{}) (time.Duration, error)

ParseDuration parses the given duration with multiple type support int (defaults to seconds) string with units string without units (default to seconds)

func ToStringArray

func ToStringArray(raw interface{}) ([]string, error)

ToStringArray converts the given interface to a []string if possible

func ValidateServiceName

func ValidateServiceName(name string) error

ValidateServiceName checks if the service name passed as an argument is is alpha-numeric with dashes. This ensures compliance with both DNS and discovery backends.

Types

type ByInterfaceThenIP

type ByInterfaceThenIP []interfaceIP

ByInterfaceThenIP implements the Sort with the following properties: 1. Sort interfaces alphabetically 2. Sort IPs by bytes (normalized to 16 byte form)

func (ByInterfaceThenIP) Len

func (se ByInterfaceThenIP) Len() int

func (ByInterfaceThenIP) Less

func (se ByInterfaceThenIP) Less(i, j int) bool

func (ByInterfaceThenIP) Swap

func (se ByInterfaceThenIP) Swap(i, j int)

Jump to

Keyboard shortcuts

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