Comparing version 1.0.1 to 1.0.2
@@ -18,2 +18,3 @@ var nat = require('../nat-upnp'); | ||
if (typeof addr === 'number') return { port: addr }; | ||
if (typeof addr === 'string' && !isNaN(addr)) return { port: Number(addr) }; | ||
if (typeof addr === 'object') return addr; | ||
@@ -37,2 +38,5 @@ | ||
var ports = normalizeOptions(options); | ||
var ttl = 60 * 30; | ||
if (typeof options.ttl === 'number') { ttl = options.ttl; } | ||
if (typeof options.ttl === 'string' && !isNaN(options.ttl)) { ttl = Number(options.ttl); } | ||
@@ -48,4 +52,3 @@ gateway.run('AddPortMapping', [ | ||
[ 'NewPortMappingDescription', options.description || 'node:nat:upnp' ], | ||
[ 'NewLeaseDuration', typeof options.ttl === 'number' ? | ||
options.ttl : 60 * 30 ] | ||
[ 'NewLeaseDuration', ttl ] | ||
], callback); | ||
@@ -52,0 +55,0 @@ }); |
{ | ||
"name": "nat-upnp", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "lib/nat-upnp", | ||
@@ -5,0 +5,0 @@ "author": "Fedor Indutny <fedor@indutny.com>", |
20506
519