Code polish

This commit is contained in:
nathan 2020-09-08 23:53:45 +02:00
parent 8669cab86c
commit 89141a11f9
1 changed files with 1 additions and 2 deletions

View File

@ -197,7 +197,7 @@ object IP {
*/ */
fun toString(ip: InetAddress, ipv4Mapped: Boolean = false): String { fun toString(ip: InetAddress, ipv4Mapped: Boolean = false): String {
if (ip is Inet4Address) { if (ip is Inet4Address) {
return ip.getHostAddress() return IPv4.toString(ip)
} }
require(ip is Inet6Address) { "Unhandled type: $ip" } require(ip is Inet6Address) { "Unhandled type: $ip" }
@ -208,7 +208,6 @@ object IP {
/** /**
* Returns the [String] representation of an [InetSocketAddress]. * Returns the [String] representation of an [InetSocketAddress].
* *
*
* The output does not include Scope ID. * The output does not include Scope ID.
* @param addr [InetSocketAddress] to be converted to an address string * @param addr [InetSocketAddress] to be converted to an address string
* @return `String` containing the text-formatted IP address * @return `String` containing the text-formatted IP address