add stuff

This commit is contained in:
AJ ONeal 2015-02-14 09:15:29 +00:00
parent 26724e0551
commit b28a45581f
2 changed files with 39 additions and 0 deletions

38
ddns-redirects.js Normal file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env node
'use strict';
// dig -p 53 @redirect-www.org pi.nadal.daplie.com A
var updateIp = require('./holepunch/helpers/update-ip.js').update;
var redirects = require('./redirects');
var ddns = [];
var ddnsMap = {};
function add(hostname) {
ddns.push({
"name": hostname
});
}
redirects.forEach(function (r) {
if (!ddnsMap[r.from.hostname.toLowerCase()]) {
add(r.from.hostname);
}
if (!ddnsMap[r.to.hostname.toLowerCase()]) {
add(r.to.hostname);
}
});
return updateIp({
updater: 'redirect-www.org'
, port: 65443
, cacert: null
, ddns: ddns
}).then(function (data) {
if ('string') {
data = JSON.parse(data);
}
console.log(JSON.stringify(data, null, ' '));
console.log('Test with');
console.log('dig <<hostname>> A');
});

View File

@ -41,6 +41,7 @@
"check-ip-address": "^1.0.0",
"cli": "^0.6.5",
"connect": "^3.3.4",
"escape-string-regexp": "^1.0.2",
"express": "^4.11.2",
"foreachasync": "^5.0.5",
"request": "^2.51.0",