Skip to content

Commit

Permalink
- fix agentx-server port_redirect_startup bugs
Browse files Browse the repository at this point in the history
- CCA security
- udp support (not fully tested)
- fine tune on some code and comments
  • Loading branch information
ZhangJiupeng committed Oct 18, 2017
1 parent f40c43b commit 0173358
Show file tree
Hide file tree
Showing 36 changed files with 1,362 additions and 382 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

[![Build Status](https://travis-ci.org/ZhangJiupeng/AgentX.svg?branch=master)](https://travis-ci.org/ZhangJiupeng/AgentX)
[![Join Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shadowsocks-java/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)

AgentX is a [Socks5](https://www.ietf.org/rfc/rfc1928.txt) proxy based on [Netty](http://netty.io/), which can be used to bypass the [GFW](https://en.wikipedia.org/wiki/Great_Firewall), support encryption, obfuscation, compression and masquerading in data transmission (allowing flexible configuration of multiple data processes), compatible with [Shadowsocks](https://shadowsocks.org/). It supports traffic monitoring and reserved custom protocol development interface (notice that this project is not the implementation of RFC2741)


### Download
The latest version: 1.2-beta [download](https://github.com/ZhangJiupeng/AgentX/releases)
[![download](https://img.shields.io/github/downloads/zhangjiupeng/agentx/latest/total.svg)](https://github.com/ZhangJiupeng/AgentX/releases)

### Document
[Introduction](https://github.com/ZhangJiupeng/AgentX/wiki/Introduction)
Expand Down
238 changes: 153 additions & 85 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2017 ZhangJiupeng
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -24,54 +9,86 @@
<artifactId>agentx</artifactId>
<packaging>jar</packaging>
<name>agentx</name>
<version>1.2</version>
<url>www.agentx.cc</url>
<description>a flexible socks5 proxy with encryption, compression and disguising support
</description>
<version>1.2.1</version>
<description>a flexible secure-socks5 proxy to bypass the firewalls</description>
<url>http://www.agentx.cc/</url>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<developers>
<developer>
<name>zhangjiupeng</name>
<name>Zhang Jiupeng</name>
<email>jiupeng.zhang@gmail.com</email>
<url>www.zhangjiupeng.com</url>
<url>https://www.zhangjiupeng.com/</url>
</developer>
</developers>

<scm>
<connection>scm:git@github.com:zhangjiupeng/agentx.git</connection>
<developerConnection>scm:git@github.com:zhangjiupeng/agentx.git</developerConnection>
<url>git@github.com:zhangjiupeng/agentx.git</url>
</scm>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<properties>
<!-- Specific Param -->
<!--<JAVA_HOME>C:/Program Files/Java/jdk1.8.0_66</JAVA_HOME>-->
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<!--<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>-->

<build>
<resources>
<resource>
Expand Down Expand Up @@ -99,8 +116,6 @@
<target>1.8</target>
<verbose>true</verbose>
<fork>true</fork>
<!-- Specific Param -->
<!--<executable>${JAVA_HOME}/bin/javac</executable>-->
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Expand All @@ -116,52 +131,85 @@
<compilerVersion>1.8</compilerVersion>
</configuration>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>client</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>cc.agentx.client.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.build.finalName}-client</finalName>
</configuration>
</execution>
<execution>
<id>server</id>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>cc.agentx.server.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.build.finalName}-server</finalName>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>

<!--<plugin>-->
<!--<artifactId>maven-assembly-plugin</artifactId>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>client</id>-->
<!--<phase>package</phase>-->
<!--<goals>-->
<!--<goal>single</goal>-->
<!--</goals>-->
<!--<configuration>-->
<!--<appendAssemblyId>false</appendAssemblyId>-->
<!--<archive>-->
<!--<manifest>-->
<!--<mainClass>cc.agentx.client.Main</mainClass>-->
<!--</manifest>-->
<!--</archive>-->
<!--<descriptorRefs>-->
<!--<descriptorRef>jar-with-dependencies</descriptorRef>-->
<!--</descriptorRefs>-->
<!--<finalName>${project.build.finalName}-client</finalName>-->
<!--</configuration>-->
<!--</execution>-->
<!--<execution>-->
<!--<id>server</id>-->
<!--<phase>package</phase>-->
<!--<goals>-->
<!--<goal>single</goal>-->
<!--</goals>-->
<!--<configuration>-->
<!--<appendAssemblyId>false</appendAssemblyId>-->
<!--<archive>-->
<!--<manifest>-->
<!--<mainClass>cc.agentx.server.Main</mainClass>-->
<!--</manifest>-->
<!--</archive>-->
<!--<descriptorRefs>-->
<!--<descriptorRef>jar-with-dependencies</descriptorRef>-->
<!--</descriptorRefs>-->
<!--<finalName>${project.build.finalName}-server</finalName>-->
<!--</configuration>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
</plugins>
</build>

<distributionManagement>
<snapshotRepository>
<id>oss</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>oss</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
Expand Down Expand Up @@ -190,6 +238,26 @@
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
</dependency>
</dependencies>

</project>
2 changes: 1 addition & 1 deletion src/main/java/cc/agentx/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public final class Constants {
public static final String APP_NAME = "agentx";
public static final String APP_VERSION = "1.2";
public static final String APP_VERSION = "1.3";
public static final String WEB_SERVER_NAME = "agentx-web-console";

private Constants() {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/cc/agentx/client/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package cc.agentx.client;

import cc.agentx.protocol.request.XRequestWrapper;
import cc.agentx.protocol.request.XRequestWrapperFactory;
import cc.agentx.protocol.request.XRequestResolver;
import cc.agentx.protocol.request.XRequestResolverFactory;
import cc.agentx.util.KeyHelper;
import cc.agentx.wrapper.Wrapper;
import cc.agentx.wrapper.WrapperFactory;
Expand Down Expand Up @@ -136,7 +136,7 @@ private static void load() throws Exception {
}

private static void check() throws Exception {
if (!XRequestWrapperFactory.exists(INSTANCE.protocol)) {
if (!XRequestResolverFactory.exists(INSTANCE.protocol)) {
throw new Exception("unknown protocol \"" + INSTANCE.protocol + "\"");
}
if (!INSTANCE.mode.equals("agentx") && !INSTANCE.mode.equals("socks5")) {
Expand Down Expand Up @@ -217,9 +217,9 @@ public Wrapper getWrapper() {
return WrapperFactory.getInstance(wrappers);
}

public XRequestWrapper getXRequestWrapper() {
public XRequestResolver getXRequestResolver() {
try {
return XRequestWrapperFactory.getInstance(protocol);
return XRequestResolverFactory.getInstance(protocol);
} catch (Exception e) {
e.printStackTrace();
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cc/agentx/client/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void startHttpServer() {
return;
}
httpServer.start();
log.info("\tStartup {} at localhost:{}...", Constants.WEB_SERVER_NAME, port);
log.info("\tStartup {} at localhost:{}", Constants.WEB_SERVER_NAME, port);
Configuration.INSTANCE.setConsole("console.agentx.cc", port);
}

Expand Down
12 changes: 0 additions & 12 deletions src/main/java/cc/agentx/client/net/Status.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,4 @@ public class Status {
public static final GlobalTrafficShapingHandler TRAFFIC_HANDLER
= new GlobalTrafficShapingHandler(Executors.newScheduledThreadPool(1), 1000);

public static void lookup() {
new Thread(() -> {
while (true) {
System.out.println("READ: " + TRAFFIC_HANDLER.trafficCounter().cumulativeReadBytes() + " bytes");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
}
Loading

0 comments on commit 0173358

Please sign in to comment.