1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 15:36:41 -05:00

improve reflection logic in registry

This commit is contained in:
Shelikhoo 2021-09-07 14:45:56 +01:00
parent 434d9e8700
commit 9b93bb614a
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -99,11 +99,7 @@ func RegisterImplementation(proto interface{}, loader CustomLoader) error {
func registerImplementation(proto interface{}, loader CustomLoader) error {
protoReflect := reflect.New(reflect.TypeOf(proto).Elem())
var proto2 protov2.Message
assignMessage := func(msg protov2.Message) {
proto2 = msg
}
reflect.ValueOf(assignMessage).Call([]reflect.Value{protoReflect})
var proto2 = protoReflect.Interface().(protov2.Message)
msgDesc := proto2.ProtoReflect().Descriptor()
fullName := string(msgDesc.FullName())
msgOpts, err := protoext.GetMessageOptions(msgDesc)