github.com/annchain/OG@v0.0.9/p2p/discover/udp_gen.go (about) 1 package discover 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "github.com/tinylib/msgp/msgp" 7 ) 8 9 // DecodeMsg implements msgp.Decodable 10 func (z *Config) DecodeMsg(dc *msgp.Reader) (err error) { 11 var field []byte 12 _ = field 13 var zb0001 uint32 14 zb0001, err = dc.ReadMapHeader() 15 if err != nil { 16 return 17 } 18 for zb0001 > 0 { 19 zb0001-- 20 field, err = dc.ReadMapKeyPtr() 21 if err != nil { 22 return 23 } 24 switch msgp.UnsafeString(field) { 25 default: 26 err = dc.Skip() 27 if err != nil { 28 return 29 } 30 } 31 } 32 return 33 } 34 35 // EncodeMsg implements msgp.Encodable 36 func (z Config) EncodeMsg(en *msgp.Writer) (err error) { 37 // map header, size 0 38 err = en.Append(0x80) 39 if err != nil { 40 return 41 } 42 return 43 } 44 45 // MarshalMsg implements msgp.Marshaler 46 func (z Config) MarshalMsg(b []byte) (o []byte, err error) { 47 o = msgp.Require(b, z.Msgsize()) 48 // map header, size 0 49 o = append(o, 0x80) 50 return 51 } 52 53 // UnmarshalMsg implements msgp.Unmarshaler 54 func (z *Config) UnmarshalMsg(bts []byte) (o []byte, err error) { 55 var field []byte 56 _ = field 57 var zb0001 uint32 58 zb0001, bts, err = msgp.ReadMapHeaderBytes(bts) 59 if err != nil { 60 return 61 } 62 for zb0001 > 0 { 63 zb0001-- 64 field, bts, err = msgp.ReadMapKeyZC(bts) 65 if err != nil { 66 return 67 } 68 switch msgp.UnsafeString(field) { 69 default: 70 bts, err = msgp.Skip(bts) 71 if err != nil { 72 return 73 } 74 } 75 } 76 o = bts 77 return 78 } 79 80 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 81 func (z Config) Msgsize() (s int) { 82 s = 1 83 return 84 } 85 86 // DecodeMsg implements msgp.Decodable 87 func (z *Findnode) DecodeMsg(dc *msgp.Reader) (err error) { 88 var zb0001 uint32 89 zb0001, err = dc.ReadArrayHeader() 90 if err != nil { 91 return 92 } 93 if zb0001 != 3 { 94 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 95 return 96 } 97 err = z.Target.DecodeMsg(dc) 98 if err != nil { 99 return 100 } 101 z.Expiration, err = dc.ReadUint64() 102 if err != nil { 103 return 104 } 105 var zb0002 uint32 106 zb0002, err = dc.ReadArrayHeader() 107 if err != nil { 108 return 109 } 110 if cap(z.Rest) >= int(zb0002) { 111 z.Rest = (z.Rest)[:zb0002] 112 } else { 113 z.Rest = make([][]byte, zb0002) 114 } 115 for za0001 := range z.Rest { 116 z.Rest[za0001], err = dc.ReadBytes(z.Rest[za0001]) 117 if err != nil { 118 return 119 } 120 } 121 return 122 } 123 124 // EncodeMsg implements msgp.Encodable 125 func (z *Findnode) EncodeMsg(en *msgp.Writer) (err error) { 126 // array header, size 3 127 err = en.Append(0x93) 128 if err != nil { 129 return 130 } 131 err = z.Target.EncodeMsg(en) 132 if err != nil { 133 return 134 } 135 err = en.WriteUint64(z.Expiration) 136 if err != nil { 137 return 138 } 139 err = en.WriteArrayHeader(uint32(len(z.Rest))) 140 if err != nil { 141 return 142 } 143 for za0001 := range z.Rest { 144 err = en.WriteBytes(z.Rest[za0001]) 145 if err != nil { 146 return 147 } 148 } 149 return 150 } 151 152 // MarshalMsg implements msgp.Marshaler 153 func (z *Findnode) MarshalMsg(b []byte) (o []byte, err error) { 154 o = msgp.Require(b, z.Msgsize()) 155 // array header, size 3 156 o = append(o, 0x93) 157 o, err = z.Target.MarshalMsg(o) 158 if err != nil { 159 return 160 } 161 o = msgp.AppendUint64(o, z.Expiration) 162 o = msgp.AppendArrayHeader(o, uint32(len(z.Rest))) 163 for za0001 := range z.Rest { 164 o = msgp.AppendBytes(o, z.Rest[za0001]) 165 } 166 return 167 } 168 169 // UnmarshalMsg implements msgp.Unmarshaler 170 func (z *Findnode) UnmarshalMsg(bts []byte) (o []byte, err error) { 171 var zb0001 uint32 172 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 173 if err != nil { 174 return 175 } 176 if zb0001 != 3 { 177 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 178 return 179 } 180 bts, err = z.Target.UnmarshalMsg(bts) 181 if err != nil { 182 return 183 } 184 z.Expiration, bts, err = msgp.ReadUint64Bytes(bts) 185 if err != nil { 186 return 187 } 188 var zb0002 uint32 189 zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) 190 if err != nil { 191 return 192 } 193 if cap(z.Rest) >= int(zb0002) { 194 z.Rest = (z.Rest)[:zb0002] 195 } else { 196 z.Rest = make([][]byte, zb0002) 197 } 198 for za0001 := range z.Rest { 199 z.Rest[za0001], bts, err = msgp.ReadBytesBytes(bts, z.Rest[za0001]) 200 if err != nil { 201 return 202 } 203 } 204 o = bts 205 return 206 } 207 208 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 209 func (z *Findnode) Msgsize() (s int) { 210 s = 1 + z.Target.Msgsize() + msgp.Uint64Size + msgp.ArrayHeaderSize 211 for za0001 := range z.Rest { 212 s += msgp.BytesPrefixSize + len(z.Rest[za0001]) 213 } 214 return 215 } 216 217 // DecodeMsg implements msgp.Decodable 218 func (z *Neighbors) DecodeMsg(dc *msgp.Reader) (err error) { 219 var zb0001 uint32 220 zb0001, err = dc.ReadArrayHeader() 221 if err != nil { 222 return 223 } 224 if zb0001 != 3 { 225 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 226 return 227 } 228 var zb0002 uint32 229 zb0002, err = dc.ReadArrayHeader() 230 if err != nil { 231 return 232 } 233 if cap(z.Nodes) >= int(zb0002) { 234 z.Nodes = (z.Nodes)[:zb0002] 235 } else { 236 z.Nodes = make([]RpcNode, zb0002) 237 } 238 for za0001 := range z.Nodes { 239 err = z.Nodes[za0001].DecodeMsg(dc) 240 if err != nil { 241 return 242 } 243 } 244 z.Expiration, err = dc.ReadUint64() 245 if err != nil { 246 return 247 } 248 var zb0003 uint32 249 zb0003, err = dc.ReadArrayHeader() 250 if err != nil { 251 return 252 } 253 if cap(z.Rest) >= int(zb0003) { 254 z.Rest = (z.Rest)[:zb0003] 255 } else { 256 z.Rest = make([][]byte, zb0003) 257 } 258 for za0002 := range z.Rest { 259 z.Rest[za0002], err = dc.ReadBytes(z.Rest[za0002]) 260 if err != nil { 261 return 262 } 263 } 264 return 265 } 266 267 // EncodeMsg implements msgp.Encodable 268 func (z *Neighbors) EncodeMsg(en *msgp.Writer) (err error) { 269 // array header, size 3 270 err = en.Append(0x93) 271 if err != nil { 272 return 273 } 274 err = en.WriteArrayHeader(uint32(len(z.Nodes))) 275 if err != nil { 276 return 277 } 278 for za0001 := range z.Nodes { 279 err = z.Nodes[za0001].EncodeMsg(en) 280 if err != nil { 281 return 282 } 283 } 284 err = en.WriteUint64(z.Expiration) 285 if err != nil { 286 return 287 } 288 err = en.WriteArrayHeader(uint32(len(z.Rest))) 289 if err != nil { 290 return 291 } 292 for za0002 := range z.Rest { 293 err = en.WriteBytes(z.Rest[za0002]) 294 if err != nil { 295 return 296 } 297 } 298 return 299 } 300 301 // MarshalMsg implements msgp.Marshaler 302 func (z *Neighbors) MarshalMsg(b []byte) (o []byte, err error) { 303 o = msgp.Require(b, z.Msgsize()) 304 // array header, size 3 305 o = append(o, 0x93) 306 o = msgp.AppendArrayHeader(o, uint32(len(z.Nodes))) 307 for za0001 := range z.Nodes { 308 o, err = z.Nodes[za0001].MarshalMsg(o) 309 if err != nil { 310 return 311 } 312 } 313 o = msgp.AppendUint64(o, z.Expiration) 314 o = msgp.AppendArrayHeader(o, uint32(len(z.Rest))) 315 for za0002 := range z.Rest { 316 o = msgp.AppendBytes(o, z.Rest[za0002]) 317 } 318 return 319 } 320 321 // UnmarshalMsg implements msgp.Unmarshaler 322 func (z *Neighbors) UnmarshalMsg(bts []byte) (o []byte, err error) { 323 var zb0001 uint32 324 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 325 if err != nil { 326 return 327 } 328 if zb0001 != 3 { 329 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 330 return 331 } 332 var zb0002 uint32 333 zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) 334 if err != nil { 335 return 336 } 337 if cap(z.Nodes) >= int(zb0002) { 338 z.Nodes = (z.Nodes)[:zb0002] 339 } else { 340 z.Nodes = make([]RpcNode, zb0002) 341 } 342 for za0001 := range z.Nodes { 343 bts, err = z.Nodes[za0001].UnmarshalMsg(bts) 344 if err != nil { 345 return 346 } 347 } 348 z.Expiration, bts, err = msgp.ReadUint64Bytes(bts) 349 if err != nil { 350 return 351 } 352 var zb0003 uint32 353 zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts) 354 if err != nil { 355 return 356 } 357 if cap(z.Rest) >= int(zb0003) { 358 z.Rest = (z.Rest)[:zb0003] 359 } else { 360 z.Rest = make([][]byte, zb0003) 361 } 362 for za0002 := range z.Rest { 363 z.Rest[za0002], bts, err = msgp.ReadBytesBytes(bts, z.Rest[za0002]) 364 if err != nil { 365 return 366 } 367 } 368 o = bts 369 return 370 } 371 372 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 373 func (z *Neighbors) Msgsize() (s int) { 374 s = 1 + msgp.ArrayHeaderSize 375 for za0001 := range z.Nodes { 376 s += z.Nodes[za0001].Msgsize() 377 } 378 s += msgp.Uint64Size + msgp.ArrayHeaderSize 379 for za0002 := range z.Rest { 380 s += msgp.BytesPrefixSize + len(z.Rest[za0002]) 381 } 382 return 383 } 384 385 // DecodeMsg implements msgp.Decodable 386 func (z *Ping) DecodeMsg(dc *msgp.Reader) (err error) { 387 var zb0001 uint32 388 zb0001, err = dc.ReadArrayHeader() 389 if err != nil { 390 return 391 } 392 if zb0001 != 5 { 393 err = msgp.ArrayError{Wanted: 5, Got: zb0001} 394 return 395 } 396 z.Version, err = dc.ReadUint() 397 if err != nil { 398 return 399 } 400 var zb0002 uint32 401 zb0002, err = dc.ReadArrayHeader() 402 if err != nil { 403 return 404 } 405 if zb0002 != 3 { 406 err = msgp.ArrayError{Wanted: 3, Got: zb0002} 407 return 408 } 409 z.From.IP, err = dc.ReadBytes(z.From.IP) 410 if err != nil { 411 return 412 } 413 z.From.UDP, err = dc.ReadUint16() 414 if err != nil { 415 return 416 } 417 z.From.TCP, err = dc.ReadUint16() 418 if err != nil { 419 return 420 } 421 var zb0003 uint32 422 zb0003, err = dc.ReadArrayHeader() 423 if err != nil { 424 return 425 } 426 if zb0003 != 3 { 427 err = msgp.ArrayError{Wanted: 3, Got: zb0003} 428 return 429 } 430 z.To.IP, err = dc.ReadBytes(z.To.IP) 431 if err != nil { 432 return 433 } 434 z.To.UDP, err = dc.ReadUint16() 435 if err != nil { 436 return 437 } 438 z.To.TCP, err = dc.ReadUint16() 439 if err != nil { 440 return 441 } 442 z.Expiration, err = dc.ReadUint64() 443 if err != nil { 444 return 445 } 446 var zb0004 uint32 447 zb0004, err = dc.ReadArrayHeader() 448 if err != nil { 449 return 450 } 451 if cap(z.Rest) >= int(zb0004) { 452 z.Rest = (z.Rest)[:zb0004] 453 } else { 454 z.Rest = make([][]byte, zb0004) 455 } 456 for za0001 := range z.Rest { 457 z.Rest[za0001], err = dc.ReadBytes(z.Rest[za0001]) 458 if err != nil { 459 return 460 } 461 } 462 return 463 } 464 465 // EncodeMsg implements msgp.Encodable 466 func (z *Ping) EncodeMsg(en *msgp.Writer) (err error) { 467 // array header, size 5 468 err = en.Append(0x95) 469 if err != nil { 470 return 471 } 472 err = en.WriteUint(z.Version) 473 if err != nil { 474 return 475 } 476 // array header, size 3 477 err = en.Append(0x93) 478 if err != nil { 479 return 480 } 481 err = en.WriteBytes(z.From.IP) 482 if err != nil { 483 return 484 } 485 err = en.WriteUint16(z.From.UDP) 486 if err != nil { 487 return 488 } 489 err = en.WriteUint16(z.From.TCP) 490 if err != nil { 491 return 492 } 493 // array header, size 3 494 err = en.Append(0x93) 495 if err != nil { 496 return 497 } 498 err = en.WriteBytes(z.To.IP) 499 if err != nil { 500 return 501 } 502 err = en.WriteUint16(z.To.UDP) 503 if err != nil { 504 return 505 } 506 err = en.WriteUint16(z.To.TCP) 507 if err != nil { 508 return 509 } 510 err = en.WriteUint64(z.Expiration) 511 if err != nil { 512 return 513 } 514 err = en.WriteArrayHeader(uint32(len(z.Rest))) 515 if err != nil { 516 return 517 } 518 for za0001 := range z.Rest { 519 err = en.WriteBytes(z.Rest[za0001]) 520 if err != nil { 521 return 522 } 523 } 524 return 525 } 526 527 // MarshalMsg implements msgp.Marshaler 528 func (z *Ping) MarshalMsg(b []byte) (o []byte, err error) { 529 o = msgp.Require(b, z.Msgsize()) 530 // array header, size 5 531 o = append(o, 0x95) 532 o = msgp.AppendUint(o, z.Version) 533 // array header, size 3 534 o = append(o, 0x93) 535 o = msgp.AppendBytes(o, z.From.IP) 536 o = msgp.AppendUint16(o, z.From.UDP) 537 o = msgp.AppendUint16(o, z.From.TCP) 538 // array header, size 3 539 o = append(o, 0x93) 540 o = msgp.AppendBytes(o, z.To.IP) 541 o = msgp.AppendUint16(o, z.To.UDP) 542 o = msgp.AppendUint16(o, z.To.TCP) 543 o = msgp.AppendUint64(o, z.Expiration) 544 o = msgp.AppendArrayHeader(o, uint32(len(z.Rest))) 545 for za0001 := range z.Rest { 546 o = msgp.AppendBytes(o, z.Rest[za0001]) 547 } 548 return 549 } 550 551 // UnmarshalMsg implements msgp.Unmarshaler 552 func (z *Ping) UnmarshalMsg(bts []byte) (o []byte, err error) { 553 var zb0001 uint32 554 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 555 if err != nil { 556 return 557 } 558 if zb0001 != 5 { 559 err = msgp.ArrayError{Wanted: 5, Got: zb0001} 560 return 561 } 562 z.Version, bts, err = msgp.ReadUintBytes(bts) 563 if err != nil { 564 return 565 } 566 var zb0002 uint32 567 zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) 568 if err != nil { 569 return 570 } 571 if zb0002 != 3 { 572 err = msgp.ArrayError{Wanted: 3, Got: zb0002} 573 return 574 } 575 z.From.IP, bts, err = msgp.ReadBytesBytes(bts, z.From.IP) 576 if err != nil { 577 return 578 } 579 z.From.UDP, bts, err = msgp.ReadUint16Bytes(bts) 580 if err != nil { 581 return 582 } 583 z.From.TCP, bts, err = msgp.ReadUint16Bytes(bts) 584 if err != nil { 585 return 586 } 587 var zb0003 uint32 588 zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts) 589 if err != nil { 590 return 591 } 592 if zb0003 != 3 { 593 err = msgp.ArrayError{Wanted: 3, Got: zb0003} 594 return 595 } 596 z.To.IP, bts, err = msgp.ReadBytesBytes(bts, z.To.IP) 597 if err != nil { 598 return 599 } 600 z.To.UDP, bts, err = msgp.ReadUint16Bytes(bts) 601 if err != nil { 602 return 603 } 604 z.To.TCP, bts, err = msgp.ReadUint16Bytes(bts) 605 if err != nil { 606 return 607 } 608 z.Expiration, bts, err = msgp.ReadUint64Bytes(bts) 609 if err != nil { 610 return 611 } 612 var zb0004 uint32 613 zb0004, bts, err = msgp.ReadArrayHeaderBytes(bts) 614 if err != nil { 615 return 616 } 617 if cap(z.Rest) >= int(zb0004) { 618 z.Rest = (z.Rest)[:zb0004] 619 } else { 620 z.Rest = make([][]byte, zb0004) 621 } 622 for za0001 := range z.Rest { 623 z.Rest[za0001], bts, err = msgp.ReadBytesBytes(bts, z.Rest[za0001]) 624 if err != nil { 625 return 626 } 627 } 628 o = bts 629 return 630 } 631 632 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 633 func (z *Ping) Msgsize() (s int) { 634 s = 1 + msgp.UintSize + 1 + msgp.BytesPrefixSize + len(z.From.IP) + msgp.Uint16Size + msgp.Uint16Size + 1 + msgp.BytesPrefixSize + len(z.To.IP) + msgp.Uint16Size + msgp.Uint16Size + msgp.Uint64Size + msgp.ArrayHeaderSize 635 for za0001 := range z.Rest { 636 s += msgp.BytesPrefixSize + len(z.Rest[za0001]) 637 } 638 return 639 } 640 641 // DecodeMsg implements msgp.Decodable 642 func (z *Pong) DecodeMsg(dc *msgp.Reader) (err error) { 643 var zb0001 uint32 644 zb0001, err = dc.ReadArrayHeader() 645 if err != nil { 646 return 647 } 648 if zb0001 != 4 { 649 err = msgp.ArrayError{Wanted: 4, Got: zb0001} 650 return 651 } 652 var zb0002 uint32 653 zb0002, err = dc.ReadArrayHeader() 654 if err != nil { 655 return 656 } 657 if zb0002 != 3 { 658 err = msgp.ArrayError{Wanted: 3, Got: zb0002} 659 return 660 } 661 z.To.IP, err = dc.ReadBytes(z.To.IP) 662 if err != nil { 663 return 664 } 665 z.To.UDP, err = dc.ReadUint16() 666 if err != nil { 667 return 668 } 669 z.To.TCP, err = dc.ReadUint16() 670 if err != nil { 671 return 672 } 673 z.ReplyTok, err = dc.ReadBytes(z.ReplyTok) 674 if err != nil { 675 return 676 } 677 z.Expiration, err = dc.ReadUint64() 678 if err != nil { 679 return 680 } 681 var zb0003 uint32 682 zb0003, err = dc.ReadArrayHeader() 683 if err != nil { 684 return 685 } 686 if cap(z.Rest) >= int(zb0003) { 687 z.Rest = (z.Rest)[:zb0003] 688 } else { 689 z.Rest = make([][]byte, zb0003) 690 } 691 for za0001 := range z.Rest { 692 z.Rest[za0001], err = dc.ReadBytes(z.Rest[za0001]) 693 if err != nil { 694 return 695 } 696 } 697 return 698 } 699 700 // EncodeMsg implements msgp.Encodable 701 func (z *Pong) EncodeMsg(en *msgp.Writer) (err error) { 702 // array header, size 4 703 // array header, size 3 704 err = en.Append(0x94, 0x93) 705 if err != nil { 706 return 707 } 708 err = en.WriteBytes(z.To.IP) 709 if err != nil { 710 return 711 } 712 err = en.WriteUint16(z.To.UDP) 713 if err != nil { 714 return 715 } 716 err = en.WriteUint16(z.To.TCP) 717 if err != nil { 718 return 719 } 720 err = en.WriteBytes(z.ReplyTok) 721 if err != nil { 722 return 723 } 724 err = en.WriteUint64(z.Expiration) 725 if err != nil { 726 return 727 } 728 err = en.WriteArrayHeader(uint32(len(z.Rest))) 729 if err != nil { 730 return 731 } 732 for za0001 := range z.Rest { 733 err = en.WriteBytes(z.Rest[za0001]) 734 if err != nil { 735 return 736 } 737 } 738 return 739 } 740 741 // MarshalMsg implements msgp.Marshaler 742 func (z *Pong) MarshalMsg(b []byte) (o []byte, err error) { 743 o = msgp.Require(b, z.Msgsize()) 744 // array header, size 4 745 // array header, size 3 746 o = append(o, 0x94, 0x93) 747 o = msgp.AppendBytes(o, z.To.IP) 748 o = msgp.AppendUint16(o, z.To.UDP) 749 o = msgp.AppendUint16(o, z.To.TCP) 750 o = msgp.AppendBytes(o, z.ReplyTok) 751 o = msgp.AppendUint64(o, z.Expiration) 752 o = msgp.AppendArrayHeader(o, uint32(len(z.Rest))) 753 for za0001 := range z.Rest { 754 o = msgp.AppendBytes(o, z.Rest[za0001]) 755 } 756 return 757 } 758 759 // UnmarshalMsg implements msgp.Unmarshaler 760 func (z *Pong) UnmarshalMsg(bts []byte) (o []byte, err error) { 761 var zb0001 uint32 762 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 763 if err != nil { 764 return 765 } 766 if zb0001 != 4 { 767 err = msgp.ArrayError{Wanted: 4, Got: zb0001} 768 return 769 } 770 var zb0002 uint32 771 zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) 772 if err != nil { 773 return 774 } 775 if zb0002 != 3 { 776 err = msgp.ArrayError{Wanted: 3, Got: zb0002} 777 return 778 } 779 z.To.IP, bts, err = msgp.ReadBytesBytes(bts, z.To.IP) 780 if err != nil { 781 return 782 } 783 z.To.UDP, bts, err = msgp.ReadUint16Bytes(bts) 784 if err != nil { 785 return 786 } 787 z.To.TCP, bts, err = msgp.ReadUint16Bytes(bts) 788 if err != nil { 789 return 790 } 791 z.ReplyTok, bts, err = msgp.ReadBytesBytes(bts, z.ReplyTok) 792 if err != nil { 793 return 794 } 795 z.Expiration, bts, err = msgp.ReadUint64Bytes(bts) 796 if err != nil { 797 return 798 } 799 var zb0003 uint32 800 zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts) 801 if err != nil { 802 return 803 } 804 if cap(z.Rest) >= int(zb0003) { 805 z.Rest = (z.Rest)[:zb0003] 806 } else { 807 z.Rest = make([][]byte, zb0003) 808 } 809 for za0001 := range z.Rest { 810 z.Rest[za0001], bts, err = msgp.ReadBytesBytes(bts, z.Rest[za0001]) 811 if err != nil { 812 return 813 } 814 } 815 o = bts 816 return 817 } 818 819 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 820 func (z *Pong) Msgsize() (s int) { 821 s = 1 + 1 + msgp.BytesPrefixSize + len(z.To.IP) + msgp.Uint16Size + msgp.Uint16Size + msgp.BytesPrefixSize + len(z.ReplyTok) + msgp.Uint64Size + msgp.ArrayHeaderSize 822 for za0001 := range z.Rest { 823 s += msgp.BytesPrefixSize + len(z.Rest[za0001]) 824 } 825 return 826 } 827 828 // DecodeMsg implements msgp.Decodable 829 func (z *ReadPacket) DecodeMsg(dc *msgp.Reader) (err error) { 830 var zb0001 uint32 831 zb0001, err = dc.ReadArrayHeader() 832 if err != nil { 833 return 834 } 835 if zb0001 != 0 { 836 err = msgp.ArrayError{Wanted: 0, Got: zb0001} 837 return 838 } 839 return 840 } 841 842 // EncodeMsg implements msgp.Encodable 843 func (z ReadPacket) EncodeMsg(en *msgp.Writer) (err error) { 844 // array header, size 0 845 err = en.Append(0x90) 846 if err != nil { 847 return 848 } 849 return 850 } 851 852 // MarshalMsg implements msgp.Marshaler 853 func (z ReadPacket) MarshalMsg(b []byte) (o []byte, err error) { 854 o = msgp.Require(b, z.Msgsize()) 855 // array header, size 0 856 o = append(o, 0x90) 857 return 858 } 859 860 // UnmarshalMsg implements msgp.Unmarshaler 861 func (z *ReadPacket) UnmarshalMsg(bts []byte) (o []byte, err error) { 862 var zb0001 uint32 863 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 864 if err != nil { 865 return 866 } 867 if zb0001 != 0 { 868 err = msgp.ArrayError{Wanted: 0, Got: zb0001} 869 return 870 } 871 o = bts 872 return 873 } 874 875 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 876 func (z ReadPacket) Msgsize() (s int) { 877 s = 1 878 return 879 } 880 881 // DecodeMsg implements msgp.Decodable 882 func (z *RpcEndpoint) DecodeMsg(dc *msgp.Reader) (err error) { 883 var zb0001 uint32 884 zb0001, err = dc.ReadArrayHeader() 885 if err != nil { 886 return 887 } 888 if zb0001 != 3 { 889 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 890 return 891 } 892 z.IP, err = dc.ReadBytes(z.IP) 893 if err != nil { 894 return 895 } 896 z.UDP, err = dc.ReadUint16() 897 if err != nil { 898 return 899 } 900 z.TCP, err = dc.ReadUint16() 901 if err != nil { 902 return 903 } 904 return 905 } 906 907 // EncodeMsg implements msgp.Encodable 908 func (z *RpcEndpoint) EncodeMsg(en *msgp.Writer) (err error) { 909 // array header, size 3 910 err = en.Append(0x93) 911 if err != nil { 912 return 913 } 914 err = en.WriteBytes(z.IP) 915 if err != nil { 916 return 917 } 918 err = en.WriteUint16(z.UDP) 919 if err != nil { 920 return 921 } 922 err = en.WriteUint16(z.TCP) 923 if err != nil { 924 return 925 } 926 return 927 } 928 929 // MarshalMsg implements msgp.Marshaler 930 func (z *RpcEndpoint) MarshalMsg(b []byte) (o []byte, err error) { 931 o = msgp.Require(b, z.Msgsize()) 932 // array header, size 3 933 o = append(o, 0x93) 934 o = msgp.AppendBytes(o, z.IP) 935 o = msgp.AppendUint16(o, z.UDP) 936 o = msgp.AppendUint16(o, z.TCP) 937 return 938 } 939 940 // UnmarshalMsg implements msgp.Unmarshaler 941 func (z *RpcEndpoint) UnmarshalMsg(bts []byte) (o []byte, err error) { 942 var zb0001 uint32 943 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 944 if err != nil { 945 return 946 } 947 if zb0001 != 3 { 948 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 949 return 950 } 951 z.IP, bts, err = msgp.ReadBytesBytes(bts, z.IP) 952 if err != nil { 953 return 954 } 955 z.UDP, bts, err = msgp.ReadUint16Bytes(bts) 956 if err != nil { 957 return 958 } 959 z.TCP, bts, err = msgp.ReadUint16Bytes(bts) 960 if err != nil { 961 return 962 } 963 o = bts 964 return 965 } 966 967 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 968 func (z *RpcEndpoint) Msgsize() (s int) { 969 s = 1 + msgp.BytesPrefixSize + len(z.IP) + msgp.Uint16Size + msgp.Uint16Size 970 return 971 } 972 973 // DecodeMsg implements msgp.Decodable 974 func (z *RpcNode) DecodeMsg(dc *msgp.Reader) (err error) { 975 var zb0001 uint32 976 zb0001, err = dc.ReadArrayHeader() 977 if err != nil { 978 return 979 } 980 if zb0001 != 4 { 981 err = msgp.ArrayError{Wanted: 4, Got: zb0001} 982 return 983 } 984 z.IP, err = dc.ReadBytes(z.IP) 985 if err != nil { 986 return 987 } 988 z.UDP, err = dc.ReadUint16() 989 if err != nil { 990 return 991 } 992 z.TCP, err = dc.ReadUint16() 993 if err != nil { 994 return 995 } 996 err = z.ID.DecodeMsg(dc) 997 if err != nil { 998 return 999 } 1000 return 1001 } 1002 1003 // EncodeMsg implements msgp.Encodable 1004 func (z *RpcNode) EncodeMsg(en *msgp.Writer) (err error) { 1005 // array header, size 4 1006 err = en.Append(0x94) 1007 if err != nil { 1008 return 1009 } 1010 err = en.WriteBytes(z.IP) 1011 if err != nil { 1012 return 1013 } 1014 err = en.WriteUint16(z.UDP) 1015 if err != nil { 1016 return 1017 } 1018 err = en.WriteUint16(z.TCP) 1019 if err != nil { 1020 return 1021 } 1022 err = z.ID.EncodeMsg(en) 1023 if err != nil { 1024 return 1025 } 1026 return 1027 } 1028 1029 // MarshalMsg implements msgp.Marshaler 1030 func (z *RpcNode) MarshalMsg(b []byte) (o []byte, err error) { 1031 o = msgp.Require(b, z.Msgsize()) 1032 // array header, size 4 1033 o = append(o, 0x94) 1034 o = msgp.AppendBytes(o, z.IP) 1035 o = msgp.AppendUint16(o, z.UDP) 1036 o = msgp.AppendUint16(o, z.TCP) 1037 o, err = z.ID.MarshalMsg(o) 1038 if err != nil { 1039 return 1040 } 1041 return 1042 } 1043 1044 // UnmarshalMsg implements msgp.Unmarshaler 1045 func (z *RpcNode) UnmarshalMsg(bts []byte) (o []byte, err error) { 1046 var zb0001 uint32 1047 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 1048 if err != nil { 1049 return 1050 } 1051 if zb0001 != 4 { 1052 err = msgp.ArrayError{Wanted: 4, Got: zb0001} 1053 return 1054 } 1055 z.IP, bts, err = msgp.ReadBytesBytes(bts, z.IP) 1056 if err != nil { 1057 return 1058 } 1059 z.UDP, bts, err = msgp.ReadUint16Bytes(bts) 1060 if err != nil { 1061 return 1062 } 1063 z.TCP, bts, err = msgp.ReadUint16Bytes(bts) 1064 if err != nil { 1065 return 1066 } 1067 bts, err = z.ID.UnmarshalMsg(bts) 1068 if err != nil { 1069 return 1070 } 1071 o = bts 1072 return 1073 } 1074 1075 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 1076 func (z *RpcNode) Msgsize() (s int) { 1077 s = 1 + msgp.BytesPrefixSize + len(z.IP) + msgp.Uint16Size + msgp.Uint16Size + z.ID.Msgsize() 1078 return 1079 }