From af9e2cbad222e18a9d3909092bc4e8e255be9384 Mon Sep 17 00:00:00 2001 From: Shivanshu-lambdatest Date: Wed, 7 Sep 2022 10:00:26 +0530 Subject: [PATCH 1/3] added missing flags --- pom.xml | 2 +- .../java/com/lambdatest/tunnel/Tunnel.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 51e94f7..3b0138c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.lambdatest lambdatest-tunnel-binary jar - 1.0.11 + 1.0.12 lambdatest-maven-tunnel LambdaTest tunnel binary in Java https://www.lambdatest.com diff --git a/src/main/java/com/lambdatest/tunnel/Tunnel.java b/src/main/java/com/lambdatest/tunnel/Tunnel.java index b5e5d17..7183149 100644 --- a/src/main/java/com/lambdatest/tunnel/Tunnel.java +++ b/src/main/java/com/lambdatest/tunnel/Tunnel.java @@ -82,6 +82,11 @@ public Tunnel() throws TunnelException { parameters.put("basicAuth", "--basic-auth"); parameters.put("mitm", "--mitm"); parameters.put("skip-upgrade", "--skip-upgrade"); + parameters.put("pacfile","--pacfile"); + parameters.put("mTLSHosts","--mTLSHosts"); + parameters.put("clientKey","--clientKey"); + parameters.put("clientCert","--clientCert"); + parameters.put("allowHosts","--allowHosts"); } /** @@ -236,6 +241,31 @@ public String passParametersToTunnel(Map options) { if(options.get("mitm") != "" && options.get("mitm") !=null ) { command += " --mitm "; } + parameters.put("pacfile","--pacfile"); + parameters.put("mTLSHosts","--mTLSHosts"); + parameters.put("clientKey","--clientKey"); + parameters.put("clientCert","--clientCert"); + parameters.put("allowHosts","--allowHosts"); + + if(options.get("pacfile") != "" && options.get("pacfile") !=null ) { + command += " --pacfile "; + } + + if(options.get("mTLSHosts") != "" && options.get("mTLSHosts") !=null ) { + command += " --mTLSHosts "; + } + + if(options.get("clientKey") != "" && options.get("clientKey") !=null ) { + command += " --clientKey "; + } + + if(options.get("clientCert") != "" && options.get("clientCert") !=null ) { + command += " --clientCert "; + } + + if(options.get("allowHosts") != "" && options.get("allowHosts") !=null ) { + command += " --allowHosts "; + } if(t1.port!=null) { command += " --callbackURL http://127.0.0.1:" + String.valueOf(t1.port); From 40b5575ebb6cc02b5ef865aaafafcbaad716b0b4 Mon Sep 17 00:00:00 2001 From: Shivanshu-lambdatest Date: Wed, 7 Sep 2022 10:01:47 +0530 Subject: [PATCH 2/3] added missing flags - removed extra code --- src/main/java/com/lambdatest/tunnel/Tunnel.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/com/lambdatest/tunnel/Tunnel.java b/src/main/java/com/lambdatest/tunnel/Tunnel.java index 7183149..4539e1a 100644 --- a/src/main/java/com/lambdatest/tunnel/Tunnel.java +++ b/src/main/java/com/lambdatest/tunnel/Tunnel.java @@ -241,11 +241,6 @@ public String passParametersToTunnel(Map options) { if(options.get("mitm") != "" && options.get("mitm") !=null ) { command += " --mitm "; } - parameters.put("pacfile","--pacfile"); - parameters.put("mTLSHosts","--mTLSHosts"); - parameters.put("clientKey","--clientKey"); - parameters.put("clientCert","--clientCert"); - parameters.put("allowHosts","--allowHosts"); if(options.get("pacfile") != "" && options.get("pacfile") !=null ) { command += " --pacfile "; From 10d4d6b7c36833de7500d2ed580600fb52470b99 Mon Sep 17 00:00:00 2001 From: Shivanshu-lambdatest Date: Fri, 9 Sep 2022 13:54:31 +0530 Subject: [PATCH 3/3] removed duplicated flags passing bug --- src/main/java/com/lambdatest/tunnel/Tunnel.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lambdatest/tunnel/Tunnel.java b/src/main/java/com/lambdatest/tunnel/Tunnel.java index 4539e1a..8cefb42 100644 --- a/src/main/java/com/lambdatest/tunnel/Tunnel.java +++ b/src/main/java/com/lambdatest/tunnel/Tunnel.java @@ -26,7 +26,7 @@ */ public class Tunnel { - private static final List IGNORE_KEYS = Arrays.asList("user", "key", "infoAPIPort", "binarypath", "load-balanced", "mitm"); + private static final List IGNORE_KEYS = Arrays.asList("user", "key", "infoAPIPort", "binarypath", "load-balanced", "mitm", "pacfile", "mTLSHosts", "clientKey", "clientCert", "allowHosts", "verbose"); private boolean tunnelFlag = false; @@ -87,6 +87,7 @@ public Tunnel() throws TunnelException { parameters.put("clientKey","--clientKey"); parameters.put("clientCert","--clientCert"); parameters.put("allowHosts","--allowHosts"); + parameters.put("verbose","--verbose"); } /** @@ -244,22 +245,31 @@ public String passParametersToTunnel(Map options) { if(options.get("pacfile") != "" && options.get("pacfile") !=null ) { command += " --pacfile "; + command += options.get("pacfile"); } if(options.get("mTLSHosts") != "" && options.get("mTLSHosts") !=null ) { command += " --mTLSHosts "; + command += options.get("mTLSHosts"); } if(options.get("clientKey") != "" && options.get("clientKey") !=null ) { command += " --clientKey "; + command += options.get("clientKey"); } if(options.get("clientCert") != "" && options.get("clientCert") !=null ) { command += " --clientCert "; + command += options.get("clientCert"); } if(options.get("allowHosts") != "" && options.get("allowHosts") !=null ) { command += " --allowHosts "; + command += options.get("allowHosts"); + } + + if(options.get("verbose") != "" && options.get("verbose") !=null ) { + command += " --verbose "; } if(t1.port!=null) {