File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 15
15
"scripts" : {
16
16
"test" : " ts-mocha -n loader=ts-node/esm -p tsconfig.json --check-leaks src/**/*.test.ts" ,
17
17
"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 '"
19
19
},
20
20
"dependencies" : {
21
21
"book" : " 1.3.3" ,
Original file line number Diff line number Diff line change 1
- import Debug from 'debug' ;
2
1
import http from 'http' ;
3
2
import { hri } from 'human-readable-ids' ;
4
3
import Koa , { Request } from 'koa' ;
@@ -26,7 +25,8 @@ export default function(opt?: LocalTunnelOpts) {
26
25
const landingPage = opt . landing || 'https://localtunnel.github.io/www/' ;
27
26
28
27
function GetClientIdFromHostname ( hostname ) {
29
- return myTldjs . getSubdomain ( hostname ) ;
28
+ const pieces = hostname . split ( ':' ) ;
29
+ return myTldjs . getSubdomain ( pieces [ 0 ] ) ;
30
30
}
31
31
32
32
const manager = new ClientManager ( opt ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ type ClientManagerStats = {
14
14
// Manage sets of clients
15
15
//
16
16
// A client is a "user session" established to service a remote localtunnel client
17
- class ClientManager {
17
+ export default class ClientManager {
18
18
19
19
private readonly logger = newLogger ( ClientManager . name )
20
20
@@ -86,8 +86,8 @@ class ClientManager {
86
86
}
87
87
}
88
88
89
- removeClient ( id ) {
90
- this . logger . debug ( ' removing client: %s' , id ) ;
89
+ removeClient ( id : string ) {
90
+ this . logger . debug ( ` removing client: ${ id } ` ) ;
91
91
const client = this . clients [ id ] ;
92
92
if ( ! client ) {
93
93
return ;
@@ -97,13 +97,11 @@ class ClientManager {
97
97
client . close ( ) ;
98
98
}
99
99
100
- hasClient ( id ) {
100
+ hasClient ( id : string ) {
101
101
return ! ! this . clients [ id ] ;
102
102
}
103
103
104
- getClient ( id ) {
104
+ getClient ( id : string ) {
105
105
return this . clients [ id ] ;
106
106
}
107
107
}
108
-
109
- export default ClientManager ;
You can’t perform that action at this time.
0 commit comments