github.com/lingyao2333/mo-zero@v1.4.1/zrpc/resolver/target.go (about)

     1  package resolver
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	"github.com/lingyao2333/mo-zero/zrpc/resolver/internal"
     8  )
     9  
    10  // BuildDirectTarget returns a string that represents the given endpoints with direct schema.
    11  func BuildDirectTarget(endpoints []string) string {
    12  	return fmt.Sprintf("%s:///%s", internal.DirectScheme,
    13  		strings.Join(endpoints, internal.EndpointSep))
    14  }
    15  
    16  // BuildDiscovTarget returns a string that represents the given endpoints with discov schema.
    17  func BuildDiscovTarget(endpoints []string, key string) string {
    18  	return fmt.Sprintf("%s://%s/%s", internal.EtcdScheme,
    19  		strings.Join(endpoints, internal.EndpointSep), key)
    20  }