clientv3/balancer/resolver/endpoint/endpoint.go
func ParseEndpoint(endpoint string) (proto string, host string, scheme string) {
	proto = "tcp"
	host = endpoint
	url, uerr := url.Parse(endpoint)
	if uerr != nil || !strings.Contains(endpoint, "://") {
		return proto, host, scheme
	}
	scheme = url.Scheme

	// strip scheme:// prefix since grpc dials by host
	host = url.Host
	switch url.Scheme {
	case "http", "https":
	case "unix", "unixs":
		proto = "unix"
		host = url.Host + url.Path
	default:
		proto, host = "", ""
	}
	return proto, host, scheme
}
func ParseEndpoint(endpoint string) (proto string, host string, scheme string) {
	proto = "tcp"
	host = endpoint
	url, uerr := url.Parse(endpoint)
	if uerr != nil || !strings.Contains(endpoint, "://") {
		return proto, host, scheme
	}
	scheme = url.Scheme

	// strip scheme:// prefix since grpc dials by host
	host = url.Host
	switch url.Scheme {
	case "http", "https":
	case "unix", "unixs":
		proto = "unix"
		host = url.Host + url.Path
	default:
		proto, host = "", ""
	}
	return proto, host, scheme
}
func ParseEndpoint ( endpoint string ) ( proto string , host string , scheme string ) { proto = " " host = endpoint url , uerr := url . Parse ( endpoint ) if uerr != nil || ! strings . Contains ( endpoint , " " ) { return proto , host , scheme } scheme = url . Scheme // strip scheme:// prefix since grpc dials by host host = url . Host switch url . Scheme { case " " , " " : case " " , " " : proto = " " host = url . Host + url . Path default : proto , host = " " , " " } return proto , host , scheme }
// ParseEndpoint endpoint parses an endpoint of the form
// (http|https)://<host>*|(unix|unixs)://<path>)
// and returns a protocol ('tcp' or 'unix'),
// host (or filepath if a unix socket),
// scheme (http, https, unix, unixs).
ParseEndpoint endpoint parses an endpoint of the form ( http|https ) : // <host > * | ( unix|unixs ) : // <path > ) and returns a protocol ( tcp or unix ) host ( or filepath if a unix socket ) scheme ( http https unix unixs ) .