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:
parent
434d9e8700
commit
9b93bb614a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user