@@ -19,16 +19,16 @@ import { ILogService } from 'vs/platform/log/common/log';
1919import { findFreePort } from 'vs/base/node/ports' ;
2020import { Event , Emitter } from 'vs/base/common/event' ;
2121
22- export async function createRemoteTunnel ( options : IConnectionOptions , tunnelRemotePort : number , tunnelLocalPort ?: number ) : Promise < RemoteTunnel > {
23- const tunnel = new NodeRemoteTunnel ( options , tunnelRemotePort , tunnelLocalPort ) ;
22+ export async function createRemoteTunnel ( options : IConnectionOptions , tunnelRemoteHost : string , tunnelRemotePort : number , tunnelLocalPort ?: number ) : Promise < RemoteTunnel > {
23+ const tunnel = new NodeRemoteTunnel ( options , tunnelRemoteHost , tunnelRemotePort , tunnelLocalPort ) ;
2424 return tunnel . waitForReady ( ) ;
2525}
2626
2727class NodeRemoteTunnel extends Disposable implements RemoteTunnel {
2828
2929 public readonly tunnelRemotePort : number ;
3030 public tunnelLocalPort ! : number ;
31- public tunnelRemoteHost : string = 'localhost' ;
31+ public tunnelRemoteHost : string ;
3232 public localAddress ! : string ;
3333
3434 private readonly _options : IConnectionOptions ;
@@ -38,7 +38,7 @@ class NodeRemoteTunnel extends Disposable implements RemoteTunnel {
3838 private readonly _listeningListener : ( ) => void ;
3939 private readonly _connectionListener : ( socket : net . Socket ) => void ;
4040
41- constructor ( options : IConnectionOptions , tunnelRemotePort : number , private readonly suggestedLocalPort ?: number ) {
41+ constructor ( options : IConnectionOptions , tunnelRemoteHost : string , tunnelRemotePort : number , private readonly suggestedLocalPort ?: number ) {
4242 super ( ) ;
4343 this . _options = options ;
4444 this . _server = net . createServer ( ) ;
@@ -51,7 +51,7 @@ class NodeRemoteTunnel extends Disposable implements RemoteTunnel {
5151 this . _server . on ( 'connection' , this . _connectionListener ) ;
5252
5353 this . tunnelRemotePort = tunnelRemotePort ;
54-
54+ this . tunnelRemoteHost = tunnelRemoteHost ;
5555 }
5656
5757 public dispose ( ) : void {
@@ -229,7 +229,7 @@ export class TunnelService implements ITunnelService {
229229 this . addTunnelToMap ( remoteHost , remotePort , tunnel ) ;
230230 }
231231 return tunnel ;
232- } else if ( remoteHost === 'localhost' ) {
232+ } else {
233233 const options : IConnectionOptions = {
234234 commit : product . commit ,
235235 socketFactory : nodeSocketFactory ,
@@ -243,11 +243,10 @@ export class TunnelService implements ITunnelService {
243243 logService : this . logService
244244 } ;
245245
246- const tunnel = createRemoteTunnel ( options , remotePort , localPort ) ;
246+ const tunnel = createRemoteTunnel ( options , remoteHost , remotePort , localPort ) ;
247247 this . addTunnelToMap ( remoteHost , remotePort , tunnel ) ;
248248 return tunnel ;
249249 }
250- return undefined ;
251250 }
252251}
253252
0 commit comments