When randomly choosing IPv4 or IPv6, set IPv6 probability based on IPv6 weight
We can't make 50% of clients use IPv6 until most relays have IPv6. Otherwise, we would overload the IPv6 Guards. Right now, about 25% of Guard consensus weight has IPv6: https://metrics.torproject.org/advbw-ipv6.html
When we are randomly choosing IPv4 or IPv6, we need to set the initial IPv6 probability based on the IPv6 Guard consensus weight. (Or the number of IPv6 bridges, if we're using bridges.)
With IPv4-only, IPv6-only, and DualStack Entry nodes, the formulas are:
IPv4-capable-weight = IPv4-only + DualStack
IPv6-capable-weight = IPv6-only + DualStack
Total-weight = IPv4-only + IPv6-only + DualStack
IPv4-capable-fraction = IPv4-capable-weight / Total-weight
IPv6-capable-fraction = IPv6-capable-weight / Total-weight
IPv4-probability = IPv4-capable-fraction / (IPv4-capable-fraction + IPv6-capable-fraction)
IPv6-probability = IPv6-capable-fraction / (IPv4-capable-fraction + IPv6-capable-fraction)
We should update these probabilities whenever we get a new consensus, new bridge lines, or new bridge descriptors.