This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
2021-02-07 12:47:14 -05:00
|
|
|
// var upnp = require("./upnp");
|
|
|
|
|
|
|
|
|
|
// var myIp = require("ip").address();
|
|
|
|
|
|
|
|
|
|
// var timeout = 30000; //ms
|
|
|
|
|
|
|
|
|
|
// upnp.searchGateway(timeout, function(err, gateway) {
|
|
|
|
|
|
|
|
|
|
// if (err) throw err;
|
|
|
|
|
|
|
|
|
|
// console.log("Found Gateway!");
|
|
|
|
|
// console.log("Fetching External IP ... ");
|
|
|
|
|
|
|
|
|
|
// gateway.getExternalIP(function(err, ip) {
|
|
|
|
|
|
|
|
|
|
// if (err) throw err;
|
|
|
|
|
|
|
|
|
|
// console.log(ip);
|
|
|
|
|
// console.log("Mapping port 8888->"+myIp+":8888 ... ");
|
|
|
|
|
|
|
|
|
|
// gateway.AddPortMapping(
|
|
|
|
|
// "TCP" // or "UDP"
|
|
|
|
|
// , 8888 // External port
|
|
|
|
|
// , 8888 // Internal Port
|
|
|
|
|
// , myIp // Internal Host (ip address of your pc)
|
|
|
|
|
// , "YOUR DESCRIPTION" // Description.
|
|
|
|
|
// , function(err) {
|
|
|
|
|
|
|
|
|
|
// if (err) throw err;
|
|
|
|
|
|
|
|
|
|
// console.log("Success");
|
|
|
|
|
// console.log("Done.");
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
2021-02-07 15:54:33 -05:00
|
|
|
// this is a test
|