GLib.hostname_is_ip_address

function hostname_is_ip_address(hostname: String): Boolean {
    // Gjs wrapper for g_hostname_is_ip_address()
}
  

Tests if hostname is the string form of an IPv4 or IPv6 address. (Eg, "192.168.0.1".)

Since 2.22

hostname

a hostname (or IP address in string form)

Returns

true if hostname is an IP address