UNPKG

497 BJavaScriptView Raw
1var EventEmitter = require('events').EventEmitter;
2var debug = require('debug')('localtunnel:client');
3
4var Tunnel = require('./lib/Tunnel');
5
6module.exports = function localtunnel(port, opt, fn) {
7 if (typeof opt === 'function') {
8 fn = opt;
9 opt = {};
10 }
11
12 opt = opt || {};
13 opt.port = port;
14
15 var client = Tunnel(opt);
16 client.open(function(err) {
17 if (err) {
18 return fn(err);
19 }
20
21 fn(null, client);
22 });
23 return client;
24};