pass nat-pmp
This commit is contained in:
parent
8e5accc6ce
commit
4f12286b55
|
@ -71,6 +71,7 @@ cli.main(function(_, options) {
|
|||
}
|
||||
|
||||
return hp.create(args).then(function () {
|
||||
process.exit(0);
|
||||
console.log('wishing wanting waiting');
|
||||
//process.exit(0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,6 +28,10 @@ module.exports.create = function (args) {
|
|||
function testOpenPort(ip, portInfo) {
|
||||
var requestAsync = require('./request');
|
||||
|
||||
if (args.debug) {
|
||||
console.log('[HP] hostname', args.loopbackHostname);
|
||||
}
|
||||
|
||||
return requestAsync({
|
||||
secure: portInfo.secure
|
||||
, rejectUnauthorized: false
|
||||
|
@ -92,7 +96,10 @@ module.exports.create = function (args) {
|
|||
|
||||
return getExternalIps().then(function (ips) {
|
||||
var pretest = (-1 !== args.protocols.indexOf('none'));
|
||||
var portInfos = args.plainPorts.concat(args.tlsPorts.map(function (info) {
|
||||
var portInfos = args.plainPorts.map(function (info) {
|
||||
info.secure = false;
|
||||
return info;
|
||||
}).concat(args.tlsPorts.map(function (info) {
|
||||
info.secure = true;
|
||||
return info;
|
||||
}));
|
||||
|
|
|
@ -58,6 +58,8 @@ module.exports.create = function (opts) {
|
|||
|
||||
results.key = opts.key;
|
||||
results.value = opts.value;
|
||||
results.loopbackHostname = opts.loopbackHostname;
|
||||
results.loopbackPrefix = opts.loopbackPrefix;
|
||||
|
||||
return results;
|
||||
};
|
||||
|
|
|
@ -43,16 +43,20 @@ function middleware(opts) {
|
|||
if (0 !== urlpath.indexOf(pathnamePrefix)) {
|
||||
if (opts.debug) {
|
||||
console.log("[HP] Pathname '" + urlpath + "'"
|
||||
+ " failed to match '" + pathnamePrefix + "'");
|
||||
+ " failed to match prefix '" + pathnamePrefix + ": "
|
||||
+ urlpath.indexOf(pathnamePrefix)
|
||||
);
|
||||
}
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
if (scmp(key, urlpath.substr(pathnamePrefix.length, key.length))) {
|
||||
if (!scmp(key, urlpath.substr(pathnamePrefix.length))) {
|
||||
if (opts.debug) {
|
||||
console.log("[HP] Pathname '" + urlpath + "'"
|
||||
+ " failed to match '" + pathnamePrefix + key + "'");
|
||||
console.log("[HP] key '" + urlpath.substr(pathnamePrefix.length) + "'"
|
||||
+ " failed to match '" + key + "': "
|
||||
+ scmp(key, urlpath.substr(pathnamePrefix.length))
|
||||
);
|
||||
}
|
||||
next();
|
||||
return;
|
||||
|
|
|
@ -45,7 +45,7 @@ function pmpForwardHelper(gw, portInfo) {
|
|||
|| portInfo.external || portInfo.public
|
||||
, public: portInfo.external || portInfo.public
|
||||
|| portInfo.internal || portInfo.private
|
||||
, ttl: portInfo.ttl || 0 // 600
|
||||
, ttl: portInfo.ttl || 7200 // 0 // 600
|
||||
}, function (err, info) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
|
|
Loading…
Reference in New Issue