Socket
Socket
Sign inDemoInstall

dns-packet

Package Overview
Dependencies
1
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.4.0 to 5.5.0

57

index.js

@@ -1356,2 +1356,58 @@ 'use strict'

const rnaptr = exports.naptr = {}
rnaptr.encode = function (data, buf, offset) {
if (!buf) buf = Buffer.alloc(rnaptr.encodingLength(data))
if (!offset) offset = 0
const oldOffset = offset
offset += 2
buf.writeUInt16BE(data.order || 0, offset)
offset += 2
buf.writeUInt16BE(data.preference || 0, offset)
offset += 2
string.encode(data.flags, buf, offset)
offset += string.encode.bytes
string.encode(data.services, buf, offset)
offset += string.encode.bytes
string.encode(data.regexp, buf, offset)
offset += string.encode.bytes
name.encode(data.replacement, buf, offset)
offset += name.encode.bytes
rnaptr.encode.bytes = offset - oldOffset
buf.writeUInt16BE(rnaptr.encode.bytes - 2, oldOffset)
return buf
}
rnaptr.encode.bytes = 0
rnaptr.decode = function (buf, offset) {
if (!offset) offset = 0
const oldOffset = offset
const data = {}
offset += 2
data.order = buf.readUInt16BE(offset)
offset += 2
data.preference = buf.readUInt16BE(offset)
offset += 2
data.flags = string.decode(buf, offset)
offset += string.decode.bytes
data.services = string.decode(buf, offset)
offset += string.decode.bytes
data.regexp = string.decode(buf, offset)
offset += string.decode.bytes
data.replacement = name.decode(buf, offset)
offset += name.decode.bytes
rnaptr.decode.bytes = offset - oldOffset
return data
}
rnaptr.decode.bytes = 0
rnaptr.encodingLength = function (data) {
return string.encodingLength(data.flags) +
string.encodingLength(data.services) +
string.encodingLength(data.regexp) +
name.encodingLength(data.replacement) + 6
}
const renc = exports.record = function (type) {

@@ -1380,2 +1436,3 @@ switch (type.toUpperCase()) {

case 'DS': return rds
case 'NAPTR': return rnaptr
}

@@ -1382,0 +1439,0 @@ return runknown

2

package.json
{
"name": "dns-packet",
"version": "5.4.0",
"version": "5.5.0",
"description": "An abstract-encoding compliant module for encoding / decoding DNS packets",

@@ -5,0 +5,0 @@ "author": "Mathias Buus",

@@ -369,2 +369,18 @@ # dns-packet

#### `NAPTR`
``` js
{
data:
{
order: 100,
preference: 10,
flags: 's',
services: 'SIP+D2U',
regexp: '!^.*$!sip:customer-service@example.com!',
replacement: '_sip._udp.example.com'
}
}
```
When encoding, scalar values are converted to an array and strings are converted to UTF-8 encoded Buffers. When decoding, the return value will always be an array of Buffer.

@@ -371,0 +387,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc