Improved ipv6 host parsing

This builds on #7 (thanks for the tests, @soul9) and uses string indexing instead of regexps to handle the host.

I benchmarked it and it's over two orders of magnitude faster, 43/ns op for string indexing versus 6300 ns/op for regexp on my machine.