Created
May 28, 2013 10:37
-
-
Save jhs/5661893 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Example MX response with dnsd | |
// | |
// To test: | |
// 1. Run this program | |
// 2. dig @localhost -p 5353 example.com mx | |
var dnsd = require('dnsd') | |
var server = dnsd.createServer(handler) | |
server.zone('example.com', 'ns1.example.com', '[email protected]', 'now', '2h', '30m', '2w', '10m') | |
server.listen(5353, '127.0.0.1') | |
console.log('Listening at 127.0.0.1:5353') | |
function handler(req, res) { | |
var question = res.question && res.question[0] | |
if(question.type != 'MX') | |
return res.end() | |
console.log('MX lookup for domain: %s', question.name) | |
res.answer.push({'name':question.name, 'type':'MX', 'data':[10, '1.2.3.1']}) | |
res.answer.push({'name':question.name, 'type':'MX', 'data':[10, '1.2.3.2']}) | |
res.answer.push({'name':question.name, 'type':'MX', 'data':[20, '1.2.3.3']}) | |
res.answer.push({'name':question.name, 'type':'MX', 'data':[30, '1.2.3.4']}) | |
return res.end() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment