|
|
@ -63,7 +63,9 @@ func (s *Server) load() error { |
|
|
|
} |
|
|
|
} |
|
|
|
var err error |
|
|
|
var err error |
|
|
|
protoregistry.GlobalFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool { |
|
|
|
protoregistry.GlobalFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool { |
|
|
|
if fd.Services() != nil { |
|
|
|
if fd.Services() == nil { |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
for i := 0; i < fd.Services().Len(); i++ { |
|
|
|
for i := 0; i < fd.Services().Len(); i++ { |
|
|
|
svc := fd.Services().Get(i) |
|
|
|
svc := fd.Services().Get(i) |
|
|
|
fdp, e := fileDescriptorProto(fd.Path()) |
|
|
|
fdp, e := fileDescriptorProto(fd.Path()) |
|
|
@ -77,14 +79,14 @@ func (s *Server) load() error { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
s.services[string(svc.FullName())] = &dpb.FileDescriptorSet{File: fdps} |
|
|
|
s.services[string(svc.FullName())] = &dpb.FileDescriptorSet{File: fdps} |
|
|
|
if svc.Methods() != nil { |
|
|
|
if svc.Methods() == nil { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
for j := 0; j < svc.Methods().Len(); j++ { |
|
|
|
for j := 0; j < svc.Methods().Len(); j++ { |
|
|
|
method := svc.Methods().Get(j) |
|
|
|
method := svc.Methods().Get(j) |
|
|
|
s.methods[string(svc.FullName())] = append(s.methods[string(svc.FullName())], string(method.Name())) |
|
|
|
s.methods[string(svc.FullName())] = append(s.methods[string(svc.FullName())], string(method.Name())) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true |
|
|
|
return true |
|
|
|
}) |
|
|
|
}) |
|
|
|
return err |
|
|
|
return err |
|
|
@ -134,11 +136,7 @@ func parseMetadata(meta interface{}) (*dpb.FileDescriptorProto, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
// Check if meta is the byte slice.
|
|
|
|
// Check if meta is the byte slice.
|
|
|
|
if enc, ok := meta.([]byte); ok { |
|
|
|
if enc, ok := meta.([]byte); ok { |
|
|
|
fd, err := decodeFileDesc(enc) |
|
|
|
return decodeFileDesc(enc) |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return nil, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return fd, nil |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return nil, fmt.Errorf("proto not sumpport metadata: %v", meta) |
|
|
|
return nil, fmt.Errorf("proto not sumpport metadata: %v", meta) |
|
|
|
} |
|
|
|
} |
|
|
|