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

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