func DetermineLDAPHost(hostport string, scheme Scheme) (string, error) {
	if len(hostport) == 0 {
		hostport = defaultHost
	}
	// add port if missing
	if _, _, err := net.SplitHostPort(hostport); err != nil {
		switch scheme {
		case SchemeLDAPS:
			return net.JoinHostPort(hostport, defaultLDAPSPort), nil
		case SchemeLDAP:
			return net.JoinHostPort(hostport, defaultLDAPPort), nil
		default:
			return "", fmt.Errorf("no default port for scheme %q", scheme)
		}
	}
	// nothing needed to be done
	return hostport, nil
}
// DetermineLDAPHost determines the host and port for the LDAP connection.
// The default host is localhost; the default port for scheme "ldap" is 389, for "ldaps" is 686
DetermineLDAPHost determines the host and port for the LDAP connection.
The default host is localhost; the default port for scheme "ldap" is 389, for "ldaps" is 686
// DetermineLDAPHost determines the host and port for the LDAP connection . // The default host is localhost ; the default port for scheme " ldap " is 389 for " ldaps " is 686
func DetermineLDAPHost(hostport string, scheme Scheme) (string, error) {
	if len(hostport) == 0 {
		hostport = defaultHost
	}
	if _, _, err := net.SplitHostPort(hostport); err != nil {
		switch scheme {
		case SchemeLDAPS:
			return net.JoinHostPort(hostport, defaultLDAPSPort), nil
		case SchemeLDAP:
			return net.JoinHostPort(hostport, defaultLDAPPort), nil
		default:
			return "", fmt.Errorf("no default port for scheme %q", scheme)
		}
	}
	return hostport, nil
}
func DetermineLDAPHost ( hostport string , scheme Scheme ) ( string , error ) { if len ( hostport ) == 0 { hostport = defaultHost } if _ , _ , err := net . SplitHostPort ( hostport ) ; err != nil { switch scheme { case SchemeLDAPS : return net . JoinHostPort ( hostport , defaultLDAPSPort ) , nil case SchemeLDAP : return net . JoinHostPort ( hostport , defaultLDAPPort ) , nil default : return " " , fmt . Errorf ( " " , scheme ) } } return hostport , nil }
DetermineLDAPHost determines the host and port for the LDAP connection.
DetermineLDAPHost determines the host and port for the LDAP connection .
// add port if missing // nothing needed to be done