fix(core): update
This commit is contained in:
		| @@ -3,6 +3,6 @@ | |||||||
|  */ |  */ | ||||||
| export const commitinfo = { | export const commitinfo = { | ||||||
|   name: '@pushrocks/smartproxy', |   name: '@pushrocks/smartproxy', | ||||||
|   version: '3.0.42', |   version: '3.0.43', | ||||||
|   description: 'a proxy for handling high workloads of proxying' |   description: 'a proxy for handling high workloads of proxying' | ||||||
| } | } | ||||||
|   | |||||||
| @@ -247,14 +247,13 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= | |||||||
|     // Enable websockets |     // Enable websockets | ||||||
|     const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer  }); |     const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer  }); | ||||||
|     wss.on('connection', (ws: plugins.wsDefault, reqArg) => { |     wss.on('connection', (ws: plugins.wsDefault, reqArg) => { | ||||||
|       console.log(`got connection for wsc for ${reqArg.url}`); |       console.log(`got connection for wsc for https://${req.get('host')}${reqArg.url}`); | ||||||
|       let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>; |       let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>; | ||||||
|  |  | ||||||
|       ws.on('message', async (message) => { |       ws.on('message', async (message) => { | ||||||
|         if (!wscConnectedDeferred) { |         if (!wscConnectedDeferred) { | ||||||
|           wscConnectedDeferred = plugins.smartpromise.defer(); |           wscConnectedDeferred = plugins.smartpromise.defer(); | ||||||
|           const parsedUrl = plugins.url.parse(reqArg.url); |           const wsc = new plugins.wsDefault(`${this.router.routeReq(reqArg)}${reqArg.url}`); | ||||||
|           const wsc = new plugins.wsDefault(`${this.router.routeWs(reqArg)}${parsedUrl.path}`); |  | ||||||
|      |      | ||||||
|           wsc.on('open', () => { |           wsc.on('open', () => { | ||||||
|             wscConnectedDeferred.resolve(wsc); |             wscConnectedDeferred.resolve(wsc); | ||||||
|   | |||||||
| @@ -21,12 +21,4 @@ export class ProxyRouter { | |||||||
|     }); |     }); | ||||||
|     return correspodingReverseProxyConfig; |     return correspodingReverseProxyConfig; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   public routeWs(wsReq: plugins.http.IncomingMessage) { |  | ||||||
|     const originalHost = plugins.url.parse(wsReq.url).host; |  | ||||||
|     const correspodingReverseProxyConfig = this.reverseProxyConfigs.find((reverseConfig) => { |  | ||||||
|       return reverseConfig.hostName === originalHost; |  | ||||||
|     }); |  | ||||||
|     return correspodingReverseProxyConfig.destinationIp; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user