resolver.go 813 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package resolver
  2. import (
  3. "fmt"
  4. "google.golang.org/grpc/resolver"
  5. )
  6. const (
  7. // DirectScheme stands for direct scheme.
  8. DirectScheme = "direct"
  9. // DiscovScheme stands for discov scheme.
  10. DiscovScheme = "discov"
  11. // EndpointSepChar is the separator cha in endpoints.
  12. EndpointSepChar = ','
  13. subsetSize = 32
  14. )
  15. var (
  16. // EndpointSep is the separator string in endpoints.
  17. EndpointSep = fmt.Sprintf("%c", EndpointSepChar)
  18. dirBuilder directBuilder
  19. disBuilder discovBuilder
  20. )
  21. // RegisterResolver registers the direct and discov schemes to the resolver.
  22. func RegisterResolver() {
  23. resolver.Register(&dirBuilder)
  24. resolver.Register(&disBuilder)
  25. }
  26. type nopResolver struct {
  27. cc resolver.ClientConn
  28. }
  29. func (r *nopResolver) Close() {
  30. }
  31. func (r *nopResolver) ResolveNow(options resolver.ResolveNowOptions) {
  32. }