Updated IPv6 to support mapping IPv4 if permitted

connection_type_change
Robinson 2022-05-24 23:32:32 +02:00
parent abbbd5c37c
commit 6d1eaeecd2
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ object Inet6 {
* @return [Inet6Address] representation of the [ip] or [null] if not a valid IP address.
*/
fun toAddress(ip: String, ipv4Mapped: Boolean = true): Inet6Address? {
return if (IPv6.isValid(ip)) {
return if (IPv6.isValid(ip) || (ipv4Mapped && IPv4.isValid(ip))) {
IPv6.toAddress(ip, ipv4Mapped)
} else {
// maybe this is a host name and not an IP address?