inet: Add function that checks if the hostname is valid