Socket
Socket
Sign inDemoInstall

dns-packet

Package Overview
Dependencies
2
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

29

index.js
var types = require('./types')
var ip = require('ip')
var Buffer = require('safe-buffer').Buffer

@@ -14,3 +15,3 @@ var QUERY_FLAG = 0

name.encode = function (n, buf, offset) {
if (!buf) buf = Buffer(name.encodingLength(n))
if (!buf) buf = Buffer.allocUnsafe(name.encodingLength(n))
if (!offset) offset = 0

@@ -73,3 +74,3 @@

string.encode = function (s, buf, offset) {
if (!buf) buf = Buffer(string.encodingLength(s))
if (!buf) buf = Buffer.allocUnsafe(string.encodingLength(s))
if (!offset) offset = 0

@@ -146,3 +147,3 @@

runknown.encode = function (data, buf, offset) {
if (!buf) buf = Buffer(runknown.encodingLength(data))
if (!buf) buf = Buffer.allocUnsafe(runknown.encodingLength(data))
if (!offset) offset = 0

@@ -178,7 +179,7 @@

rtxt.encode = function (data, buf, offset) {
if (!buf) buf = Buffer(rtxt.encodingLength(data))
if (!buf) buf = Buffer.allocUnsafe(rtxt.encodingLength(data))
if (!offset) offset = 0
if (typeof data === 'string') data = Buffer(data)
if (!data) data = Buffer(0)
if (typeof data === 'string') data = Buffer.from(data)
if (!data) data = Buffer.allocUnsafe(0)

@@ -223,3 +224,3 @@ var oldOffset = offset

rhinfo.encode = function (data, buf, offset) {
if (!buf) buf = Buffer(rhinfo.encodingLength(data))
if (!buf) buf = Buffer.allocUnsafe(rhinfo.encodingLength(data))
if (!offset) offset = 0

@@ -266,3 +267,3 @@

rptr.encode = function (data, buf, offset) {
if (!buf) buf = Buffer(rptr.encodingLength(data))
if (!buf) buf = Buffer.allocUnsafe(rptr.encodingLength(data))
if (!offset) offset = 0

@@ -295,3 +296,3 @@

rsrv.encode = function (data, buf, offset) {
if (!buf) buf = Buffer(rsrv.encodingLength(data))
if (!buf) buf = Buffer.allocUnsafe(rsrv.encodingLength(data))
if (!offset) offset = 0

@@ -337,3 +338,3 @@

ra.encode = function (host, buf, offset) {
if (!buf) buf = Buffer(ra.encodingLength(host))
if (!buf) buf = Buffer.allocUnsafe(ra.encodingLength(host))
if (!offset) offset = 0

@@ -368,3 +369,3 @@

raaaa.encode = function (host, buf, offset) {
if (!buf) buf = Buffer(raaaa.encodingLength(host))
if (!buf) buf = Buffer.allocUnsafe(raaaa.encodingLength(host))
if (!offset) offset = 0

@@ -414,3 +415,3 @@

answer.encode = function (a, buf, offset) {
if (!buf) buf = Buffer(answer.encodingLength(a))
if (!buf) buf = Buffer.allocUnsafe(answer.encodingLength(a))
if (!offset) offset = 0

@@ -473,3 +474,3 @@

question.encode = function (q, buf, offset) {
if (!buf) buf = Buffer(question.encodingLength(q))
if (!buf) buf = Buffer.allocUnsafe(question.encodingLength(q))
if (!offset) offset = 0

@@ -530,3 +531,3 @@

exports.encode = function (result, buf, offset) {
if (!buf) buf = Buffer(exports.encodingLength(result))
if (!buf) buf = Buffer.allocUnsafe(exports.encodingLength(result))
if (!offset) offset = 0

@@ -533,0 +534,0 @@

{
"name": "dns-packet",
"version": "1.1.0",
"version": "1.1.1",
"description": "An abstract-encoding compliant module for encoding / decoding DNS packets",

@@ -10,3 +10,4 @@ "repository": {

"dependencies": {
"ip": "^1.1.0"
"ip": "^1.1.0",
"safe-buffer": "^5.0.1"
},

@@ -13,0 +14,0 @@ "devDependencies": {

var tape = require('tape')
var packet = require('./')
var Buffer = require('safe-buffer').Buffer
tape('unknown', function (t) {
testEncoder(t, packet.unknown, Buffer('hello world'))
testEncoder(t, packet.unknown, Buffer.from('hello world'))
t.end()

@@ -10,5 +11,5 @@ })

tape('txt', function (t) {
testEncoder(t, packet.txt, Buffer(0))
testEncoder(t, packet.txt, Buffer('hello world'))
testEncoder(t, packet.txt, Buffer([0, 1, 2, 3, 4, 5]))
testEncoder(t, packet.txt, Buffer.allocUnsafe(0))
testEncoder(t, packet.txt, Buffer.from('hello world'))
testEncoder(t, packet.txt, Buffer.from([0, 1, 2, 3, 4, 5]))
t.end()

@@ -18,3 +19,3 @@ })

tape('null', function (t) {
testEncoder(t, packet.null, Buffer([0, 1, 2, 3, 4, 5]))
testEncoder(t, packet.null, Buffer.from([0, 1, 2, 3, 4, 5]))
t.end()

@@ -145,3 +146,3 @@ })

name: 'hello.null.com',
data: Buffer([1, 2, 3, 4, 5])
data: Buffer.from([1, 2, 3, 4, 5])
}]

@@ -170,3 +171,3 @@ })

var bigger = Buffer(buf2.length + 10)
var bigger = Buffer.allocUnsafe(buf2.length + 10)

@@ -173,0 +174,0 @@ var buf3 = packet.encode(val, bigger, 10)

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