net.fs.rudp.Route Java Examples
The following examples show how to use
net.fs.rudp.Route.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PortMapManager.java From NSS with Apache License 2.0 | 5 votes |
void listen(final ServerSocket serverSocket){ Route.es.execute(new Runnable() { @Override public void run() { while(true){ try { final Socket socket=serverSocket.accept(); Route.es.execute(new Runnable() { @Override public void run() { int listenPort=serverSocket.getLocalPort(); MapRule mapRule=mapRuleTable.get(listenPort); if(mapRule!=null){ Route route=null; if(mapClient.isUseTcp()){ route=mapClient.route_tcp; }else { route=mapClient.route_udp; } PortMapProcess process=new PortMapProcess(mapClient,route, socket,mapClient.serverAddress,mapClient.serverPort,null, null,mapRule.dst_port); } } }); } catch (IOException e) { e.printStackTrace(); break; } } } }); }
Example #2
Source File: ClientUI.java From NSS with Apache License 2.0 | 5 votes |
void setSpeed(int downloadSpeed, int uploadSpeed) { config.setDownloadSpeed(downloadSpeed); config.setUploadSpeed(uploadSpeed); int s1 = (int) ((float) downloadSpeed * 1.1f); text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s "); int s2 = (int) ((float) uploadSpeed * 1.1f); text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s "); Route.localDownloadSpeed = downloadSpeed; Route.localUploadSpeed = config.uploadSpeed; saveConfig(); }
Example #3
Source File: ClientNoUI.java From NSS with Apache License 2.0 | 5 votes |
ClientNoUI() throws Exception { loadConfig(); Route.localDownloadSpeed=config.downloadSpeed; Route.localUploadSpeed=config.uploadSpeed; //mapClient=new MapClient(config.getSocks5Port(),false); // mapClient.setUi(this); // mapClient.setMapServer(config.getServerAddress(), config.getServerPort(),config.getRemotePort() ,config.getPasswordMd5(),config.getPasswordMd5_Proxy(),config.isDirect_cn(),false,""); }
Example #4
Source File: VDatagramSocket.java From NSS with Apache License 2.0 | 5 votes |
public void send(DatagramPacket p) throws IOException { TCPTun tun=null; if(client){ tun=capEnv.tcpManager.getDefaultTcpTun(); if(tun!=null){ if(!tun.remoteAddress.getHostAddress().equals(p.getAddress().getHostAddress()) ||CapEnv.toUnsigned(tun.remotePort)!=p.getPort()){ capEnv.tcpManager.removeTun(tun); capEnv.tcpManager.setDefaultTcpTun(null); } }else { tryConnectTun_Client(p.getAddress(),(short) p.getPort()); tun=capEnv.tcpManager.getDefaultTcpTun(); } }else { tun=capEnv.tcpManager.getTcpConnection_Server(p.getAddress().getHostAddress(), (short) p.getPort()); } if(tun!=null){ if(tun.preDataReady){ tun.sendData(p.getData()); }else{ throw new IOException("隧道未连接!"); } }else{ throw new IOException("隧道不存在! "+" thread "+Route.es.getActiveCount()+" "+p.getAddress()+":"+p.getPort()); } }
Example #5
Source File: PortMapManager.java From finalspeed-91yun with GNU General Public License v2.0 | 5 votes |
void listen(final ServerSocket serverSocket){ Route.es.execute(new Runnable() { @Override public void run() { while(true){ try { final Socket socket=serverSocket.accept(); Route.es.execute(new Runnable() { @Override public void run() { int listenPort=serverSocket.getLocalPort(); MapRule mapRule=mapRuleTable.get(listenPort); if(mapRule!=null){ Route route=null; if(mapClient.isUseTcp()){ route=mapClient.route_tcp; }else { route=mapClient.route_udp; } PortMapProcess process=new PortMapProcess(mapClient,route, socket,mapClient.serverAddress,mapClient.serverPort,null, null,mapRule.dst_port); } } }); } catch (IOException e) { e.printStackTrace(); break; } } } }); }
Example #6
Source File: ClientUI.java From finalspeed-91yun with GNU General Public License v2.0 | 5 votes |
void setSpeed(int downloadSpeed, int uploadSpeed) { config.setDownloadSpeed(downloadSpeed); config.setUploadSpeed(uploadSpeed); int s1 = (int) ((float) downloadSpeed * 1.1f); text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s "); int s2 = (int) ((float) uploadSpeed * 1.1f); text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s "); Route.localDownloadSpeed = downloadSpeed; Route.localUploadSpeed = config.uploadSpeed; saveConfig(); }
Example #7
Source File: ClientNoUI.java From finalspeed-91yun with GNU General Public License v2.0 | 5 votes |
ClientNoUI(){ loadConfig(); Route.localDownloadSpeed=config.downloadSpeed; Route.localUploadSpeed=config.uploadSpeed; // mapClient=new MapClient(config.getSocks5Port()); // mapClient.setUi(this); // mapClient.setMapServer(config.getServerAddress(), config.getServerPort(),config.getRemotePort() ,config.getPasswordMd5(),config.getPasswordMd5_Proxy(),config.isDirect_cn()); }
Example #8
Source File: MapTunnelProcessor.java From finalspeed-91yun with GNU General Public License v2.0 | 5 votes |
public void process(final ConnectionUDP conn){ this.conn=conn; pc=this; Route.es.execute(new Runnable(){ public void run(){ process(); } }); }
Example #9
Source File: VDatagramSocket.java From finalspeed-91yun with GNU General Public License v2.0 | 5 votes |
public void send(DatagramPacket p) throws IOException { TCPTun tun=null; if(client){ tun=capEnv.tcpManager.getDefaultTcpTun(); if(tun!=null){ if(!tun.remoteAddress.getHostAddress().equals(p.getAddress().getHostAddress()) ||CapEnv.toUnsigned(tun.remotePort)!=p.getPort()){ capEnv.tcpManager.removeTun(tun); capEnv.tcpManager.setDefaultTcpTun(null); } }else { tryConnectTun_Client(p.getAddress(),(short) p.getPort()); tun=capEnv.tcpManager.getDefaultTcpTun(); } }else { tun=capEnv.tcpManager.getTcpConnection_Server(p.getAddress().getHostAddress(), (short) p.getPort()); } if(tun!=null){ if(tun.preDataReady){ tun.sendData(p.getData()); }else{ throw new IOException("隧道未连接!"); } }else{ throw new IOException("隧道不存在! "+" thread "+Route.es.getActiveCount()+" "+p.getAddress()+":"+p.getPort()); } }
Example #10
Source File: PortMapManager.java From finalspeed with GNU General Public License v2.0 | 5 votes |
void listen(final ServerSocket serverSocket) { Route.es.execute(new Runnable() { @Override public void run() { while (true) { try { final Socket socket = serverSocket.accept(); Route.es.execute(new Runnable() { @Override public void run() { int listenPort = serverSocket.getLocalPort(); MapRule mapRule = mapRuleTable.get(listenPort); if (mapRule != null) { Route route; if (mapClient.isUseTcp()) { route = mapClient.route_tcp; } else { route = mapClient.route_udp; } new PortMapProcess(mapClient, route, socket, mapClient.serverAddress, mapClient .serverPort, null, null, mapRule.dst_port); } } }); } catch (IOException e) { e.printStackTrace(); break; } } } }); }
Example #11
Source File: ClientUI.java From finalspeed with GNU General Public License v2.0 | 5 votes |
void setSpeed(int downloadSpeed, int uploadSpeed) { config.setDownloadSpeed(downloadSpeed); config.setUploadSpeed(uploadSpeed); int s1 = (int) ((float) downloadSpeed * 1.1f); text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s "); int s2 = (int) ((float) uploadSpeed * 1.1f); text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s "); Route.localDownloadSpeed = downloadSpeed; Route.localUploadSpeed = config.uploadSpeed; saveConfig(); }
Example #12
Source File: ClientNoUI.java From finalspeed with GNU General Public License v2.0 | 5 votes |
ClientNoUI() { loadConfig(); Route.localDownloadSpeed = config.downloadSpeed; Route.localUploadSpeed = config.uploadSpeed; // mapClient=new MapClient(config.getSocks5Port()); // mapClient.setUi(this); // mapClient.setMapServer(config.getServerAddress(), config.getServerPort(),config.getRemotePort() ,config // .getPasswordMd5(),config.getPasswordMd5_Proxy(),config.isDirect_cn()); }
Example #13
Source File: VDatagramSocket.java From finalspeed with GNU General Public License v2.0 | 5 votes |
public void send(DatagramPacket p) throws IOException { TCPTun tun; if (client) { tun = capEnv.tcpManager.getDefaultTcpTun(); if (tun != null) { if (!tun.remoteAddress.getHostAddress().equals(p.getAddress().getHostAddress()) || CapEnv.toUnsigned(tun.remotePort) != p.getPort()) { capEnv.tcpManager.removeTun(tun); capEnv.tcpManager.setDefaultTcpTun(null); } } else { tryConnectTun_Client(p.getAddress(), (short) p.getPort()); tun = capEnv.tcpManager.getDefaultTcpTun(); } } else { tun = capEnv.tcpManager.getTcpConnection_Server(p.getAddress().getHostAddress(), (short) p.getPort()); } if (tun != null) { if (tun.preDataReady) { tun.sendData(p.getData()); } else { throw new IOException("隧道未连接!"); } } else { throw new IOException("隧道不存在! " + " thread " + Route.es.getActiveCount() + " " + p.getAddress() + ":" + p .getPort()); } }
Example #14
Source File: FSServer.java From NSS with Apache License 2.0 | 4 votes |
public FSServer() throws Exception { MLog.info(""); MLog.info("FinalSpeed server starting... "); MLog.info("System Name: " + systemName); udpServer = this; final MapTunnelProcessor mp = new MapTunnelProcessor(); String port_s = readFileData("./cnf/listen_port"); if (port_s != null && !port_s.trim().equals("")) { port_s = port_s.replaceAll("\n", "").replaceAll("\r", ""); routePort = Integer.parseInt(port_s); } route_udp = new Route(mp.getClass().getName(), (short) routePort, Route.mode_server, false,true); if (systemName.equals("linux")) { startFirewall_linux(); setFireWall_linux_udp(); }else if(systemName.contains("windows")){ startFirewall_windows(); } Route.es.execute(new Runnable() { @Override public void run() { try { route_tcp = new Route(mp.getClass().getName(), (short) routePort, Route.mode_server, true,true); if (systemName.equals("linux")) { setFireWall_linux_tcp(); }else if(systemName.contains("windows")){ if(success_firewall_windows){ setFireWall_windows_tcp(); }else{ System.out.println("启动windows防火墙失败,请先运行防火墙服务."); } } } catch (Exception e) { // e.printStackTrace(); } } }); }
Example #15
Source File: FSServer.java From finalspeed-91yun with GNU General Public License v2.0 | 4 votes |
public FSServer() throws Exception { MLog.info(""); MLog.info("FinalSpeed server starting... "); MLog.info("System Name: " + systemName); udpServer = this; final MapTunnelProcessor mp = new MapTunnelProcessor(); String port_s = readFileData("./cnf/listen_port"); if (port_s != null && !port_s.trim().equals("")) { port_s = port_s.replaceAll("\n", "").replaceAll("\r", ""); routePort = Integer.parseInt(port_s); } route_udp = new Route(mp.getClass().getName(), (short) routePort, Route.mode_server, false,true); if (systemName.equals("linux")) { startFirewall_linux(); setFireWall_linux_udp(); }else if(systemName.contains("windows")){ startFirewall_windows(); } Route.es.execute(new Runnable() { @Override public void run() { try { route_tcp = new Route(mp.getClass().getName(), (short) routePort, Route.mode_server, true,true); if (systemName.equals("linux")) { setFireWall_linux_tcp(); }else if(systemName.contains("windows")){ if(success_firewall_windows){ setFireWall_windows_tcp(); }else{ System.out.println("启动windows防火墙失败,请先运行防火墙服务."); } } } catch (Exception e) { // e.printStackTrace(); } } }); }
Example #16
Source File: FSServer.java From finalspeed with GNU General Public License v2.0 | 4 votes |
public FSServer() throws Exception { MLog.info(""); MLog.info("FinalSpeed server starting... "); MLog.info("System Name: " + systemName); udpServer = this; final MapTunnelProcessor mp = new MapTunnelProcessor(); String port_s = readFileData("./cnf/listen_port"); if (port_s != null && !port_s.trim().equals("")) { port_s = port_s.replaceAll("\n", "").replaceAll("\r", ""); routePort = Integer.parseInt(port_s); } route_udp = new Route(mp.getClass().getName(), (short) routePort, Route.mode_server, false, true); if (systemName.equals("linux")) { startFirewall_linux(); setFireWall_linux_udp(); } else if (systemName.contains("windows")) { startFirewall_windows(); } Route.es.execute(new Runnable() { @Override public void run() { try { route_tcp = new Route(mp.getClass().getName(), (short) routePort, Route.mode_server, true, true); if (systemName.equals("linux")) { setFireWall_linux_tcp(); } else if (systemName.contains("windows")) { if (success_firewall_windows) { setFireWall_windows_tcp(); } else { System.out.println("启动windows防火墙失败,请先运行防火墙服务."); } } } catch (Exception e) { // e.printStackTrace(); } } }); }