diff --git a/README.md b/README.md index edc5cb4..4225c13 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ The project is published to Sonatype OSS: sbt users may add this to their `build.sbt`: ``` -libraryDependencies += "io.github.erikvanzijst" %% "scala-tlsproxy_2.12" % "0.2.0" +libraryDependencies += "io.github.erikvanzijst" % "scala-tlsproxy_2.12" % "0.3.0" ``` To use it as a library in-process: diff --git a/build.sbt b/build.sbt index 95cee05..fb2528e 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ name := "scala-tlsproxy" organization := "io.github.erikvanzijst" -version := "0.3.0-SNAPSHOT" +version := "0.3.0" scalaVersion := "2.12.14" diff --git a/src/main/scala/io/github/erikvanzijst/scalatlsproxy/TlsProxyHandler.scala b/src/main/scala/io/github/erikvanzijst/scalatlsproxy/TlsProxyHandler.scala index 356d9df..38bd327 100644 --- a/src/main/scala/io/github/erikvanzijst/scalatlsproxy/TlsProxyHandler.scala +++ b/src/main/scala/io/github/erikvanzijst/scalatlsproxy/TlsProxyHandler.scala @@ -19,7 +19,7 @@ object ProxyPhase extends Enumeration { object TlsProxyHandler { val destPattern: Regex = "CONNECT ([^:]+):([0-9]+) HTTP/1.1".r - val userAgent: String = "TlsProxy/1.0 (github.com/erikvanzijst/scala_tlsproxy)" + val userAgent: String = "TlsProxy/0.3.0 (github.com/erikvanzijst/scala_tlsproxy)" } class TlsProxyHandler(selector: Selector, clientChannel: SocketChannel) extends KeyHandler with StrictLogging { @@ -54,7 +54,7 @@ class TlsProxyHandler(selector: Selector, clientChannel: SocketChannel) extends private def readClient(): Unit = { if (clientKey.isValid && clientKey.isReadable && clientChannel.read(clientBuffer) == -1) - throw new IOException(s"$clientAddress unexpected EOF from client") + throw new IOException(s"$clientAddress unexpected EOF from client") if (!clientBuffer.hasRemaining) throw new IOException(s"$clientAddress handshake overflow") } @@ -183,11 +183,10 @@ class TlsProxyHandler(selector: Selector, clientChannel: SocketChannel) extends } catch { case e: IOException => - val msg = s"$clientAddress -> $getServerAddress" + (if (phase == Established) s" (up: ${upstreamPipe.bytes} down: ${downstreamPipe.bytes})" else "") + s" connection failed: ${e.getClass.getSimpleName}: ${e.getMessage}" - logger.error(msg) + logger.warn(msg) close() }