Last active
December 16, 2015 03:18
-
-
Save achernya/5368512 to your computer and use it in GitHub Desktop.
DNS HS to IN translator written in node.js to get a VAXstation 3100 to work in a modern MIT Athena environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dns = require('native-dns'); | |
var server = dns.createServer(); | |
server.on('request', function (request, response) { | |
var question = dns.Question({ | |
name: request.question[0].name, | |
type: request.question[0].type, | |
}); | |
var req = dns.Request({ | |
question: question, | |
server: { address: '18.72.0.3', port: 53, type: 'udp' }, | |
timeout: 1000, | |
}); | |
req.on('timeout', function () { | |
console.log('Timeout in making request'); | |
}); | |
req.on('message', function (err, answer) { | |
response.answer = answer.answer; | |
for (var i = 0; (i < response.answer.length); i++) { | |
response.answer[i].class = request.question[0].class; | |
} | |
console.log(response); | |
response.send(); | |
}); | |
req.on('end', function () { | |
console.log("Finished a request"); | |
}); | |
req.send(); | |
}); | |
server.on('error', function (err, buff, req, res) { | |
console.log(err.stack); | |
}); | |
server.serve(53); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment