Skip to content

Commit

Permalink
2016.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
wntr committed Jan 8, 2016
1 parent b3a8d8c commit 5ef350a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
<classpathentry kind="lib" path="lib/pcap4j-core.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.6.6.jar"/>
<classpathentry kind="lib" path="lib/pcap4j-packetfactory-static.jar"/>
<classpathentry kind="lib" path="lib/slf4j-nop-1.6.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/bin/
/client_config.json
/port_map.json
Binary file added lib/slf4j-nop-1.6.1.jar
Binary file not shown.
7 changes: 5 additions & 2 deletions src/net/fs/cap/CapEnv.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ PromiscuousMode getMode(PcapNetworkInterface pi){
void initInterface() throws Exception{
detectInterface();
List<PcapNetworkInterface> allDevs = Pcaps.findAllDevs();
MLog.println("网络接口列表10: ");
MLog.println("Network Interface List: ");
for(PcapNetworkInterface pi:allDevs){
String desString="";
if(pi.getDescription()!=null){
Expand All @@ -213,9 +213,10 @@ void initInterface() throws Exception{
if(nif.getDescription()!=null){
desString=nif.getDescription();
}
MLog.info("自动选择网络接口:\n"+" "+desString+" "+nif.getName());
MLog.info("Selected Network Interface:\n"+" "+desString+" "+nif.getName());
}else {
tcpEnable=false;
MLog.info("Select Network Interface failed,can't use TCP protocal!\n");
}
if(tcpEnable){
sendHandle = nif.openLive(SNAPLEN,getMode(nif), READ_TIMEOUT);
Expand Down Expand Up @@ -251,6 +252,8 @@ public void run(){
};
thread.start();
}

MLog.info("FinalSpeed server start success.");

}

Expand Down
20 changes: 18 additions & 2 deletions src/net/fs/server/FSServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.BindException;

import net.fs.rudp.ConnectionProcessor;
import net.fs.rudp.Route;
Expand All @@ -30,15 +31,26 @@ public class FSServer {

boolean success_firewall_windows=true;

public static void main(String[] args) throws Exception {
FSServer fs = new FSServer();
public static void main(String[] args) {
try {
FSServer fs = new FSServer();
} catch (Exception e) {
e.printStackTrace();
if(e instanceof BindException){
MLog.println("Udp port already in use.");
}
MLog.println("Start failed.");
System.exit(0);
}
}

static FSServer get() {
return udpServer;
}

public FSServer() throws Exception {
MLog.info("");
MLog.info("FinalSpeed server starting... ");
MLog.info("System Name: " + systemName);
udpServer = this;
final MapTunnelProcessor mp = new MapTunnelProcessor();
Expand Down Expand Up @@ -395,4 +407,8 @@ String readFileData(String path) {
return content;
}

public int getRoutePort() {
return routePort;
}

}

0 comments on commit 5ef350a

Please sign in to comment.