Opal-Estate-Pro/node_modules/localtunnel/client.js

25 lines
497 B
JavaScript
Raw Normal View History

2019-09-13 06:27:52 +02:00
var EventEmitter = require('events').EventEmitter;
var debug = require('debug')('localtunnel:client');
var Tunnel = require('./lib/Tunnel');
module.exports = function localtunnel(port, opt, fn) {
if (typeof opt === 'function') {
fn = opt;
opt = {};
}
opt = opt || {};
opt.port = port;
var client = Tunnel(opt);
client.open(function(err) {
if (err) {
return fn(err);
}
fn(null, client);
});
return client;
};