(fullMethod string)
| 119 | } |
| 120 | |
| 121 | func lookupMethodDescriptor(fullMethod string) (protoreflect.MethodDescriptor, bool) { |
| 122 | parts := strings.Split(strings.TrimPrefix(fullMethod, "/"), "/") |
| 123 | if len(parts) != 2 || parts[0] == "" || parts[1] == "" { |
| 124 | return nil, false |
| 125 | } |
| 126 | desc, err := protoregistry.GlobalFiles.FindDescriptorByName(protoreflect.FullName(parts[0])) |
| 127 | if err != nil { |
| 128 | return nil, false |
| 129 | } |
| 130 | svcDesc, ok := desc.(protoreflect.ServiceDescriptor) |
| 131 | if !ok { |
| 132 | return nil, false |
| 133 | } |
| 134 | methods := svcDesc.Methods() |
| 135 | name := protoreflect.Name(parts[1]) |
| 136 | for i := 0; i < methods.Len(); i++ { |
| 137 | m := methods.Get(i) |
| 138 | if m.Name() == name { |
| 139 | return m, true |
| 140 | } |
| 141 | } |
| 142 | return nil, false |
| 143 | } |
| 144 | |
| 145 | func isPublicMethod(method protoreflect.MethodDescriptor) bool { |
| 146 | opts := method.Options() |
no test coverage detected