support direct scheme on rpc resolver

This commit is contained in:
kevin
2020-08-18 18:36:44 +08:00
parent 0214161bfc
commit f03cfb0ff7
11 changed files with 170 additions and 134 deletions

17
rpcx/internal/target.go Normal file
View File

@@ -0,0 +1,17 @@
package internal
import (
"fmt"
"strings"
"github.com/tal-tech/go-zero/rpcx/internal/resolver"
)
func BuildDirectTarget(endpoints []string) string {
return fmt.Sprintf("%s:///%s", resolver.DirectScheme, strings.Join(endpoints, resolver.EndpointSep))
}
func BuildDiscovTarget(endpoints []string, key string) string {
return fmt.Sprintf("%s://%s/%s", resolver.DiscovScheme,
strings.Join(endpoints, resolver.EndpointSep), key)
}