1
2
3
4 package types
5
6 import (
7 bytes "bytes"
8 fmt "fmt"
9 proto "github.com/gogo/protobuf/proto"
10 io "io"
11 math "math"
12 math_bits "math/bits"
13 reflect "reflect"
14 strings "strings"
15 )
16
17
18 var _ = proto.Marshal
19 var _ = fmt.Errorf
20 var _ = math.Inf
21
22
23
24
25
26 const _ = proto.GoGoProtoPackageIsVersion3
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 type Any struct {
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 TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"`
138
139 Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
140 XXX_NoUnkeyedLiteral struct{} `json:"-"`
141 XXX_unrecognized []byte `json:"-"`
142 XXX_sizecache int32 `json:"-"`
143 }
144
145 func (m *Any) Reset() { *m = Any{} }
146 func (*Any) ProtoMessage() {}
147 func (*Any) Descriptor() ([]byte, []int) {
148 return fileDescriptor_b53526c13ae22eb4, []int{0}
149 }
150 func (*Any) XXX_WellKnownType() string { return "Any" }
151 func (m *Any) XXX_Unmarshal(b []byte) error {
152 return m.Unmarshal(b)
153 }
154 func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
155 if deterministic {
156 return xxx_messageInfo_Any.Marshal(b, m, deterministic)
157 } else {
158 b = b[:cap(b)]
159 n, err := m.MarshalToSizedBuffer(b)
160 if err != nil {
161 return nil, err
162 }
163 return b[:n], nil
164 }
165 }
166 func (m *Any) XXX_Merge(src proto.Message) {
167 xxx_messageInfo_Any.Merge(m, src)
168 }
169 func (m *Any) XXX_Size() int {
170 return m.Size()
171 }
172 func (m *Any) XXX_DiscardUnknown() {
173 xxx_messageInfo_Any.DiscardUnknown(m)
174 }
175
176 var xxx_messageInfo_Any proto.InternalMessageInfo
177
178 func (m *Any) GetTypeUrl() string {
179 if m != nil {
180 return m.TypeUrl
181 }
182 return ""
183 }
184
185 func (m *Any) GetValue() []byte {
186 if m != nil {
187 return m.Value
188 }
189 return nil
190 }
191
192 func (*Any) XXX_MessageName() string {
193 return "google.protobuf.Any"
194 }
195 func init() {
196 proto.RegisterType((*Any)(nil), "google.protobuf.Any")
197 }
198
199 func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_b53526c13ae22eb4) }
200
201 var fileDescriptor_b53526c13ae22eb4 = []byte{
202
203 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f,
204 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4,
205 0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x25, 0x33, 0x2e, 0x66, 0xc7, 0xbc, 0x4a,
206 0x21, 0x49, 0x2e, 0x8e, 0x92, 0xca, 0x82, 0xd4, 0xf8, 0xd2, 0xa2, 0x1c, 0x09, 0x46, 0x05, 0x46,
207 0x0d, 0xce, 0x20, 0x76, 0x10, 0x3f, 0xb4, 0x28, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7,
208 0x34, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc2, 0x71, 0xaa, 0xbf, 0xf1, 0x50, 0x8e,
209 0xe1, 0xc3, 0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x1b, 0x1e, 0xc9, 0x31, 0xae, 0x78, 0x24,
210 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78,
211 0x24, 0xc7, 0xf0, 0x01, 0x24, 0xfe, 0x58, 0x8e, 0xf1, 0xc4, 0x63, 0x39, 0x46, 0x2e, 0xe1, 0xe4,
212 0xfc, 0x5c, 0x3d, 0x34, 0xeb, 0x9d, 0x38, 0x1c, 0xf3, 0x2a, 0x03, 0x40, 0x9c, 0x00, 0xc6, 0x28,
213 0x56, 0x90, 0x8d, 0xc5, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c, 0x56, 0x31, 0xc9, 0xb9, 0x43, 0x94,
214 0x06, 0x40, 0x95, 0xea, 0x85, 0xa7, 0xe6, 0xe4, 0x78, 0xe7, 0xe5, 0x97, 0xe7, 0x85, 0x80, 0x94,
215 0x25, 0xb1, 0x81, 0xcd, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x81, 0x82, 0xd3, 0xed,
216 0x00, 0x00, 0x00,
217 }
218
219 func (this *Any) Compare(that interface{}) int {
220 if that == nil {
221 if this == nil {
222 return 0
223 }
224 return 1
225 }
226
227 that1, ok := that.(*Any)
228 if !ok {
229 that2, ok := that.(Any)
230 if ok {
231 that1 = &that2
232 } else {
233 return 1
234 }
235 }
236 if that1 == nil {
237 if this == nil {
238 return 0
239 }
240 return 1
241 } else if this == nil {
242 return -1
243 }
244 if this.TypeUrl != that1.TypeUrl {
245 if this.TypeUrl < that1.TypeUrl {
246 return -1
247 }
248 return 1
249 }
250 if c := bytes.Compare(this.Value, that1.Value); c != 0 {
251 return c
252 }
253 if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 {
254 return c
255 }
256 return 0
257 }
258 func (this *Any) Equal(that interface{}) bool {
259 if that == nil {
260 return this == nil
261 }
262
263 that1, ok := that.(*Any)
264 if !ok {
265 that2, ok := that.(Any)
266 if ok {
267 that1 = &that2
268 } else {
269 return false
270 }
271 }
272 if that1 == nil {
273 return this == nil
274 } else if this == nil {
275 return false
276 }
277 if this.TypeUrl != that1.TypeUrl {
278 return false
279 }
280 if !bytes.Equal(this.Value, that1.Value) {
281 return false
282 }
283 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
284 return false
285 }
286 return true
287 }
288 func (this *Any) GoString() string {
289 if this == nil {
290 return "nil"
291 }
292 s := make([]string, 0, 6)
293 s = append(s, "&types.Any{")
294 s = append(s, "TypeUrl: "+fmt.Sprintf("%#v", this.TypeUrl)+",\n")
295 s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n")
296 if this.XXX_unrecognized != nil {
297 s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
298 }
299 s = append(s, "}")
300 return strings.Join(s, "")
301 }
302 func valueToGoStringAny(v interface{}, typ string) string {
303 rv := reflect.ValueOf(v)
304 if rv.IsNil() {
305 return "nil"
306 }
307 pv := reflect.Indirect(rv).Interface()
308 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
309 }
310 func (m *Any) Marshal() (dAtA []byte, err error) {
311 size := m.Size()
312 dAtA = make([]byte, size)
313 n, err := m.MarshalToSizedBuffer(dAtA[:size])
314 if err != nil {
315 return nil, err
316 }
317 return dAtA[:n], nil
318 }
319
320 func (m *Any) MarshalTo(dAtA []byte) (int, error) {
321 size := m.Size()
322 return m.MarshalToSizedBuffer(dAtA[:size])
323 }
324
325 func (m *Any) MarshalToSizedBuffer(dAtA []byte) (int, error) {
326 i := len(dAtA)
327 _ = i
328 var l int
329 _ = l
330 if m.XXX_unrecognized != nil {
331 i -= len(m.XXX_unrecognized)
332 copy(dAtA[i:], m.XXX_unrecognized)
333 }
334 if len(m.Value) > 0 {
335 i -= len(m.Value)
336 copy(dAtA[i:], m.Value)
337 i = encodeVarintAny(dAtA, i, uint64(len(m.Value)))
338 i--
339 dAtA[i] = 0x12
340 }
341 if len(m.TypeUrl) > 0 {
342 i -= len(m.TypeUrl)
343 copy(dAtA[i:], m.TypeUrl)
344 i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl)))
345 i--
346 dAtA[i] = 0xa
347 }
348 return len(dAtA) - i, nil
349 }
350
351 func encodeVarintAny(dAtA []byte, offset int, v uint64) int {
352 offset -= sovAny(v)
353 base := offset
354 for v >= 1<<7 {
355 dAtA[offset] = uint8(v&0x7f | 0x80)
356 v >>= 7
357 offset++
358 }
359 dAtA[offset] = uint8(v)
360 return base
361 }
362 func NewPopulatedAny(r randyAny, easy bool) *Any {
363 this := &Any{}
364 this.TypeUrl = string(randStringAny(r))
365 v1 := r.Intn(100)
366 this.Value = make([]byte, v1)
367 for i := 0; i < v1; i++ {
368 this.Value[i] = byte(r.Intn(256))
369 }
370 if !easy && r.Intn(10) != 0 {
371 this.XXX_unrecognized = randUnrecognizedAny(r, 3)
372 }
373 return this
374 }
375
376 type randyAny interface {
377 Float32() float32
378 Float64() float64
379 Int63() int64
380 Int31() int32
381 Uint32() uint32
382 Intn(n int) int
383 }
384
385 func randUTF8RuneAny(r randyAny) rune {
386 ru := r.Intn(62)
387 if ru < 10 {
388 return rune(ru + 48)
389 } else if ru < 36 {
390 return rune(ru + 55)
391 }
392 return rune(ru + 61)
393 }
394 func randStringAny(r randyAny) string {
395 v2 := r.Intn(100)
396 tmps := make([]rune, v2)
397 for i := 0; i < v2; i++ {
398 tmps[i] = randUTF8RuneAny(r)
399 }
400 return string(tmps)
401 }
402 func randUnrecognizedAny(r randyAny, maxFieldNumber int) (dAtA []byte) {
403 l := r.Intn(5)
404 for i := 0; i < l; i++ {
405 wire := r.Intn(4)
406 if wire == 3 {
407 wire = 5
408 }
409 fieldNumber := maxFieldNumber + r.Intn(100)
410 dAtA = randFieldAny(dAtA, r, fieldNumber, wire)
411 }
412 return dAtA
413 }
414 func randFieldAny(dAtA []byte, r randyAny, fieldNumber int, wire int) []byte {
415 key := uint32(fieldNumber)<<3 | uint32(wire)
416 switch wire {
417 case 0:
418 dAtA = encodeVarintPopulateAny(dAtA, uint64(key))
419 v3 := r.Int63()
420 if r.Intn(2) == 0 {
421 v3 *= -1
422 }
423 dAtA = encodeVarintPopulateAny(dAtA, uint64(v3))
424 case 1:
425 dAtA = encodeVarintPopulateAny(dAtA, uint64(key))
426 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
427 case 2:
428 dAtA = encodeVarintPopulateAny(dAtA, uint64(key))
429 ll := r.Intn(100)
430 dAtA = encodeVarintPopulateAny(dAtA, uint64(ll))
431 for j := 0; j < ll; j++ {
432 dAtA = append(dAtA, byte(r.Intn(256)))
433 }
434 default:
435 dAtA = encodeVarintPopulateAny(dAtA, uint64(key))
436 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
437 }
438 return dAtA
439 }
440 func encodeVarintPopulateAny(dAtA []byte, v uint64) []byte {
441 for v >= 1<<7 {
442 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
443 v >>= 7
444 }
445 dAtA = append(dAtA, uint8(v))
446 return dAtA
447 }
448 func (m *Any) Size() (n int) {
449 if m == nil {
450 return 0
451 }
452 var l int
453 _ = l
454 l = len(m.TypeUrl)
455 if l > 0 {
456 n += 1 + l + sovAny(uint64(l))
457 }
458 l = len(m.Value)
459 if l > 0 {
460 n += 1 + l + sovAny(uint64(l))
461 }
462 if m.XXX_unrecognized != nil {
463 n += len(m.XXX_unrecognized)
464 }
465 return n
466 }
467
468 func sovAny(x uint64) (n int) {
469 return (math_bits.Len64(x|1) + 6) / 7
470 }
471 func sozAny(x uint64) (n int) {
472 return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63))))
473 }
474 func (this *Any) String() string {
475 if this == nil {
476 return "nil"
477 }
478 s := strings.Join([]string{`&Any{`,
479 `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`,
480 `Value:` + fmt.Sprintf("%v", this.Value) + `,`,
481 `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
482 `}`,
483 }, "")
484 return s
485 }
486 func valueToStringAny(v interface{}) string {
487 rv := reflect.ValueOf(v)
488 if rv.IsNil() {
489 return "nil"
490 }
491 pv := reflect.Indirect(rv).Interface()
492 return fmt.Sprintf("*%v", pv)
493 }
494 func (m *Any) Unmarshal(dAtA []byte) error {
495 l := len(dAtA)
496 iNdEx := 0
497 for iNdEx < l {
498 preIndex := iNdEx
499 var wire uint64
500 for shift := uint(0); ; shift += 7 {
501 if shift >= 64 {
502 return ErrIntOverflowAny
503 }
504 if iNdEx >= l {
505 return io.ErrUnexpectedEOF
506 }
507 b := dAtA[iNdEx]
508 iNdEx++
509 wire |= uint64(b&0x7F) << shift
510 if b < 0x80 {
511 break
512 }
513 }
514 fieldNum := int32(wire >> 3)
515 wireType := int(wire & 0x7)
516 if wireType == 4 {
517 return fmt.Errorf("proto: Any: wiretype end group for non-group")
518 }
519 if fieldNum <= 0 {
520 return fmt.Errorf("proto: Any: illegal tag %d (wire type %d)", fieldNum, wire)
521 }
522 switch fieldNum {
523 case 1:
524 if wireType != 2 {
525 return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType)
526 }
527 var stringLen uint64
528 for shift := uint(0); ; shift += 7 {
529 if shift >= 64 {
530 return ErrIntOverflowAny
531 }
532 if iNdEx >= l {
533 return io.ErrUnexpectedEOF
534 }
535 b := dAtA[iNdEx]
536 iNdEx++
537 stringLen |= uint64(b&0x7F) << shift
538 if b < 0x80 {
539 break
540 }
541 }
542 intStringLen := int(stringLen)
543 if intStringLen < 0 {
544 return ErrInvalidLengthAny
545 }
546 postIndex := iNdEx + intStringLen
547 if postIndex < 0 {
548 return ErrInvalidLengthAny
549 }
550 if postIndex > l {
551 return io.ErrUnexpectedEOF
552 }
553 m.TypeUrl = string(dAtA[iNdEx:postIndex])
554 iNdEx = postIndex
555 case 2:
556 if wireType != 2 {
557 return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
558 }
559 var byteLen int
560 for shift := uint(0); ; shift += 7 {
561 if shift >= 64 {
562 return ErrIntOverflowAny
563 }
564 if iNdEx >= l {
565 return io.ErrUnexpectedEOF
566 }
567 b := dAtA[iNdEx]
568 iNdEx++
569 byteLen |= int(b&0x7F) << shift
570 if b < 0x80 {
571 break
572 }
573 }
574 if byteLen < 0 {
575 return ErrInvalidLengthAny
576 }
577 postIndex := iNdEx + byteLen
578 if postIndex < 0 {
579 return ErrInvalidLengthAny
580 }
581 if postIndex > l {
582 return io.ErrUnexpectedEOF
583 }
584 m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...)
585 if m.Value == nil {
586 m.Value = []byte{}
587 }
588 iNdEx = postIndex
589 default:
590 iNdEx = preIndex
591 skippy, err := skipAny(dAtA[iNdEx:])
592 if err != nil {
593 return err
594 }
595 if (skippy < 0) || (iNdEx+skippy) < 0 {
596 return ErrInvalidLengthAny
597 }
598 if (iNdEx + skippy) > l {
599 return io.ErrUnexpectedEOF
600 }
601 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
602 iNdEx += skippy
603 }
604 }
605
606 if iNdEx > l {
607 return io.ErrUnexpectedEOF
608 }
609 return nil
610 }
611 func skipAny(dAtA []byte) (n int, err error) {
612 l := len(dAtA)
613 iNdEx := 0
614 depth := 0
615 for iNdEx < l {
616 var wire uint64
617 for shift := uint(0); ; shift += 7 {
618 if shift >= 64 {
619 return 0, ErrIntOverflowAny
620 }
621 if iNdEx >= l {
622 return 0, io.ErrUnexpectedEOF
623 }
624 b := dAtA[iNdEx]
625 iNdEx++
626 wire |= (uint64(b) & 0x7F) << shift
627 if b < 0x80 {
628 break
629 }
630 }
631 wireType := int(wire & 0x7)
632 switch wireType {
633 case 0:
634 for shift := uint(0); ; shift += 7 {
635 if shift >= 64 {
636 return 0, ErrIntOverflowAny
637 }
638 if iNdEx >= l {
639 return 0, io.ErrUnexpectedEOF
640 }
641 iNdEx++
642 if dAtA[iNdEx-1] < 0x80 {
643 break
644 }
645 }
646 case 1:
647 iNdEx += 8
648 case 2:
649 var length int
650 for shift := uint(0); ; shift += 7 {
651 if shift >= 64 {
652 return 0, ErrIntOverflowAny
653 }
654 if iNdEx >= l {
655 return 0, io.ErrUnexpectedEOF
656 }
657 b := dAtA[iNdEx]
658 iNdEx++
659 length |= (int(b) & 0x7F) << shift
660 if b < 0x80 {
661 break
662 }
663 }
664 if length < 0 {
665 return 0, ErrInvalidLengthAny
666 }
667 iNdEx += length
668 case 3:
669 depth++
670 case 4:
671 if depth == 0 {
672 return 0, ErrUnexpectedEndOfGroupAny
673 }
674 depth--
675 case 5:
676 iNdEx += 4
677 default:
678 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
679 }
680 if iNdEx < 0 {
681 return 0, ErrInvalidLengthAny
682 }
683 if depth == 0 {
684 return iNdEx, nil
685 }
686 }
687 return 0, io.ErrUnexpectedEOF
688 }
689
690 var (
691 ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling")
692 ErrIntOverflowAny = fmt.Errorf("proto: integer overflow")
693 ErrUnexpectedEndOfGroupAny = fmt.Errorf("proto: unexpected end of group")
694 )
695
View as plain text