-
Notifications
You must be signed in to change notification settings - Fork 8
/
conn.pb.go
445 lines (421 loc) · 9.37 KB
/
conn.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.6.5
// source: github.com/aperturerobotics/bifrost/transport/common/conn/conn.proto
package conn
import (
fmt "fmt"
io "io"
strconv "strconv"
strings "strings"
quic "github.com/aperturerobotics/bifrost/transport/common/quic"
protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
json "github.com/aperturerobotics/protobuf-go-lite/json"
)
// Opts are extra options for the conn.
type Opts struct {
unknownFields []byte
// Quic are the quic protocol options.
Quic *quic.Opts `protobuf:"bytes,1,opt,name=quic,proto3" json:"quic,omitempty"`
// Verbose turns on verbose debug logging.
Verbose bool `protobuf:"varint,2,opt,name=verbose,proto3" json:"verbose,omitempty"`
// Mtu sets the maximum size for a single packet.
// Defaults to 65000.
Mtu uint32 `protobuf:"varint,3,opt,name=mtu,proto3" json:"mtu,omitempty"`
// BufSize is the number of packets to buffer.
//
// Total memory cap is mtu * bufSize.
// Defaults to 10.
BufSize uint32 `protobuf:"varint,4,opt,name=buf_size,json=bufSize,proto3" json:"bufSize,omitempty"`
}
func (x *Opts) Reset() {
*x = Opts{}
}
func (*Opts) ProtoMessage() {}
func (x *Opts) GetQuic() *quic.Opts {
if x != nil {
return x.Quic
}
return nil
}
func (x *Opts) GetVerbose() bool {
if x != nil {
return x.Verbose
}
return false
}
func (x *Opts) GetMtu() uint32 {
if x != nil {
return x.Mtu
}
return 0
}
func (x *Opts) GetBufSize() uint32 {
if x != nil {
return x.BufSize
}
return 0
}
func (m *Opts) CloneVT() *Opts {
if m == nil {
return (*Opts)(nil)
}
r := new(Opts)
r.Verbose = m.Verbose
r.Mtu = m.Mtu
r.BufSize = m.BufSize
if rhs := m.Quic; rhs != nil {
r.Quic = rhs.CloneVT()
}
if len(m.unknownFields) > 0 {
r.unknownFields = make([]byte, len(m.unknownFields))
copy(r.unknownFields, m.unknownFields)
}
return r
}
func (m *Opts) CloneMessageVT() protobuf_go_lite.CloneMessage {
return m.CloneVT()
}
func (this *Opts) EqualVT(that *Opts) bool {
if this == that {
return true
} else if this == nil || that == nil {
return false
}
if !this.Quic.EqualVT(that.Quic) {
return false
}
if this.Verbose != that.Verbose {
return false
}
if this.Mtu != that.Mtu {
return false
}
if this.BufSize != that.BufSize {
return false
}
return string(this.unknownFields) == string(that.unknownFields)
}
func (this *Opts) EqualMessageVT(thatMsg any) bool {
that, ok := thatMsg.(*Opts)
if !ok {
return false
}
return this.EqualVT(that)
}
// MarshalProtoJSON marshals the Opts message to JSON.
func (x *Opts) MarshalProtoJSON(s *json.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.Quic != nil || s.HasField("quic") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("quic")
x.Quic.MarshalProtoJSON(s.WithField("quic"))
}
if x.Verbose || s.HasField("verbose") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("verbose")
s.WriteBool(x.Verbose)
}
if x.Mtu != 0 || s.HasField("mtu") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("mtu")
s.WriteUint32(x.Mtu)
}
if x.BufSize != 0 || s.HasField("bufSize") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("bufSize")
s.WriteUint32(x.BufSize)
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the Opts to JSON.
func (x *Opts) MarshalJSON() ([]byte, error) {
return json.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the Opts message from JSON.
func (x *Opts) UnmarshalProtoJSON(s *json.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.Skip() // ignore unknown field
case "quic":
if s.ReadNil() {
x.Quic = nil
return
}
x.Quic = &quic.Opts{}
x.Quic.UnmarshalProtoJSON(s.WithField("quic", true))
case "verbose":
s.AddField("verbose")
x.Verbose = s.ReadBool()
case "mtu":
s.AddField("mtu")
x.Mtu = s.ReadUint32()
case "buf_size", "bufSize":
s.AddField("buf_size")
x.BufSize = s.ReadUint32()
}
})
}
// UnmarshalJSON unmarshals the Opts from JSON.
func (x *Opts) UnmarshalJSON(b []byte) error {
return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
func (m *Opts) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
}
size := m.SizeVT()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBufferVT(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Opts) MarshalToVT(dAtA []byte) (int, error) {
size := m.SizeVT()
return m.MarshalToSizedBufferVT(dAtA[:size])
}
func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
if m == nil {
return 0, nil
}
i := len(dAtA)
_ = i
var l int
_ = l
if m.unknownFields != nil {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if m.BufSize != 0 {
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.BufSize))
i--
dAtA[i] = 0x20
}
if m.Mtu != 0 {
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Mtu))
i--
dAtA[i] = 0x18
}
if m.Verbose {
i--
if m.Verbose {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
if m.Quic != nil {
size, err := m.Quic.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Opts) SizeVT() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Quic != nil {
l = m.Quic.SizeVT()
n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
}
if m.Verbose {
n += 2
}
if m.Mtu != 0 {
n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.Mtu))
}
if m.BufSize != 0 {
n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.BufSize))
}
n += len(m.unknownFields)
return n
}
func (x *Opts) MarshalProtoText() string {
var sb strings.Builder
sb.WriteString("Opts { ")
if x.Quic != nil {
sb.WriteString(" quic: ")
sb.WriteString(x.Quic.MarshalProtoText())
}
if x.Verbose {
sb.WriteString(" verbose: ")
sb.WriteString(strconv.FormatBool(x.Verbose))
}
if x.Mtu != 0 {
sb.WriteString(" mtu: ")
sb.WriteString(strconv.FormatUint(uint64(x.Mtu), 10))
}
if x.BufSize != 0 {
sb.WriteString(" buf_size: ")
sb.WriteString(strconv.FormatUint(uint64(x.BufSize), 10))
}
sb.WriteString("}")
return sb.String()
}
func (x *Opts) String() string {
return x.MarshalProtoText()
}
func (m *Opts) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protobuf_go_lite.ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Opts: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Quic", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protobuf_go_lite.ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return protobuf_go_lite.ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return protobuf_go_lite.ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Quic == nil {
m.Quic = &quic.Opts{}
}
if err := m.Quic.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Verbose", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protobuf_go_lite.ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Verbose = bool(v != 0)
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Mtu", wireType)
}
m.Mtu = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protobuf_go_lite.ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Mtu |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BufSize", wireType)
}
m.BufSize = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protobuf_go_lite.ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BufSize |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protobuf_go_lite.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}