github.com/lingyao2333/mo-zero@v1.4.1/zrpc/resolver/internal/targets/endpoints.go (about) 1 package targets 2 3 import ( 4 "strings" 5 6 "google.golang.org/grpc/resolver" 7 ) 8 9 const slashSeparator = "/" 10 11 // GetAuthority returns the authority of the target. 12 func GetAuthority(target resolver.Target) string { 13 return target.URL.Host 14 } 15 16 // GetEndpoints returns the endpoints from the given target. 17 func GetEndpoints(target resolver.Target) string { 18 return strings.Trim(target.URL.Path, slashSeparator) 19 }