Skip to content

Commit

Permalink
增加更多可配置信息,测试fq功能成功
Browse files Browse the repository at this point in the history
  • Loading branch information
arloor committed Nov 18, 2018
1 parent d67749d commit 7c0eaca
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,23 @@ crypto=false

当然,proxyclient无论如何不可以单独运行

## 在vps上运行情况

在使用字节取反的加密下,已经可以|fan|qiang]|了,惊喜惊喜。

```jshelllanguage
2018-11-18 08:44:54.446 [nioEventLoopGroup-4-1] INFO c.a.p.r.DefaultHttpMessageDecoderAdapter - 处理请求 HttpRequest{body='null', method='CONNECT', host='adservice.google.co.jp', port=443, path=adservice.google.co.jp:443}
2018-11-18 08:44:54.457 [nioEventLoopGroup-2-1] INFO c.a.p.proxyconnection.ProxyConnectionHandler - 连接成功: adservice.google.co.jp:443
2018-11-18 08:44:54.630 [nioEventLoopGroup-4-1] INFO c.a.p.r.DefaultHttpMessageDecoderAdapter - 处理请求 HttpRequest{body='null', method='CONNECT', host='ogs.google.com', port=443, path=ogs.google.com:443}
2018-11-18 08:44:54.650 [nioEventLoopGroup-2-2] INFO c.a.p.proxyconnection.ProxyConnectionHandler - 连接成功: ogs.google.com:443
2018-11-18 08:45:45.016 [nioEventLoopGroup-4-1] INFO c.a.p.r.DefaultHttpMessageDecoderAdapter - 处理请求 HttpRequest{body='null', method='CONNECT', host='r1---sn-a5meknek.googlevideo.com', port=443, path=r1---sn-a5meknek.googlevideo.com:443}
2018-11-18 08:45:45.139 [nioEventLoopGroup-2-1] INFO c.a.p.proxyconnection.ProxyConnectionHandler - 连接成功: r1---sn-a5meknek.googlevideo.com:443
2018-11-18 08:45:54.703 [nioEventLoopGroup-4-1] INFO c.a.p.r.DefaultHttpMessageDecoderAdapter - 处理请求 HttpRequest{body='null', method='CONNECT', host='www.google.co.jp', port=443, path=www.google.co.jp:443}
2018-11-18 08:45:54.754 [nioEventLoopGroup-2-1] INFO c.a.p.proxyconnection.ProxyConnectionHandler - 连接成功: www.google.co.jp:443
```



Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
public class ClientProxyBootStrap {

private static Logger logger= LoggerFactory.getLogger(ClientProxyBootStrap.class);
private static int port=8081;
private static int clientPort =8081;
public static int serverPort =8081;
public static String serverHost ="127.0.0.1";
public static boolean crypto=true;

public final static EventLoopGroup REMOTEWORKER =new NioEventLoopGroup(4);
Expand All @@ -38,12 +40,19 @@ public static void main(String[] args){
ClientProxyBootStrap.crypto =false;
}
logger.info("当前代理是否进行加密: "+ClientProxyBootStrap.crypto);

String port=prop.getProperty("client.port", "8080");
String clientPort=prop.getProperty("client.port", "8081");
try {
ClientProxyBootStrap.clientPort =Integer.parseInt(clientPort);
}catch (Exception e){
logger.error("解析client.port配置失败,设置为默认端口:"+ClientProxyBootStrap.clientPort);
}
String serverhost=prop.getProperty("server.host","127.0.0.1");
ClientProxyBootStrap.serverHost =serverhost;
String serverport=prop.getProperty("server.port","8080");
try {
ClientProxyBootStrap.port =Integer.parseInt(port);
ClientProxyBootStrap.serverPort =Integer.parseInt(serverport);
}catch (Exception e){
logger.error("解析server.port配置失败,设置为默认端口:"+ClientProxyBootStrap.port);
logger.error("server.port配置失败,设置为默认端口:"+ClientProxyBootStrap.serverPort);
}

try {
Expand All @@ -53,8 +62,8 @@ public static void main(String[] args){
.option(ChannelOption.SO_BACKLOG, 1024)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
.childHandler(MyChannelInitializer.instance);
ChannelFuture future = bootstrap.bind(ClientProxyBootStrap.port).sync();
logger.info("开启代理 端口:"+ClientProxyBootStrap.port);
ChannelFuture future = bootstrap.bind(ClientProxyBootStrap.clientPort).sync();
logger.info("开启代理 端口:"+ClientProxyBootStrap.clientPort);
future.channel().closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new SendBack2ClientHandler());
}
});
ChannelFuture future = bootstrap.connect("127.0.0.1", 8080);
ChannelFuture future = bootstrap.connect(ClientProxyBootStrap.serverHost, ClientProxyBootStrap.serverPort);
future.addListener(ChannelFutureListener -> {
if (future.isSuccess()) {
logger.info("连接成功: 到代理服务器");
Expand Down
2 changes: 2 additions & 0 deletions proxycommon/src/main/resources/proxy.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ crypto=true
crypto.type=SIMPLE
#默认为8080
server.port=8080
#默认为127.0.0.1
server.host=172.105.199.215
#默认为8081
client.port=8081
7 changes: 0 additions & 7 deletions proxyserver/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public ProxyConnectionHandler(SocketChannel channel) {
}

private ProxyConnectionHandler() {
rejectHosts.add("google");
rejectHosts.add("youtube");
rejectHosts.add("facebook");
// rejectHosts.add("google");
// rejectHosts.add("youtube");
// rejectHosts.add("facebook");
}

public void channelRead(ChannelHandlerContext localCtx, Object msg) throws Exception {
Expand Down

0 comments on commit 7c0eaca

Please sign in to comment.