-
Notifications
You must be signed in to change notification settings - Fork 8
/
inproc.pb.go
697 lines (663 loc) · 16.3 KB
/
inproc.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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.8.0
// source: github.com/aperturerobotics/bifrost/transport/inproc/inproc.proto
package inproc
import (
fmt "fmt"
io "io"
strconv "strconv"
strings "strings"
dialer "github.com/aperturerobotics/bifrost/transport/common/dialer"
pconn "github.com/aperturerobotics/bifrost/transport/common/pconn"
protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
json "github.com/aperturerobotics/protobuf-go-lite/json"
)
// Config is the configuration for the inproc testing transport.
type Config struct {
unknownFields []byte
// TransportPeerID sets the peer ID to attach the transport to.
// If unset, attaches to any running peer with a private key.
TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transportPeerId,omitempty"`
// PacketOpts are options to set on the packet connection.
PacketOpts *pconn.Opts `protobuf:"bytes,2,opt,name=packet_opts,json=packetOpts,proto3" json:"packetOpts,omitempty"`
// Dialers maps peer IDs to dialers.
Dialers map[string]*dialer.DialerOpts `protobuf:"bytes,3,rep,name=dialers,proto3" json:"dialers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *Config) Reset() {
*x = Config{}
}
func (*Config) ProtoMessage() {}
func (x *Config) GetTransportPeerId() string {
if x != nil {
return x.TransportPeerId
}
return ""
}
func (x *Config) GetPacketOpts() *pconn.Opts {
if x != nil {
return x.PacketOpts
}
return nil
}
func (x *Config) GetDialers() map[string]*dialer.DialerOpts {
if x != nil {
return x.Dialers
}
return nil
}
type Config_DialersEntry struct {
unknownFields []byte
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value *dialer.DialerOpts `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
func (x *Config_DialersEntry) Reset() {
*x = Config_DialersEntry{}
}
func (*Config_DialersEntry) ProtoMessage() {}
func (x *Config_DialersEntry) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *Config_DialersEntry) GetValue() *dialer.DialerOpts {
if x != nil {
return x.Value
}
return nil
}
func (m *Config) CloneVT() *Config {
if m == nil {
return (*Config)(nil)
}
r := new(Config)
r.TransportPeerId = m.TransportPeerId
if rhs := m.PacketOpts; rhs != nil {
r.PacketOpts = rhs.CloneVT()
}
if rhs := m.Dialers; rhs != nil {
tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs))
for k, v := range rhs {
tmpContainer[k] = v.CloneVT()
}
r.Dialers = tmpContainer
}
if len(m.unknownFields) > 0 {
r.unknownFields = make([]byte, len(m.unknownFields))
copy(r.unknownFields, m.unknownFields)
}
return r
}
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage {
return m.CloneVT()
}
func (this *Config) EqualVT(that *Config) bool {
if this == that {
return true
} else if this == nil || that == nil {
return false
}
if this.TransportPeerId != that.TransportPeerId {
return false
}
if !this.PacketOpts.EqualVT(that.PacketOpts) {
return false
}
if len(this.Dialers) != len(that.Dialers) {
return false
}
for i, vx := range this.Dialers {
vy, ok := that.Dialers[i]
if !ok {
return false
}
if p, q := vx, vy; p != q {
if p == nil {
p = &dialer.DialerOpts{}
}
if q == nil {
q = &dialer.DialerOpts{}
}
if !p.EqualVT(q) {
return false
}
}
}
return string(this.unknownFields) == string(that.unknownFields)
}
func (this *Config) EqualMessageVT(thatMsg any) bool {
that, ok := thatMsg.(*Config)
if !ok {
return false
}
return this.EqualVT(that)
}
// MarshalProtoJSON marshals the Config_DialersEntry message to JSON.
func (x *Config_DialersEntry) MarshalProtoJSON(s *json.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.Key != "" || s.HasField("key") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("key")
s.WriteString(x.Key)
}
if x.Value != nil || s.HasField("value") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("value")
x.Value.MarshalProtoJSON(s.WithField("value"))
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the Config_DialersEntry to JSON.
func (x *Config_DialersEntry) MarshalJSON() ([]byte, error) {
return json.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the Config_DialersEntry message from JSON.
func (x *Config_DialersEntry) UnmarshalProtoJSON(s *json.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.Skip() // ignore unknown field
case "key":
s.AddField("key")
x.Key = s.ReadString()
case "value":
if s.ReadNil() {
x.Value = nil
return
}
x.Value = &dialer.DialerOpts{}
x.Value.UnmarshalProtoJSON(s.WithField("value", true))
}
})
}
// UnmarshalJSON unmarshals the Config_DialersEntry from JSON.
func (x *Config_DialersEntry) UnmarshalJSON(b []byte) error {
return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
// MarshalProtoJSON marshals the Config message to JSON.
func (x *Config) MarshalProtoJSON(s *json.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if x.TransportPeerId != "" || s.HasField("transportPeerId") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("transportPeerId")
s.WriteString(x.TransportPeerId)
}
if x.PacketOpts != nil || s.HasField("packetOpts") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("packetOpts")
x.PacketOpts.MarshalProtoJSON(s.WithField("packetOpts"))
}
if x.Dialers != nil || s.HasField("dialers") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("dialers")
s.WriteObjectStart()
var wroteElement bool
for k, v := range x.Dialers {
s.WriteMoreIf(&wroteElement)
s.WriteObjectStringField(k)
v.MarshalProtoJSON(s.WithField("dialers"))
}
s.WriteObjectEnd()
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the Config to JSON.
func (x *Config) MarshalJSON() ([]byte, error) {
return json.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the Config message from JSON.
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.Skip() // ignore unknown field
case "transport_peer_id", "transportPeerId":
s.AddField("transport_peer_id")
x.TransportPeerId = s.ReadString()
case "packet_opts", "packetOpts":
if s.ReadNil() {
x.PacketOpts = nil
return
}
x.PacketOpts = &pconn.Opts{}
x.PacketOpts.UnmarshalProtoJSON(s.WithField("packet_opts", true))
case "dialers":
s.AddField("dialers")
if s.ReadNil() {
x.Dialers = nil
return
}
x.Dialers = make(map[string]*dialer.DialerOpts)
s.ReadStringMap(func(key string) {
var v dialer.DialerOpts
v.UnmarshalProtoJSON(s)
x.Dialers[key] = &v
})
}
})
}
// UnmarshalJSON unmarshals the Config from JSON.
func (x *Config) UnmarshalJSON(b []byte) error {
return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
func (m *Config) 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 *Config) MarshalToVT(dAtA []byte) (int, error) {
size := m.SizeVT()
return m.MarshalToSizedBufferVT(dAtA[:size])
}
func (m *Config) 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 len(m.Dialers) > 0 {
for k := range m.Dialers {
v := m.Dialers[k]
baseI := i
size, err := v.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x1a
}
}
if m.PacketOpts != nil {
size, err := m.PacketOpts.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size))
i--
dAtA[i] = 0x12
}
if len(m.TransportPeerId) > 0 {
i -= len(m.TransportPeerId)
copy(dAtA[i:], m.TransportPeerId)
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Config) SizeVT() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.TransportPeerId)
if l > 0 {
n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
}
if m.PacketOpts != nil {
l = m.PacketOpts.SizeVT()
n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
}
if len(m.Dialers) > 0 {
for k, v := range m.Dialers {
_ = k
_ = v
l = 0
if v != nil {
l = v.SizeVT()
}
l += 1 + protobuf_go_lite.SizeOfVarint(uint64(l))
mapEntrySize := 1 + len(k) + protobuf_go_lite.SizeOfVarint(uint64(len(k))) + l
n += mapEntrySize + 1 + protobuf_go_lite.SizeOfVarint(uint64(mapEntrySize))
}
}
n += len(m.unknownFields)
return n
}
func (x *Config_DialersEntry) MarshalProtoText() string {
var sb strings.Builder
sb.WriteString("DialersEntry {")
if x.Key != "" {
if sb.Len() > 14 {
sb.WriteString(" ")
}
sb.WriteString("key: ")
sb.WriteString(strconv.Quote(x.Key))
}
if x.Value != nil {
if sb.Len() > 14 {
sb.WriteString(" ")
}
sb.WriteString("value: ")
sb.WriteString(x.Value.MarshalProtoText())
}
sb.WriteString("}")
return sb.String()
}
func (x *Config_DialersEntry) String() string {
return x.MarshalProtoText()
}
func (x *Config) MarshalProtoText() string {
var sb strings.Builder
sb.WriteString("Config {")
if x.TransportPeerId != "" {
if sb.Len() > 8 {
sb.WriteString(" ")
}
sb.WriteString("transport_peer_id: ")
sb.WriteString(strconv.Quote(x.TransportPeerId))
}
if x.PacketOpts != nil {
if sb.Len() > 8 {
sb.WriteString(" ")
}
sb.WriteString("packet_opts: ")
sb.WriteString(x.PacketOpts.MarshalProtoText())
}
if len(x.Dialers) > 0 {
if sb.Len() > 8 {
sb.WriteString(" ")
}
sb.WriteString("dialers: {")
for k, v := range x.Dialers {
sb.WriteString(" ")
sb.WriteString(strconv.Quote(k))
sb.WriteString(": ")
sb.WriteString(v.MarshalProtoText())
}
sb.WriteString(" }")
}
sb.WriteString("}")
return sb.String()
}
func (x *Config) String() string {
return x.MarshalProtoText()
}
func (m *Config) 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: Config: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType)
}
var stringLen 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++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protobuf_go_lite.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protobuf_go_lite.ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.TransportPeerId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PacketOpts", 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.PacketOpts == nil {
m.PacketOpts = &pconn.Opts{}
}
if err := m.PacketOpts.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Dialers", 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.Dialers == nil {
m.Dialers = make(map[string]*dialer.DialerOpts)
}
var mapkey string
var mapvalue *dialer.DialerOpts
for iNdEx < postIndex {
entryPreIndex := 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)
if fieldNum == 1 {
var stringLenmapkey 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++
stringLenmapkey |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return protobuf_go_lite.ErrInvalidLength
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey < 0 {
return protobuf_go_lite.ErrInvalidLength
}
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey = string(dAtA[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
} else if fieldNum == 2 {
var mapmsglen 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++
mapmsglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if mapmsglen < 0 {
return protobuf_go_lite.ErrInvalidLength
}
postmsgIndex := iNdEx + mapmsglen
if postmsgIndex < 0 {
return protobuf_go_lite.ErrInvalidLength
}
if postmsgIndex > l {
return io.ErrUnexpectedEOF
}
mapvalue = &dialer.DialerOpts{}
if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil {
return err
}
iNdEx = postmsgIndex
} else {
iNdEx = entryPreIndex
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) > postIndex {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
m.Dialers[mapkey] = mapvalue
iNdEx = postIndex
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
}