Bigger IRC networks often have multiple servers distributed across the world. They typically use round-robin DNS to distribute the load across these servers. OFTC has reported to us that chat.sr.ht always connects to the same IP address, despite DNS returning multiple AAAA records in randomized order.
After investigation, it appears that
net.LookupIPAddr always returns the records in the same fixed order, undoing the randomization performed by the DNS server. This seems to be caused by Go's implementation of RFC 6724, specifically "Rule 9: Use longest matching prefix". See
Not sure what a solution would look like. Performing the resolution ourselves would require us to re-implement a whole bunch of code, e.g. IPv4 fallback.
An additional complication seems that in-flight DNS requests are grouped together, and this results in the same order re-used for all of these connections: see Go issue #31698.