Skip to content

Commit

Permalink
修复了Vertx本身的漏洞 eclipse-vertx/vert.x#2470
Browse files Browse the repository at this point in the history
更新的README,现在携带完整的配置文件格式
  • Loading branch information
taikulawo committed Feb 13, 2019
1 parent b180687 commit aac6fe4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 11 deletions.
27 changes: 27 additions & 0 deletions README.md
Expand Up @@ -2,3 +2,30 @@

这是一个具有了相应思想的玩具

总体的配置文件

```
{
"isLocal":"true | false",
"inbounds":[
{
"tl":"tcp | udp",
"tag":"your inbound tag name",
"main":"main class path, package url. com.wwc.Protocol.Socks.InboundHandler",
"name":"protocol name",
"sendto":"which outbound use, use tag here",
"port":6000
}
],
"outbounds":[
{
"tl":"tcp | udp",
"tag":"your outbound tag name",
"main":"main class path, package url. com.wwc.Protocol.Socks.OutboundHandler",
"name":"protocol name"
}
]
}
```

通过指定不同的Inbound和Outbound Class位置来运行时加载
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>3.5.1</version>
<version>[3.5.4,)</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/wwc/Protocol/Outbound.java
Expand Up @@ -22,7 +22,7 @@ default Outbound getInstance(){
}

/**
* 这里的Inbound和Outbound并不一定真的是Inbound,Outbound,又可能是另一个实现了Processable接口的类比如
* 这里的Inbound和Outbound并不一定真的是Inbound,OutboundHandler,又可能是另一个实现了Processable接口的类比如
* InboundHandler,
* Inbound对于每一个连接应该只使用process一次,后面的数据传递应该通过Processable p来进行
* 调用process来向Outbound传递消息,这时Outbound应该保存这三个参数
Expand Down
@@ -0,0 +1,6 @@
package com.wwc.Protocol.Shadowsocks;

public class OutboundHandler {


}
4 changes: 2 additions & 2 deletions src/main/java/com/wwc/Protocol/Socks/InboundHandler.java
Expand Up @@ -123,7 +123,7 @@ private void processStreamStart(){
private void processStreamRunning(Buffer data){
//for socks. we don't need to control package length,
//so in there, we transfer all data we recv from socket.
log.debug("Send to Outbound through process(), size: [{}]",data.length());
log.debug("Send to OutboundHandler through process(), size: [{}]",data.length());
outbound.process(data,dst,this.handler,this);

}
Expand Down Expand Up @@ -204,13 +204,13 @@ private void processAddr(){

private void connectToOutbound(){
String sendTo = (String)inboundConfig.get("sendTo");

try {
outbound = Main.instance.dispatcher.dispatchToOutbound(sendTo);
} catch (Exception e) {
e.printStackTrace();
}


}


Expand Down
Empty file removed src/main/java/com/wwc/README
Empty file.
12 changes: 5 additions & 7 deletions src/main/java/com/wwc/Utils/ConfigManager.java
Expand Up @@ -106,6 +106,10 @@ public SpecConfig getSpecConfig(String tag){
}

public HashMap getSpecOutboundFromTag(String tag){
return getHashMap(tag, outbounds);
}

private HashMap getHashMap(String tag, ArrayList<HashMap<String, Object>> outbounds) {
for(HashMap<String,Object> config : outbounds){
String name = (String)config.get("tag");
if(name.equals(tag)){
Expand All @@ -116,12 +120,6 @@ public HashMap getSpecOutboundFromTag(String tag){
}

public HashMap getSpecInboundFromTag(String tag){
for(HashMap<String,Object> config : inbounds){
String name = (String) config.get("tag");
if(name.equals(tag)){
return config;
}
}
return null;
return getHashMap(tag, inbounds);
}
}

0 comments on commit aac6fe4

Please sign in to comment.