Fix to support IPv6 addresses
Return the correct address family
Add tests
Merge pull request #46 from aw/ipv6-support

Add IPv6 support