parsers

package
v0.0.0-...-e2887c0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package parsers provides helper functions to parse and validate different type of string. It can be hosts, unix addresses, tcp addresses, filters, kernel operating system versions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseHost

func ParseHost(defaultTCPAddr, defaultUnixAddr, addr string) (string, error)

ParseHost parses the specified address and returns an address that will be used as the host. Depending of the address specified, will use the defaultTCPAddr or defaultUnixAddr FIXME: Change this not to receive default value as parameter

func ParseKeyValueOpt

func ParseKeyValueOpt(opt string) (string, string, error)

ParseKeyValueOpt parses and validates the specified string as a key/value pair (key=value)

func ParseLink(val string) (string, string, error)

ParseLink parses and validates the specified string as a link format (name:alias)

func ParsePortRange

func ParsePortRange(ports string) (uint64, uint64, error)

ParsePortRange parses and validates the specified string as a port-range (8000-9000)

func ParseRepositoryTag

func ParseRepositoryTag(repos string) (string, string)

ParseRepositoryTag gets a repos name and returns the right reposName + tag|digest The tag can be confusing because of a port in a repository name.

Ex: localhost.localdomain:5000/samalba/hipache:latest
Digest ex: localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb

func ParseTCPAddr

func ParseTCPAddr(addr string, defaultAddr string) (string, error)

ParseTCPAddr parses and validates that the specified address is a valid TCP address. It returns a formatted TCP address, either using the address parsed from addr, or the contents of defaultAddr if addr is a blank string.

func ParseUnixAddr

func ParseUnixAddr(addr string, defaultAddr string) (string, error)

ParseUnixAddr parses and validates that the specified address is a valid UNIX socket address. It returns a formatted UNIX socket address, either using the address parsed from addr, or the contents of defaultAddr if addr is a blank string.

func PartParser

func PartParser(template, data string) (map[string]string, error)

PartParser parses and validates the specified string (data) using the specified template e.g. ip:public:private -> 192.168.0.1:80:8000

Types

This section is empty.

Directories

Path Synopsis
Package filters provides helper function to parse and handle command line filter, used for example in docker ps or docker images commands.
Package filters provides helper function to parse and handle command line filter, used for example in docker ps or docker images commands.
Package kernel provides helper function to get, parse and compare kernel versions for different platforms.
Package kernel provides helper function to get, parse and compare kernel versions for different platforms.
Package operatingsystem provides helper function to get the operating system name for different platforms.
Package operatingsystem provides helper function to get the operating system name for different platforms.

Jump to

Keyboard shortcuts

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