IPv6 fix for ip_as_username

Correctly parse IPv6 addresses and convert them to hex.