diff --git a/client/protocols/protocols_defs.h b/client/protocols/protocols_defs.h index ed2ed313..935c828e 100644 --- a/client/protocols/protocols_defs.h +++ b/client/protocols/protocols_defs.h @@ -43,6 +43,7 @@ namespace amnezia constexpr char server_priv_key[] = "server_priv_key"; constexpr char server_pub_key[] = "server_pub_key"; constexpr char psk_key[] = "psk_key"; + constexpr char allowed_ips[] = "allowed_ips"; constexpr char client_ip[] = "client_ip"; // internal ip address @@ -78,6 +79,9 @@ namespace amnezia constexpr char sftp[] = "sftp"; constexpr char awg[] = "awg"; + constexpr char splitTunnelSites[] = "splitTunnelSites"; + constexpr char splitTunnelType[] = "splitTunnelType"; + } namespace protocols diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index de026ce1..527cbcef 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -131,7 +131,7 @@ ImportController - + Scanned %1 of %2. Отсканировано %1 из%2. @@ -2472,6 +2472,11 @@ While it offers a blend of security, stability, and speed, it's essential t AmneziaWG - Special protocol from Amnezia, based on WireGuard. It's fast like WireGuard, but very resistant to blockages. Recommended for regions with high levels of censorship. + + + AmneziaWG - Special protocol from Amnezia, based on WireGuard. It's fast like WireGuard, but very resistant to blockages. Recommended for regions with high levels of censorship. + + IKEv2 - Modern stable protocol, a bit faster than others, restores connection after signal loss. It has native support on the latest versions of Android and iOS. @@ -2648,6 +2653,16 @@ This means that AmneziaWG keeps the fast performance of the original while addin &Randomize colors + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer @@ -2815,7 +2830,7 @@ This means that AmneziaWG keeps the fast performance of the original while addin VpnConnection - + Mbps Mbps diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 77879a50..98801800 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -142,7 +142,7 @@ ImportController - + Scanned %1 of %2. 扫描 %1 of %2. @@ -2952,7 +2952,7 @@ While it offers a blend of security, stability, and speed, it's essential t VpnConnection - + Mbps diff --git a/client/ui/controllers/importController.cpp b/client/ui/controllers/importController.cpp index 08b662ec..044ddb37 100644 --- a/client/ui/controllers/importController.cpp +++ b/client/ui/controllers/importController.cpp @@ -263,6 +263,13 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data) // return QJsonObject(); // } + auto allowedIps = configMap.value("AllowedIPs").split(","); + QJsonArray allowedIpsJsonArray; + for (const auto &allowedIp : allowedIps) { + allowedIpsJsonArray.append(allowedIp); + } + lastConfig[config_key::allowed_ips] = allowedIpsJsonArray; + QString protocolName = "wireguard"; if (!configMap.value(config_key::junkPacketCount).isEmpty() && !configMap.value(config_key::junkPacketMinSize).isEmpty() diff --git a/client/vpnconnection.cpp b/client/vpnconnection.cpp index 46e8be60..c73df444 100644 --- a/client/vpnconnection.cpp +++ b/client/vpnconnection.cpp @@ -329,6 +329,8 @@ void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &crede return; } + appendSplitTunnelingConfig(); + #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) m_vpnProtocol.reset(VpnProtocol::factory(container, m_vpnConfiguration)); if (!m_vpnProtocol) { @@ -363,6 +365,20 @@ void VpnConnection::createProtocolConnections() connect(m_vpnProtocol.data(), SIGNAL(bytesChanged(quint64, quint64)), this, SLOT(onBytesChanged(quint64, quint64))); } +void VpnConnection::appendSplitTunnelingConfig() +{ + auto routeMode = m_settings->routeMode(); + auto sites = m_settings->getVpnIps(routeMode); + + QJsonArray sitesJsonArray; + for (const auto &site : sites) { + sitesJsonArray.append(site); + } + + m_vpnConfiguration.insert(config_key::splitTunnelType, routeMode); + m_vpnConfiguration.insert(config_key::splitTunnelSites, sitesJsonArray); +} + #ifdef Q_OS_ANDROID void VpnConnection::restoreConnection() { diff --git a/client/vpnconnection.h b/client/vpnconnection.h index f6b2343c..45582de5 100644 --- a/client/vpnconnection.h +++ b/client/vpnconnection.h @@ -112,6 +112,8 @@ private: #endif void createProtocolConnections(); + + void appendSplitTunnelingConfig(); }; #endif // VPNCONNECTION_H