IPAddress

sealed class IPAddress : Address(source)

Base abstraction for denoting an ip address

e.g.

"192.168.0.1".toIPAddress()
"http://127.0.0.1:8080".toIPAddress()
"::1".toIPAddress()
"[::1]".toIPAddress()
"http://[::1]:8080".toIPAddress()
"https://uName:pass word@[::1]:8443/some/path".toIPAddress()

ByteArray(4).toIPAddressV4().let { address ->
    assertIs(address)
}
ByteArray(16).toIPAddressV6(scope = "1").let { address ->
    assertIs(address)
    assertIsNot(address)
    println(address)
    // 0:0:0:0:0:0:0:0%1
}

See also

io.matthewnelson.kmp.tor.runtime.core.util.toInetAddress
io.matthewnelson.kmp.tor.runtime.core.util.toIPAddress

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
open class V4 : IPAddress

Holder for an IPv4 address

Link copied to clipboard
open class V6 : IPAddress

Holder for an IPv6 address

Properties

Link copied to clipboard
@JvmField
val value: String

Functions

Link copied to clipboard
fun address(): ByteArray

Returns the raw bytes for this IPAddress in network byte order. Will either be 4 or 16 bytes in length (V4 or V6 respectively).

Link copied to clipboard
fun canonicalHostName(): String

Returns value in its canonicalized hostname form

Link copied to clipboard
operator override fun compareTo(other: Address): Int
Link copied to clipboard
@JvmName(name = "inetAddressOf")
fun IPAddress.toInetAddress(): InetAddress
Link copied to clipboard
@JvmStatic
@JvmName(name = "unmapFrom")
fun IPAddress.unmappingFrom(): AddressMapping

Creates a AddressMapping that instruct tor to unmap any addresses associated with the provided IPAddress.