|
|
@ -66,7 +66,11 @@ func (m *prefixMuxMap[T]) get(path string) (val T, exist bool) {
|
|
|
|
|
|
|
|
|
|
|
|
// match assume pattern like `/core.v1.AuthenticateService/login`
|
|
|
|
// match assume pattern like `/core.v1.AuthenticateService/login`
|
|
|
|
func (m *prefixMuxMap[T]) match(pattern string) (val T, exist bool) {
|
|
|
|
func (m *prefixMuxMap[T]) match(pattern string) (val T, exist bool) {
|
|
|
|
path, _ := strings.CutPrefix(pattern, m.prefix)
|
|
|
|
path, found := strings.CutPrefix(pattern, m.prefix)
|
|
|
|
|
|
|
|
if !found {
|
|
|
|
|
|
|
|
exist = false
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
idx := strings.IndexByte(path[1:], '/')
|
|
|
|
idx := strings.IndexByte(path[1:], '/')
|
|
|
|
if idx < 0 {
|
|
|
|
if idx < 0 {
|
|
|
|
return
|
|
|
|
return
|
|
|
|