Remote socket address correctly passed

This commit is contained in:
Manevolent
2019-11-26 11:34:30 -07:00
parent 614b3d9d69
commit 28c570f253
2 changed files with 8 additions and 7 deletions
@@ -17,6 +17,7 @@ import org.bouncycastle.math.ec.ECPoint;
import java.io.IOException;
import java.math.BigInteger;
import java.net.*;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
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("ot", "1")); // constant, set to 1
Random r = new Random();
initiv.add(
new CommandSingleParameter(
"ip",
r.nextInt(255) + "." + r.nextInt(255) + "." + r.nextInt(255) + "." +r.nextInt(255)
)
);
InetAddress address = getClient().getRemoteSocketAddress().getAddress();
if (address != null)
initiv.add(new CommandSingleParameter("ip", address.getHostAddress().substring(1)));
return initiv;
}
@@ -415,6 +415,10 @@ public class LocalTeamspeakClientSocket
return (InetSocketAddress) socket.getLocalSocketAddress();
}
public InetSocketAddress getRemoteSocketAddress() {
return remote;
}
@Override
public void close() throws IOException {
socket.close();