Exemple #1
0
// 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
}
Exemple #2
0
// 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
}