Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ Available Types:
- `exchange` -- string
* `TXT`
- `data` -- string
* `SPF`
- `data` -- string
* `SRV`
- `priority` -- number
- `weight` -- number
Expand Down
2 changes: 2 additions & 0 deletions dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ exports.resolve4 = client.resolve4;
exports.resolve6 = client.resolve6;
exports.resolveMx = client.resolveMx;
exports.resolveTxt = client.resolveTxt;
exports.resolveSpf = client.resolveSpf;
exports.resolveSrv = client.resolveSrv;
exports.resolveNs = client.resolveNs;
exports.resolveCname = client.resolveCname;
Expand Down Expand Up @@ -61,6 +62,7 @@ var definedTypes = [
'PTR',
'NAPTR',
'TXT',
'SPF',
'MX',
'SRV',
'SOA',
Expand Down
9 changes: 9 additions & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var A = consts.NAME_TO_QTYPE.A,
AAAA = consts.NAME_TO_QTYPE.AAAA,
MX = consts.NAME_TO_QTYPE.MX,
TXT = consts.NAME_TO_QTYPE.TXT,
SPV = consts.NAME_TO_QTYPE.SPF,
NS = consts.NAME_TO_QTYPE.NS,
CNAME = consts.NAME_TO_QTYPE.CNAME,
SRV = consts.NAME_TO_QTYPE.SRV,
Expand Down Expand Up @@ -440,6 +441,7 @@ var resolve = function(domain, rrtype, ip, callback) {
});
break;
case TXT:
case SPF:
case NS:
case CNAME:
case PTR:
Expand Down Expand Up @@ -499,6 +501,13 @@ var resolveTxt = function(domain, callback) {
};
exports.resolveTxt = resolveTxt;

var resolveSpf = function(domain, callback) {
return resolve(domain, 'SPF', function(err, results) {
callback(err, results);
});
};
exports.resolveSpf = resolveSpf;

var resolveSrv = function(domain, callback) {
return resolve(domain, 'SRV', function(err, results) {
callback(err, results);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "native-dns",
"version": "0.5.0",
"version": "0.5.2",
"author": "Timothy J Fontaine <tjfontaine@gmail.com> (http://atxconsulting.com)",
"description": "Replacement for the core DNS module, includes server implementation",
"keywords": [
Expand All @@ -25,8 +25,8 @@
},
"dependencies": {
"ipaddr.js": ">= 0.1.1",
"native-dns-cache": ">= 0.0.1",
"native-dns-packet": ">= 0.0.1"
"native-dns-cache": "0.0.1",
"native-dns-packet": "0.0.1"
},
"devDependencies": {
"optimist": "",
Expand Down
11 changes: 11 additions & 0 deletions test/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,17 @@ exports.resolveTxt = function (test) {
checkWrap(test, req);
};

exports.resolveSpf = function (test) {
var req = dns.resolveSpf('google.com', function(err, records) {
test.ifError(err);
test.equal(records.length, 1);
test.equal(records[0].indexOf('v=spf1'), 0);
test.done();
});

checkWrap(test, req);
};


exports.lookup_ipv4_explicit = function (test) {
var req = dns.lookup('www.google.com', 4, function(err, ip, family) {
Expand Down