parsers

package
v1.9.1-resin-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2016 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 ParseDockerDaemonHost added in v1.9.0

func ParseDockerDaemonHost(defaultTCPAddr, defaultTLSHost, defaultUnixAddr, defaultAddr, addr string) (string, error)

ParseDockerDaemonHost 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 defaultUnixAddr must be a absolute file path (no `unix://` prefix) defaultTCPAddr must be the full `tcp://host:port` form

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 added in v1.5.0

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 added in v1.4.0

func ParseTCPAddr(tryAddr 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 tryAddr, or the contents of defaultAddr if tryAddr is a blank string. tryAddr is expected to have already been Trim()'d defaultAddr must be in the full `tcp://host:port` form

func ParseUintList added in v1.9.0

func ParseUintList(val string) (map[int]bool, error)

ParseUintList parses and validates the specified string as the value found in some cgroup file (e.g. `cpuset.cpus`, `cpuset.mems`), which could be one of the formats below. Note that duplicates are actually allowed in the input string. It returns a `map[int]bool` with available elements from `val` set to `true`. Supported formats:

7
1-6
0,3-4,7,8-10
0-0,0,1-7
03,1-3      <- this is gonna get parsed as [1,2,3]
3,2,1
0-2,3,1

func ParseUnixAddr added in v1.4.0

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