feat(ipv6): use ipv6 endpoint IPs if supported

This commit is contained in:
Quentin McGaw
2022-09-12 21:31:37 +00:00
parent dd7630997b
commit 7fdc7de210
35 changed files with 92 additions and 62 deletions

View File

@@ -33,6 +33,7 @@ func GetConnection(provider string,
storage Storage,
selection settings.ServerSelection,
defaults ConnectionDefaults,
ipv6Supported bool,
randSource rand.Source) (
connection models.Connection, err error) {
servers, err := storage.FilterServers(provider, selection)
@@ -47,8 +48,7 @@ func GetConnection(provider string,
connections := make([]models.Connection, 0, len(servers))
for _, server := range servers {
for _, ip := range server.IPs {
if ip.To4() == nil {
// do not use IPv6 connections for now
if !ipv6Supported && ip.To4() == nil {
continue
}