target.go 634 B

1234567891011121314151617181920
  1. package resolver
  2. import (
  3. "fmt"
  4. "strings"
  5. "github.com/wuntsong-org/go-zero-plus/zrpc/resolver/internal"
  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", internal.DirectScheme,
  10. strings.Join(endpoints, internal.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", internal.EtcdScheme,
  15. strings.Join(endpoints, internal.EndpointSep), key)
  16. }