loveinsky100 / panama Goto Github PK
View Code? Open in Web Editor NEWpanama是一个高性能的代理服务器,基于shadowsocks协议,采用netty实现,可以使用ss客户端进行连接。并且除了常规的代理模式,还支持链式代理,反向代理功能,支持内网穿透。
License: MIT License
panama是一个高性能的代理服务器,基于shadowsocks协议,采用netty实现,可以使用ss客户端进行连接。并且除了常规的代理模式,还支持链式代理,反向代理功能,支持内网穿透。
License: MIT License
hi.
我在mac上也装了你这个程序。
不过panama要是作为mac上的ss客户端,该怎么运行呢?
我用代理下载一个大文件 ,然后马上关闭浏览器 然后马上关闭ss客户端
但是我发现ss服务器还在一直输出 以下信息 ,是不是有某种机制 可以不再下载了。
2021-05-24 18:27:57.524 INFO 14621 --- [tLoopGroup-4-10] c.x.w.n.proxy.AbstractShadowSocksProxy : proxy <---------------- target 1342 byte
2021-05-24 18:27:57.524 INFO 14621 --- [tLoopGroup-4-10] c.x.w.n.proxy.AbstractShadowSocksProxy : client <---------------- proxy 1342 byte
2021-05-24 18:27:57.535 INFO 14621 --- [tLoopGroup-4-10] c.x.w.n.proxy.AbstractShadowSocksProxy : proxy <---------------- target 2684 byte
2021-05-24 18:27:57.535 INFO 14621 --- [tLoopGroup-4-10] c.x.w.n.proxy.AbstractShadowSocksProxy : client <---------------- proxy 2684 byte
2021-05-24 18:27:57.597 INFO 14621 --- [tLoopGroup-4-10] c.x.w.n.proxy.AbstractShadowSocksProxy : proxy <---------------- target 2684 byte
2021-05-24 18:27:57.597 INFO 14621 --- [tLoopGroup-4-10] c.x.w.n.proxy.AbstractShadowSocksProxy : client <---------------- proxy 2684 byte
......
[email protected] 这是我的邮箱 或者加我qq 1317216521 向您请教一下 给你报酬
计划实现一个在线支付购买ss账号的web应用系统,用户付款后就会在服务器上启动一个ss服务器 监听指定端口。
目前参照这个项目 和 https://github.com/Saseke/zeus.git 这个项目已经完成用java实现了ss服务端和客户端。
就差obfs server和obfs客户端的实现了,剩下的就是简单的web开发和java客户端开发了。
普通模式下,是怎么返回用户请求数据的,没有看懂呢
为啥我用ss客户端链接的时候,整个手机都用不了。后台一直在报错。错误如下:
2023-09-06 11:04:05 [ nioEventLoopGroup-3-1:208657 ] - [ WARN ] An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.RuntimeException: unknown request type: -82
at org.leo.server.panama.vpn.proxy.impl.ShadowSocksProxy.doProxy(ShadowSocksProxy.java:41)
at org.leo.server.panama.vpn.handler.ShadowSocksRequestHandler.doRequest(ShadowSocksRequestHandler.java:44)
at org.leo.server.panama.vpn.handler.ShadowSocksRequestHandler.doRequest(ShadowSocksRequestHandler.java:13)
at org.leo.server.panama.core.handler.tcp.TCPRequestHandler.doRequest(TCPRequestHandler.java:80)
at org.leo.server.panama.core.handler.tcp.TCPRequestHandler.channelReadComplete(TCPRequestHandler.java:63)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:373)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelReadComplete(DefaultChannelPipeline.java:1439)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)
at io.netty.channel.DefaultChannelPipeline.fireChannelReadComplete(DefaultChannelPipeline.java:971)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:168)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:648)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:583)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:500)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
shadowsocks粘包 拆包如何 处理?
目前我看到的是通过channelReadComplete进行处理的 。
tcp socket 是没有边界的,需要自定义协议处理相邻2个包的边界。
shadowsocks协议 每个包的大小是多少,如何区分边界?
@OverRide
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (null == request) {
request = new TCPRequest(ctx);
}
byte []readData = read(ctx, msg);
if (null == data || data.length == 0) {
data = readData;
} else {
int start = data.length;
data = Arrays.copyOf(data, start + readData.length);
System.arraycopy(readData, 0, data, start, readData.length);
}
// super.channelRead(ctx, msg);
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
if (null == data || null == request) {
super.channelReadComplete(ctx);
return;
}
request.setData(data);
doRequest(request);
request = null;
data = null;
super.channelReadComplete(ctx);
}
在服务器通过netstat发现似乎有连接遗留,运行一段时间后panama进程被系统杀掉,然后系统日志报没有可用端口
反向代理模式会有丢包,数据丢失情况
你好 你有没有博客或者个人网站,想跟你学习一下。
@OverRide
public void doProxy(byte []data) {
String target = null;
int port = 0;
log.info("client ----------------> proxy " + data.length + " byte");
byte []decryptData = wrapper.unwrap(data);
// 分包后第二个包不再去解析,直接复用先前的连接
if (null == redirectClient) {
ShadowSocksRequest shadowSocksRequest = requestResolver.parse(decryptData);
if (shadowSocksRequest.getAtyp() == ShadowSocksRequest.Type.UNKNOWN) {
throw new RuntimeException("unknown request type: " + decryptData[0]);
}
target = shadowSocksRequest.getHost();
port = shadowSocksRequest.getPort();
if (shadowSocksRequest.getChannel() == ShadowSocksRequest.Channel.TCP) {
int dataLength = shadowSocksRequest.getSubsequentDataLength();
if (dataLength > 0) {
decryptData = Arrays.copyOfRange(decryptData, decryptData.length - dataLength, decryptData.length);
}
} else if (shadowSocksRequest.getChannel() == ShadowSocksRequest.Channel.UDP) {
throw new RuntimeException("unsupport request type: udp");
}
}
sendRequest2Target(decryptData, target, port);
}
hi.
root@bwg-vps panama-by-loveinsky100]# mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] panama
[INFO] core
[INFO] server
[INFO] client
[INFO] spring
[INFO] test
[INFO] vpn
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building panama 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building core 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/io/netty/netty-all/4.1.31.Final/netty-all-4.1.31.Final.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] panama ............................................ SUCCESS [0.002s]
[INFO] core .............................................. FAILURE [0.887s]
[INFO] server ............................................ SKIPPED
[INFO] client ............................................ SKIPPED
[INFO] spring ............................................ SKIPPED
[INFO] test .............................................. SKIPPED
[INFO] vpn ............................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.107s
[INFO] Finished at: Wed Apr 15 16:54:27 CST 2020
[INFO] Final Memory: 7M/34M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project core: Could not resolve dependencies for project org.leo.server:core:jar:1.0-SNAPSHOT: Failed to collect dependencies at io.netty:netty-all:jar:4.1.31.Final: Failed to read artifact descriptor for io.netty:netty-all:jar:4.1.31.Final: Could not transfer artifact io.netty:netty-all:pom:4.1.31.Final from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/io/netty/netty-all/4.1.31.Final/netty-all-4.1.31.Final.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :core
[root@bwg-vps panama-by-loveinsky100]#
RT
启动server
启动client
没有响应呢?
经常会出现这个错误
client <---------------- proxy closed
io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.3.1:53
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:267)
at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:127)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:466)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
java.lang.NullPointerException
at org.leo.server.panama.client.AbstractClient.send(AbstractClient.java:54)
at org.leo.server.panama.vpn.proxy.AbstractShadowSocksProxy.sendRequest2Target(AbstractShadowSocksProxy.java:95)
at org.leo.server.panama.vpn.proxy.impl.ShadowSocksProxy.doProxy(ShadowSocksProxy.java:58)
at org.leo.server.panama.vpn.reverse.server.ReverseShadowSocksServer.doProxy(ReverseShadowSocksServer.java:152)
at org.leo.server.panama.vpn.reverse.server.ReverseShadowSocksServer.lambda$doRequest$3(ReverseShadowSocksServer.jav
a:113)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.leo.server.panama.vpn.reverse.server.ReverseShadowSocksServer.doRequest(ReverseShadowSocksServer.java:113)
at org.leo.server.panama.vpn.reverse.core.ReverseCoreClient.doCompleteResponse(ReverseCoreClient.java:70)
at org.leo.server.panama.vpn.reverse.core.ReverseCoreClient.doCompleteResponse(ReverseCoreClient.java:24)
at org.leo.server.panama.client.handler.TCPClientHandler.channelReadComplete(TCPClientHandler.java:59)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:373)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelReadComplete(DefaultChannelPipeline.java:1439)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)
at io.netty.channel.DefaultChannelPipeline.fireChannelReadComplete(DefaultChannelPipeline.java:971)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:168)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:648)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:583)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:500)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
是连接超时么?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.