bufbuild / httplb

Client-side load balancing for net/http
https://pkg.go.dev/github.com/bufbuild/httplb
Apache License 2.0
48 stars 2 forks source link

Implement address family affinity and prefer IPv4 by default #66

Closed jchadwick-buf closed 6 months ago

jchadwick-buf commented 6 months ago

Implements address family policy. When the policy is set to PreferIPv4 or PreferIPv6, any DNS result that has both IPv4 and IPv6 records will be filtered to only the preferred records; in cases where only IPv4 or IPv6 addresses are present, this has no impact. The default is set to PreferIPv4 to help lower the likelihood of problems due to the fact that httplb lacks some kind of implementation of a "happy eyeballs" algorithm to perform IPv6 fallback.

It winds up being a little tricky to test this, but it's probably worthwhile; right now we can only test the DNS resolver in a fairly limited way (by relying on the fact that resolving an IP address is a no-op.) With this approach, we can test the DNS resolver more-or-less end-to-end.

jchadwick-buf commented 6 months ago

Please update the docs about the default behavior before merging.

I already did do this, and I can't find anywhere else where it's wrong. Am I missing something?

Regardless, I did add more documentation.

jhump commented 6 months ago

I already did do this, and I can't find anywhere else where it's wrong. Am I missing something?

Nope. I left that comment just before you pushed the commit with doc updates. Updates look great! Thanks!