holepunch.js/bin/service.js

58 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-12-31 02:21:29 +00:00
'use strict';
var punch = require('../');
2015-12-31 02:37:57 +00:00
var exec = require('child_process').exec;
2015-12-31 02:21:29 +00:00
function touch() {
2015-12-31 02:37:57 +00:00
exec("/usr/local/bin/ddns --hostname sarah.daplie.com --email 'coolaj86@gmail.com' --agree --token /srv/holepunch/bin/token.jwt", function (err, stdout, stderr) {
if (err || stderr) {
console.error('ddns error:', err || stderr);
}
//console.log(stdout);
});
2015-12-31 02:21:29 +00:00
punch({
mappings: [
{ internal: 80
, external: 80
, secure: false
, loopback: false
}
, { internal: 65080
, external: 65080
, secure: false
, loopback: false
}
, { internal: 65443
, external: 65443
, secure: false
, loopback: false
}
, { internal: 443
, external: 443
, secure: false
, loopback: false
}
, { internal: 65022
, external: 65022
, secure: false
, loopback: false
}
, { internal: 22
, external: 22
, secure: false
, loopback: false
}
]
, upnp: true
, pmp: true
, debug: true
}).then(function (results) {
console.log('map results');
console.log(results);
});
}
setInterval(touch, 90 * 60 * 1000);
touch();