unify variable name in examples

This commit is contained in:
silverwind 2018-07-04 17:46:44 +02:00
parent 93b8c3c03b
commit 9446241c41
No known key found for this signature in database
GPG Key ID: 2E62B41C93869443
3 changed files with 7 additions and 7 deletions

View File

@ -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()

View File

@ -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) {

View File

@ -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) {