Comments (34)
这是个问题,这个版本本来就很烂。,,,,有很多bug的。。有空我我考虑重写吧
from ngrok-java.
我在你的基础上改了一点,发现还是有问题,所以才提issue了 😂
期待ing ...
from ngrok-java.
把你代码合并呗,一起开发呗?我一个人近期提不起兴趣来
from ngrok-java.
我改的代码现在跟你的几乎没多少区别,也没解决实质性的问题。
等我看看原理再改一下,然后给你提pr吧
from ngrok-java.
好啊,其实我的想法是用nio重写。。但是nio对ssl加密。官方没有实现。。要自己弄。。nio不需要这么多线程
from ngrok-java.
只要是用线程的内存泄漏不好处理。。。功力不够。。nio就好很多了,
from ngrok-java.
+QQ一起开发呗,,,没几行代码,我先研究下nio ssl,搭个雏形
from ngrok-java.
😂我都没有看过这些底层的东西,太菜了
from ngrok-java.
好了,你看看。。测试下,。。
from ngrok-java.
6666, 好的
from ngrok-java.
用浏览器访问会卡住,控制台报错如下:
recvstr:{"Type":"AuthResp","Payload":{"Version":"2","MmVersion":"1.7","ClientId":"60c0b7da5bcc5e2f9866aec2c281e3a1","Error":""}}
AuthResp .....OK....
recvstr:{"Type":"ReqProxy","Payload":{}}
recvstr:{"Type":"NewTunnel","Payload":{"ReqId":"84333d24","Url":"http://4c93e15b.tunnel.qydev.com","Protocol":"http","Error":""}}
NewTunnel .....OK....
recvstr:{"Type":"Pong","Payload":{}}
recvstr:{"Type":"Pong","Payload":{}}
recvstr:{"Type":"ReqProxy","Payload":{}}
recvstr:{"Type":"StartProxy","Payload":{"Url":"http://4c93e15b.tunnel.qydev.com","ClientAddr":"14.23.164.60:49463"}}
recvstr:{"Type":"Pong","Payload":{}}
recvstr:{"Type":"StartProxy","Payload":{"Url":"http://4c93e15b.tunnel.qydev.com","ClientAddr":"14.23.164.60:45442"}}
recvstr:{"Type":"ReqProxy","Payload":{}}
Exception in thread "pool-1-thread-1" java.lang.IllegalStateException: java.nio.channels.ClosedChannelException
at com.geek.ngrok.NioSSLProvider.onOutput(NioSSLProvider.java:35)
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:172)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:92)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:66)
at com.geek.ngrok.SSLProvider$1.run(SSLProvider.java:45)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:265)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:474)
at com.geek.ngrok.NioSSLProvider.onOutput(NioSSLProvider.java:31)
... 7 more
java.lang.IllegalStateException: failed to wrap
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:182)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:99)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:66)
at com.geek.ngrok.NioSSLProvider.initEngine(NioSSLProvider.java:92)
at com.geek.ngrok.NgrokClient.start(NgrokClient.java:146)
at com.geek.ngrok.ngrok.main(ngrok.java:17)
recvstr:{"Type":"ReqProxy","Payload":{}}
java.lang.IllegalStateException: failed to wrap
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:182)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:99)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:66)
at com.geek.ngrok.NioSSLProvider.initEngine(NioSSLProvider.java:92)
at com.geek.ngrok.NgrokClient.start(NgrokClient.java:146)
at com.geek.ngrok.ngrok.main(ngrok.java:17)
Exception in thread "pool-1-thread-2" java.lang.IllegalStateException: failed to wrap
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:182)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:92)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:66)
at com.geek.ngrok.SSLProvider$1.run(SSLProvider.java:45)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
from ngrok-java.
链接复用会出错,原因不明
from ngrok-java.
对,我明明在自己电脑上是这个链接,断开之后打包放到服务器上跑还是那个链接,看的我一脸懵逼
from ngrok-java.
好了,已修复。
from ngrok-java.
nio使用姿势不对导致的。。
from ngrok-java.
Hmmmmmm,我这还是报错 😂
ngrok-java v1.1(2018/8/16)
recvstr:{"Type":"AuthResp","Payload":{"Version":"2","MmVersion":"1.7","ClientId":"a4767422b3afaa817e6c6543fbff791d","Error":""}}
AuthResp .....OK....
recvstr:{"Type":"ReqProxy","Payload":{}}
recvstr:{"Type":"NewTunnel","Payload":{"ReqId":"67119227","Url":"http://72199f94.tunnel.qydev.com","Protocol":"http","Error":""}}
NewTunnel .....OK....
recvstr:{"Type":"Pong","Payload":{}}
recvstr:{"Type":"StartProxy","Payload":{"Url":"http://72199f94.tunnel.qydev.com","ClientAddr":"14.23.164.60:51554"}}
recvstr:{"Type":"ReqProxy","Payload":{}}
Exception in thread "pool-1-thread-1" java.lang.IllegalStateException: java.nio.channels.ClosedChannelException
at com.geek.ngrok.NioSSLProvider.onOutput(NioSSLProvider.java:34)
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:174)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:94)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:68)
at com.geek.ngrok.SSLProvider$1.run(SSLProvider.java:47)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:270)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:461)
at com.geek.ngrok.NioSSLProvider.onOutput(NioSSLProvider.java:30)
... 7 more
java.lang.IllegalStateException: failed to wrap
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:184)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:101)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:68)
at com.geek.ngrok.NioSSLProvider.initEngine(NioSSLProvider.java:91)
at com.geek.ngrok.NgrokClient.start(NgrokClient.java:192)
at com.geek.ngrok.ngrok.main(ngrok.java:15)
recvstr:{"Type":"ReqProxy","Payload":{}}
java.lang.IllegalStateException: failed to wrap
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:184)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:101)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:68)
at com.geek.ngrok.NioSSLProvider.initEngine(NioSSLProvider.java:91)
at com.geek.ngrok.NgrokClient.start(NgrokClient.java:192)
at com.geek.ngrok.ngrok.main(ngrok.java:15)
Exception in thread "pool-1-thread-2" java.lang.IllegalStateException: failed to wrap
at com.geek.ngrok.SSLProvider.wrap(SSLProvider.java:184)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:94)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:68)
at com.geek.ngrok.SSLProvider$1.run(SSLProvider.java:47)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
from ngrok-java.
断线重连也好了。。不开发了,,测试好了。。给个报告
from ngrok-java.
这个新版的我就没有正常运行起来过。。。 需要有第三人来跑一下试试,是不是我环境有问题还是代码的问题。
from ngrok-java.
不至于啊,现在报什么错?
from ngrok-java.
ngrok-java v1.4(2018/8/20)
recvstr:{"Type":"AuthResp","Payload":{"Version":"2","MmVersion":"1.7","ClientId":"51ac4c443f5edc7b8378bef25e2bbdf2","Error":""}}
AuthResp .....OK....
recvstr:{"Type":"ReqProxy","Payload":{}}
recvstr:{"Type":"NewTunnel","Payload":{"ReqId":"8d03cd41","Url":"http://72199f94.tunnel.qydev.com","Protocol":"http","Error":""}}
NewTunnel .....OK....
recvstr:{"Type":"Pong","Payload":{}}
recvstr:{"Type":"ReqProxy","Payload":{}}
recvstr:{"Type":"StartProxy","Payload":{"Url":"http://72199f94.tunnel.qydev.com","ClientAddr":"14.23.164.60:61520"}}
handshake failure
Exception in thread "pool-1-thread-1" java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:206)
at com.geek.ngrok.SSLProvider$2.run(SSLProvider.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
handshake failure
ssl session closed
Exception in thread "pool-1-thread-2" java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:206)
at com.geek.ngrok.SSLProvider$2.run(SSLProvider.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
ssl session closed
ssl session closed
web服务是有请求的
127.0.0.1 - - [20/Aug/2018 16:56:35] "GET / HTTP/1.1" 200 -
from ngrok-java.
from ngrok-java.
改成128在我电脑上还是不行,打包成jar在linux下跑,第一次用浏览器打开可以显示,后面就卡住了
from ngrok-java.
linux报什么错?
from ngrok-java.
一样的错误。我在打印
下面把异常打印了一下,是这样的...
ecvstr:{"Type":"Pong","Payload":{}}
recvstr:{"Type":"StartProxy","Payload":{"Url":"http://72199f94.tunnel.qydev.com","ClientAddr":"14.23.164.60:63874"}}
recvstr:{"Type":"ReqProxy","Payload":{}}
handshake failure
javax.net.ssl.SSLException: Received fatal alert: unexpected_message
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1666)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1634)
at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1800)
at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1083)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:907)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
at com.geek.ngrok.SSLProvider.unwrap(SSLProvider.java:206)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:117)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:84)
at com.geek.ngrok.SSLProvider$2.run(SSLProvider.java:76)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
handshake failure
java.lang.IllegalArgumentException: Bad arguments
ssl session closed
at javax.crypto.Mac.update(Mac.java:509)
at sun.security.ssl.MAC.compute(MAC.java:135)
at sun.security.ssl.InputRecord.checkMacTags(InputRecord.java:265)
at sun.security.ssl.InputRecord.decrypt(InputRecord.java:216)
at sun.security.ssl.EngineInputRecord.decrypt(EngineInputRecord.java:177)
at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:974)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:907)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
at com.geek.ngrok.SSLProvider.unwrap(SSLProvider.java:206)
at com.geek.ngrok.SSLProvider.isHandShaking(SSLProvider.java:107)
at com.geek.ngrok.SSLProvider.exec(SSLProvider.java:84)
at com.geek.ngrok.SSLProvider$1.run(SSLProvider.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "pool-1-thread-1" java.nio.BufferOverflowException
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:206)
at com.geek.ngrok.SSLProvider$2.run(SSLProvider.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
ssl session closed
ssl session closed
ssl session closed
ssl session closed
from ngrok-java.
你的是jre1.7吗?
from ngrok-java.
不对1.8
from ngrok-java.
jre 1.8
from ngrok-java.
你确认你没改过任何代码?
from ngrok-java.
没有,我下载的zip包然后把几个.java
文件替换了,eclipse里面clean了几次,然后改了一下ngrok.java
的subdomain及hostname,如下:
public static void main(String args[]) throws Exception{
//new
NgrokClient ngclient=new NgrokClient();
String subDomain = "72199f94";
String hostName = "72199f94.tunnel.qydev.com";
//addtunnel
ngclient.addTun("127.0.0.1",8080,"http",hostName,subDomain,0,"");
//start
ngclient.start();
}
from ngrok-java.
。。你直接用eclipse打开我的项目。。别的不动,然后看下
from ngrok-java.
一样的
from ngrok-java.
你再看下,如果不是高并发应该不会出问题,高并发会异常断开重连。。原因不明
from ngrok-java.
现在应该OK了。。。
from ngrok-java.
大神,报了一个错误
2018-11-08 13:28:13.671 16429-16509/handreace.server W/System.err: javax.net.ssl.SSLException: java.io.EOFException: Read error
2018-11-08 13:28:13.672 16429-16509/handreace.server W/System.err: at com.android.org.conscrypt.SSLUtils.toSSLException(SSLUtils.java:295)
2018-11-08 13:28:13.673 16429-16509/handreace.server W/System.err: at com.android.org.conscrypt.ConscryptEngine.convertException(ConscryptEngine.java:1093)
2018-11-08 13:28:13.673 16429-16509/handreace.server W/System.err: at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:851)
2018-11-08 13:28:13.674 16429-16509/handreace.server W/System.err: at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:678)
2018-11-08 13:28:13.674 16429-16509/handreace.server W/System.err: at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:644)
2018-11-08 13:28:13.675 16429-16509/handreace.server W/System.err: at handreace.server.ngrok.SSLProvider.unwrap(SSLProvider.java:205)
2018-11-08 13:28:13.675 16429-16509/handreace.server W/System.err: at handreace.server.ngrok.SSLProvider.isHandShaking(SSLProvider.java:104)
2018-11-08 13:28:13.675 16429-16509/handreace.server W/System.err: at handreace.server.ngrok.SSLProvider.exec(SSLProvider.java:81)
2018-11-08 13:28:13.676 16429-16509/handreace.server W/System.err: at handreace.server.ngrok.SSLProvider$2.run(SSLProvider.java:73)
2018-11-08 13:28:13.676 16429-16509/handreace.server W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2018-11-08 13:28:13.677 16429-16509/handreace.server W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2018-11-08 13:28:13.677 16429-16509/handreace.server W/System.err: at java.lang.Thread.run(Thread.java:784)
from ngrok-java.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngrok-java.