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 ¶
- func ParseDockerDaemonHost(defaultTCPAddr, defaultTLSHost, defaultUnixAddr, defaultAddr, addr string) (string, error)
- func ParseKeyValueOpt(opt string) (string, string, error)
- func ParseLink(val string) (string, string, error)
- func ParsePortRange(ports string) (uint64, uint64, error)
- func ParseRepositoryTag(repos string) (string, string)
- func ParseTCPAddr(tryAddr string, defaultAddr string) (string, error)
- func ParseUintList(val string) (map[int]bool, error)
- func ParseUnixAddr(addr string, defaultAddr string) (string, error)
- func PartParser(template, data string) (map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDockerDaemonHost ¶
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 ¶
ParseKeyValueOpt parses and validates the specified string as a key/value pair (key=value)
func ParsePortRange ¶
ParsePortRange parses and validates the specified string as a port-range (8000-9000)
func ParseRepositoryTag ¶
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 ¶
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 ¶
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 ¶
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.
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. |