V1.0
This commit is contained in:
@@ -5,16 +5,20 @@ import java.io.BufferedOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.naming.spi.Resolver;
|
||||
import javax.swing.JPanel;
|
||||
@@ -71,7 +75,7 @@ public class Tunnel{
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return getIpport().getIp().getHostAddress();
|
||||
return getIpport().getIp();
|
||||
}
|
||||
public int getPort() {
|
||||
return getIpport().getPort();
|
||||
@@ -83,7 +87,8 @@ public class Tunnel{
|
||||
}
|
||||
public Socket connectClientSocket() throws UnknownHostException, IOException {
|
||||
Socket socket=new Socket();
|
||||
socket.connect(getIpport().getSocketAddress(), 10000);
|
||||
// socket.bind(new InetSocketAddress(new Random().nextInt(65535)+1));
|
||||
socket.connect(getIpport().getSocketAddress(), Consts.CONNECT_TIMEOUT);
|
||||
return socket;
|
||||
}
|
||||
|
||||
@@ -114,5 +119,28 @@ public class Tunnel{
|
||||
this.ipport = ipport;
|
||||
}
|
||||
|
||||
private Vector<RemoteTCPConnection >rtcs=new Vector<>();
|
||||
|
||||
public Vector<RemoteTCPConnection> getRtcs() {
|
||||
return rtcs;
|
||||
}
|
||||
|
||||
AtomicLong om=new AtomicLong(0);
|
||||
AtomicLong im=new AtomicLong(0);
|
||||
|
||||
long om1=0;
|
||||
long im1=0;
|
||||
|
||||
|
||||
public AtomicLong getOM() {
|
||||
return om;
|
||||
}
|
||||
public AtomicLong getIM() {
|
||||
return im;
|
||||
}
|
||||
public void updateTraffics(long timems) {
|
||||
tlr.setTraffic(om.get(), im.get(), om.get()-om1, im.get()-im1);
|
||||
om1=om.get();
|
||||
im1=im.get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user