- Use net_set_address API function to set IPv6 address.

This commit is contained in:
Juha Heinanen
2019-11-03 11:46:17 +02:00
parent a47ca666f4
commit 91717628f9
6 changed files with 109 additions and 58 deletions
@@ -6,6 +6,7 @@ import android.content.Context
import android.support.v7.app.AlertDialog
import android.content.Intent
import android.content.pm.PackageManager
import android.net.LinkAddress
import android.os.Bundle
import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat
@@ -227,6 +228,22 @@ object Utils {
return true
}
fun findIpV6Address(list: List<LinkAddress>): String {
for (la in list)
if (la.scope == android.system.OsConstants.RT_SCOPE_UNIVERSE)
if (checkIpV6(la.address.hostAddress))
return la.address.hostAddress
return ""
}
fun findIpV4Address(list: List<LinkAddress>): String {
for (la in list)
if (la.scope == android.system.OsConstants.RT_SCOPE_UNIVERSE)
if (checkIpV4(la.address.hostAddress))
return la.address.hostAddress
return ""
}
fun implode(list: List<String>, sep: String): String {
var res = ""
for (s in list) {