diff --git a/.classpath b/.classpath index 7e936d5..2df5523 100644 --- a/.classpath +++ b/.classpath @@ -8,5 +8,6 @@ + diff --git a/.gitignore b/.gitignore index ae3c172..1074ba5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /bin/ +/client_config.json +/port_map.json diff --git a/lib/slf4j-nop-1.6.1.jar b/lib/slf4j-nop-1.6.1.jar new file mode 100644 index 0000000..b7bd5aa Binary files /dev/null and b/lib/slf4j-nop-1.6.1.jar differ diff --git a/src/net/fs/cap/CapEnv.java b/src/net/fs/cap/CapEnv.java index 882ac93..98da8c3 100644 --- a/src/net/fs/cap/CapEnv.java +++ b/src/net/fs/cap/CapEnv.java @@ -195,7 +195,7 @@ PromiscuousMode getMode(PcapNetworkInterface pi){ void initInterface() throws Exception{ detectInterface(); List allDevs = Pcaps.findAllDevs(); - MLog.println("网络接口列表10: "); + MLog.println("Network Interface List: "); for(PcapNetworkInterface pi:allDevs){ String desString=""; if(pi.getDescription()!=null){ @@ -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); @@ -251,6 +252,8 @@ public void run(){ }; thread.start(); } + + MLog.info("FinalSpeed server start success."); } diff --git a/src/net/fs/server/FSServer.java b/src/net/fs/server/FSServer.java index 4c14f9c..1649883 100644 --- a/src/net/fs/server/FSServer.java +++ b/src/net/fs/server/FSServer.java @@ -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; @@ -30,8 +31,17 @@ 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() { @@ -39,6 +49,8 @@ static FSServer get() { } public FSServer() throws Exception { + MLog.info(""); + MLog.info("FinalSpeed server starting... "); MLog.info("System Name: " + systemName); udpServer = this; final MapTunnelProcessor mp = new MapTunnelProcessor(); @@ -395,4 +407,8 @@ String readFileData(String path) { return content; } + public int getRoutePort() { + return routePort; + } + }