From 8e8fbb9413dc670dc075802372bed246d9428949 Mon Sep 17 00:00:00 2001 From: le0m Date: Tue, 3 Oct 2023 00:56:11 +0200 Subject: [PATCH] feat(airvpn): support for AirVPN entry-IP 3 for Wireguard protocol --- internal/provider/airvpn/updater/servers.go | 36 +++++++++++++-------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/internal/provider/airvpn/updater/servers.go b/internal/provider/airvpn/updater/servers.go index ff2e2122b..f7c99ae7e 100644 --- a/internal/provider/airvpn/updater/servers.go +++ b/internal/provider/airvpn/updater/servers.go @@ -20,14 +20,14 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) ( } // every API server model has: - // - Wireguard server using IPv4In1 - // - Wiregard server using IPv6In1 + // - Wireguard server using IPv4In1 and IPv4In3 + // - Wiregard server using IPv6In1 and IPv4In3 // - OpenVPN TCP+UDP+SSH+SSL server with tls-auth using IPv4In1 and IPv6In1 // - OpenVPN TCP+UDP+SSH+SSL server with tls-auth using IPv4In2 and IPv6In2 // - OpenVPN TCP+UDP+SSH+SSL server with tls-crypt using IPv4In3 and IPv6In3 // - OpenVPN TCP+UDP+SSH+SSL server with tls-crypt using IPv6In4 and IPv6In4 - const numberOfServersPerAPIServer = 1 + // Wireguard server using IPv4In1 - 1 + // Wiregard server using IPv6In1 + const numberOfServersPerAPIServer = 2 + // Wireguard server using IPv4In1, IPv4In3 + 2 + // Wiregard server using IPv6In1, IPv4In3 4 + // OpenVPN TCP server with tls-auth using IPv4In3, IPv6In3, IPv4In4, IPv6In4 4 // OpenVPN UDP server with tls-auth using IPv4In3, IPv6In3, IPv4In4, IPv6In4 projectedNumberOfServers := numberOfServersPerAPIServer * len(data.Servers) @@ -56,15 +56,25 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) ( baseWireguardServer.VPN = vpn.Wireguard baseWireguardServer.WgPubKey = "PyLCXAQT8KkM4T+dUsOQfn+Ub3pGxfGlxkIApuig+hk=" - ipv4WireguadServer := baseWireguardServer - ipv4WireguadServer.IPs = []netip.Addr{apiServer.IPv4In1} - ipv4WireguadServer.Hostname = apiServer.CountryCode + ".vpn.airdns.org" - servers = append(servers, ipv4WireguadServer) - - ipv6WireguadServer := baseWireguardServer - ipv6WireguadServer.IPs = []netip.Addr{apiServer.IPv6In1} - ipv6WireguadServer.Hostname = apiServer.CountryCode + ".ipv6.vpn.airdns.org" - servers = append(servers, ipv6WireguadServer) + ipv4In1WireguadServer := baseWireguardServer + ipv4In1WireguadServer.IPs = []netip.Addr{apiServer.IPv4In1} + ipv4In1WireguadServer.Hostname = apiServer.CountryCode + ".vpn.airdns.org" + servers = append(servers, ipv4In1WireguadServer) + + ipv6In1WireguadServer := baseWireguardServer + ipv6In1WireguadServer.IPs = []netip.Addr{apiServer.IPv6In1} + ipv6In1WireguadServer.Hostname = apiServer.CountryCode + ".ipv6.vpn.airdns.org" + servers = append(servers, ipv6In1WireguadServer) + + ipv4In3WireguadServer := baseWireguardServer + ipv4In3WireguadServer.IPs = []netip.Addr{apiServer.IPv4In3} + ipv4In3WireguadServer.Hostname = apiServer.CountryCode + "3.vpn.airdns.org" + servers = append(servers, ipv4In3WireguadServer) + + ipv6In3WireguadServer := baseWireguardServer + ipv6In3WireguadServer.IPs = []netip.Addr{apiServer.IPv6In3} + ipv6In3WireguadServer.Hostname = apiServer.CountryCode + "3.ipv6.vpn.airdns.org" + servers = append(servers, ipv6In3WireguadServer) baseOpenVPNServer := baseServer baseOpenVPNServer.VPN = vpn.OpenVPN