You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/zrpc/resolver/internal/targets/endpoints.go

20 lines
403 B
Go

package targets
import (
"strings"
"google.golang.org/grpc/resolver"
)
const slashSeparator = "/"
// GetAuthority returns the authority of the target.
func GetAuthority(target resolver.Target) string {
return target.URL.Host
}
// GetEndpoints returns the endpoints from the given target.
func GetEndpoints(target resolver.Target) string {
return strings.Trim(target.URL.Path, slashSeparator)
}