I don’t use IPv6 yet myself, but I understand it is pretty standard to write IPv6 addresses enclosed in square brackets, if they appear in any context that might plausibly support being followed by a port number.
The Consul documentation is not entirely clear on which options might or might not be interpreted that way, but there’s an easy way around that - just enclose every IPv6 address in square brackets, unless doing so actually triggers an error (in which case take the square brackets back out, only in those cases that require them not to be there).
Well, not that interesting… it seems pretty indicative that there’s a particular code path in the auto_config subsystem which is not using suitable address manipulation functions. An easy, if irritating, bug to accidentally include, if writing new code whilst not thinking about IPv6.
OK, maybe it is a bit interesting… I’ve since learned that as far as Go’s standard library is concerned, the square brackets form of IPv6 addresses is not generally supported for standalone addresses - it’s only supported specifically when splitting host:port strings.
Even the IPv6 RFCs are fairly quiet about the square brackets form.
The code in Consul handling this is a bit of a mess - there’s a function that sometimes returns host:port and sometimes only host, and the code in Consul is re-implementing the parsing of the contents of the retry_join option, which is also parsed inside the GitHub - hashicorp/memberlist: Golang package for gossip based membership and failure detection library - meaning you can currently write an IPv6 address inside square brackets in retry_join and have it accepted by one part of Consul but rejected by another! Messy…