endpoints.go 403 B

12345678910111213141516171819
  1. package targets
  2. import (
  3. "strings"
  4. "google.golang.org/grpc/resolver"
  5. )
  6. const slashSeparator = "/"
  7. // GetAuthority returns the authority of the target.
  8. func GetAuthority(target resolver.Target) string {
  9. return target.URL.Host
  10. }
  11. // GetEndpoints returns the endpoints from the given target.
  12. func GetEndpoints(target resolver.Target) string {
  13. return strings.Trim(target.URL.Path, slashSeparator)
  14. }