From 9446241c411777c30c4b377097131673b2f2e40a Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 4 Jul 2018 17:46:44 +0200 Subject: [PATCH] unify variable name in examples --- examples/doh.js | 6 +++--- examples/tcp.js | 4 ++-- examples/tls.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/doh.js b/examples/doh.js index 3dfd507..37ef19f 100644 --- a/examples/doh.js +++ b/examples/doh.js @@ -15,7 +15,7 @@ function getRandomInt (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min } -const encodeddnsPacket = dnsPacket.encode({ +const buf = dnsPacket.encode({ type: 'query', id: getRandomInt(1, 65534), flags: dnsPacket.RECURSION_DESIRED, @@ -32,7 +32,7 @@ const options = { method: 'POST', headers: { 'Content-Type': 'application/dns-udpwireformat', - 'Content-Length': Buffer.byteLength(encodeddnsPacket) + 'Content-Length': Buffer.byteLength(buf) } } @@ -48,5 +48,5 @@ const request = https.request(options, (response) => { request.on('error', (e) => { console.error(e) }) -request.write(encodeddnsPacket) +request.write(buf) request.end() diff --git a/examples/tcp.js b/examples/tcp.js index 6f2f707..b25c2c4 100644 --- a/examples/tcp.js +++ b/examples/tcp.js @@ -10,7 +10,7 @@ function getRandomInt (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min } -const encodedPacket = dnsPacket.streamEncode({ +const buf = dnsPacket.streamEncode({ type: 'query', id: getRandomInt(1, 65534), flags: dnsPacket.RECURSION_DESIRED, @@ -23,7 +23,7 @@ const encodedPacket = dnsPacket.streamEncode({ const client = new net.Socket() client.connect(53, '8.8.8.8', function () { console.log('Connected') - client.write(encodedPacket) + client.write(buf) }) client.on('data', function (data) { diff --git a/examples/tls.js b/examples/tls.js index 514d34c..694a4fe 100644 --- a/examples/tls.js +++ b/examples/tls.js @@ -10,7 +10,7 @@ function getRandomInt (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min } -const encodedPacket = dnsPacket.streamEncode({ +const buf = dnsPacket.streamEncode({ type: 'query', id: getRandomInt(1, 65534), flags: dnsPacket.RECURSION_DESIRED, @@ -32,7 +32,7 @@ const options = { const client = tls.connect(options, () => { console.log('client connected') - client.write(encodedPacket) + client.write(buf) }) client.on('data', function (data) {