You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
498 B
14 lines
498 B
const Tunnel = require('./lib/Tunnel'); |
|
|
|
module.exports = function localtunnel(arg1, arg2, arg3) { |
|
const options = typeof arg1 === 'object' ? arg1 : { ...arg2, port: arg1 }; |
|
const callback = typeof arg1 === 'object' ? arg2 : arg3; |
|
const client = new Tunnel(options); |
|
if (callback) { |
|
client.open(err => (err ? callback(err) : callback(null, client))); |
|
return client; |
|
} |
|
return new Promise((resolve, reject) => |
|
client.open(err => (err ? reject(err) : resolve(client))) |
|
); |
|
};
|
|
|