Compare commits

...

12 Commits

Author SHA1 Message Date
Cyril Anisimov
3e391a0535 Make XRay port changable 2024-08-18 15:28:02 +02:00
pokamest
8fefae0325 Merge pull request #974 from amnezia-vpn/bugfix/service-is-running
temporarily disabled the running service check
2024-08-14 16:57:45 +01:00
vladimir.kuznetsov
ede633ea03 temporarily disabled the running service check 2024-08-14 19:46:20 +04:00
pokamest
b4469064a2 Merge pull request #967 from amnezia-vpn/refactoring/awg-additional-parameters
update default values of additional awg parameters
2024-08-14 10:07:45 +01:00
pokamest
393e289784 Merge pull request #968 from amnezia-vpn/feature/xray-custom-port
feature/xray custom port
2024-08-12 08:34:13 +01:00
Cyril Anisimov
d18423ee8c Feature/xray custom port (#965)
* add variable port to scripts for xray

* update naming
2024-08-12 08:27:52 +01:00
vladimir.kuznetsov
3fc9edd346 update default values of additional awg parameters 2024-08-12 09:56:00 +04:00
pokamest
1a1f75d873 Merge pull request #920 from sobolevn/patch-1 2024-08-08 16:16:23 +01:00
pokamest
df02e0bf78 Merge pull request #950 from amnezia-vpn/bugfix/awg-page-settings-translations 2024-08-08 16:14:38 +01:00
Garegin Harutyunyan
264d77463d Refactoring/service logging functional (#793) 2024-08-08 16:13:49 +01:00
vladimir.kuznetsov
0a37ffd5e3 added qsTr() for PageProtocolAwgSettings 2024-08-08 09:57:51 +04:00
sobolevn
dc85a99e08 Fix Android section rendering in the README 2024-08-03 13:19:17 +03:00
18 changed files with 71 additions and 34 deletions

View File

@@ -154,9 +154,11 @@ The Android app has the following requirements:
* Android platform SDK 33
* CMake 3.25.0
After you have installed QT, QT Creator, and Android Studio, you need to configure QT Creator correctly. Click in the top menu bar on `QT Creator` -> `Preferences` -> `Devices` and select the tab `Android`.
* set path to JDK 11
* set path to Android SDK ($ANDROID_HOME)
After you have installed QT, QT Creator, and Android Studio, you need to configure QT Creator correctly.
- Click in the top menu bar on `QT Creator` -> `Preferences` -> `Devices` and select the tab `Android`.
- Set path to JDK 11
- Set path to Android SDK (`$ANDROID_HOME`)
In case you get errors regarding missing SDK or 'SDK manager not running', you cannot fix them by correcting the paths. If you have some spare GBs on your disk, you can let QT Creator install all requirements by choosing an empty folder for `Android SDK location` and clicking on `Set Up SDK`. Be aware: This will install a second Android SDK and NDK on your machine! 
Double-check that the right CMake version is configured:  Click on `QT Creator` -> `Preferences` and click on the side menu on `Kits`. Under the center content view's `Kits` tab, you'll find an entry for `CMake Tool`. If the default selected CMake version is lower than 3.25.0, install on your system CMake >= 3.25.0 and choose `System CMake at <path>` from the drop-down list. If this entry is missing, you either have not installed CMake yet or QT Creator hasn't found the path to it. In that case, click in the preferences window on the side menu item `CMake`, then on the tab `Tools` in the center content view, and finally on the button `Add` to set the path to your installed CMake. 

View File

@@ -161,13 +161,15 @@ void AmneziaApplication::init()
m_engine->load(url);
m_systemController->setQmlRoot(m_engine->rootObjects().value(0));
bool enabled = m_settings->isSaveLogs();
#ifndef Q_OS_ANDROID
if (m_settings->isSaveLogs()) {
if (enabled) {
if (!Logger::init()) {
qWarning() << "Initialization of debug subsystem failed";
}
}
#endif
Logger::setServiceLogsEnabled(enabled);
#ifdef Q_OS_WIN
if (m_parser.isSet("a"))

View File

@@ -569,6 +569,7 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential
// Xray vars
vars.append({ { "$XRAY_SITE_NAME", xrayConfig.value(config_key::site).toString(protocols::xray::defaultSite) } });
vars.append({ { "$XRAY_SERVER_PORT", xrayConfig.value(config_key::port).toString(protocols::xray::defaultPort) } });
// Wireguard vars
vars.append({ { "$WIREGUARD_SUBNET_IP",

View File

@@ -99,6 +99,29 @@ void Logger::deInit()
m_file.close();
}
bool Logger::setServiceLogsEnabled(bool enabled) {
#ifdef AMNEZIA_DESKTOP
IpcClient *m_IpcClient = new IpcClient;
if (!m_IpcClient->isSocketConnected()) {
if (!IpcClient::init(m_IpcClient)) {
qWarning() << "Error occurred when init IPC client";
return false;
}
}
if (m_IpcClient->Interface()) {
m_IpcClient->Interface()->setLogsEnabled(enabled);
}
else {
qWarning() << "Error occurred setting up service logs";
return false;
}
#endif
return true;
}
QString Logger::userLogsDir()
{
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/log";
@@ -141,7 +164,9 @@ bool Logger::openLogsFolder()
bool Logger::openServiceLogsFolder()
{
QString path = Utils::systemLogPath();
#ifdef Q_OS_WIN
path = "file:///" + path;
#endif
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
return true;
}
@@ -184,8 +209,7 @@ void Logger::clearServiceLogs()
}
if (m_IpcClient->Interface()) {
m_IpcClient->Interface()->setLogsEnabled(false);
m_IpcClient->Interface()->cleanUp();
m_IpcClient->Interface()->clearLogs();
}
else {
qWarning() << "Error occurred cleaning up service logs";

View File

@@ -26,6 +26,7 @@ public:
static bool init();
static void deInit();
static bool setServiceLogsEnabled(bool enabled);
static bool openLogsFolder();
static bool openServiceLogsFolder();
static QString appLogFileNamePath();

View File

@@ -159,6 +159,7 @@ bool ProtocolProps::defaultPortChangeable(Proto p)
case Proto::Dns: return false;
case Proto::Sftp: return true;
case Proto::Socks5Proxy: return true;
case Proto::Xray: return true;
default: return false;
}
}

View File

@@ -29,7 +29,7 @@ cat > /opt/amnezia/xray/server.json <<EOF
},
"inbounds": [
{
"port": 443,
"port": "$XRAY_SERVER_PORT",
"protocol": "vless",
"settings": {
"clients": [
@@ -44,7 +44,7 @@ cat > /opt/amnezia/xray/server.json <<EOF
"network": "tcp",
"security": "reality",
"realitySettings": {
"dest": "$XRAY_SITE_NAME:443",
"dest": "$XRAY_SITE_NAME:$XRAY_SERVER_PORT",
"serverNames": [
"$XRAY_SITE_NAME"
],

View File

@@ -4,7 +4,7 @@ sudo docker run -d \
--log-driver none \
--restart always \
--cap-add=NET_ADMIN \
-p 443:443/tcp \
-p $XRAY_SERVER_PORT:$XRAY_SERVER_PORT/tcp \
--name $CONTAINER_NAME $CONTAINER_NAME
sudo docker network connect amnezia-dns-net $CONTAINER_NAME

View File

@@ -19,7 +19,7 @@
"vnext": [
{
"address": "$SERVER_IP_ADDRESS",
"port": 443,
"port": "$XRAY_SERVER_PORT",
"users": [
{
"id": "$XRAY_CLIENT_ID",

View File

@@ -226,6 +226,8 @@ void Settings::setSaveLogs(bool enabled)
}
}
#endif
Logger::setServiceLogsEnabled(enabled);
if (enabled) {
setLogEnableDate(QDateTime::currentDateTime());
}

View File

@@ -36,13 +36,13 @@ ConnectionController::ConnectionController(const QSharedPointer<ServersModel> &s
void ConnectionController::openConnection()
{
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
if (!Utils::processIsRunning(Utils::executable(SERVICE_NAME, false), true))
{
emit connectionErrorOccurred(ErrorCode::AmneziaServiceNotRunning);
return;
}
#endif
// #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
// if (!Utils::processIsRunning(Utils::executable(SERVICE_NAME, false), true))
// {
// emit connectionErrorOccurred(ErrorCode::AmneziaServiceNotRunning);
// return;
// }
// #endif
int serverIndex = m_serversModel->getDefaultServerIndex();
QJsonObject serverConfig = m_serversModel->getServerConfig(serverIndex);

View File

@@ -240,9 +240,9 @@ void ImportController::processNativeWireGuardConfig()
auto containerConfig = container.value(ContainerProps::containerTypeToString(DockerContainer::WireGuard)).toObject();
auto protocolConfig = QJsonDocument::fromJson(containerConfig.value(config_key::last_config).toString().toUtf8()).object();
QString junkPacketCount = QString::number(QRandomGenerator::global()->bounded(3, 10));
QString junkPacketMinSize = QString::number(50);
QString junkPacketMaxSize = QString::number(1000);
QString junkPacketCount = QString::number(QRandomGenerator::global()->bounded(2, 5));
QString junkPacketMinSize = QString::number(10);
QString junkPacketMaxSize = QString::number(50);
protocolConfig[config_key::junkPacketCount] = junkPacketCount;
protocolConfig[config_key::junkPacketMinSize] = junkPacketMinSize;
protocolConfig[config_key::junkPacketMaxSize] = junkPacketMaxSize;

View File

@@ -85,9 +85,9 @@ void InstallController::install(DockerContainer container, int port, TransportPr
containerConfig.insert(config_key::transport_proto, ProtocolProps::transportProtoToString(transportProto, protocol));
if (container == DockerContainer::Awg) {
QString junkPacketCount = QString::number(QRandomGenerator::global()->bounded(3, 10));
QString junkPacketMinSize = QString::number(50);
QString junkPacketMaxSize = QString::number(1000);
QString junkPacketCount = QString::number(QRandomGenerator::global()->bounded(2, 5));
QString junkPacketMinSize = QString::number(10);
QString junkPacketMaxSize = QString::number(50);
int s1 = QRandomGenerator::global()->bounded(15, 150);
int s2 = QRandomGenerator::global()->bounded(15, 150);

View File

@@ -143,7 +143,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "Jc - Junk packet count"
headerText: qsTr("Jc - Junk packet count")
textFieldText: junkPacketCount
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -168,7 +168,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "Jmin - Junk packet minimum size"
headerText: qsTr("Jmin - Junk packet minimum size")
textFieldText: junkPacketMinSize
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -189,7 +189,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "Jmax - Junk packet maximum size"
headerText: qsTr("Jmax - Junk packet maximum size")
textFieldText: junkPacketMaxSize
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -210,7 +210,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "S1 - Init packet junk size"
headerText: qsTr("S1 - Init packet junk size")
textFieldText: initPacketJunkSize
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -231,7 +231,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "S2 - Response packet junk size"
headerText: qsTr("S2 - Response packet junk size")
textFieldText: responsePacketJunkSize
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -252,7 +252,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "H1 - Init packet magic header"
headerText: qsTr("H1 - Init packet magic header")
textFieldText: initPacketMagicHeader
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -273,7 +273,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "H2 - Response packet magic header"
headerText: qsTr("H2 - Response packet magic header")
textFieldText: responsePacketMagicHeader
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -294,7 +294,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "H4 - Transport packet magic header"
headerText: qsTr("H4 - Transport packet magic header")
textFieldText: transportPacketMagicHeader
textField.validator: IntValidator { bottom: 0 }
parentFlickable: fl
@@ -316,7 +316,7 @@ PageType {
Layout.topMargin: 16
parentFlickable: fl
headerText: "H3 - Underload packet magic header"
headerText: qsTr("H3 - Underload packet magic header")
textFieldText: underloadPacketMagicHeader
textField.validator: IntValidator { bottom: 0 }

View File

@@ -21,6 +21,7 @@ class IpcInterface
SLOT( void cleanUp() );
SLOT( void setLogsEnabled(bool enabled) );
SLOT( void clearLogs() );
SLOT( bool createTun(const QString &dev, const QString &subnet) );
SLOT( bool deleteTun(const QString &dev) );

View File

@@ -162,6 +162,10 @@ void IpcServer::cleanUp()
Logger::cleanUp();
}
void IpcServer::clearLogs() {
Logger::clearLogs();
}
bool IpcServer::createTun(const QString &dev, const QString &subnet)
{
return Router::createTun(dev, subnet);

View File

@@ -26,6 +26,7 @@ public:
virtual bool checkAndInstallDriver() override;
virtual QStringList getTapList() override;
virtual void cleanUp() override;
virtual void clearLogs() override;
virtual void setLogsEnabled(bool enabled) override;
virtual bool createTun(const QString &dev, const QString &subnet) override;
virtual bool deleteTun(const QString &dev) override;

View File

@@ -46,8 +46,6 @@ int main(int argc, char **argv)
{
Utils::initializePath(Utils::systemLogPath());
Logger::init();
if (argc >= 2) {
qInfo() << "Started as console application";
return runApplication(argc, argv);