Skip to content

Commit

Permalink
Upgrade depends
Browse files Browse the repository at this point in the history
  • Loading branch information
alikemal.ocalan committed Jan 10, 2021
1 parent f749f1a commit 4715884
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ application {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile 'io.netty:netty-handler-proxy:4.1.53.Final'
compile 'io.netty:netty-handler-proxy:4.1.56.Final'
compile 'com.squareup.okhttp3:okhttp:4.9.0'
compile 'com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.0'
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation 'ch.qos.logback:logback-core:1.2.3'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
}

jar {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin.code.style=official
kotlin_version=1.4.10
kotlin_version=1.4.21-2
projectGroup=com.github.alikemalocalan
projectName=greentunnel4jvm
projectVersion=2.2-SNAPSHOT
Expand Down
16 changes: 2 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.alikemalocalan</groupId>
<artifactId>greentunnel4jvm</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<licenses>
<license>
Expand All @@ -17,7 +17,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler-proxy</artifactId>
<version>4.1.53.Final</version>
<version>4.1.56.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -43,17 +43,5 @@
<version>1.2.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class HttpProxyClientHandler : ChannelInboundHandlerAdapter() {
ctx.channel()
.writeAndFlush(Unpooled.wrappedBuffer("HTTP/1.1 200 Connection Established\r\n\r\n".commonAsUtf8ToByteArray()))
ctx.channel().config().isAutoRead = false // disable AutoRead until remote connection is ready
remoteChannel = Optional.of(sendRequestWithRemoteChannel(ctx, request))
remoteChannel = Optional.of(sendRequestToRemoteChannel(ctx, request))
buf.release()
}
}

private fun sendRequestWithRemoteChannel(
private fun sendRequestToRemoteChannel(
ctx: ChannelHandlerContext,
request: HttpRequest
): Channel {
Expand All @@ -59,7 +59,7 @@ class HttpProxyClientHandler : ChannelInboundHandlerAdapter() {
ctx.channel().config().isAutoRead = true // connection is ready, enable AutoRead
HttpServiceUtils.writeToHttps(request.toByteBuf(), remoteFuture.channel())
ctx.channel().read()
} else ctx.close()
}
}
return remoteFuture.channel()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data class HttpRequest(
}
}.orElseGet { "" }

private fun getPath(): String =
fun path(): String =
if (uri.path.isNullOrBlank()) "/"
else uri.path

Expand All @@ -36,7 +36,7 @@ data class HttpRequest(
override fun toString(): String = String.format(
"%s %s %s%s%s",
method,
getPath(),
path(),
protocolVersion,
headersAsString(),
payload.map { payload -> "\r\n" + payload }.orElseGet { "" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object DNSOverHttps {
try {
dns.lookup(address).first().hostAddress
} catch (ex: UnknownHostException) {
logger.error(ex.message)
logger.error("${ex.message} for : $address")
"127.0.0.1"
}
}

0 comments on commit 4715884

Please sign in to comment.