Compare commits

...

6 Commits

Author SHA1 Message Date
pokamest 343e6a50df resetIpStack added 2021-12-15 14:53:07 +03:00
pokamest 5aa47d35e7 Version to main screen 2021-12-14 12:50:57 +03:00
pokamest 313ceed1d0 StartPageLogic fix 2021-12-12 14:42:25 +03:00
pokamest ac07d62344 ui fixes 2021-12-11 14:44:24 +03:00
pokamest 2db1bbae4b WireGuard server script fix 2021-12-10 15:43:43 +03:00
pokamest 4eef127744 VPN modes ui fix 2021-12-04 19:48:47 +03:00
16 changed files with 83 additions and 17 deletions
+2 -6
View File
@@ -38,13 +38,9 @@ apply plugin: 'kotlinx-serialization'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'com.android.installreferrer:installreferrer:2.2'
implementation 'com.android.billingclient:billing-ktx:4.0.0'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0-alpha02"
implementation "androidx.security:security-crypto:1.1.0-alpha03"
implementation "androidx.security:security-identity-credential:1.0.0-alpha02"
implementation 'com.adjust.sdk:adjust-android:4.28.2'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.0.10"
}
@@ -106,8 +102,8 @@ android {
resConfig "en"
minSdkVersion = 24
targetSdkVersion = 30
versionCode 2 // Change to a higher number
versionName "2.0.1" // Change to a higher number
versionCode 5 // Change to a higher number
versionName "2.0.5" // Change to a higher number
}
buildTypes {
+2 -2
View File
@@ -4,7 +4,7 @@
#define APPLICATION_NAME "AmneziaVPN"
#define SERVICE_NAME "AmneziaVPN-service"
#define ORGANIZATION_NAME "AmneziaVPN.ORG"
#define APP_MAJOR_VERSION "2.0.1"
#define APP_VERSION "2.0.1.0"
#define APP_MAJOR_VERSION "2.0.5"
#define APP_VERSION "2.0.5.0"
#endif // DEFINES_H
+2 -2
View File
@@ -17,9 +17,9 @@ iptables -A FORWARD -i wg0 -j ACCEPT
iptables -A OUTPUT -o wg0 -j ACCEPT
# Allow forwarding traffic only from the VPN.
iptables -A FORWARD -i wg0 -o eth0 -s $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_MASK_CIDR -j ACCEPT
iptables -A FORWARD -i wg0 -o eth0 -s $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -s $WIREGUARD_SUBNET_IP/$OPENVPN_SUBNET_CIDR -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR -o eth0 -j MASQUERADE
tail -f /dev/null
+1
View File
@@ -167,6 +167,7 @@ void StartPageLogic::onPushButtonImport()
m_settings.addServer(o);
m_settings.setDefaultServer(m_settings.serversCount() - 1);
emit uiLogic()->goToPage(Page::Vpn);
emit uiLogic()->setStartPage(Page::Vpn);
}
else {
+14 -2
View File
@@ -4,6 +4,7 @@
#include "vpnconnection.h"
#include <functional>
#include "../uilogic.h"
#include "defines.h"
VpnLogic::VpnLogic(UiLogic *logic, QObject *parent):
@@ -13,7 +14,6 @@ VpnLogic::VpnLogic(UiLogic *logic, QObject *parent):
m_radioButtonVpnModeAllSitesChecked{true},
m_radioButtonVpnModeForwardSitesChecked{false},
m_radioButtonVpnModeExceptSitesChecked{false},
m_pushButtonVpnAddSiteEnabled{true},
m_labelSpeedReceivedText{tr("0 Mbps")},
m_labelSpeedSentText{tr("0 Mbps")},
@@ -42,7 +42,6 @@ void VpnLogic::onUpdatePage()
set_radioButtonVpnModeAllSitesChecked(mode == Settings::VpnAllSites);
set_radioButtonVpnModeForwardSitesChecked(mode == Settings::VpnOnlyForwardSites);
set_radioButtonVpnModeExceptSitesChecked(mode == Settings::VpnAllExceptSites);
set_pushButtonVpnAddSiteEnabled(mode != Settings::VpnAllSites);
const QJsonObject &server = uiLogic()->m_settings.defaultServer();
QString serverString = QString("%2 (%3)")
@@ -53,22 +52,35 @@ void VpnLogic::onUpdatePage()
DockerContainer selectedContainer = m_settings.defaultContainer(m_settings.defaultServerIndex());
QString selectedContainerName = ContainerProps::containerHumanNames().value(selectedContainer);
set_labelCurrentService(selectedContainerName);
set_isContainerWorkingOnPlatform(ContainerProps::isWorkingOnPlatform(selectedContainer));
if (!isContainerWorkingOnPlatform()) {
set_labelErrorText(tr("AmneziaVPN not supporting selected protocol on this device. Select another protocol."));
}
else {
set_labelErrorText("");
}
QString ver = QString("v. %2").arg(QString(APP_MAJOR_VERSION));
set_labelVersionText(ver);
}
void VpnLogic::onRadioButtonVpnModeAllSitesClicked()
{
m_settings.setRouteMode(Settings::VpnAllSites);
onUpdatePage();
}
void VpnLogic::onRadioButtonVpnModeForwardSitesClicked()
{
m_settings.setRouteMode(Settings::VpnOnlyForwardSites);
onUpdatePage();
}
void VpnLogic::onRadioButtonVpnModeExceptSitesClicked()
{
m_settings.setRouteMode(Settings::VpnAllExceptSites);
onUpdatePage();
}
void VpnLogic::onBytesChanged(quint64 receivedData, quint64 sentData)
+3 -1
View File
@@ -19,8 +19,10 @@ class VpnLogic : public PageLogicBase
AUTO_PROPERTY(bool, pushButtonConnectEnabled)
AUTO_PROPERTY(bool, pushButtonConnectVisible)
AUTO_PROPERTY(bool, widgetVpnModeEnabled)
AUTO_PROPERTY(bool, isContainerWorkingOnPlatform)
AUTO_PROPERTY(QString, labelErrorText)
AUTO_PROPERTY(bool, pushButtonVpnAddSiteEnabled)
AUTO_PROPERTY(QString, labelVersionText)
AUTO_PROPERTY(bool, radioButtonVpnModeAllSitesChecked)
AUTO_PROPERTY(bool, radioButtonVpnModeForwardSitesChecked)
+16 -3
View File
@@ -20,6 +20,16 @@ PageBase {
source: "qrc:/images/background_connected.png"
}
LabelType {
x: 10
y: 5
width: 100
height: 21
text: VpnLogic.labelVersionText
color: "#dddddd"
font.pixelSize: 12
}
ImageButtonType {
x: parent.width - 40
y: 10
@@ -61,7 +71,7 @@ PageBase {
}
contentItem: Item {}
antialiasing: true
enabled: VpnLogic.pushButtonConnectEnabled
enabled: VpnLogic.pushButtonConnectEnabled && VpnLogic.isContainerWorkingOnPlatform
opacity: VpnLogic.pushButtonConnectVisible ? 1 : 0
// transitions: Transition {
@@ -141,11 +151,14 @@ PageBase {
id: error_text
anchors.top: layout2.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
anchors.topMargin: 20
width: parent.width - 20
height: 21
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: VpnLogic.labelErrorText
color: "red"
}
Item {
@@ -273,7 +286,7 @@ PageBase {
width: parent.width - 40
height: GC.isMobile() ? 0: 40
text: qsTr("+ Add site")
enabled: VpnLogic.pushButtonVpnAddSiteEnabled
enabled: ! VpnLogic.radioButtonVpnModeAllSitesChecked
background: Rectangle {
anchors.fill: parent
radius: 4
@@ -36,7 +36,7 @@ PageShareProtocolBase {
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: parent.bottom
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
+1
View File
@@ -47,6 +47,7 @@ void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState sta
{
if (IpcClient::Interface()) {
if (state == VpnProtocol::Connected){
IpcClient::Interface()->resetIpStack();
IpcClient::Interface()->flushDns();
if (m_settings.routeMode() != Settings::VpnAllSites) {
+1
View File
@@ -11,6 +11,7 @@ class IpcInterface
SLOT( bool clearSavedRoutes() );
SLOT( bool routeDeleteList(const QString &gw, const QStringList &ip) );
SLOT( void flushDns() );
SLOT( void resetIpStack() );
SLOT( bool checkAndInstallDriver() );
SLOT( QStringList getTapList() );
+5
View File
@@ -83,6 +83,11 @@ void IpcServer::flushDns()
return Router::flushDns();
}
void IpcServer::resetIpStack()
{
Router::resetIpStack();
}
bool IpcServer::checkAndInstallDriver()
{
#ifdef Q_OS_WIN
+1
View File
@@ -20,6 +20,7 @@ public:
virtual bool clearSavedRoutes() override;
virtual bool routeDeleteList(const QString &gw, const QStringList &ips) override;
virtual void flushDns() override;
virtual void resetIpStack() override;
virtual bool checkAndInstallDriver() override;
virtual QStringList getTapList() override;
+11
View File
@@ -53,3 +53,14 @@ void Router::flushDns()
#endif
}
void Router::resetIpStack()
{
#ifdef Q_OS_WIN
RouterWin::Instance().resetIpStack();
#elif defined (Q_OS_MAC)
// todo fixme
#elif defined Q_OS_LINUX
// todo fixme
#endif
}
+1
View File
@@ -19,6 +19,7 @@ public:
static bool clearSavedRoutes();
static int routeDeleteList(const QString &gw, const QStringList &ips);
static void flushDns();
static void resetIpStack();
};
#endif // ROUTER_H
+21
View File
@@ -289,6 +289,27 @@ void RouterWin::flushDns()
//qDebug().noquote() << "OUTPUT ipconfig /flushdns: " + p.readAll();
}
void RouterWin::resetIpStack()
{
// {
// QProcess p;
// QString command = QString("ipconfig /release");
// p.start(command);
// }
{
QProcess p;
QString command = QString("netsh int ip reset");
p.start(command);
p.waitForFinished();
}
{
QProcess p;
QString command = QString("netsh winsock reset");
p.start(command);
p.waitForFinished();
}
}
void RouterWin::suspendWcmSvc(bool suspend)
{
if (suspend == m_suspended) return;
+1
View File
@@ -39,6 +39,7 @@ public:
bool clearSavedRoutes();
int routeDeleteList(const QString &gw, const QStringList &ips);
void flushDns();
void resetIpStack();
void suspendWcmSvc(bool suspend);