added comment

This commit is contained in:
xis 2023-10-24 20:30:31 +02:00
parent 66cfe2a6ad
commit 54a0e140f6

View file

@ -47,6 +47,9 @@ class ServerInfoProviderImpl(
} }
} }
// perform fake request to 1.1.1.1:80 just to get the localAddress
// with use of the default routing.
// if it fails, we use the localAddress() which can be wrong
private fun guessLocalAddress() = try { private fun guessLocalAddress() = try {
DatagramSocket().use { s -> DatagramSocket().use { s ->
s.connect(InetAddress.getByAddress(byteArrayOf(1, 1, 1, 1)), 80) s.connect(InetAddress.getByAddress(byteArrayOf(1, 1, 1, 1)), 80)