mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
feat(pmtud/tcp): support mixed IPv4 and IPv6 TCP servers
- Add default cloudflare and google tls ipv6 servers to default tcp servers - update integration test to try against both ipv4 and ipv6 servers
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package ip
|
||||
|
||||
import (
|
||||
"net/netip"
|
||||
"slices"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/pmtud/constants"
|
||||
)
|
||||
|
||||
func GetFamilies(dsts []netip.AddrPort) (families []int) {
|
||||
const maxFamilies = 2
|
||||
families = make([]int, 0, maxFamilies)
|
||||
for _, dst := range dsts {
|
||||
family := GetFamily(dst)
|
||||
if !slices.Contains(families, family) {
|
||||
families = append(families, family)
|
||||
}
|
||||
}
|
||||
return families
|
||||
}
|
||||
|
||||
func GetFamily(dst netip.AddrPort) int {
|
||||
if dst.Addr().Is4() {
|
||||
return constants.AF_INET
|
||||
}
|
||||
return constants.AF_INET6
|
||||
}
|
||||
Reference in New Issue
Block a user