...
1
2
3
4
5
6
7 package protolegacy
8
9 import (
10 "bytes"
11 "compress/gzip"
12 "errors"
13 "fmt"
14 "io/ioutil"
15
16 "google.golang.org/protobuf/reflect/protoreflect"
17 "google.golang.org/protobuf/reflect/protoregistry"
18 "google.golang.org/protobuf/runtime/protoiface"
19 "google.golang.org/protobuf/runtime/protoimpl"
20 )
21
22 const (
23 ProtoPackageIsVersion1 = true
24 ProtoPackageIsVersion2 = true
25 ProtoPackageIsVersion3 = true
26 )
27
28 const (
29 WireVarint = 0
30 WireFixed32 = 5
31 WireFixed64 = 1
32 WireBytes = 2
33 WireStartGroup = 3
34 WireEndGroup = 4
35 )
36
37 type (
38 Message = protoiface.MessageV1
39 ExtensionRange = protoiface.ExtensionRangeV1
40 ExtensionDesc = protoimpl.ExtensionInfo
41 Extension = protoimpl.ExtensionFieldV1
42 XXX_InternalExtensions = protoimpl.ExtensionFields
43 )
44
45 func RegisterFile(s string, d []byte) {
46
47 zr, err := gzip.NewReader(bytes.NewReader(d))
48 if err != nil {
49 panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err))
50 }
51 b, err := ioutil.ReadAll(zr)
52 if err != nil {
53 panic(fmt.Sprintf("proto: invalid compressed file descriptor: %v", err))
54 }
55
56
57
58
59 protoimpl.DescBuilder{RawDescriptor: b}.Build()
60 }
61
62 func RegisterType(m Message, s string) {
63 mt := protoimpl.X.LegacyMessageTypeOf(m, protoreflect.FullName(s))
64 if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil {
65 panic(err)
66 }
67 }
68
69 func RegisterMapType(interface{}, string) {
70
71 }
72
73 func RegisterEnum(string, map[int32]string, map[string]int32) {
74
75 }
76
77 func RegisterExtension(d *ExtensionDesc) {
78 if err := protoregistry.GlobalTypes.RegisterExtension(d); err != nil {
79 panic(err)
80 }
81 }
82
83 var ErrInternalBadWireType = errors.New("not implemented")
84
85 func Size(Message) int { panic("not implemented") }
86 func Marshal(Message) ([]byte, error) { panic("not implemented") }
87 func Unmarshal([]byte, Message) error { panic("not implemented") }
88
89 func SizeVarint(uint64) int { panic("not implemented") }
90 func EncodeVarint(uint64) []byte { panic("not implemented") }
91 func DecodeVarint([]byte) (uint64, int) { panic("not implemented") }
92
93 func CompactTextString(Message) string { panic("not implemented") }
94 func EnumName(map[int32]string, int32) string { panic("not implemented") }
95 func UnmarshalJSONEnum(map[string]int32, []byte, string) (int32, error) { panic("not implemented") }
96
97 type Buffer struct{}
98
99 func (*Buffer) DecodeFixed32() (uint64, error) { panic("not implemented") }
100 func (*Buffer) DecodeFixed64() (uint64, error) { panic("not implemented") }
101 func (*Buffer) DecodeGroup(Message) error { panic("not implemented") }
102 func (*Buffer) DecodeMessage(Message) error { panic("not implemented") }
103 func (*Buffer) DecodeRawBytes(bool) ([]byte, error) { panic("not implemented") }
104 func (*Buffer) DecodeStringBytes() (string, error) { panic("not implemented") }
105 func (*Buffer) DecodeVarint() (uint64, error) { panic("not implemented") }
106 func (*Buffer) DecodeZigzag32() (uint64, error) { panic("not implemented") }
107 func (*Buffer) DecodeZigzag64() (uint64, error) { panic("not implemented") }
108 func (*Buffer) EncodeFixed32(uint64) error { panic("not implemented") }
109 func (*Buffer) EncodeFixed64(uint64) error { panic("not implemented") }
110 func (*Buffer) EncodeMessage(Message) error { panic("not implemented") }
111 func (*Buffer) EncodeRawBytes([]byte) error { panic("not implemented") }
112 func (*Buffer) EncodeStringBytes(string) error { panic("not implemented") }
113 func (*Buffer) EncodeVarint(uint64) error { panic("not implemented") }
114 func (*Buffer) EncodeZigzag32(uint64) error { panic("not implemented") }
115 func (*Buffer) EncodeZigzag64(uint64) error { panic("not implemented") }
116 func (*Buffer) Marshal(Message) error { panic("not implemented") }
117 func (*Buffer) Unmarshal(Message) error { panic("not implemented") }
118
119 type InternalMessageInfo struct{}
120
121 func (*InternalMessageInfo) DiscardUnknown(Message) { panic("not implemented") }
122 func (*InternalMessageInfo) Marshal([]byte, Message, bool) ([]byte, error) { panic("not implemented") }
123 func (*InternalMessageInfo) Merge(Message, Message) { panic("not implemented") }
124 func (*InternalMessageInfo) Size(Message) int { panic("not implemented") }
125 func (*InternalMessageInfo) Unmarshal(Message, []byte) error { panic("not implemented") }
126
View as plain text