target.go 439 B

123456789101112131415161718
  1. package internal
  2. import (
  3. "fmt"
  4. "strings"
  5. "github.com/tal-tech/go-zero/zrpc/internal/resolver"
  6. )
  7. func BuildDirectTarget(endpoints []string) string {
  8. return fmt.Sprintf("%s:///%s", resolver.DirectScheme,
  9. strings.Join(endpoints, resolver.EndpointSep))
  10. }
  11. func BuildDiscovTarget(endpoints []string, key string) string {
  12. return fmt.Sprintf("%s://%s/%s", resolver.DiscovScheme,
  13. strings.Join(endpoints, resolver.EndpointSep), key)
  14. }