mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 09:40:24 +08:00
20 lines
403 B
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)
|
||
|
}
|