github.com/imannamdari/v2ray-core/v5@v5.0.5/common/serial/resolver.go (about) 1 package serial 2 3 import ( 4 "github.com/golang/protobuf/proto" 5 ) 6 7 type AnyResolver interface { 8 Resolve(typeURL string) (proto.Message, error) 9 } 10 11 type serialResolver struct{} 12 13 func (s serialResolver) Resolve(typeURL string) (proto.Message, error) { 14 instance, err := GetInstance(typeURL) 15 if err != nil { 16 return nil, err 17 } 18 return instance.(proto.Message), nil 19 } 20 21 func GetResolver() AnyResolver { 22 return &serialResolver{} 23 }