diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f072693..e0812966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased](https://github.com/alexdlaird/java-ngrok/compare/1.4.4...java8-ngrok) + +## [1.4.4](https://github.com/alexdlaird/java-ngrok/compare/1.4.3...1.4.4) - 2021-09-28 +### Added +- Test improvements. + +### Fixed +- Parse issue from `ngrok` config file with `inspect` and `bind_tls` in `tunnels` definitions. +- Full `ngrok` log line now passed to Java logger (was previously just the `msg` field). + ## [1.4.3](https://github.com/alexdlaird/java-ngrok/compare/1.4.0...1.4.3) - 2021-08-26 ### Added - Build improvements. diff --git a/README.md b/README.md index b2f9c249..ce853552 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,14 @@ on [Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.a com.github.alexdlaird java-ngrok - 1.5.3 + 1.5.5 ``` #### Gradle ```groovy -implementation "com.github.alexdlaird:java-ngrok:1.5.3" +implementation "com.github.alexdlaird:java-ngrok:1.5.5" ``` If we want `ngrok` to be available from the command line, [pyngrok](https://github.com/alexdlaird/pyngrok) can be @@ -92,7 +92,7 @@ include the `java8-ngrok` dependency from com.github.alexdlaird java8-ngrok - 1.4.3 + 1.4.4 ``` diff --git a/build.gradle b/build.gradle index 5d65fab4..c4f67fe3 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group "com.github.alexdlaird" -version "1.4.3" +version "1.4.4" java { withJavadocJar() diff --git a/src/main/java/com/github/alexdlaird/ngrok/NgrokClient.java b/src/main/java/com/github/alexdlaird/ngrok/NgrokClient.java index 5be071ae..aa274b31 100644 --- a/src/main/java/com/github/alexdlaird/ngrok/NgrokClient.java +++ b/src/main/java/com/github/alexdlaird/ngrok/NgrokClient.java @@ -135,7 +135,7 @@ public class NgrokClient { private static final Logger LOGGER = Logger.getLogger(String.valueOf(NgrokClient.class)); - private static final String VERSION = "1.4.3"; + private static final String VERSION = "1.4.4"; private final JavaNgrokConfig javaNgrokConfig; private final NgrokProcess ngrokProcess; diff --git a/src/main/java/com/github/alexdlaird/ngrok/process/NgrokProcess.java b/src/main/java/com/github/alexdlaird/ngrok/process/NgrokProcess.java index e17eab5d..d3ae5803 100644 --- a/src/main/java/com/github/alexdlaird/ngrok/process/NgrokProcess.java +++ b/src/main/java/com/github/alexdlaird/ngrok/process/NgrokProcess.java @@ -429,7 +429,7 @@ private NgrokLog logLine(final String line) { return null; } - LOGGER.log(Level.parse(ngrokLog.getLvl()), ngrokLog.getMsg()); + LOGGER.log(Level.parse(ngrokLog.getLvl()), ngrokLog.getLine()); logs.add(ngrokLog); if (logs.size() > javaNgrokConfig.getMaxLogs()) { logs.remove(0); diff --git a/src/main/java/com/github/alexdlaird/ngrok/protocol/CreateTunnel.java b/src/main/java/com/github/alexdlaird/ngrok/protocol/CreateTunnel.java index 3c249fc1..5678bfbd 100644 --- a/src/main/java/com/github/alexdlaird/ngrok/protocol/CreateTunnel.java +++ b/src/main/java/com/github/alexdlaird/ngrok/protocol/CreateTunnel.java @@ -392,10 +392,10 @@ public void withTunnelDefinition(Map tunnelDefinition) { this.addr = (String) tunnelDefinition.get("addr"); } if (isNull(this.inspect) && tunnelDefinition.containsKey("inspect")) { - this.inspect = Boolean.valueOf((String) tunnelDefinition.get("inspect")); + this.inspect = Boolean.valueOf(String.valueOf(tunnelDefinition.get("inspect"))); } if (isNull(this.bindTls) && tunnelDefinition.containsKey("bind_tls")) { - this.bindTls = BindTls.valueOf(((String) tunnelDefinition.get("bind_tls")).toUpperCase()); + this.bindTls = BindTls.valueOf((String.valueOf(tunnelDefinition.get("bind_tls"))).toUpperCase()); } if (isNull(this.auth) && tunnelDefinition.containsKey("auth")) { this.auth = (String) tunnelDefinition.get("auth"); diff --git a/src/main/java/overview.html b/src/main/java/overview.html index 6ce1c8f6..8d86b800 100644 --- a/src/main/java/overview.html +++ b/src/main/java/overview.html @@ -18,14 +18,14 @@

Maven

<dependency> <groupId>com.github.alexdlaird</groupId> <artifactId>java-ngrok</artifactId> - <version>1.5.3</version> + <version>1.5.5</version> </dependency>

Gradle

-implementation "com.github.alexdlaird:java-ngrok:1.5.3"
+implementation "com.github.alexdlaird:java-ngrok:1.5.5"
 
If we want ngrok to be available from the command line, @@ -61,7 +61,7 @@

Java 8

<dependency> <groupId>com.github.alexdlaird</groupId> <artifactId>java8-ngrok</artifactId> - <version>1.4.3</version> + <version>1.4.4</version> </dependency> @@ -69,4 +69,4 @@

Java 8

Java 9, so certain convenience methods around managing the ngrok process (for instance, tearing it down) are not available in the Java 8 build. - \ No newline at end of file + diff --git a/src/test/java/com/github/alexdlaird/ngrok/NgrokClientTest.java b/src/test/java/com/github/alexdlaird/ngrok/NgrokClientTest.java index a642524d..4a243953 100644 --- a/src/test/java/com/github/alexdlaird/ngrok/NgrokClientTest.java +++ b/src/test/java/com/github/alexdlaird/ngrok/NgrokClientTest.java @@ -409,16 +409,18 @@ public void testTunnelDefinitions() { // GIVEN final String subdomain = createUniqueSubdomain(); - final Map httpTunnelConfig = new HashMap() {{ + final Map httpTunnelConfig = new HashMap<>() {{ put("proto", "http"); put("addr", "8000"); put("subdomain", subdomain); + put("inspect", Boolean.FALSE); + put("bind_tls", Boolean.TRUE); }}; - final Map tcpTunnelConfig = new HashMap() {{ + final Map tcpTunnelConfig = new HashMap<>() {{ put("proto", "tcp"); put("addr", "22"); }}; - final Map tunnelsConfig = new HashMap() {{ + final Map tunnelsConfig = new HashMap<>() {{ put("http-tunnel", httpTunnelConfig); put("tcp-tunnel", tcpTunnelConfig); }}; @@ -445,15 +447,17 @@ public void testTunnelDefinitions() { .withName("tcp-tunnel") .build(); final Tunnel sshTunnel = ngrokClient2.connect(createSshTunnel); + final List tunnels = ngrokClient2.getTunnels(); // THEN - assertEquals("http-tunnel (http)", httpTunnel.getName()); + assertEquals(2, tunnels.size()); + assertEquals("http-tunnel", httpTunnel.getName()); assertEquals("http://localhost:8000", httpTunnel.getConfig().getAddr()); - assertEquals(Proto.HTTP.toString(), httpTunnel.getProto()); - assertEquals(String.format("http://%s.ngrok.io", subdomain), httpTunnel.getPublicUrl()); + assertEquals("https", httpTunnel.getProto()); + assertEquals(String.format("https://%s.ngrok.io", subdomain), httpTunnel.getPublicUrl()); assertEquals("tcp-tunnel", sshTunnel.getName()); assertEquals("localhost:22", sshTunnel.getConfig().getAddr()); - assertEquals(Proto.TCP.toString(), sshTunnel.getProto()); + assertEquals("tcp", sshTunnel.getProto()); assertThat(sshTunnel.getPublicUrl(), startsWith("tcp://")); }