示例#1
0
文件: opts.go 项目: nathena/docker
// ParseHost and set defaults for a Daemon host string
func ParseHost(defaultHost, val string) (string, error) {
	host, err := parsers.ParseDockerDaemonHost(DefaultTCPHost, DefaultTLSHost, DefaultUnixSocket, defaultHost, val)
	if err != nil {
		return val, err
	}
	return host, nil
}
示例#2
0
文件: opts.go 项目: nathena/docker
// ValidateHost validates that the specified string is a valid host and returns it.
func ValidateHost(val string) (string, error) {
	_, err := parsers.ParseDockerDaemonHost(DefaultTCPHost, DefaultTLSHost, DefaultUnixSocket, "", val)
	if err != nil {
		return val, err
	}
	// Note: unlike most flag validators, we don't return the mutated value here
	//       we need to know what the user entered later (using ParseHost) to adjust for tls
	return val, nil
}