Skip to content

Commit ddc6b20

Browse files
committed
1 parent 99730cb commit ddc6b20

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"scripts": {
1616
"test": "ts-mocha -n loader=ts-node/esm -p tsconfig.json --check-leaks src/**/*.test.ts",
1717
"start": "./bin/server",
18-
"dev": "nodemon -e ts,js,json --watch './src/**/*' --watch './bin/**/*' --exec './bin/server.ts --port 3000'"
18+
"dev": "LOG_LEVEL=debug nodemon -e ts,js,json --watch './src/**/*' --watch './bin/**/*' --exec './bin/server.ts -p 8080 -d localhost'"
1919
},
2020
"dependencies": {
2121
"book": "1.3.3",

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Debug from 'debug';
21
import http from 'http';
32
import { hri } from 'human-readable-ids';
43
import Koa, { Request } from 'koa';
@@ -26,7 +25,8 @@ export default function(opt?: LocalTunnelOpts) {
2625
const landingPage = opt.landing || 'https://localtunnel.github.io/www/';
2726

2827
function GetClientIdFromHostname(hostname) {
29-
return myTldjs.getSubdomain(hostname);
28+
const pieces = hostname.split(':');
29+
return myTldjs.getSubdomain(pieces[0]);
3030
}
3131

3232
const manager = new ClientManager(opt);

src/lib/ClientManager.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type ClientManagerStats = {
1414
// Manage sets of clients
1515
//
1616
// A client is a "user session" established to service a remote localtunnel client
17-
class ClientManager {
17+
export default class ClientManager {
1818

1919
private readonly logger = newLogger(ClientManager.name)
2020

@@ -86,8 +86,8 @@ class ClientManager {
8686
}
8787
}
8888

89-
removeClient(id) {
90-
this.logger.debug('removing client: %s', id);
89+
removeClient(id: string) {
90+
this.logger.debug(`removing client: ${id}`);
9191
const client = this.clients[id];
9292
if (!client) {
9393
return;
@@ -97,13 +97,11 @@ class ClientManager {
9797
client.close();
9898
}
9999

100-
hasClient(id) {
100+
hasClient(id: string) {
101101
return !!this.clients[id];
102102
}
103103

104-
getClient(id) {
104+
getClient(id: string) {
105105
return this.clients[id];
106106
}
107107
}
108-
109-
export default ClientManager;

0 commit comments

Comments
 (0)