zmsg.go (63654B)
1 // Code generated by "go run msg_generate.go"; DO NOT EDIT. 2 3 package dns 4 5 // pack*() functions 6 7 func (rr *A) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 8 off, err = packDataA(rr.A, msg, off) 9 if err != nil { 10 return off, err 11 } 12 return off, nil 13 } 14 15 func (rr *AAAA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 16 off, err = packDataAAAA(rr.AAAA, msg, off) 17 if err != nil { 18 return off, err 19 } 20 return off, nil 21 } 22 23 func (rr *AFSDB) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 24 off, err = packUint16(rr.Subtype, msg, off) 25 if err != nil { 26 return off, err 27 } 28 off, err = packDomainName(rr.Hostname, msg, off, compression, false) 29 if err != nil { 30 return off, err 31 } 32 return off, nil 33 } 34 35 func (rr *AMTRELAY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 36 off, err = packUint8(rr.Precedence, msg, off) 37 if err != nil { 38 return off, err 39 } 40 off, err = packUint8(rr.GatewayType, msg, off) 41 if err != nil { 42 return off, err 43 } 44 off, err = packIPSECGateway(rr.GatewayAddr, rr.GatewayHost, msg, off, rr.GatewayType, compression, false) 45 if err != nil { 46 return off, err 47 } 48 return off, nil 49 } 50 51 func (rr *ANY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 52 return off, nil 53 } 54 55 func (rr *APL) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 56 off, err = packDataApl(rr.Prefixes, msg, off) 57 if err != nil { 58 return off, err 59 } 60 return off, nil 61 } 62 63 func (rr *AVC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 64 off, err = packStringTxt(rr.Txt, msg, off) 65 if err != nil { 66 return off, err 67 } 68 return off, nil 69 } 70 71 func (rr *CAA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 72 off, err = packUint8(rr.Flag, msg, off) 73 if err != nil { 74 return off, err 75 } 76 off, err = packString(rr.Tag, msg, off) 77 if err != nil { 78 return off, err 79 } 80 off, err = packStringOctet(rr.Value, msg, off) 81 if err != nil { 82 return off, err 83 } 84 return off, nil 85 } 86 87 func (rr *CDNSKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 88 off, err = packUint16(rr.Flags, msg, off) 89 if err != nil { 90 return off, err 91 } 92 off, err = packUint8(rr.Protocol, msg, off) 93 if err != nil { 94 return off, err 95 } 96 off, err = packUint8(rr.Algorithm, msg, off) 97 if err != nil { 98 return off, err 99 } 100 off, err = packStringBase64(rr.PublicKey, msg, off) 101 if err != nil { 102 return off, err 103 } 104 return off, nil 105 } 106 107 func (rr *CDS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 108 off, err = packUint16(rr.KeyTag, msg, off) 109 if err != nil { 110 return off, err 111 } 112 off, err = packUint8(rr.Algorithm, msg, off) 113 if err != nil { 114 return off, err 115 } 116 off, err = packUint8(rr.DigestType, msg, off) 117 if err != nil { 118 return off, err 119 } 120 off, err = packStringHex(rr.Digest, msg, off) 121 if err != nil { 122 return off, err 123 } 124 return off, nil 125 } 126 127 func (rr *CERT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 128 off, err = packUint16(rr.Type, msg, off) 129 if err != nil { 130 return off, err 131 } 132 off, err = packUint16(rr.KeyTag, msg, off) 133 if err != nil { 134 return off, err 135 } 136 off, err = packUint8(rr.Algorithm, msg, off) 137 if err != nil { 138 return off, err 139 } 140 off, err = packStringBase64(rr.Certificate, msg, off) 141 if err != nil { 142 return off, err 143 } 144 return off, nil 145 } 146 147 func (rr *CNAME) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 148 off, err = packDomainName(rr.Target, msg, off, compression, compress) 149 if err != nil { 150 return off, err 151 } 152 return off, nil 153 } 154 155 func (rr *CSYNC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 156 off, err = packUint32(rr.Serial, msg, off) 157 if err != nil { 158 return off, err 159 } 160 off, err = packUint16(rr.Flags, msg, off) 161 if err != nil { 162 return off, err 163 } 164 off, err = packDataNsec(rr.TypeBitMap, msg, off) 165 if err != nil { 166 return off, err 167 } 168 return off, nil 169 } 170 171 func (rr *DHCID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 172 off, err = packStringBase64(rr.Digest, msg, off) 173 if err != nil { 174 return off, err 175 } 176 return off, nil 177 } 178 179 func (rr *DLV) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 180 off, err = packUint16(rr.KeyTag, msg, off) 181 if err != nil { 182 return off, err 183 } 184 off, err = packUint8(rr.Algorithm, msg, off) 185 if err != nil { 186 return off, err 187 } 188 off, err = packUint8(rr.DigestType, msg, off) 189 if err != nil { 190 return off, err 191 } 192 off, err = packStringHex(rr.Digest, msg, off) 193 if err != nil { 194 return off, err 195 } 196 return off, nil 197 } 198 199 func (rr *DNAME) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 200 off, err = packDomainName(rr.Target, msg, off, compression, false) 201 if err != nil { 202 return off, err 203 } 204 return off, nil 205 } 206 207 func (rr *DNSKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 208 off, err = packUint16(rr.Flags, msg, off) 209 if err != nil { 210 return off, err 211 } 212 off, err = packUint8(rr.Protocol, msg, off) 213 if err != nil { 214 return off, err 215 } 216 off, err = packUint8(rr.Algorithm, msg, off) 217 if err != nil { 218 return off, err 219 } 220 off, err = packStringBase64(rr.PublicKey, msg, off) 221 if err != nil { 222 return off, err 223 } 224 return off, nil 225 } 226 227 func (rr *DS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 228 off, err = packUint16(rr.KeyTag, msg, off) 229 if err != nil { 230 return off, err 231 } 232 off, err = packUint8(rr.Algorithm, msg, off) 233 if err != nil { 234 return off, err 235 } 236 off, err = packUint8(rr.DigestType, msg, off) 237 if err != nil { 238 return off, err 239 } 240 off, err = packStringHex(rr.Digest, msg, off) 241 if err != nil { 242 return off, err 243 } 244 return off, nil 245 } 246 247 func (rr *EID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 248 off, err = packStringHex(rr.Endpoint, msg, off) 249 if err != nil { 250 return off, err 251 } 252 return off, nil 253 } 254 255 func (rr *EUI48) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 256 off, err = packUint48(rr.Address, msg, off) 257 if err != nil { 258 return off, err 259 } 260 return off, nil 261 } 262 263 func (rr *EUI64) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 264 off, err = packUint64(rr.Address, msg, off) 265 if err != nil { 266 return off, err 267 } 268 return off, nil 269 } 270 271 func (rr *GID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 272 off, err = packUint32(rr.Gid, msg, off) 273 if err != nil { 274 return off, err 275 } 276 return off, nil 277 } 278 279 func (rr *GPOS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 280 off, err = packString(rr.Longitude, msg, off) 281 if err != nil { 282 return off, err 283 } 284 off, err = packString(rr.Latitude, msg, off) 285 if err != nil { 286 return off, err 287 } 288 off, err = packString(rr.Altitude, msg, off) 289 if err != nil { 290 return off, err 291 } 292 return off, nil 293 } 294 295 func (rr *HINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 296 off, err = packString(rr.Cpu, msg, off) 297 if err != nil { 298 return off, err 299 } 300 off, err = packString(rr.Os, msg, off) 301 if err != nil { 302 return off, err 303 } 304 return off, nil 305 } 306 307 func (rr *HIP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 308 off, err = packUint8(rr.HitLength, msg, off) 309 if err != nil { 310 return off, err 311 } 312 off, err = packUint8(rr.PublicKeyAlgorithm, msg, off) 313 if err != nil { 314 return off, err 315 } 316 off, err = packUint16(rr.PublicKeyLength, msg, off) 317 if err != nil { 318 return off, err 319 } 320 off, err = packStringHex(rr.Hit, msg, off) 321 if err != nil { 322 return off, err 323 } 324 off, err = packStringBase64(rr.PublicKey, msg, off) 325 if err != nil { 326 return off, err 327 } 328 off, err = packDataDomainNames(rr.RendezvousServers, msg, off, compression, false) 329 if err != nil { 330 return off, err 331 } 332 return off, nil 333 } 334 335 func (rr *HTTPS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 336 off, err = packUint16(rr.Priority, msg, off) 337 if err != nil { 338 return off, err 339 } 340 off, err = packDomainName(rr.Target, msg, off, compression, false) 341 if err != nil { 342 return off, err 343 } 344 off, err = packDataSVCB(rr.Value, msg, off) 345 if err != nil { 346 return off, err 347 } 348 return off, nil 349 } 350 351 func (rr *IPSECKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 352 off, err = packUint8(rr.Precedence, msg, off) 353 if err != nil { 354 return off, err 355 } 356 off, err = packUint8(rr.GatewayType, msg, off) 357 if err != nil { 358 return off, err 359 } 360 off, err = packUint8(rr.Algorithm, msg, off) 361 if err != nil { 362 return off, err 363 } 364 off, err = packIPSECGateway(rr.GatewayAddr, rr.GatewayHost, msg, off, rr.GatewayType, compression, false) 365 if err != nil { 366 return off, err 367 } 368 off, err = packStringBase64(rr.PublicKey, msg, off) 369 if err != nil { 370 return off, err 371 } 372 return off, nil 373 } 374 375 func (rr *KEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 376 off, err = packUint16(rr.Flags, msg, off) 377 if err != nil { 378 return off, err 379 } 380 off, err = packUint8(rr.Protocol, msg, off) 381 if err != nil { 382 return off, err 383 } 384 off, err = packUint8(rr.Algorithm, msg, off) 385 if err != nil { 386 return off, err 387 } 388 off, err = packStringBase64(rr.PublicKey, msg, off) 389 if err != nil { 390 return off, err 391 } 392 return off, nil 393 } 394 395 func (rr *KX) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 396 off, err = packUint16(rr.Preference, msg, off) 397 if err != nil { 398 return off, err 399 } 400 off, err = packDomainName(rr.Exchanger, msg, off, compression, false) 401 if err != nil { 402 return off, err 403 } 404 return off, nil 405 } 406 407 func (rr *L32) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 408 off, err = packUint16(rr.Preference, msg, off) 409 if err != nil { 410 return off, err 411 } 412 off, err = packDataA(rr.Locator32, msg, off) 413 if err != nil { 414 return off, err 415 } 416 return off, nil 417 } 418 419 func (rr *L64) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 420 off, err = packUint16(rr.Preference, msg, off) 421 if err != nil { 422 return off, err 423 } 424 off, err = packUint64(rr.Locator64, msg, off) 425 if err != nil { 426 return off, err 427 } 428 return off, nil 429 } 430 431 func (rr *LOC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 432 off, err = packUint8(rr.Version, msg, off) 433 if err != nil { 434 return off, err 435 } 436 off, err = packUint8(rr.Size, msg, off) 437 if err != nil { 438 return off, err 439 } 440 off, err = packUint8(rr.HorizPre, msg, off) 441 if err != nil { 442 return off, err 443 } 444 off, err = packUint8(rr.VertPre, msg, off) 445 if err != nil { 446 return off, err 447 } 448 off, err = packUint32(rr.Latitude, msg, off) 449 if err != nil { 450 return off, err 451 } 452 off, err = packUint32(rr.Longitude, msg, off) 453 if err != nil { 454 return off, err 455 } 456 off, err = packUint32(rr.Altitude, msg, off) 457 if err != nil { 458 return off, err 459 } 460 return off, nil 461 } 462 463 func (rr *LP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 464 off, err = packUint16(rr.Preference, msg, off) 465 if err != nil { 466 return off, err 467 } 468 off, err = packDomainName(rr.Fqdn, msg, off, compression, false) 469 if err != nil { 470 return off, err 471 } 472 return off, nil 473 } 474 475 func (rr *MB) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 476 off, err = packDomainName(rr.Mb, msg, off, compression, compress) 477 if err != nil { 478 return off, err 479 } 480 return off, nil 481 } 482 483 func (rr *MD) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 484 off, err = packDomainName(rr.Md, msg, off, compression, compress) 485 if err != nil { 486 return off, err 487 } 488 return off, nil 489 } 490 491 func (rr *MF) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 492 off, err = packDomainName(rr.Mf, msg, off, compression, compress) 493 if err != nil { 494 return off, err 495 } 496 return off, nil 497 } 498 499 func (rr *MG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 500 off, err = packDomainName(rr.Mg, msg, off, compression, compress) 501 if err != nil { 502 return off, err 503 } 504 return off, nil 505 } 506 507 func (rr *MINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 508 off, err = packDomainName(rr.Rmail, msg, off, compression, compress) 509 if err != nil { 510 return off, err 511 } 512 off, err = packDomainName(rr.Email, msg, off, compression, compress) 513 if err != nil { 514 return off, err 515 } 516 return off, nil 517 } 518 519 func (rr *MR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 520 off, err = packDomainName(rr.Mr, msg, off, compression, compress) 521 if err != nil { 522 return off, err 523 } 524 return off, nil 525 } 526 527 func (rr *MX) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 528 off, err = packUint16(rr.Preference, msg, off) 529 if err != nil { 530 return off, err 531 } 532 off, err = packDomainName(rr.Mx, msg, off, compression, compress) 533 if err != nil { 534 return off, err 535 } 536 return off, nil 537 } 538 539 func (rr *NAPTR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 540 off, err = packUint16(rr.Order, msg, off) 541 if err != nil { 542 return off, err 543 } 544 off, err = packUint16(rr.Preference, msg, off) 545 if err != nil { 546 return off, err 547 } 548 off, err = packString(rr.Flags, msg, off) 549 if err != nil { 550 return off, err 551 } 552 off, err = packString(rr.Service, msg, off) 553 if err != nil { 554 return off, err 555 } 556 off, err = packString(rr.Regexp, msg, off) 557 if err != nil { 558 return off, err 559 } 560 off, err = packDomainName(rr.Replacement, msg, off, compression, false) 561 if err != nil { 562 return off, err 563 } 564 return off, nil 565 } 566 567 func (rr *NID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 568 off, err = packUint16(rr.Preference, msg, off) 569 if err != nil { 570 return off, err 571 } 572 off, err = packUint64(rr.NodeID, msg, off) 573 if err != nil { 574 return off, err 575 } 576 return off, nil 577 } 578 579 func (rr *NIMLOC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 580 off, err = packStringHex(rr.Locator, msg, off) 581 if err != nil { 582 return off, err 583 } 584 return off, nil 585 } 586 587 func (rr *NINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 588 off, err = packStringTxt(rr.ZSData, msg, off) 589 if err != nil { 590 return off, err 591 } 592 return off, nil 593 } 594 595 func (rr *NS) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 596 off, err = packDomainName(rr.Ns, msg, off, compression, compress) 597 if err != nil { 598 return off, err 599 } 600 return off, nil 601 } 602 603 func (rr *NSAPPTR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 604 off, err = packDomainName(rr.Ptr, msg, off, compression, false) 605 if err != nil { 606 return off, err 607 } 608 return off, nil 609 } 610 611 func (rr *NSEC) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 612 off, err = packDomainName(rr.NextDomain, msg, off, compression, false) 613 if err != nil { 614 return off, err 615 } 616 off, err = packDataNsec(rr.TypeBitMap, msg, off) 617 if err != nil { 618 return off, err 619 } 620 return off, nil 621 } 622 623 func (rr *NSEC3) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 624 off, err = packUint8(rr.Hash, msg, off) 625 if err != nil { 626 return off, err 627 } 628 off, err = packUint8(rr.Flags, msg, off) 629 if err != nil { 630 return off, err 631 } 632 off, err = packUint16(rr.Iterations, msg, off) 633 if err != nil { 634 return off, err 635 } 636 off, err = packUint8(rr.SaltLength, msg, off) 637 if err != nil { 638 return off, err 639 } 640 // Only pack salt if value is not "-", i.e. empty 641 if rr.Salt != "-" { 642 off, err = packStringHex(rr.Salt, msg, off) 643 if err != nil { 644 return off, err 645 } 646 } 647 off, err = packUint8(rr.HashLength, msg, off) 648 if err != nil { 649 return off, err 650 } 651 off, err = packStringBase32(rr.NextDomain, msg, off) 652 if err != nil { 653 return off, err 654 } 655 off, err = packDataNsec(rr.TypeBitMap, msg, off) 656 if err != nil { 657 return off, err 658 } 659 return off, nil 660 } 661 662 func (rr *NSEC3PARAM) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 663 off, err = packUint8(rr.Hash, msg, off) 664 if err != nil { 665 return off, err 666 } 667 off, err = packUint8(rr.Flags, msg, off) 668 if err != nil { 669 return off, err 670 } 671 off, err = packUint16(rr.Iterations, msg, off) 672 if err != nil { 673 return off, err 674 } 675 off, err = packUint8(rr.SaltLength, msg, off) 676 if err != nil { 677 return off, err 678 } 679 // Only pack salt if value is not "-", i.e. empty 680 if rr.Salt != "-" { 681 off, err = packStringHex(rr.Salt, msg, off) 682 if err != nil { 683 return off, err 684 } 685 } 686 return off, nil 687 } 688 689 func (rr *NULL) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 690 off, err = packStringAny(rr.Data, msg, off) 691 if err != nil { 692 return off, err 693 } 694 return off, nil 695 } 696 697 func (rr *OPENPGPKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 698 off, err = packStringBase64(rr.PublicKey, msg, off) 699 if err != nil { 700 return off, err 701 } 702 return off, nil 703 } 704 705 func (rr *OPT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 706 off, err = packDataOpt(rr.Option, msg, off) 707 if err != nil { 708 return off, err 709 } 710 return off, nil 711 } 712 713 func (rr *PTR) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 714 off, err = packDomainName(rr.Ptr, msg, off, compression, compress) 715 if err != nil { 716 return off, err 717 } 718 return off, nil 719 } 720 721 func (rr *PX) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 722 off, err = packUint16(rr.Preference, msg, off) 723 if err != nil { 724 return off, err 725 } 726 off, err = packDomainName(rr.Map822, msg, off, compression, false) 727 if err != nil { 728 return off, err 729 } 730 off, err = packDomainName(rr.Mapx400, msg, off, compression, false) 731 if err != nil { 732 return off, err 733 } 734 return off, nil 735 } 736 737 func (rr *RFC3597) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 738 off, err = packStringHex(rr.Rdata, msg, off) 739 if err != nil { 740 return off, err 741 } 742 return off, nil 743 } 744 745 func (rr *RKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 746 off, err = packUint16(rr.Flags, msg, off) 747 if err != nil { 748 return off, err 749 } 750 off, err = packUint8(rr.Protocol, msg, off) 751 if err != nil { 752 return off, err 753 } 754 off, err = packUint8(rr.Algorithm, msg, off) 755 if err != nil { 756 return off, err 757 } 758 off, err = packStringBase64(rr.PublicKey, msg, off) 759 if err != nil { 760 return off, err 761 } 762 return off, nil 763 } 764 765 func (rr *RP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 766 off, err = packDomainName(rr.Mbox, msg, off, compression, false) 767 if err != nil { 768 return off, err 769 } 770 off, err = packDomainName(rr.Txt, msg, off, compression, false) 771 if err != nil { 772 return off, err 773 } 774 return off, nil 775 } 776 777 func (rr *RRSIG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 778 off, err = packUint16(rr.TypeCovered, msg, off) 779 if err != nil { 780 return off, err 781 } 782 off, err = packUint8(rr.Algorithm, msg, off) 783 if err != nil { 784 return off, err 785 } 786 off, err = packUint8(rr.Labels, msg, off) 787 if err != nil { 788 return off, err 789 } 790 off, err = packUint32(rr.OrigTtl, msg, off) 791 if err != nil { 792 return off, err 793 } 794 off, err = packUint32(rr.Expiration, msg, off) 795 if err != nil { 796 return off, err 797 } 798 off, err = packUint32(rr.Inception, msg, off) 799 if err != nil { 800 return off, err 801 } 802 off, err = packUint16(rr.KeyTag, msg, off) 803 if err != nil { 804 return off, err 805 } 806 off, err = packDomainName(rr.SignerName, msg, off, compression, false) 807 if err != nil { 808 return off, err 809 } 810 off, err = packStringBase64(rr.Signature, msg, off) 811 if err != nil { 812 return off, err 813 } 814 return off, nil 815 } 816 817 func (rr *RT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 818 off, err = packUint16(rr.Preference, msg, off) 819 if err != nil { 820 return off, err 821 } 822 off, err = packDomainName(rr.Host, msg, off, compression, false) 823 if err != nil { 824 return off, err 825 } 826 return off, nil 827 } 828 829 func (rr *SIG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 830 off, err = packUint16(rr.TypeCovered, msg, off) 831 if err != nil { 832 return off, err 833 } 834 off, err = packUint8(rr.Algorithm, msg, off) 835 if err != nil { 836 return off, err 837 } 838 off, err = packUint8(rr.Labels, msg, off) 839 if err != nil { 840 return off, err 841 } 842 off, err = packUint32(rr.OrigTtl, msg, off) 843 if err != nil { 844 return off, err 845 } 846 off, err = packUint32(rr.Expiration, msg, off) 847 if err != nil { 848 return off, err 849 } 850 off, err = packUint32(rr.Inception, msg, off) 851 if err != nil { 852 return off, err 853 } 854 off, err = packUint16(rr.KeyTag, msg, off) 855 if err != nil { 856 return off, err 857 } 858 off, err = packDomainName(rr.SignerName, msg, off, compression, false) 859 if err != nil { 860 return off, err 861 } 862 off, err = packStringBase64(rr.Signature, msg, off) 863 if err != nil { 864 return off, err 865 } 866 return off, nil 867 } 868 869 func (rr *SMIMEA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 870 off, err = packUint8(rr.Usage, msg, off) 871 if err != nil { 872 return off, err 873 } 874 off, err = packUint8(rr.Selector, msg, off) 875 if err != nil { 876 return off, err 877 } 878 off, err = packUint8(rr.MatchingType, msg, off) 879 if err != nil { 880 return off, err 881 } 882 off, err = packStringHex(rr.Certificate, msg, off) 883 if err != nil { 884 return off, err 885 } 886 return off, nil 887 } 888 889 func (rr *SOA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 890 off, err = packDomainName(rr.Ns, msg, off, compression, compress) 891 if err != nil { 892 return off, err 893 } 894 off, err = packDomainName(rr.Mbox, msg, off, compression, compress) 895 if err != nil { 896 return off, err 897 } 898 off, err = packUint32(rr.Serial, msg, off) 899 if err != nil { 900 return off, err 901 } 902 off, err = packUint32(rr.Refresh, msg, off) 903 if err != nil { 904 return off, err 905 } 906 off, err = packUint32(rr.Retry, msg, off) 907 if err != nil { 908 return off, err 909 } 910 off, err = packUint32(rr.Expire, msg, off) 911 if err != nil { 912 return off, err 913 } 914 off, err = packUint32(rr.Minttl, msg, off) 915 if err != nil { 916 return off, err 917 } 918 return off, nil 919 } 920 921 func (rr *SPF) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 922 off, err = packStringTxt(rr.Txt, msg, off) 923 if err != nil { 924 return off, err 925 } 926 return off, nil 927 } 928 929 func (rr *SRV) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 930 off, err = packUint16(rr.Priority, msg, off) 931 if err != nil { 932 return off, err 933 } 934 off, err = packUint16(rr.Weight, msg, off) 935 if err != nil { 936 return off, err 937 } 938 off, err = packUint16(rr.Port, msg, off) 939 if err != nil { 940 return off, err 941 } 942 off, err = packDomainName(rr.Target, msg, off, compression, false) 943 if err != nil { 944 return off, err 945 } 946 return off, nil 947 } 948 949 func (rr *SSHFP) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 950 off, err = packUint8(rr.Algorithm, msg, off) 951 if err != nil { 952 return off, err 953 } 954 off, err = packUint8(rr.Type, msg, off) 955 if err != nil { 956 return off, err 957 } 958 off, err = packStringHex(rr.FingerPrint, msg, off) 959 if err != nil { 960 return off, err 961 } 962 return off, nil 963 } 964 965 func (rr *SVCB) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 966 off, err = packUint16(rr.Priority, msg, off) 967 if err != nil { 968 return off, err 969 } 970 off, err = packDomainName(rr.Target, msg, off, compression, false) 971 if err != nil { 972 return off, err 973 } 974 off, err = packDataSVCB(rr.Value, msg, off) 975 if err != nil { 976 return off, err 977 } 978 return off, nil 979 } 980 981 func (rr *TA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 982 off, err = packUint16(rr.KeyTag, msg, off) 983 if err != nil { 984 return off, err 985 } 986 off, err = packUint8(rr.Algorithm, msg, off) 987 if err != nil { 988 return off, err 989 } 990 off, err = packUint8(rr.DigestType, msg, off) 991 if err != nil { 992 return off, err 993 } 994 off, err = packStringHex(rr.Digest, msg, off) 995 if err != nil { 996 return off, err 997 } 998 return off, nil 999 } 1000 1001 func (rr *TALINK) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1002 off, err = packDomainName(rr.PreviousName, msg, off, compression, false) 1003 if err != nil { 1004 return off, err 1005 } 1006 off, err = packDomainName(rr.NextName, msg, off, compression, false) 1007 if err != nil { 1008 return off, err 1009 } 1010 return off, nil 1011 } 1012 1013 func (rr *TKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1014 off, err = packDomainName(rr.Algorithm, msg, off, compression, false) 1015 if err != nil { 1016 return off, err 1017 } 1018 off, err = packUint32(rr.Inception, msg, off) 1019 if err != nil { 1020 return off, err 1021 } 1022 off, err = packUint32(rr.Expiration, msg, off) 1023 if err != nil { 1024 return off, err 1025 } 1026 off, err = packUint16(rr.Mode, msg, off) 1027 if err != nil { 1028 return off, err 1029 } 1030 off, err = packUint16(rr.Error, msg, off) 1031 if err != nil { 1032 return off, err 1033 } 1034 off, err = packUint16(rr.KeySize, msg, off) 1035 if err != nil { 1036 return off, err 1037 } 1038 off, err = packStringHex(rr.Key, msg, off) 1039 if err != nil { 1040 return off, err 1041 } 1042 off, err = packUint16(rr.OtherLen, msg, off) 1043 if err != nil { 1044 return off, err 1045 } 1046 off, err = packStringHex(rr.OtherData, msg, off) 1047 if err != nil { 1048 return off, err 1049 } 1050 return off, nil 1051 } 1052 1053 func (rr *TLSA) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1054 off, err = packUint8(rr.Usage, msg, off) 1055 if err != nil { 1056 return off, err 1057 } 1058 off, err = packUint8(rr.Selector, msg, off) 1059 if err != nil { 1060 return off, err 1061 } 1062 off, err = packUint8(rr.MatchingType, msg, off) 1063 if err != nil { 1064 return off, err 1065 } 1066 off, err = packStringHex(rr.Certificate, msg, off) 1067 if err != nil { 1068 return off, err 1069 } 1070 return off, nil 1071 } 1072 1073 func (rr *TSIG) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1074 off, err = packDomainName(rr.Algorithm, msg, off, compression, false) 1075 if err != nil { 1076 return off, err 1077 } 1078 off, err = packUint48(rr.TimeSigned, msg, off) 1079 if err != nil { 1080 return off, err 1081 } 1082 off, err = packUint16(rr.Fudge, msg, off) 1083 if err != nil { 1084 return off, err 1085 } 1086 off, err = packUint16(rr.MACSize, msg, off) 1087 if err != nil { 1088 return off, err 1089 } 1090 off, err = packStringHex(rr.MAC, msg, off) 1091 if err != nil { 1092 return off, err 1093 } 1094 off, err = packUint16(rr.OrigId, msg, off) 1095 if err != nil { 1096 return off, err 1097 } 1098 off, err = packUint16(rr.Error, msg, off) 1099 if err != nil { 1100 return off, err 1101 } 1102 off, err = packUint16(rr.OtherLen, msg, off) 1103 if err != nil { 1104 return off, err 1105 } 1106 off, err = packStringHex(rr.OtherData, msg, off) 1107 if err != nil { 1108 return off, err 1109 } 1110 return off, nil 1111 } 1112 1113 func (rr *TXT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1114 off, err = packStringTxt(rr.Txt, msg, off) 1115 if err != nil { 1116 return off, err 1117 } 1118 return off, nil 1119 } 1120 1121 func (rr *UID) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1122 off, err = packUint32(rr.Uid, msg, off) 1123 if err != nil { 1124 return off, err 1125 } 1126 return off, nil 1127 } 1128 1129 func (rr *UINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1130 off, err = packString(rr.Uinfo, msg, off) 1131 if err != nil { 1132 return off, err 1133 } 1134 return off, nil 1135 } 1136 1137 func (rr *URI) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1138 off, err = packUint16(rr.Priority, msg, off) 1139 if err != nil { 1140 return off, err 1141 } 1142 off, err = packUint16(rr.Weight, msg, off) 1143 if err != nil { 1144 return off, err 1145 } 1146 off, err = packStringOctet(rr.Target, msg, off) 1147 if err != nil { 1148 return off, err 1149 } 1150 return off, nil 1151 } 1152 1153 func (rr *X25) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1154 off, err = packString(rr.PSDNAddress, msg, off) 1155 if err != nil { 1156 return off, err 1157 } 1158 return off, nil 1159 } 1160 1161 func (rr *ZONEMD) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { 1162 off, err = packUint32(rr.Serial, msg, off) 1163 if err != nil { 1164 return off, err 1165 } 1166 off, err = packUint8(rr.Scheme, msg, off) 1167 if err != nil { 1168 return off, err 1169 } 1170 off, err = packUint8(rr.Hash, msg, off) 1171 if err != nil { 1172 return off, err 1173 } 1174 off, err = packStringHex(rr.Digest, msg, off) 1175 if err != nil { 1176 return off, err 1177 } 1178 return off, nil 1179 } 1180 1181 // unpack*() functions 1182 1183 func (rr *A) unpack(msg []byte, off int) (off1 int, err error) { 1184 rdStart := off 1185 _ = rdStart 1186 1187 rr.A, off, err = unpackDataA(msg, off) 1188 if err != nil { 1189 return off, err 1190 } 1191 return off, nil 1192 } 1193 1194 func (rr *AAAA) unpack(msg []byte, off int) (off1 int, err error) { 1195 rdStart := off 1196 _ = rdStart 1197 1198 rr.AAAA, off, err = unpackDataAAAA(msg, off) 1199 if err != nil { 1200 return off, err 1201 } 1202 return off, nil 1203 } 1204 1205 func (rr *AFSDB) unpack(msg []byte, off int) (off1 int, err error) { 1206 rdStart := off 1207 _ = rdStart 1208 1209 rr.Subtype, off, err = unpackUint16(msg, off) 1210 if err != nil { 1211 return off, err 1212 } 1213 if off == len(msg) { 1214 return off, nil 1215 } 1216 rr.Hostname, off, err = UnpackDomainName(msg, off) 1217 if err != nil { 1218 return off, err 1219 } 1220 return off, nil 1221 } 1222 1223 func (rr *AMTRELAY) unpack(msg []byte, off int) (off1 int, err error) { 1224 rdStart := off 1225 _ = rdStart 1226 1227 rr.Precedence, off, err = unpackUint8(msg, off) 1228 if err != nil { 1229 return off, err 1230 } 1231 if off == len(msg) { 1232 return off, nil 1233 } 1234 rr.GatewayType, off, err = unpackUint8(msg, off) 1235 if err != nil { 1236 return off, err 1237 } 1238 if off == len(msg) { 1239 return off, nil 1240 } 1241 if off == len(msg) { 1242 return off, nil 1243 } 1244 rr.GatewayAddr, rr.GatewayHost, off, err = unpackIPSECGateway(msg, off, rr.GatewayType) 1245 if err != nil { 1246 return off, err 1247 } 1248 return off, nil 1249 } 1250 1251 func (rr *ANY) unpack(msg []byte, off int) (off1 int, err error) { 1252 rdStart := off 1253 _ = rdStart 1254 1255 return off, nil 1256 } 1257 1258 func (rr *APL) unpack(msg []byte, off int) (off1 int, err error) { 1259 rdStart := off 1260 _ = rdStart 1261 1262 rr.Prefixes, off, err = unpackDataApl(msg, off) 1263 if err != nil { 1264 return off, err 1265 } 1266 return off, nil 1267 } 1268 1269 func (rr *AVC) unpack(msg []byte, off int) (off1 int, err error) { 1270 rdStart := off 1271 _ = rdStart 1272 1273 rr.Txt, off, err = unpackStringTxt(msg, off) 1274 if err != nil { 1275 return off, err 1276 } 1277 return off, nil 1278 } 1279 1280 func (rr *CAA) unpack(msg []byte, off int) (off1 int, err error) { 1281 rdStart := off 1282 _ = rdStart 1283 1284 rr.Flag, off, err = unpackUint8(msg, off) 1285 if err != nil { 1286 return off, err 1287 } 1288 if off == len(msg) { 1289 return off, nil 1290 } 1291 rr.Tag, off, err = unpackString(msg, off) 1292 if err != nil { 1293 return off, err 1294 } 1295 if off == len(msg) { 1296 return off, nil 1297 } 1298 rr.Value, off, err = unpackStringOctet(msg, off) 1299 if err != nil { 1300 return off, err 1301 } 1302 return off, nil 1303 } 1304 1305 func (rr *CDNSKEY) unpack(msg []byte, off int) (off1 int, err error) { 1306 rdStart := off 1307 _ = rdStart 1308 1309 rr.Flags, off, err = unpackUint16(msg, off) 1310 if err != nil { 1311 return off, err 1312 } 1313 if off == len(msg) { 1314 return off, nil 1315 } 1316 rr.Protocol, off, err = unpackUint8(msg, off) 1317 if err != nil { 1318 return off, err 1319 } 1320 if off == len(msg) { 1321 return off, nil 1322 } 1323 rr.Algorithm, off, err = unpackUint8(msg, off) 1324 if err != nil { 1325 return off, err 1326 } 1327 if off == len(msg) { 1328 return off, nil 1329 } 1330 rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1331 if err != nil { 1332 return off, err 1333 } 1334 return off, nil 1335 } 1336 1337 func (rr *CDS) unpack(msg []byte, off int) (off1 int, err error) { 1338 rdStart := off 1339 _ = rdStart 1340 1341 rr.KeyTag, off, err = unpackUint16(msg, off) 1342 if err != nil { 1343 return off, err 1344 } 1345 if off == len(msg) { 1346 return off, nil 1347 } 1348 rr.Algorithm, off, err = unpackUint8(msg, off) 1349 if err != nil { 1350 return off, err 1351 } 1352 if off == len(msg) { 1353 return off, nil 1354 } 1355 rr.DigestType, off, err = unpackUint8(msg, off) 1356 if err != nil { 1357 return off, err 1358 } 1359 if off == len(msg) { 1360 return off, nil 1361 } 1362 rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1363 if err != nil { 1364 return off, err 1365 } 1366 return off, nil 1367 } 1368 1369 func (rr *CERT) unpack(msg []byte, off int) (off1 int, err error) { 1370 rdStart := off 1371 _ = rdStart 1372 1373 rr.Type, off, err = unpackUint16(msg, off) 1374 if err != nil { 1375 return off, err 1376 } 1377 if off == len(msg) { 1378 return off, nil 1379 } 1380 rr.KeyTag, off, err = unpackUint16(msg, off) 1381 if err != nil { 1382 return off, err 1383 } 1384 if off == len(msg) { 1385 return off, nil 1386 } 1387 rr.Algorithm, off, err = unpackUint8(msg, off) 1388 if err != nil { 1389 return off, err 1390 } 1391 if off == len(msg) { 1392 return off, nil 1393 } 1394 rr.Certificate, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1395 if err != nil { 1396 return off, err 1397 } 1398 return off, nil 1399 } 1400 1401 func (rr *CNAME) unpack(msg []byte, off int) (off1 int, err error) { 1402 rdStart := off 1403 _ = rdStart 1404 1405 rr.Target, off, err = UnpackDomainName(msg, off) 1406 if err != nil { 1407 return off, err 1408 } 1409 return off, nil 1410 } 1411 1412 func (rr *CSYNC) unpack(msg []byte, off int) (off1 int, err error) { 1413 rdStart := off 1414 _ = rdStart 1415 1416 rr.Serial, off, err = unpackUint32(msg, off) 1417 if err != nil { 1418 return off, err 1419 } 1420 if off == len(msg) { 1421 return off, nil 1422 } 1423 rr.Flags, off, err = unpackUint16(msg, off) 1424 if err != nil { 1425 return off, err 1426 } 1427 if off == len(msg) { 1428 return off, nil 1429 } 1430 rr.TypeBitMap, off, err = unpackDataNsec(msg, off) 1431 if err != nil { 1432 return off, err 1433 } 1434 return off, nil 1435 } 1436 1437 func (rr *DHCID) unpack(msg []byte, off int) (off1 int, err error) { 1438 rdStart := off 1439 _ = rdStart 1440 1441 rr.Digest, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1442 if err != nil { 1443 return off, err 1444 } 1445 return off, nil 1446 } 1447 1448 func (rr *DLV) unpack(msg []byte, off int) (off1 int, err error) { 1449 rdStart := off 1450 _ = rdStart 1451 1452 rr.KeyTag, off, err = unpackUint16(msg, off) 1453 if err != nil { 1454 return off, err 1455 } 1456 if off == len(msg) { 1457 return off, nil 1458 } 1459 rr.Algorithm, off, err = unpackUint8(msg, off) 1460 if err != nil { 1461 return off, err 1462 } 1463 if off == len(msg) { 1464 return off, nil 1465 } 1466 rr.DigestType, off, err = unpackUint8(msg, off) 1467 if err != nil { 1468 return off, err 1469 } 1470 if off == len(msg) { 1471 return off, nil 1472 } 1473 rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1474 if err != nil { 1475 return off, err 1476 } 1477 return off, nil 1478 } 1479 1480 func (rr *DNAME) unpack(msg []byte, off int) (off1 int, err error) { 1481 rdStart := off 1482 _ = rdStart 1483 1484 rr.Target, off, err = UnpackDomainName(msg, off) 1485 if err != nil { 1486 return off, err 1487 } 1488 return off, nil 1489 } 1490 1491 func (rr *DNSKEY) unpack(msg []byte, off int) (off1 int, err error) { 1492 rdStart := off 1493 _ = rdStart 1494 1495 rr.Flags, off, err = unpackUint16(msg, off) 1496 if err != nil { 1497 return off, err 1498 } 1499 if off == len(msg) { 1500 return off, nil 1501 } 1502 rr.Protocol, off, err = unpackUint8(msg, off) 1503 if err != nil { 1504 return off, err 1505 } 1506 if off == len(msg) { 1507 return off, nil 1508 } 1509 rr.Algorithm, off, err = unpackUint8(msg, off) 1510 if err != nil { 1511 return off, err 1512 } 1513 if off == len(msg) { 1514 return off, nil 1515 } 1516 rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1517 if err != nil { 1518 return off, err 1519 } 1520 return off, nil 1521 } 1522 1523 func (rr *DS) unpack(msg []byte, off int) (off1 int, err error) { 1524 rdStart := off 1525 _ = rdStart 1526 1527 rr.KeyTag, off, err = unpackUint16(msg, off) 1528 if err != nil { 1529 return off, err 1530 } 1531 if off == len(msg) { 1532 return off, nil 1533 } 1534 rr.Algorithm, off, err = unpackUint8(msg, off) 1535 if err != nil { 1536 return off, err 1537 } 1538 if off == len(msg) { 1539 return off, nil 1540 } 1541 rr.DigestType, off, err = unpackUint8(msg, off) 1542 if err != nil { 1543 return off, err 1544 } 1545 if off == len(msg) { 1546 return off, nil 1547 } 1548 rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1549 if err != nil { 1550 return off, err 1551 } 1552 return off, nil 1553 } 1554 1555 func (rr *EID) unpack(msg []byte, off int) (off1 int, err error) { 1556 rdStart := off 1557 _ = rdStart 1558 1559 rr.Endpoint, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1560 if err != nil { 1561 return off, err 1562 } 1563 return off, nil 1564 } 1565 1566 func (rr *EUI48) unpack(msg []byte, off int) (off1 int, err error) { 1567 rdStart := off 1568 _ = rdStart 1569 1570 rr.Address, off, err = unpackUint48(msg, off) 1571 if err != nil { 1572 return off, err 1573 } 1574 return off, nil 1575 } 1576 1577 func (rr *EUI64) unpack(msg []byte, off int) (off1 int, err error) { 1578 rdStart := off 1579 _ = rdStart 1580 1581 rr.Address, off, err = unpackUint64(msg, off) 1582 if err != nil { 1583 return off, err 1584 } 1585 return off, nil 1586 } 1587 1588 func (rr *GID) unpack(msg []byte, off int) (off1 int, err error) { 1589 rdStart := off 1590 _ = rdStart 1591 1592 rr.Gid, off, err = unpackUint32(msg, off) 1593 if err != nil { 1594 return off, err 1595 } 1596 return off, nil 1597 } 1598 1599 func (rr *GPOS) unpack(msg []byte, off int) (off1 int, err error) { 1600 rdStart := off 1601 _ = rdStart 1602 1603 rr.Longitude, off, err = unpackString(msg, off) 1604 if err != nil { 1605 return off, err 1606 } 1607 if off == len(msg) { 1608 return off, nil 1609 } 1610 rr.Latitude, off, err = unpackString(msg, off) 1611 if err != nil { 1612 return off, err 1613 } 1614 if off == len(msg) { 1615 return off, nil 1616 } 1617 rr.Altitude, off, err = unpackString(msg, off) 1618 if err != nil { 1619 return off, err 1620 } 1621 return off, nil 1622 } 1623 1624 func (rr *HINFO) unpack(msg []byte, off int) (off1 int, err error) { 1625 rdStart := off 1626 _ = rdStart 1627 1628 rr.Cpu, off, err = unpackString(msg, off) 1629 if err != nil { 1630 return off, err 1631 } 1632 if off == len(msg) { 1633 return off, nil 1634 } 1635 rr.Os, off, err = unpackString(msg, off) 1636 if err != nil { 1637 return off, err 1638 } 1639 return off, nil 1640 } 1641 1642 func (rr *HIP) unpack(msg []byte, off int) (off1 int, err error) { 1643 rdStart := off 1644 _ = rdStart 1645 1646 rr.HitLength, off, err = unpackUint8(msg, off) 1647 if err != nil { 1648 return off, err 1649 } 1650 if off == len(msg) { 1651 return off, nil 1652 } 1653 rr.PublicKeyAlgorithm, off, err = unpackUint8(msg, off) 1654 if err != nil { 1655 return off, err 1656 } 1657 if off == len(msg) { 1658 return off, nil 1659 } 1660 rr.PublicKeyLength, off, err = unpackUint16(msg, off) 1661 if err != nil { 1662 return off, err 1663 } 1664 if off == len(msg) { 1665 return off, nil 1666 } 1667 rr.Hit, off, err = unpackStringHex(msg, off, off+int(rr.HitLength)) 1668 if err != nil { 1669 return off, err 1670 } 1671 rr.PublicKey, off, err = unpackStringBase64(msg, off, off+int(rr.PublicKeyLength)) 1672 if err != nil { 1673 return off, err 1674 } 1675 rr.RendezvousServers, off, err = unpackDataDomainNames(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1676 if err != nil { 1677 return off, err 1678 } 1679 return off, nil 1680 } 1681 1682 func (rr *HTTPS) unpack(msg []byte, off int) (off1 int, err error) { 1683 rdStart := off 1684 _ = rdStart 1685 1686 rr.Priority, off, err = unpackUint16(msg, off) 1687 if err != nil { 1688 return off, err 1689 } 1690 if off == len(msg) { 1691 return off, nil 1692 } 1693 rr.Target, off, err = UnpackDomainName(msg, off) 1694 if err != nil { 1695 return off, err 1696 } 1697 if off == len(msg) { 1698 return off, nil 1699 } 1700 rr.Value, off, err = unpackDataSVCB(msg, off) 1701 if err != nil { 1702 return off, err 1703 } 1704 return off, nil 1705 } 1706 1707 func (rr *IPSECKEY) unpack(msg []byte, off int) (off1 int, err error) { 1708 rdStart := off 1709 _ = rdStart 1710 1711 rr.Precedence, off, err = unpackUint8(msg, off) 1712 if err != nil { 1713 return off, err 1714 } 1715 if off == len(msg) { 1716 return off, nil 1717 } 1718 rr.GatewayType, off, err = unpackUint8(msg, off) 1719 if err != nil { 1720 return off, err 1721 } 1722 if off == len(msg) { 1723 return off, nil 1724 } 1725 rr.Algorithm, off, err = unpackUint8(msg, off) 1726 if err != nil { 1727 return off, err 1728 } 1729 if off == len(msg) { 1730 return off, nil 1731 } 1732 if off == len(msg) { 1733 return off, nil 1734 } 1735 rr.GatewayAddr, rr.GatewayHost, off, err = unpackIPSECGateway(msg, off, rr.GatewayType) 1736 if err != nil { 1737 return off, err 1738 } 1739 if off == len(msg) { 1740 return off, nil 1741 } 1742 rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1743 if err != nil { 1744 return off, err 1745 } 1746 return off, nil 1747 } 1748 1749 func (rr *KEY) unpack(msg []byte, off int) (off1 int, err error) { 1750 rdStart := off 1751 _ = rdStart 1752 1753 rr.Flags, off, err = unpackUint16(msg, off) 1754 if err != nil { 1755 return off, err 1756 } 1757 if off == len(msg) { 1758 return off, nil 1759 } 1760 rr.Protocol, off, err = unpackUint8(msg, off) 1761 if err != nil { 1762 return off, err 1763 } 1764 if off == len(msg) { 1765 return off, nil 1766 } 1767 rr.Algorithm, off, err = unpackUint8(msg, off) 1768 if err != nil { 1769 return off, err 1770 } 1771 if off == len(msg) { 1772 return off, nil 1773 } 1774 rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 1775 if err != nil { 1776 return off, err 1777 } 1778 return off, nil 1779 } 1780 1781 func (rr *KX) unpack(msg []byte, off int) (off1 int, err error) { 1782 rdStart := off 1783 _ = rdStart 1784 1785 rr.Preference, off, err = unpackUint16(msg, off) 1786 if err != nil { 1787 return off, err 1788 } 1789 if off == len(msg) { 1790 return off, nil 1791 } 1792 rr.Exchanger, off, err = UnpackDomainName(msg, off) 1793 if err != nil { 1794 return off, err 1795 } 1796 return off, nil 1797 } 1798 1799 func (rr *L32) unpack(msg []byte, off int) (off1 int, err error) { 1800 rdStart := off 1801 _ = rdStart 1802 1803 rr.Preference, off, err = unpackUint16(msg, off) 1804 if err != nil { 1805 return off, err 1806 } 1807 if off == len(msg) { 1808 return off, nil 1809 } 1810 rr.Locator32, off, err = unpackDataA(msg, off) 1811 if err != nil { 1812 return off, err 1813 } 1814 return off, nil 1815 } 1816 1817 func (rr *L64) unpack(msg []byte, off int) (off1 int, err error) { 1818 rdStart := off 1819 _ = rdStart 1820 1821 rr.Preference, off, err = unpackUint16(msg, off) 1822 if err != nil { 1823 return off, err 1824 } 1825 if off == len(msg) { 1826 return off, nil 1827 } 1828 rr.Locator64, off, err = unpackUint64(msg, off) 1829 if err != nil { 1830 return off, err 1831 } 1832 return off, nil 1833 } 1834 1835 func (rr *LOC) unpack(msg []byte, off int) (off1 int, err error) { 1836 rdStart := off 1837 _ = rdStart 1838 1839 rr.Version, off, err = unpackUint8(msg, off) 1840 if err != nil { 1841 return off, err 1842 } 1843 if off == len(msg) { 1844 return off, nil 1845 } 1846 rr.Size, off, err = unpackUint8(msg, off) 1847 if err != nil { 1848 return off, err 1849 } 1850 if off == len(msg) { 1851 return off, nil 1852 } 1853 rr.HorizPre, off, err = unpackUint8(msg, off) 1854 if err != nil { 1855 return off, err 1856 } 1857 if off == len(msg) { 1858 return off, nil 1859 } 1860 rr.VertPre, off, err = unpackUint8(msg, off) 1861 if err != nil { 1862 return off, err 1863 } 1864 if off == len(msg) { 1865 return off, nil 1866 } 1867 rr.Latitude, off, err = unpackUint32(msg, off) 1868 if err != nil { 1869 return off, err 1870 } 1871 if off == len(msg) { 1872 return off, nil 1873 } 1874 rr.Longitude, off, err = unpackUint32(msg, off) 1875 if err != nil { 1876 return off, err 1877 } 1878 if off == len(msg) { 1879 return off, nil 1880 } 1881 rr.Altitude, off, err = unpackUint32(msg, off) 1882 if err != nil { 1883 return off, err 1884 } 1885 return off, nil 1886 } 1887 1888 func (rr *LP) unpack(msg []byte, off int) (off1 int, err error) { 1889 rdStart := off 1890 _ = rdStart 1891 1892 rr.Preference, off, err = unpackUint16(msg, off) 1893 if err != nil { 1894 return off, err 1895 } 1896 if off == len(msg) { 1897 return off, nil 1898 } 1899 rr.Fqdn, off, err = UnpackDomainName(msg, off) 1900 if err != nil { 1901 return off, err 1902 } 1903 return off, nil 1904 } 1905 1906 func (rr *MB) unpack(msg []byte, off int) (off1 int, err error) { 1907 rdStart := off 1908 _ = rdStart 1909 1910 rr.Mb, off, err = UnpackDomainName(msg, off) 1911 if err != nil { 1912 return off, err 1913 } 1914 return off, nil 1915 } 1916 1917 func (rr *MD) unpack(msg []byte, off int) (off1 int, err error) { 1918 rdStart := off 1919 _ = rdStart 1920 1921 rr.Md, off, err = UnpackDomainName(msg, off) 1922 if err != nil { 1923 return off, err 1924 } 1925 return off, nil 1926 } 1927 1928 func (rr *MF) unpack(msg []byte, off int) (off1 int, err error) { 1929 rdStart := off 1930 _ = rdStart 1931 1932 rr.Mf, off, err = UnpackDomainName(msg, off) 1933 if err != nil { 1934 return off, err 1935 } 1936 return off, nil 1937 } 1938 1939 func (rr *MG) unpack(msg []byte, off int) (off1 int, err error) { 1940 rdStart := off 1941 _ = rdStart 1942 1943 rr.Mg, off, err = UnpackDomainName(msg, off) 1944 if err != nil { 1945 return off, err 1946 } 1947 return off, nil 1948 } 1949 1950 func (rr *MINFO) unpack(msg []byte, off int) (off1 int, err error) { 1951 rdStart := off 1952 _ = rdStart 1953 1954 rr.Rmail, off, err = UnpackDomainName(msg, off) 1955 if err != nil { 1956 return off, err 1957 } 1958 if off == len(msg) { 1959 return off, nil 1960 } 1961 rr.Email, off, err = UnpackDomainName(msg, off) 1962 if err != nil { 1963 return off, err 1964 } 1965 return off, nil 1966 } 1967 1968 func (rr *MR) unpack(msg []byte, off int) (off1 int, err error) { 1969 rdStart := off 1970 _ = rdStart 1971 1972 rr.Mr, off, err = UnpackDomainName(msg, off) 1973 if err != nil { 1974 return off, err 1975 } 1976 return off, nil 1977 } 1978 1979 func (rr *MX) unpack(msg []byte, off int) (off1 int, err error) { 1980 rdStart := off 1981 _ = rdStart 1982 1983 rr.Preference, off, err = unpackUint16(msg, off) 1984 if err != nil { 1985 return off, err 1986 } 1987 if off == len(msg) { 1988 return off, nil 1989 } 1990 rr.Mx, off, err = UnpackDomainName(msg, off) 1991 if err != nil { 1992 return off, err 1993 } 1994 return off, nil 1995 } 1996 1997 func (rr *NAPTR) unpack(msg []byte, off int) (off1 int, err error) { 1998 rdStart := off 1999 _ = rdStart 2000 2001 rr.Order, off, err = unpackUint16(msg, off) 2002 if err != nil { 2003 return off, err 2004 } 2005 if off == len(msg) { 2006 return off, nil 2007 } 2008 rr.Preference, off, err = unpackUint16(msg, off) 2009 if err != nil { 2010 return off, err 2011 } 2012 if off == len(msg) { 2013 return off, nil 2014 } 2015 rr.Flags, off, err = unpackString(msg, off) 2016 if err != nil { 2017 return off, err 2018 } 2019 if off == len(msg) { 2020 return off, nil 2021 } 2022 rr.Service, off, err = unpackString(msg, off) 2023 if err != nil { 2024 return off, err 2025 } 2026 if off == len(msg) { 2027 return off, nil 2028 } 2029 rr.Regexp, off, err = unpackString(msg, off) 2030 if err != nil { 2031 return off, err 2032 } 2033 if off == len(msg) { 2034 return off, nil 2035 } 2036 rr.Replacement, off, err = UnpackDomainName(msg, off) 2037 if err != nil { 2038 return off, err 2039 } 2040 return off, nil 2041 } 2042 2043 func (rr *NID) unpack(msg []byte, off int) (off1 int, err error) { 2044 rdStart := off 2045 _ = rdStart 2046 2047 rr.Preference, off, err = unpackUint16(msg, off) 2048 if err != nil { 2049 return off, err 2050 } 2051 if off == len(msg) { 2052 return off, nil 2053 } 2054 rr.NodeID, off, err = unpackUint64(msg, off) 2055 if err != nil { 2056 return off, err 2057 } 2058 return off, nil 2059 } 2060 2061 func (rr *NIMLOC) unpack(msg []byte, off int) (off1 int, err error) { 2062 rdStart := off 2063 _ = rdStart 2064 2065 rr.Locator, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2066 if err != nil { 2067 return off, err 2068 } 2069 return off, nil 2070 } 2071 2072 func (rr *NINFO) unpack(msg []byte, off int) (off1 int, err error) { 2073 rdStart := off 2074 _ = rdStart 2075 2076 rr.ZSData, off, err = unpackStringTxt(msg, off) 2077 if err != nil { 2078 return off, err 2079 } 2080 return off, nil 2081 } 2082 2083 func (rr *NS) unpack(msg []byte, off int) (off1 int, err error) { 2084 rdStart := off 2085 _ = rdStart 2086 2087 rr.Ns, off, err = UnpackDomainName(msg, off) 2088 if err != nil { 2089 return off, err 2090 } 2091 return off, nil 2092 } 2093 2094 func (rr *NSAPPTR) unpack(msg []byte, off int) (off1 int, err error) { 2095 rdStart := off 2096 _ = rdStart 2097 2098 rr.Ptr, off, err = UnpackDomainName(msg, off) 2099 if err != nil { 2100 return off, err 2101 } 2102 return off, nil 2103 } 2104 2105 func (rr *NSEC) unpack(msg []byte, off int) (off1 int, err error) { 2106 rdStart := off 2107 _ = rdStart 2108 2109 rr.NextDomain, off, err = UnpackDomainName(msg, off) 2110 if err != nil { 2111 return off, err 2112 } 2113 if off == len(msg) { 2114 return off, nil 2115 } 2116 rr.TypeBitMap, off, err = unpackDataNsec(msg, off) 2117 if err != nil { 2118 return off, err 2119 } 2120 return off, nil 2121 } 2122 2123 func (rr *NSEC3) unpack(msg []byte, off int) (off1 int, err error) { 2124 rdStart := off 2125 _ = rdStart 2126 2127 rr.Hash, off, err = unpackUint8(msg, off) 2128 if err != nil { 2129 return off, err 2130 } 2131 if off == len(msg) { 2132 return off, nil 2133 } 2134 rr.Flags, off, err = unpackUint8(msg, off) 2135 if err != nil { 2136 return off, err 2137 } 2138 if off == len(msg) { 2139 return off, nil 2140 } 2141 rr.Iterations, off, err = unpackUint16(msg, off) 2142 if err != nil { 2143 return off, err 2144 } 2145 if off == len(msg) { 2146 return off, nil 2147 } 2148 rr.SaltLength, off, err = unpackUint8(msg, off) 2149 if err != nil { 2150 return off, err 2151 } 2152 if off == len(msg) { 2153 return off, nil 2154 } 2155 rr.Salt, off, err = unpackStringHex(msg, off, off+int(rr.SaltLength)) 2156 if err != nil { 2157 return off, err 2158 } 2159 rr.HashLength, off, err = unpackUint8(msg, off) 2160 if err != nil { 2161 return off, err 2162 } 2163 if off == len(msg) { 2164 return off, nil 2165 } 2166 rr.NextDomain, off, err = unpackStringBase32(msg, off, off+int(rr.HashLength)) 2167 if err != nil { 2168 return off, err 2169 } 2170 rr.TypeBitMap, off, err = unpackDataNsec(msg, off) 2171 if err != nil { 2172 return off, err 2173 } 2174 return off, nil 2175 } 2176 2177 func (rr *NSEC3PARAM) unpack(msg []byte, off int) (off1 int, err error) { 2178 rdStart := off 2179 _ = rdStart 2180 2181 rr.Hash, off, err = unpackUint8(msg, off) 2182 if err != nil { 2183 return off, err 2184 } 2185 if off == len(msg) { 2186 return off, nil 2187 } 2188 rr.Flags, off, err = unpackUint8(msg, off) 2189 if err != nil { 2190 return off, err 2191 } 2192 if off == len(msg) { 2193 return off, nil 2194 } 2195 rr.Iterations, off, err = unpackUint16(msg, off) 2196 if err != nil { 2197 return off, err 2198 } 2199 if off == len(msg) { 2200 return off, nil 2201 } 2202 rr.SaltLength, off, err = unpackUint8(msg, off) 2203 if err != nil { 2204 return off, err 2205 } 2206 if off == len(msg) { 2207 return off, nil 2208 } 2209 rr.Salt, off, err = unpackStringHex(msg, off, off+int(rr.SaltLength)) 2210 if err != nil { 2211 return off, err 2212 } 2213 return off, nil 2214 } 2215 2216 func (rr *NULL) unpack(msg []byte, off int) (off1 int, err error) { 2217 rdStart := off 2218 _ = rdStart 2219 2220 rr.Data, off, err = unpackStringAny(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2221 if err != nil { 2222 return off, err 2223 } 2224 return off, nil 2225 } 2226 2227 func (rr *OPENPGPKEY) unpack(msg []byte, off int) (off1 int, err error) { 2228 rdStart := off 2229 _ = rdStart 2230 2231 rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2232 if err != nil { 2233 return off, err 2234 } 2235 return off, nil 2236 } 2237 2238 func (rr *OPT) unpack(msg []byte, off int) (off1 int, err error) { 2239 rdStart := off 2240 _ = rdStart 2241 2242 rr.Option, off, err = unpackDataOpt(msg, off) 2243 if err != nil { 2244 return off, err 2245 } 2246 return off, nil 2247 } 2248 2249 func (rr *PTR) unpack(msg []byte, off int) (off1 int, err error) { 2250 rdStart := off 2251 _ = rdStart 2252 2253 rr.Ptr, off, err = UnpackDomainName(msg, off) 2254 if err != nil { 2255 return off, err 2256 } 2257 return off, nil 2258 } 2259 2260 func (rr *PX) unpack(msg []byte, off int) (off1 int, err error) { 2261 rdStart := off 2262 _ = rdStart 2263 2264 rr.Preference, off, err = unpackUint16(msg, off) 2265 if err != nil { 2266 return off, err 2267 } 2268 if off == len(msg) { 2269 return off, nil 2270 } 2271 rr.Map822, off, err = UnpackDomainName(msg, off) 2272 if err != nil { 2273 return off, err 2274 } 2275 if off == len(msg) { 2276 return off, nil 2277 } 2278 rr.Mapx400, off, err = UnpackDomainName(msg, off) 2279 if err != nil { 2280 return off, err 2281 } 2282 return off, nil 2283 } 2284 2285 func (rr *RFC3597) unpack(msg []byte, off int) (off1 int, err error) { 2286 rdStart := off 2287 _ = rdStart 2288 2289 rr.Rdata, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2290 if err != nil { 2291 return off, err 2292 } 2293 return off, nil 2294 } 2295 2296 func (rr *RKEY) unpack(msg []byte, off int) (off1 int, err error) { 2297 rdStart := off 2298 _ = rdStart 2299 2300 rr.Flags, off, err = unpackUint16(msg, off) 2301 if err != nil { 2302 return off, err 2303 } 2304 if off == len(msg) { 2305 return off, nil 2306 } 2307 rr.Protocol, off, err = unpackUint8(msg, off) 2308 if err != nil { 2309 return off, err 2310 } 2311 if off == len(msg) { 2312 return off, nil 2313 } 2314 rr.Algorithm, off, err = unpackUint8(msg, off) 2315 if err != nil { 2316 return off, err 2317 } 2318 if off == len(msg) { 2319 return off, nil 2320 } 2321 rr.PublicKey, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2322 if err != nil { 2323 return off, err 2324 } 2325 return off, nil 2326 } 2327 2328 func (rr *RP) unpack(msg []byte, off int) (off1 int, err error) { 2329 rdStart := off 2330 _ = rdStart 2331 2332 rr.Mbox, off, err = UnpackDomainName(msg, off) 2333 if err != nil { 2334 return off, err 2335 } 2336 if off == len(msg) { 2337 return off, nil 2338 } 2339 rr.Txt, off, err = UnpackDomainName(msg, off) 2340 if err != nil { 2341 return off, err 2342 } 2343 return off, nil 2344 } 2345 2346 func (rr *RRSIG) unpack(msg []byte, off int) (off1 int, err error) { 2347 rdStart := off 2348 _ = rdStart 2349 2350 rr.TypeCovered, off, err = unpackUint16(msg, off) 2351 if err != nil { 2352 return off, err 2353 } 2354 if off == len(msg) { 2355 return off, nil 2356 } 2357 rr.Algorithm, off, err = unpackUint8(msg, off) 2358 if err != nil { 2359 return off, err 2360 } 2361 if off == len(msg) { 2362 return off, nil 2363 } 2364 rr.Labels, off, err = unpackUint8(msg, off) 2365 if err != nil { 2366 return off, err 2367 } 2368 if off == len(msg) { 2369 return off, nil 2370 } 2371 rr.OrigTtl, off, err = unpackUint32(msg, off) 2372 if err != nil { 2373 return off, err 2374 } 2375 if off == len(msg) { 2376 return off, nil 2377 } 2378 rr.Expiration, off, err = unpackUint32(msg, off) 2379 if err != nil { 2380 return off, err 2381 } 2382 if off == len(msg) { 2383 return off, nil 2384 } 2385 rr.Inception, off, err = unpackUint32(msg, off) 2386 if err != nil { 2387 return off, err 2388 } 2389 if off == len(msg) { 2390 return off, nil 2391 } 2392 rr.KeyTag, off, err = unpackUint16(msg, off) 2393 if err != nil { 2394 return off, err 2395 } 2396 if off == len(msg) { 2397 return off, nil 2398 } 2399 rr.SignerName, off, err = UnpackDomainName(msg, off) 2400 if err != nil { 2401 return off, err 2402 } 2403 if off == len(msg) { 2404 return off, nil 2405 } 2406 rr.Signature, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2407 if err != nil { 2408 return off, err 2409 } 2410 return off, nil 2411 } 2412 2413 func (rr *RT) unpack(msg []byte, off int) (off1 int, err error) { 2414 rdStart := off 2415 _ = rdStart 2416 2417 rr.Preference, off, err = unpackUint16(msg, off) 2418 if err != nil { 2419 return off, err 2420 } 2421 if off == len(msg) { 2422 return off, nil 2423 } 2424 rr.Host, off, err = UnpackDomainName(msg, off) 2425 if err != nil { 2426 return off, err 2427 } 2428 return off, nil 2429 } 2430 2431 func (rr *SIG) unpack(msg []byte, off int) (off1 int, err error) { 2432 rdStart := off 2433 _ = rdStart 2434 2435 rr.TypeCovered, off, err = unpackUint16(msg, off) 2436 if err != nil { 2437 return off, err 2438 } 2439 if off == len(msg) { 2440 return off, nil 2441 } 2442 rr.Algorithm, off, err = unpackUint8(msg, off) 2443 if err != nil { 2444 return off, err 2445 } 2446 if off == len(msg) { 2447 return off, nil 2448 } 2449 rr.Labels, off, err = unpackUint8(msg, off) 2450 if err != nil { 2451 return off, err 2452 } 2453 if off == len(msg) { 2454 return off, nil 2455 } 2456 rr.OrigTtl, off, err = unpackUint32(msg, off) 2457 if err != nil { 2458 return off, err 2459 } 2460 if off == len(msg) { 2461 return off, nil 2462 } 2463 rr.Expiration, off, err = unpackUint32(msg, off) 2464 if err != nil { 2465 return off, err 2466 } 2467 if off == len(msg) { 2468 return off, nil 2469 } 2470 rr.Inception, off, err = unpackUint32(msg, off) 2471 if err != nil { 2472 return off, err 2473 } 2474 if off == len(msg) { 2475 return off, nil 2476 } 2477 rr.KeyTag, off, err = unpackUint16(msg, off) 2478 if err != nil { 2479 return off, err 2480 } 2481 if off == len(msg) { 2482 return off, nil 2483 } 2484 rr.SignerName, off, err = UnpackDomainName(msg, off) 2485 if err != nil { 2486 return off, err 2487 } 2488 if off == len(msg) { 2489 return off, nil 2490 } 2491 rr.Signature, off, err = unpackStringBase64(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2492 if err != nil { 2493 return off, err 2494 } 2495 return off, nil 2496 } 2497 2498 func (rr *SMIMEA) unpack(msg []byte, off int) (off1 int, err error) { 2499 rdStart := off 2500 _ = rdStart 2501 2502 rr.Usage, off, err = unpackUint8(msg, off) 2503 if err != nil { 2504 return off, err 2505 } 2506 if off == len(msg) { 2507 return off, nil 2508 } 2509 rr.Selector, off, err = unpackUint8(msg, off) 2510 if err != nil { 2511 return off, err 2512 } 2513 if off == len(msg) { 2514 return off, nil 2515 } 2516 rr.MatchingType, off, err = unpackUint8(msg, off) 2517 if err != nil { 2518 return off, err 2519 } 2520 if off == len(msg) { 2521 return off, nil 2522 } 2523 rr.Certificate, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2524 if err != nil { 2525 return off, err 2526 } 2527 return off, nil 2528 } 2529 2530 func (rr *SOA) unpack(msg []byte, off int) (off1 int, err error) { 2531 rdStart := off 2532 _ = rdStart 2533 2534 rr.Ns, off, err = UnpackDomainName(msg, off) 2535 if err != nil { 2536 return off, err 2537 } 2538 if off == len(msg) { 2539 return off, nil 2540 } 2541 rr.Mbox, off, err = UnpackDomainName(msg, off) 2542 if err != nil { 2543 return off, err 2544 } 2545 if off == len(msg) { 2546 return off, nil 2547 } 2548 rr.Serial, off, err = unpackUint32(msg, off) 2549 if err != nil { 2550 return off, err 2551 } 2552 if off == len(msg) { 2553 return off, nil 2554 } 2555 rr.Refresh, off, err = unpackUint32(msg, off) 2556 if err != nil { 2557 return off, err 2558 } 2559 if off == len(msg) { 2560 return off, nil 2561 } 2562 rr.Retry, off, err = unpackUint32(msg, off) 2563 if err != nil { 2564 return off, err 2565 } 2566 if off == len(msg) { 2567 return off, nil 2568 } 2569 rr.Expire, off, err = unpackUint32(msg, off) 2570 if err != nil { 2571 return off, err 2572 } 2573 if off == len(msg) { 2574 return off, nil 2575 } 2576 rr.Minttl, off, err = unpackUint32(msg, off) 2577 if err != nil { 2578 return off, err 2579 } 2580 return off, nil 2581 } 2582 2583 func (rr *SPF) unpack(msg []byte, off int) (off1 int, err error) { 2584 rdStart := off 2585 _ = rdStart 2586 2587 rr.Txt, off, err = unpackStringTxt(msg, off) 2588 if err != nil { 2589 return off, err 2590 } 2591 return off, nil 2592 } 2593 2594 func (rr *SRV) unpack(msg []byte, off int) (off1 int, err error) { 2595 rdStart := off 2596 _ = rdStart 2597 2598 rr.Priority, off, err = unpackUint16(msg, off) 2599 if err != nil { 2600 return off, err 2601 } 2602 if off == len(msg) { 2603 return off, nil 2604 } 2605 rr.Weight, off, err = unpackUint16(msg, off) 2606 if err != nil { 2607 return off, err 2608 } 2609 if off == len(msg) { 2610 return off, nil 2611 } 2612 rr.Port, off, err = unpackUint16(msg, off) 2613 if err != nil { 2614 return off, err 2615 } 2616 if off == len(msg) { 2617 return off, nil 2618 } 2619 rr.Target, off, err = UnpackDomainName(msg, off) 2620 if err != nil { 2621 return off, err 2622 } 2623 return off, nil 2624 } 2625 2626 func (rr *SSHFP) unpack(msg []byte, off int) (off1 int, err error) { 2627 rdStart := off 2628 _ = rdStart 2629 2630 rr.Algorithm, off, err = unpackUint8(msg, off) 2631 if err != nil { 2632 return off, err 2633 } 2634 if off == len(msg) { 2635 return off, nil 2636 } 2637 rr.Type, off, err = unpackUint8(msg, off) 2638 if err != nil { 2639 return off, err 2640 } 2641 if off == len(msg) { 2642 return off, nil 2643 } 2644 rr.FingerPrint, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2645 if err != nil { 2646 return off, err 2647 } 2648 return off, nil 2649 } 2650 2651 func (rr *SVCB) unpack(msg []byte, off int) (off1 int, err error) { 2652 rdStart := off 2653 _ = rdStart 2654 2655 rr.Priority, off, err = unpackUint16(msg, off) 2656 if err != nil { 2657 return off, err 2658 } 2659 if off == len(msg) { 2660 return off, nil 2661 } 2662 rr.Target, off, err = UnpackDomainName(msg, off) 2663 if err != nil { 2664 return off, err 2665 } 2666 if off == len(msg) { 2667 return off, nil 2668 } 2669 rr.Value, off, err = unpackDataSVCB(msg, off) 2670 if err != nil { 2671 return off, err 2672 } 2673 return off, nil 2674 } 2675 2676 func (rr *TA) unpack(msg []byte, off int) (off1 int, err error) { 2677 rdStart := off 2678 _ = rdStart 2679 2680 rr.KeyTag, off, err = unpackUint16(msg, off) 2681 if err != nil { 2682 return off, err 2683 } 2684 if off == len(msg) { 2685 return off, nil 2686 } 2687 rr.Algorithm, off, err = unpackUint8(msg, off) 2688 if err != nil { 2689 return off, err 2690 } 2691 if off == len(msg) { 2692 return off, nil 2693 } 2694 rr.DigestType, off, err = unpackUint8(msg, off) 2695 if err != nil { 2696 return off, err 2697 } 2698 if off == len(msg) { 2699 return off, nil 2700 } 2701 rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2702 if err != nil { 2703 return off, err 2704 } 2705 return off, nil 2706 } 2707 2708 func (rr *TALINK) unpack(msg []byte, off int) (off1 int, err error) { 2709 rdStart := off 2710 _ = rdStart 2711 2712 rr.PreviousName, off, err = UnpackDomainName(msg, off) 2713 if err != nil { 2714 return off, err 2715 } 2716 if off == len(msg) { 2717 return off, nil 2718 } 2719 rr.NextName, off, err = UnpackDomainName(msg, off) 2720 if err != nil { 2721 return off, err 2722 } 2723 return off, nil 2724 } 2725 2726 func (rr *TKEY) unpack(msg []byte, off int) (off1 int, err error) { 2727 rdStart := off 2728 _ = rdStart 2729 2730 rr.Algorithm, off, err = UnpackDomainName(msg, off) 2731 if err != nil { 2732 return off, err 2733 } 2734 if off == len(msg) { 2735 return off, nil 2736 } 2737 rr.Inception, off, err = unpackUint32(msg, off) 2738 if err != nil { 2739 return off, err 2740 } 2741 if off == len(msg) { 2742 return off, nil 2743 } 2744 rr.Expiration, off, err = unpackUint32(msg, off) 2745 if err != nil { 2746 return off, err 2747 } 2748 if off == len(msg) { 2749 return off, nil 2750 } 2751 rr.Mode, off, err = unpackUint16(msg, off) 2752 if err != nil { 2753 return off, err 2754 } 2755 if off == len(msg) { 2756 return off, nil 2757 } 2758 rr.Error, off, err = unpackUint16(msg, off) 2759 if err != nil { 2760 return off, err 2761 } 2762 if off == len(msg) { 2763 return off, nil 2764 } 2765 rr.KeySize, off, err = unpackUint16(msg, off) 2766 if err != nil { 2767 return off, err 2768 } 2769 if off == len(msg) { 2770 return off, nil 2771 } 2772 rr.Key, off, err = unpackStringHex(msg, off, off+int(rr.KeySize)) 2773 if err != nil { 2774 return off, err 2775 } 2776 rr.OtherLen, off, err = unpackUint16(msg, off) 2777 if err != nil { 2778 return off, err 2779 } 2780 if off == len(msg) { 2781 return off, nil 2782 } 2783 rr.OtherData, off, err = unpackStringHex(msg, off, off+int(rr.OtherLen)) 2784 if err != nil { 2785 return off, err 2786 } 2787 return off, nil 2788 } 2789 2790 func (rr *TLSA) unpack(msg []byte, off int) (off1 int, err error) { 2791 rdStart := off 2792 _ = rdStart 2793 2794 rr.Usage, off, err = unpackUint8(msg, off) 2795 if err != nil { 2796 return off, err 2797 } 2798 if off == len(msg) { 2799 return off, nil 2800 } 2801 rr.Selector, off, err = unpackUint8(msg, off) 2802 if err != nil { 2803 return off, err 2804 } 2805 if off == len(msg) { 2806 return off, nil 2807 } 2808 rr.MatchingType, off, err = unpackUint8(msg, off) 2809 if err != nil { 2810 return off, err 2811 } 2812 if off == len(msg) { 2813 return off, nil 2814 } 2815 rr.Certificate, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2816 if err != nil { 2817 return off, err 2818 } 2819 return off, nil 2820 } 2821 2822 func (rr *TSIG) unpack(msg []byte, off int) (off1 int, err error) { 2823 rdStart := off 2824 _ = rdStart 2825 2826 rr.Algorithm, off, err = UnpackDomainName(msg, off) 2827 if err != nil { 2828 return off, err 2829 } 2830 if off == len(msg) { 2831 return off, nil 2832 } 2833 rr.TimeSigned, off, err = unpackUint48(msg, off) 2834 if err != nil { 2835 return off, err 2836 } 2837 if off == len(msg) { 2838 return off, nil 2839 } 2840 rr.Fudge, off, err = unpackUint16(msg, off) 2841 if err != nil { 2842 return off, err 2843 } 2844 if off == len(msg) { 2845 return off, nil 2846 } 2847 rr.MACSize, off, err = unpackUint16(msg, off) 2848 if err != nil { 2849 return off, err 2850 } 2851 if off == len(msg) { 2852 return off, nil 2853 } 2854 rr.MAC, off, err = unpackStringHex(msg, off, off+int(rr.MACSize)) 2855 if err != nil { 2856 return off, err 2857 } 2858 rr.OrigId, off, err = unpackUint16(msg, off) 2859 if err != nil { 2860 return off, err 2861 } 2862 if off == len(msg) { 2863 return off, nil 2864 } 2865 rr.Error, off, err = unpackUint16(msg, off) 2866 if err != nil { 2867 return off, err 2868 } 2869 if off == len(msg) { 2870 return off, nil 2871 } 2872 rr.OtherLen, off, err = unpackUint16(msg, off) 2873 if err != nil { 2874 return off, err 2875 } 2876 if off == len(msg) { 2877 return off, nil 2878 } 2879 rr.OtherData, off, err = unpackStringHex(msg, off, off+int(rr.OtherLen)) 2880 if err != nil { 2881 return off, err 2882 } 2883 return off, nil 2884 } 2885 2886 func (rr *TXT) unpack(msg []byte, off int) (off1 int, err error) { 2887 rdStart := off 2888 _ = rdStart 2889 2890 rr.Txt, off, err = unpackStringTxt(msg, off) 2891 if err != nil { 2892 return off, err 2893 } 2894 return off, nil 2895 } 2896 2897 func (rr *UID) unpack(msg []byte, off int) (off1 int, err error) { 2898 rdStart := off 2899 _ = rdStart 2900 2901 rr.Uid, off, err = unpackUint32(msg, off) 2902 if err != nil { 2903 return off, err 2904 } 2905 return off, nil 2906 } 2907 2908 func (rr *UINFO) unpack(msg []byte, off int) (off1 int, err error) { 2909 rdStart := off 2910 _ = rdStart 2911 2912 rr.Uinfo, off, err = unpackString(msg, off) 2913 if err != nil { 2914 return off, err 2915 } 2916 return off, nil 2917 } 2918 2919 func (rr *URI) unpack(msg []byte, off int) (off1 int, err error) { 2920 rdStart := off 2921 _ = rdStart 2922 2923 rr.Priority, off, err = unpackUint16(msg, off) 2924 if err != nil { 2925 return off, err 2926 } 2927 if off == len(msg) { 2928 return off, nil 2929 } 2930 rr.Weight, off, err = unpackUint16(msg, off) 2931 if err != nil { 2932 return off, err 2933 } 2934 if off == len(msg) { 2935 return off, nil 2936 } 2937 rr.Target, off, err = unpackStringOctet(msg, off) 2938 if err != nil { 2939 return off, err 2940 } 2941 return off, nil 2942 } 2943 2944 func (rr *X25) unpack(msg []byte, off int) (off1 int, err error) { 2945 rdStart := off 2946 _ = rdStart 2947 2948 rr.PSDNAddress, off, err = unpackString(msg, off) 2949 if err != nil { 2950 return off, err 2951 } 2952 return off, nil 2953 } 2954 2955 func (rr *ZONEMD) unpack(msg []byte, off int) (off1 int, err error) { 2956 rdStart := off 2957 _ = rdStart 2958 2959 rr.Serial, off, err = unpackUint32(msg, off) 2960 if err != nil { 2961 return off, err 2962 } 2963 if off == len(msg) { 2964 return off, nil 2965 } 2966 rr.Scheme, off, err = unpackUint8(msg, off) 2967 if err != nil { 2968 return off, err 2969 } 2970 if off == len(msg) { 2971 return off, nil 2972 } 2973 rr.Hash, off, err = unpackUint8(msg, off) 2974 if err != nil { 2975 return off, err 2976 } 2977 if off == len(msg) { 2978 return off, nil 2979 } 2980 rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) 2981 if err != nil { 2982 return off, err 2983 } 2984 return off, nil 2985 }