Remote socket address correctly passed
This commit is contained in:
+4
-7
@@ -17,6 +17,7 @@ import org.bouncycastle.math.ec.ECPoint;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.net.*;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
@@ -220,13 +221,9 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
|||||||
initiv.add(new CommandSingleParameter("omega", getClient().getIdentity().getPublicKeyString()));
|
initiv.add(new CommandSingleParameter("omega", getClient().getIdentity().getPublicKeyString()));
|
||||||
initiv.add(new CommandSingleParameter("ot", "1")); // constant, set to 1
|
initiv.add(new CommandSingleParameter("ot", "1")); // constant, set to 1
|
||||||
|
|
||||||
Random r = new Random();
|
InetAddress address = getClient().getRemoteSocketAddress().getAddress();
|
||||||
initiv.add(
|
if (address != null)
|
||||||
new CommandSingleParameter(
|
initiv.add(new CommandSingleParameter("ip", address.getHostAddress().substring(1)));
|
||||||
"ip",
|
|
||||||
r.nextInt(255) + "." + r.nextInt(255) + "." + r.nextInt(255) + "." +r.nextInt(255)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return initiv;
|
return initiv;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -415,6 +415,10 @@ public class LocalTeamspeakClientSocket
|
|||||||
return (InetSocketAddress) socket.getLocalSocketAddress();
|
return (InetSocketAddress) socket.getLocalSocketAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InetSocketAddress getRemoteSocketAddress() {
|
||||||
|
return remote;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
socket.close();
|
socket.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user