upnp: better params for addPortMapping.

This commit is contained in:
Christopher Jeffrey 2017-03-02 12:04:09 -08:00
parent 0791bad973
commit 36377d5a7f
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -505,11 +505,12 @@ UPNPService.prototype.getExternalIP = co(function* () {
/**
* Attempt to add port mapping to local IP.
* @param {String} remote - Remote IP.
* @param {Number} port - Local and remote port.
* @param {Number} src - Remote port.
* @param {Number} dest - Local port.
* @returns {Promise}
*/
UPNPService.prototype.addPortMapping = co(function* (remote, port) {
UPNPService.prototype.addPortMapping = co(function* (remote, src, dest) {
var action = 'AddPortMapping';
var local = UPNP.getLocalIP();
var xml, child;
@ -519,10 +520,10 @@ UPNPService.prototype.addPortMapping = co(function* (remote, port) {
xml = yield this.soapRequest(action, [
['NewRemoteHost', remote],
['NewExternalPort', port],
['NewExternalPort', src],
['NewProtocol', 'TCP'],
['NewInternalClient', local],
['NewInternalPort', port],
['NewInternalPort', dest],
['NewEnabled', 'True'],
['NewPortMappingDescription', 'upnp:bcoin'],
['NewLeaseDuration', 0]
@ -539,7 +540,7 @@ UPNPService.prototype.addPortMapping = co(function* (remote, port) {
/**
* Attempt to remove port mapping from local IP.
* @param {String} remote - Remote IP.
* @param {Number} port - Local and remote port.
* @param {Number} port - Remote port.
* @returns {Promise}
*/