KLALB3.2
This commit is contained in:
@@ -11,11 +11,13 @@ import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -112,15 +114,43 @@ public class KLALBProxySystem {
|
||||
case "KLALBController":
|
||||
JsonElement vase= entry.get("VirtualAddress");
|
||||
//System.out.println(vase);
|
||||
List<InetAddress>daddr=new ArrayList<InetAddress>();
|
||||
JsonElement vdns= entry.get("DNS");
|
||||
if(vdns!=null) {
|
||||
if(vdns instanceof JsonArray) {
|
||||
JsonArray arr=(JsonArray) vdns;
|
||||
for(JsonElement str:arr) {
|
||||
try {
|
||||
daddr.add((Inet6Address) InetAddress.getByName(str.getAsString()));
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
daddr.add((Inet6Address) InetAddress.getByName(vdns.getAsString()));
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(vase!=null) {
|
||||
try {
|
||||
klalbController=new KLALBController((Inet6Address) InetAddress.getByName(vase.getAsString()));
|
||||
klalbController=new KLALBController((Inet6Address) InetAddress.getByName(vase.getAsString()),daddr);
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
klalbController=new KLALBController();
|
||||
klalbController=new KLALBController(daddr);
|
||||
}
|
||||
|
||||
|
||||
JsonElement vasn= entry.get("VirtualASN");
|
||||
if(vasn!=null) {
|
||||
klalbController.getIpv6Router().setASN (Long.parseLong( vasn.getAsString()));
|
||||
}
|
||||
|
||||
|
||||
JsonElement vsne=entry.get("VirtualSocketName");
|
||||
//if(vsne!=null) {
|
||||
MultipurposeSocketAddress.getSocketTypeRegister().put(vsne.getAsString(), klalbController.getSocketType());
|
||||
@@ -280,7 +310,7 @@ public class KLALBProxySystem {
|
||||
if(string.startsWith("SocketBridge")) {
|
||||
return new DefaultSocketBridgeFactory();
|
||||
}else if(string.startsWith("MinecraftSocketBridge")) {
|
||||
return new DefaultMinecraftSocketBridgeFactory(klalbController.getSelf(), Integer.parseInt(string.substring(21)));
|
||||
return new DefaultMinecraftSocketBridgeFactory(klalbController.getSelf().getAddress(), Integer.parseInt(string.substring(21)));
|
||||
}
|
||||
throw new IllegalArgumentException("unknown SocketBridge type:"+string);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user