142 Commits

Author SHA1 Message Date
vulcainman
8d78b4b53a Fix several lint issues
This commit includes several fixes that addess lint issues introduced by
commit a7a0b78b41219b40d28d71232f79f8170f528f30
2026-04-06 17:12:19 +08:00
vulcainman
dfe5e3f86b Implement QU bit support in question encoder/decoder
This commit fix current QU bit implementation that may be used in mDNS
protocol. Indeed, until now, if a packet with QU bit set is received,
it is decoded as:

{

  ...

  questions: [
    {
      name: '...',
      type: 'PTR',
      class: 'UNKNOWN_32769'
    },
    {
      name: '...',
      type: 'PTR',
      class: 'UNKNOWN_32769'
    }
  ],

  ...

}

Instead of :

{

  ...

  questions: [
    {
      name: '...',
      type: 'PTR',
      class: 'IN'
    },
    {
      name: '...',
      type: 'PTR',
      class: 'IN'
    }
  ],

  ...

}

This commit adds a proper QU bit support via the qu_bit field.
It enables:

- The encoder to parse properly both the class and the QU bit
- THe decoder to encode a DNS packet with the QU bit set
2026-04-06 17:12:11 +08:00
Nihanth Subramanya
5b155e76d9 Add constant for NXDOMAIN
Trivially OR'ing 0x03 to the flags works to set NXDOMAIN in the response header. Exposing a constant for this makes it accessible and obvious.
2026-04-06 17:09:46 +08:00
Jack Bates
530d20bb93 Presentation format encoding
RFC 4034 specifies the presentation format of the DNSKEY public key,
RRSIG signature, and DS digest fields (base64, base64, and hexadecimal).
With this change, when fields are represented as such, the package will
use the corresponding encoding.
2026-04-06 17:09:15 +08:00
Matt Simerson
52e7f4aa40
ci: update actions (#100)
- ci: use node 22
- test: add node 22
2025-04-04 10:50:38 +02:00
Mathias Buus
c95cbf44a3
Create FUNDING.json 2024-09-18 18:56:27 +02:00
silverwind
7b6662025c
v5.6.1
* Proper Encoding/Decoding for Email Name Representation for SOA and RP Records (#93) (M4t7e)
* test node 20 (silverwind)
2023-08-25 12:59:20 +02:00
M4t7e
13f19d9b63
Proper Encoding/Decoding for Email Name Representation for SOA and RP Records (#93)
* Correct encode/decode for mail name representation

* Embeddedd `mail` in an option object

* Cleaner case distinction in decode function
2023-08-25 12:55:39 +02:00
silverwind
519f55d403
test node 20 2023-04-19 00:24:27 +02:00
silverwind
e50f34c045
5.6.0 2023-04-18 12:55:51 +02:00
Hasan Adams
f14f4838a8
Add TLSA support (#92)
* add tlsa record support

* add test for tlsa and update readme
2023-04-18 12:52:51 +02:00
silverwind
ec4d317696
sort record types in README alphabetically 2023-03-27 13:42:48 +02:00
silverwind
a0687b3c14
5.5.0 2023-03-27 12:23:50 +02:00
xuhjbj
aca1ff751c
implement the NAPTR record (#89)
* implement the NAPTR record

* implement NAPTR record for readme

* update

* Update index.js

* Update index.js

* Update index.js

* fix test failed

* Add actual example values to README

* Update README.md

* Update README.md

---------

Co-authored-by: root <root@wxs1.fyre.ibm.com>
Co-authored-by: silverwind <me@silverwind.io>
2023-03-27 12:21:37 +02:00
silverwind
31d3caf326
5.4.0 2022-06-14 23:13:19 +02:00
silverwind
0fc249c64a
add SSHFP to readme 2022-06-14 23:11:47 +02:00
wolfy1339
fab30b2588
Implement SSHFP records (#80)
* Add SSHFP record support

Use offset since we may receive a full dns packet
Account for maximum hash lengths for each hash type
fix: don't use the output of `Buffer#copy()`, instead use `Buffer#byteLength`
fix: normalize fingerprint string
fix: the offset pointer starts out at RDLENGTH
fix: account for the `RDLENGTH` field in `rsshfp.decode()`

* tests: add test for the SSHFP record type
2022-06-14 23:09:01 +02:00
silverwind
a5ee7897e2
test node 18 2022-06-14 23:03:44 +02:00
Matt Simerson
bd33c5f690
switch to GitHub Actions (#83)
* Switch to GitHub Actions

* chore(ci): switch to GitHub Actions
* chore(ci): switch reporter from nyc to c8
* chore(nyc): remove dependency
* move .eslintrc to .eslintrc.yaml (be explicit)

* noop: ws

Co-authored-by: silverwind <me@silverwind.io>
2022-06-14 23:01:00 +02:00
Mathias Buus
dbfe59b623 5.3.1 2021-12-23 11:46:38 +01:00
Joachim Viide
1d42aadae7
Make name.decode stricter (#79)
* Add tests for name decoding corner cases

* Modify name.decode to throw an error in the following cases:
 * Not enough data for reading the full label
 * The label is too long (over 253 characters when dots are included)
  * A label must be either <= 63 bytes or a pointer
  * Pointers can only point to prior data (see RFC 1035, section 4.1.4)

In addition pointer jumps don't add extra dots in the names anymore.

* Make name_decoding tests more specific

* Make name.decode non-recursive

* Ensure name.decode can read the label header

* Fix name.decode error messages
2021-12-23 11:46:21 +01:00
Amith Mohanan
8e6d91c078
fix: Remove duplicate named export txt (#71) 2021-11-02 18:24:20 +01:00
Mathias Buus
5aebb85c32 5.3.0 2021-07-05 12:13:12 +02:00
Martin Heidegger
007a7c0634
fix: explicit Buffer reference for webpack (#68) 2021-07-05 12:12:40 +02:00
Martin Heidegger
30e54ea616
replacing ip with @leichtgewicht/ip-codec (#67) 2021-07-05 12:12:15 +02:00
Mathias Buus
5fbc94b38d 5.2.4 2021-05-26 11:26:40 +02:00
Mathias Buus
fbaa906476 move all allocUnsafes to allocs for easier maintenance 2021-05-26 11:26:35 +02:00
Mathias Buus
e81b4020c0 only master travis 2021-05-25 13:33:28 +02:00
Mathias Buus
066919e4df 5.2.3 2021-05-25 13:30:41 +02:00
Mathias Buus
bd84615252 check for .. also in encodingLength 2021-05-25 13:30:37 +02:00
Mathias Buus
bb04450fe4 5.2.2 2021-05-19 19:59:50 +02:00
Mathias Buus
25f15dd0fe do trim on encodingLength as well 2021-05-19 19:59:39 +02:00
Tom Pusateri
c11116822a
Update DoH example from internet-draft to RFC 8484. (#58) 2020-04-17 15:21:31 +02:00
Mathias Buus
cbe05219b4 5.2.1 2019-03-26 13:26:32 +01:00
Martin Kolárik
c61dd19846 Fix udpPayloadSize encoding 2019-03-26 13:25:30 +01:00
Joe Hildebrand
77eadae3c3 Add coverage using nyc, badge to readme, and ignore the coverage outputs. (#50)
* First pass at mafintosh/dns-packet#48. No auto-refresh yet, because that's a more invasive change.

* Add a quick note to README to kick off a round of tests.

* remove sudo:false
2019-02-27 23:31:44 +01:00
silverwind
e7c072072d
5.2.0 changelog 2019-02-21 23:41:12 +01:00
silverwind
58801f83bc
5.2.0 2019-02-21 23:34:19 +01:00
silverwind
799de23dca
update devDependencies 2019-02-21 23:33:53 +01:00
silverwind
c8fd22c8a1
tweaks 2019-02-21 23:33:07 +01:00
Joe Hildebrand
4932026f66 Add EDNS OPT de/encoding
* Add ECS processing.  See #46

* Add support for Padding.  Simplify ECS to not do CIDR parsing.

* Done implementing the EDNS0 options that make sense

* Default to string values from IANA for EDNSO option codes.  Add tests for mappings.

* Add a few more aliases for option codes

* Update README for EDNS0 options

* I think this is what is desired.  Happy to change it more if you want.

* Address code review comments from @silverwind
2019-02-21 23:25:17 +01:00
silverwind
afa238119f
5.1.2 2019-01-23 00:16:51 +01:00
silverwind
985adc20b1
fix rp encode bytes 2019-01-23 00:16:23 +01:00
silverwind
e8c299d64d
update changelog for 5.1.0 2019-01-22 22:58:38 +01:00
silverwind
b72cefd4c9
5.1.1 2019-01-22 22:52:11 +01:00
silverwind
1eafa35beb
bring readme example in line with other examples 2019-01-22 22:51:27 +01:00
silverwind
75e8f4b0b9
alphabetically sort record types in readme 2019-01-22 22:49:54 +01:00
silverwind
2764de3e02
add fallback for RP mbox, add a few more tests 2019-01-22 22:48:57 +01:00
silverwind
0d8791efad
5.1.0 2019-01-22 22:41:29 +01:00
silverwind
57b595e1b0
update devDependencies 2019-01-22 22:41:08 +01:00