target.go 624 B

1234567891011121314151617181920
  1. package internal
  2. import (
  3. "fmt"
  4. "strings"
  5. "git.i2edu.net/i2/go-zero/zrpc/internal/resolver"
  6. )
  7. // BuildDirectTarget returns a string that represents the given endpoints with direct schema.
  8. func BuildDirectTarget(endpoints []string) string {
  9. return fmt.Sprintf("%s:///%s", resolver.DirectScheme,
  10. strings.Join(endpoints, resolver.EndpointSep))
  11. }
  12. // BuildDiscovTarget returns a string that represents the given endpoints with discov schema.
  13. func BuildDiscovTarget(endpoints []string, key string) string {
  14. return fmt.Sprintf("%s://%s/%s", resolver.DiscovScheme,
  15. strings.Join(endpoints, resolver.EndpointSep), key)
  16. }