You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
3 years ago
|
package internal
|
||
4 years ago
|
|
||
4 years ago
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"google.golang.org/grpc/resolver"
|
||
|
)
|
||
4 years ago
|
|
||
4 years ago
|
const (
|
||
4 years ago
|
// DirectScheme stands for direct scheme.
|
||
4 years ago
|
DirectScheme = "direct"
|
||
4 years ago
|
// DiscovScheme stands for discov scheme.
|
||
4 years ago
|
DiscovScheme = "discov"
|
||
3 years ago
|
// EtcdScheme stands for etcd scheme.
|
||
|
EtcdScheme = "etcd"
|
||
3 years ago
|
// KubernetesScheme stands for k8s scheme.
|
||
|
KubernetesScheme = "k8s"
|
||
4 years ago
|
// EndpointSepChar is the separator cha in endpoints.
|
||
4 years ago
|
EndpointSepChar = ','
|
||
4 years ago
|
|
||
|
subsetSize = 32
|
||
4 years ago
|
)
|
||
|
|
||
4 years ago
|
var (
|
||
4 years ago
|
// EndpointSep is the separator string in endpoints.
|
||
4 years ago
|
EndpointSep = fmt.Sprintf("%c", EndpointSepChar)
|
||
4 years ago
|
|
||
3 years ago
|
directResolverBuilder directBuilder
|
||
|
discovResolverBuilder discovBuilder
|
||
|
etcdResolverBuilder etcdBuilder
|
||
|
k8sResolverBuilder kubeBuilder
|
||
4 years ago
|
)
|
||
4 years ago
|
|
||
4 years ago
|
// RegisterResolver registers the direct and discov schemes to the resolver.
|
||
4 years ago
|
func RegisterResolver() {
|
||
3 years ago
|
resolver.Register(&directResolverBuilder)
|
||
|
resolver.Register(&discovResolverBuilder)
|
||
|
resolver.Register(&etcdResolverBuilder)
|
||
|
resolver.Register(&k8sResolverBuilder)
|
||
4 years ago
|
}
|
||
|
|
||
4 years ago
|
type nopResolver struct {
|
||
4 years ago
|
cc resolver.ClientConn
|
||
4 years ago
|
}
|
||
|
|
||
4 years ago
|
func (r *nopResolver) Close() {
|
||
4 years ago
|
}
|
||
|
|
||
4 years ago
|
func (r *nopResolver) ResolveNow(options resolver.ResolveNowOptions) {
|
||
4 years ago
|
}
|