Fix to work with IPv6

Previously using localhost as 127.0.0.1 failed with relays from the IPv6
localhost (::1). I have suggested use of 'localhost' and have changed some
others to be IPv6 aware