From f504f8483b292b985e11bd5f47efe48020e6ca7d Mon Sep 17 00:00:00 2001 From: lbod Date: Thu, 1 Nov 2018 19:27:32 +0000 Subject: [PATCH] Allow independent proxy url configuration for the browserstack binary This commit refers to issue #16 --- src/BrowserStackTunnel.ts | 7 ++++--- src/Tunnel.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/BrowserStackTunnel.ts b/src/BrowserStackTunnel.ts index 8f76a12..04a0986 100644 --- a/src/BrowserStackTunnel.ts +++ b/src/BrowserStackTunnel.ts @@ -155,10 +155,11 @@ export default class BrowserStackTunnel extends Tunnel this.skipServerValidation && args.push('-skipCheck'); this.tunnelId && args.push('-localIdentifier', this.tunnelId); this.verbose && args.push('-v'); + const aProxy = + this.tunnelProxy !== undefined ? this.tunnelProxy : this.proxy; - if (this.proxy) { - const proxy = parseUrl(this.proxy); - + if (aProxy) { + const proxy = parseUrl(aProxy); proxy.hostname && args.push('-proxyHost', proxy.hostname); proxy.port && args.push('-proxyPort', proxy.port); diff --git a/src/Tunnel.ts b/src/Tunnel.ts index a129d95..f61736a 100644 --- a/src/Tunnel.ts +++ b/src/Tunnel.ts @@ -103,6 +103,15 @@ export default class Tunnel extends Evented */ proxy: string | undefined; + /** + * The URL of a proxy server for the tunnel to go through. Only the + * hostname, port, and auth are used. + * + * This overrides the `proxy` configuration allowing independent + * configuration for the Tunnel binary process only. + */ + tunnelProxy!: string | undefined; + /** A unique identifier for the newly created tunnel. */ tunnelId: string | undefined; @@ -743,6 +752,9 @@ export interface TunnelProperties extends DownloadProperties { /** [[Tunnel.Tunnel.protocol|More info]] */ protocol: string; + /** [[Tunnel.Tunnel.tunnelProxy|More info]] */ + tunnelProxy: string | undefined; + /** [[Tunnel.Tunnel.tunnelId|More info]] */ tunnelId: string | undefined;