diff --git a/.gitmodules b/.gitmodules
index ac846a0328..1b738cf6b7 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -5,3 +5,6 @@
[submodule "external/quirc"]
path = external/quirc
url = https://github.com/dlbeer/quirc/
+[submodule "external/i2pd"]
+ path = external/i2pd
+ url = https://github.com/PurpleI2P/i2pd
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index e711b63561..245b6180e2 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -1,3 +1,5 @@
+file(GLOB I2PD_SOURCES "i2pd/daemon/*.cpp" "i2pd/libi2pd/*.cpp" "i2pd/libi2pd_client/*.cpp" "i2pd/i18n/*.cpp")
+
add_library(quirc STATIC
quirc/lib/decode.c
quirc/lib/identify.c
@@ -6,3 +8,9 @@ add_library(quirc STATIC
)
set_target_properties(quirc PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(quirc PUBLIC quirc/lib)
+
+add_library(i2pd STATIC
+ ${I2PD_SOURCES}
+)
+set_target_properties(i2pd PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(i2pd PUBLIC i2pd/daemon i2pd/libi2pd i2pd/libi2pd_client i2pd/i18n)
\ No newline at end of file
diff --git a/external/i2pd b/external/i2pd
new file mode 160000
index 0000000000..41dd8b527d
--- /dev/null
+++ b/external/i2pd
@@ -0,0 +1 @@
+Subproject commit 41dd8b527d93d6001960652de2b2f06299346c11
diff --git a/main.qml b/main.qml
index 98fb43c01d..51c880f373 100644
--- a/main.qml
+++ b/main.qml
@@ -714,6 +714,39 @@ ApplicationWindow {
// Pause refresh while starting daemon
currentWallet.pauseRefresh();
+ if (persistentSettings.protectConnectionMode > 0) {
+ var defaultArgs = ["--detach","--data-dir","--bootstrap-daemon-address","--prune-blockchain","--no-sync","--check-updates","--non-interactive","--max-concurrency","--tx-proxy=i2p,127.0.0.1:4447"]
+ var customDaemonArgsArray = flags.split(' ');
+ var flag = "";
+ var allArgs = [];
+ var i2pdArgs = ["--tx-proxy i2p,127.0.0.1:4447"];
+ //create an array (allArgs) of ['--arg value','--arg2','--arg3']
+ for (let i = 0; i < customDaemonArgsArray.length; i++) {
+ if(!customDaemonArgsArray[i].startsWith("--")) {
+ flag += " " + customDaemonArgsArray[i]
+ } else {
+ if(flag){
+ allArgs.push(flag)
+ }
+ flag = customDaemonArgsArray[i]
+ }
+ }
+ allArgs.push(flag)
+ //pop from allArgs if value is inside the deleteme array (defaultArgs)
+ allArgs = allArgs.filter( ( el ) => !defaultArgs.includes( el.split(" ")[0] ) )
+ //append required i2pd flags
+ for (let i = 0; i < i2pdArgs.length; i++) {
+ if(!allArgs.includes(i2pdArgs[i])) {
+ allArgs.push(i2pdArgs[i])
+ continue
+ }
+ }
+
+ flags = allArgs.join(" ");
+
+ i2pdManager.start();
+ }
+
const noSync = appWindow.walletMode === 0;
const bootstrapNodeAddress = persistentSettings.walletMode < 2 ? "auto" : persistentSettings.bootstrapNodeAddress
daemonManager.start(flags, persistentSettings.nettype, persistentSettings.blockchainDataDir, bootstrapNodeAddress, noSync, persistentSettings.pruneBlockchain);
@@ -730,6 +763,9 @@ ApplicationWindow {
if (splash) {
hideProcessingSplash();
}
+ if (persistentSettings.protectConnectionMode > 0) {
+ i2pdManager.stop();
+ }
callback(result);
});
}
@@ -1450,6 +1486,8 @@ ApplicationWindow {
property string proxyAddress: "127.0.0.1:9050"
property bool proxyEnabled: isTails
+
+ property int protectConnectionMode: 0
function getProxyAddress() {
if ((socksProxyFlagSet && socksProxyFlag == "") || !proxyEnabled) {
return "";
@@ -2176,6 +2214,7 @@ ApplicationWindow {
// Close wallet non async on exit
daemonManager.exit();
p2poolManager.exit();
+ i2pdManager.exit();
closeWallet(Qt.quit);
}
diff --git a/pages/settings/Settings.qml b/pages/settings/Settings.qml
index 17457f98f2..f83fd6f669 100644
--- a/pages/settings/Settings.qml
+++ b/pages/settings/Settings.qml
@@ -81,6 +81,11 @@ ColumnLayout {
text: qsTr("Info") + translationManager.emptyString
onSelected: settingsStateView.state = "Info"
}
+ MoneroComponents.NavbarItem {
+ active: settingsStateView.state == "Network"
+ text: qsTr("Network") + translationManager.emptyString
+ onSelected: settingsStateView.state = "Network"
+ }
}
Rectangle{
@@ -92,6 +97,7 @@ ColumnLayout {
property SettingsNode settingsNodeView: SettingsNode { }
property SettingsLog settingsLogView: SettingsLog { }
property SettingsInfo settingsInfoView: SettingsInfo { }
+ property SettingsNetwork settingsNetworkView: SettingsNetwork { }
Layout.fillWidth: true
Layout.preferredHeight: settingsHeight
color: "transparent"
@@ -133,6 +139,10 @@ ColumnLayout {
name: "Info"
PropertyChanges { target: settingsStateView; currentView: settingsStateView.settingsInfoView }
PropertyChanges { target: settingsPage; settingsHeight: settingsStateView.settingsInfoView.infoHeight + 140 }
+ }, State {
+ name: "Network"
+ PropertyChanges { target: settingsStateView; currentView: settingsStateView.settingsNetworkView }
+ PropertyChanges { target: settingsPage; settingsHeight: settingsStateView.settingsNetworkView.networkHeight + 140 }
}
]
diff --git a/pages/settings/SettingsNetwork.qml b/pages/settings/SettingsNetwork.qml
new file mode 100644
index 0000000000..90698582e1
--- /dev/null
+++ b/pages/settings/SettingsNetwork.qml
@@ -0,0 +1,141 @@
+// Copyright (c) 2014-2024, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import QtQuick 2.9
+import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.0
+import QtQuick.Dialogs 1.2
+
+import moneroComponents.I2PDManager 1.0
+import moneroComponents.DaemonManager 1.0
+
+import "../../components" as MoneroComponents
+
+Rectangle {
+ color: "transparent"
+ Layout.fillWidth: true
+ property alias networkHeight: networkLayout.height
+
+ ColumnLayout {
+ id: networkLayout
+ Layout.fillWidth: true
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.margins: 20
+ anchors.topMargin: 0
+ spacing: 30
+
+ MoneroComponents.Label {
+ id: networkTitleLabel
+ fontSize: 24
+ text: qsTr("Network traffic protection") + translationManager.emptyString
+ }
+
+ MoneroComponents.TextPlain {
+ id: networkMainLabel
+ text: qsTr("Your wallet communicates with a set node and other nodes on the\nMonero network. This communication can be used to identify you.\nUse the options below to protect your privacy. Please check your\nlocal laws and internet policies before protecting your connection\nusing i2p, an anonymizing software.") + translationManager.emptyString
+ wrapMode: Text.Wrap
+ Layout.fillWidth: true
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 14
+ color: MoneroComponents.Style.defaultFontColor
+ }
+
+ ColumnLayout {
+ id: modeButtonsColumn
+ Layout.topMargin: 8
+
+ MoneroComponents.RadioButton {
+ id: handleProtectButton
+ text: qsTr("Protect my network connection") + translationManager.emptyString
+ fontSize: 16
+ enabled: !checked
+ checked: persistentSettings.protectConnectionMode > 0
+ onClicked: {
+ handleProtectButton.checked = true;
+ handleUnprotectButton.checked = false;
+ persistentSettings.protectConnectionMode = 1;
+ startI2PD();
+ }
+ }
+
+ MoneroComponents.RadioButton {
+ id: handleUnprotectButton
+ text: qsTr("Do not protect my connection") + translationManager.emptyString
+ fontSize: 16
+ enabled: !checked
+ checked: persistentSettings.protectConnectionMode === 0
+ onClicked: {
+ handleUnprotectButton.checked = true;
+ handleProtectButton.checked = false;
+ persistentSettings.protectConnectionMode = 0;
+ stopI2PD();
+ }
+ }
+ }
+
+ RowLayout
+ {
+ MoneroComponents.Label {
+ id: networkProtectionStatusLabel
+ fontSize: 20
+ text: qsTr("Status: ") + translationManager.emptyString
+ }
+
+ MoneroComponents.Label {
+ id: networkProtectionStatus
+ fontSize: 20
+ text: qsTr("Unprotected") + translationManager.emptyString
+ }
+ }
+ }
+
+ function startI2PD()
+ {
+ appWindow.stopDaemon(function() {
+ appWindow.startDaemon("")
+ });
+ }
+
+ function stopI2PD()
+ {
+ appWindow.stopDaemon(function() {
+ appWindow.startDaemon("")
+ });
+ }
+
+ function onI2PDStatus(isRunning)
+ {
+
+ }
+
+ Component.onCompleted: {
+ //i2pdManager.i2pdStatus.connect(onI2PDStatus); // figure out a way to keep up to date on the status
+ }
+}
\ No newline at end of file
diff --git a/qml.qrc b/qml.qrc
index d4bd45a618..20669f7f8b 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -185,6 +185,7 @@
pages/settings/SettingsLog.qml
pages/settings/SettingsLayout.qml
pages/settings/SettingsInfo.qml
+ pages/settings/SettingsNetwork.qml
components/WarningBox.qml
images/miningxmr.png
images/miningxmr@2x.png
@@ -222,6 +223,7 @@
wizard/WizardSummaryItem.qml
wizard/WizardModeSelection.qml
wizard/WizardModeRemoteNodeWarning.qml
+ wizard/WizardProtectConnection1.qml
wizard/WizardModeBootstrap.qml
wizard/WizardMenuItem.qml
js/Wizard.js
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b5718df3a2..482fb77bc8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,5 @@
add_subdirectory(QR-Code-scanner)
+add_subdirectory(i2pd)
add_subdirectory(openpgp)
add_subdirectory(zxcvbn-c)
@@ -100,6 +101,7 @@ target_include_directories(monero-wallet-gui PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/daemon
${CMAKE_CURRENT_SOURCE_DIR}/p2pool
+ ${CMAKE_CURRENT_SOURCE_DIR}/i2pd
${CMAKE_CURRENT_SOURCE_DIR}/libwalletqt
${CMAKE_CURRENT_SOURCE_DIR}/model
${CMAKE_CURRENT_SOURCE_DIR}/QR-Code-scanner
@@ -132,6 +134,7 @@ target_link_libraries(monero-wallet-gui
easylogging
${QT5_LIBRARIES}
${EXTRA_LIBRARIES}
+ i2p
openpgp
qrdecoder
translations
diff --git a/src/i2pd/CMakeLists.txt b/src/i2pd/CMakeLists.txt
new file mode 100644
index 0000000000..8dec6e2897
--- /dev/null
+++ b/src/i2pd/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_library(i2p STATIC
+ I2PDManager.cpp
+)
+find_package(ZLIB)
+target_link_libraries(i2p PRIVATE i2pd ZLIB::ZLIB)
\ No newline at end of file
diff --git a/src/i2pd/I2PDManager.cpp b/src/i2pd/I2PDManager.cpp
new file mode 100644
index 0000000000..e3a8ce42d5
--- /dev/null
+++ b/src/i2pd/I2PDManager.cpp
@@ -0,0 +1,221 @@
+// Copyright (c) 2014-2022, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "I2PDManager.h"
+
+#include "../../external/i2pd/libi2pd/Config.h"
+#include "../../external/i2pd/libi2pd/FS.h"
+#include "../../external/i2pd/libi2pd/Log.h"
+#include "../../external/i2pd/libi2pd/Base.h"
+#include "../../external/i2pd/libi2pd/version.h"
+#include "../../external/i2pd/libi2pd/Transports.h"
+#include "../../external/i2pd/libi2pd/RouterInfo.h"
+#include "../../external/i2pd/libi2pd/RouterContext.h"
+#include "../../external/i2pd/libi2pd/Tunnel.h"
+#include "../../external/i2pd/libi2pd/HTTP.h"
+#include "../../external/i2pd/libi2pd/NetDb.hpp"
+#include "../../external/i2pd/libi2pd/Garlic.h"
+#include "../../external/i2pd/libi2pd/Streaming.h"
+#include "../../external/i2pd/libi2pd/Destination.h"
+#include "../../external/i2pd/libi2pd_client/ClientContext.h"
+#include "../../external/i2pd/libi2pd/Crypto.h"
+
+#include
+#include
+#include
+#include
+
+I2PDManager::I2PDManager(QObject *parent)
+ : QObject(parent)
+{
+#ifdef Q_OS_WIN
+ m_i2pdDataDir = QApplication::applicationDirPath() + "/i2pd";
+ if (!QDir(m_i2pdDataDir).exists()) {
+ QDir().mkdir(m_i2pdDataDir);
+ }
+#elif defined(Q_OS_UNIX)
+ m_i2pdDataDir = QApplication::applicationDirPath() + "/i2pd";
+ if (!QDir(m_i2pdDataDir).exists()) {
+ QDir().mkdir(m_i2pdDataDir);
+ }
+#endif
+ if (m_i2pdDataDir.length() == 0) {
+ qCritical() << "I2PD not compatible with current platform";
+ }
+
+ std::string dataDir = "--datadir=" + m_i2pdDataDir.toStdString();
+ std::vector argv({"i2pd", dataDir.data()});
+ init(argv.size(), (char**) argv.data());
+}
+
+I2PDManager::~I2PDManager()
+{
+
+}
+
+void I2PDManager::init(int argc, char* argv[])
+{
+ i2p::log::Logger().Start();
+
+ i2p::config::Init();
+ i2p::config::ParseCmdline(argc, argv);
+
+ std::string datadir;
+ i2p::config::GetOption("datadir", datadir);
+ i2p::fs::DetectDataDir(datadir, false);
+ i2p::fs::Init();
+
+ i2p::config::Finalize();
+
+ std::string certsdir; i2p::config::GetOption("certsdir", certsdir);
+ i2p::fs::SetCertsDir(certsdir);
+ certsdir = i2p::fs::GetCertsDir();
+
+ bool precomputation; i2p::config::GetOption("precomputation.elgamal", precomputation);
+ bool aesni; i2p::config::GetOption("cpuext.aesni", aesni);
+ bool forceCpuExt; i2p::config::GetOption("cpuext.force", forceCpuExt);
+ bool ssu; i2p::config::GetOption("ssu", ssu);
+ if (!ssu && i2p::config::IsDefault ("precomputation.elgamal"))
+ precomputation = false; // we don't elgamal table if no ssu, unless it's specified explicitly
+ i2p::crypto::InitCrypto(precomputation, aesni, forceCpuExt);
+
+ i2p::transport::InitAddressFromIface(); // get address4/6 from interfaces
+
+ int netID; i2p::config::GetOption("netid", netID);
+ i2p::context.SetNetID(netID);
+ i2p::context.Init();
+
+ i2p::transport::InitTransports();
+
+ bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
+ if (isFloodfill)
+ {
+ i2p::context.SetFloodfill (true);
+ }
+ else
+ i2p::context.SetFloodfill (false);
+
+ bool transit; i2p::config::GetOption("notransit", transit);
+ i2p::context.SetAcceptsTunnels (!transit);
+ uint32_t transitTunnels; i2p::config::GetOption("limits.transittunnels", transitTunnels);
+ if (isFloodfill && i2p::config::IsDefault ("limits.transittunnels"))
+ transitTunnels *= 2; // double default number of transit tunnels for floodfill
+ i2p::tunnel::tunnels.SetMaxNumTransitTunnels (transitTunnels);
+
+ /* this section also honors 'floodfill' flag, if set above */
+ std::string bandwidth; i2p::config::GetOption("bandwidth", bandwidth);
+ if (bandwidth.length () > 0)
+ {
+ if (bandwidth[0] >= 'K' && bandwidth[0] <= 'X')
+ {
+ i2p::context.SetBandwidth (bandwidth[0]);
+ }
+ else
+ {
+ auto value = std::atoi(bandwidth.c_str());
+ if (value > 0)
+ {
+ i2p::context.SetBandwidth (value);
+ }
+ else
+ {
+ i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
+ }
+ }
+ }
+ else if (isFloodfill)
+ {
+ i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH2);
+ }
+ else
+ {
+ i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
+ }
+
+ int shareRatio; i2p::config::GetOption("share", shareRatio);
+ i2p::context.SetShareRatio (shareRatio);
+
+ std::string family; i2p::config::GetOption("family", family);
+ i2p::context.SetFamily(family);
+}
+
+void I2PDManager::start()
+{
+ if (!isRunning()) {
+ i2p::data::netdb.Start();
+
+ bool nettime; i2p::config::GetOption("nettime.enabled", nettime);
+ if (nettime)
+ {
+ m_NTPSync = std::unique_ptr(new i2p::util::NTPTimeSync);
+ m_NTPSync->Start();
+ }
+
+ bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
+ bool ssu2; i2p::config::GetOption("ssu2.enabled", ssu2);
+ bool checkInReserved; i2p::config::GetOption("reservedrange", checkInReserved);
+
+ i2p::transport::transports.SetCheckReserved(checkInReserved);
+ i2p::transport::transports.Start(ntcp2, ssu2);
+ if (!(i2p::transport::transports.IsBoundSSU2() || i2p::transport::transports.IsBoundNTCP2()))
+ {
+ i2p::transport::transports.Stop();
+ i2p::data::netdb.Stop();
+ return;
+ }
+
+ i2p::tunnel::tunnels.Start();
+ i2p::context.Start();
+ i2p::client::context.Start();
+ }
+}
+
+void I2PDManager::stop()
+{
+ if (isRunning()) {
+ i2p::client::context.Stop();
+ i2p::context.Stop();
+ i2p::tunnel::tunnels.Stop();
+
+ if (m_NTPSync)
+ {
+ m_NTPSync->Stop ();
+ m_NTPSync = nullptr;
+ }
+
+ i2p::transport::transports.Stop();
+ i2p::data::netdb.Stop();
+ i2p::crypto::TerminateCrypto();
+ }
+}
+
+bool I2PDManager::isRunning() const
+{
+ //return m_isRunning;
+ return false;
+}
\ No newline at end of file
diff --git a/src/i2pd/I2PDManager.h b/src/i2pd/I2PDManager.h
new file mode 100644
index 0000000000..4ecc7ca0bd
--- /dev/null
+++ b/src/i2pd/I2PDManager.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2014-2022, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef I2PDMANAGER_H
+#define I2PDMANAGER_H
+
+#include
+#include "../../external/i2pd/libi2pd/Timestamp.h"
+
+class I2PDManager : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit I2PDManager(QObject *parent = 0);
+ ~I2PDManager();
+
+public:
+ Q_INVOKABLE void start();
+ Q_INVOKABLE void stop();
+ Q_INVOKABLE bool isRunning() const;
+
+private:
+ void init(int argc, char* argv[]);
+ QString m_i2pdDataDir;
+ std::unique_ptr m_NTPSync;
+ bool m_isRunning;
+};
+
+#endif // I2PDMANAGER_H
\ No newline at end of file
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 38901d3ff1..97c56dd69a 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -79,6 +79,7 @@
#ifndef Q_OS_IOS
#include "daemon/DaemonManager.h"
#include "p2pool/P2PoolManager.h"
+#include "i2pd/I2PDManager.h"
#endif
#if defined(Q_OS_WIN)
@@ -414,6 +415,8 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
"DaemonManager can't be instantiated directly");
qmlRegisterUncreatableType("moneroComponents.P2PoolManager", 1, 0, "P2PoolManager",
"P2PoolManager can't be instantiated directly");
+ qmlRegisterUncreatableType("moneroComponents.I2PDManager", 1, 0, "I2PDManager",
+ "I2PDManager can't be instantiated directly");
#endif
qmlRegisterUncreatableType("moneroComponents.AddressBookModel", 1, 0, "AddressBookModel",
"AddressBookModel can't be instantiated directly");
@@ -476,8 +479,10 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
#ifndef Q_OS_IOS
DaemonManager daemonManager;
P2PoolManager p2poolManager;
+ I2PDManager i2pdManager;
engine.rootContext()->setContextProperty("daemonManager", &daemonManager);
engine.rootContext()->setContextProperty("p2poolManager", &p2poolManager);
+ engine.rootContext()->setContextProperty("i2pdManager", &i2pdManager);
#endif
engine.rootContext()->setContextProperty("isWindows", isWindows);
diff --git a/wizard/WizardController.qml b/wizard/WizardController.qml
index 1bc5ca96cb..a8c5660edc 100644
--- a/wizard/WizardController.qml
+++ b/wizard/WizardController.qml
@@ -149,6 +149,7 @@ Rectangle {
property WizardOpenWallet1 wizardOpenWallet1View: WizardOpenWallet1 { }
property WizardModeSelection wizardModeSelectionView: WizardModeSelection { }
property WizardModeRemoteNodeWarning wizardModeRemoteNodeWarningView: WizardModeRemoteNodeWarning { }
+ property WizardProtectConnection1 wizardProtectConnection1View: WizardProtectConnection1 { }
property WizardModeBootstrap wizardModeBootstrapView: WizardModeBootstrap {}
anchors.fill: parent
@@ -241,6 +242,10 @@ Rectangle {
name: "wizardModeRemoteNodeWarning"
PropertyChanges { target: wizardStateView; currentView: wizardStateView.wizardModeRemoteNodeWarningView }
PropertyChanges { target: wizardFlickable; contentHeight: wizardStateView.wizardModeRemoteNodeWarningView.pageHeight + 80 }
+ }, State {
+ name: "wizardProtectConnection1"
+ PropertyChanges { target: wizardStateView; currentView: wizardStateView.wizardProtectConnection1View }
+ PropertyChanges { target: wizardFlickable; contentHeight: wizardStateView.wizardProtectConnection1View.pageHeight + 80 }
}, State {
name: "wizardModeBootstrap"
PropertyChanges { target: wizardStateView; currentView: wizardStateView.wizardModeBootstrapView }
diff --git a/wizard/WizardModeBootstrap.qml b/wizard/WizardModeBootstrap.qml
index df4d8efb73..46c16c4338 100644
--- a/wizard/WizardModeBootstrap.qml
+++ b/wizard/WizardModeBootstrap.qml
@@ -118,7 +118,7 @@ Rectangle {
onNextClicked: {
appWindow.changeWalletMode(1);
- wizardController.wizardState = 'wizardHome';
+ wizardController.wizardState = 'wizardProtectConnection1';
}
}
}
diff --git a/wizard/WizardModeRemoteNodeWarning.qml b/wizard/WizardModeRemoteNodeWarning.qml
index e7a947735a..db35650801 100644
--- a/wizard/WizardModeRemoteNodeWarning.qml
+++ b/wizard/WizardModeRemoteNodeWarning.qml
@@ -121,7 +121,7 @@ Rectangle {
onNextClicked: {
appWindow.changeWalletMode(0);
- wizardController.wizardState = 'wizardHome';
+ wizardController.wizardState = 'wizardProtectConnection1';
}
}
}
diff --git a/wizard/WizardModeSelection.qml b/wizard/WizardModeSelection.qml
index 050b440f8e..87e636e464 100644
--- a/wizard/WizardModeSelection.qml
+++ b/wizard/WizardModeSelection.qml
@@ -150,7 +150,7 @@ Rectangle {
onMenuClicked: {
appWindow.persistentSettings.pruneBlockchain = true;
- applyWalletMode(2, 'wizardHome');
+ applyWalletMode(2, 'wizardProtectConnection1');
}
}
diff --git a/wizard/WizardProtectConnection1.qml b/wizard/WizardProtectConnection1.qml
new file mode 100644
index 0000000000..e5067a97a2
--- /dev/null
+++ b/wizard/WizardProtectConnection1.qml
@@ -0,0 +1,131 @@
+// Copyright (c) 2014-2024, The Monero Project
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other
+// materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its contributors may be
+// used to endorse or promote products derived from this software without specific
+// prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import QtQuick 2.9
+import QtQuick.Layouts 1.2
+import QtQuick.Controls 2.0
+
+import "../js/Wizard.js" as Wizard
+import "../components" as MoneroComponents
+
+Rectangle {
+ id: wizardProtectConnection1
+
+ color: "transparent"
+ property alias pageHeight: pageRoot.height
+ property string viewName: "wizardProtectConnection1"
+
+ ColumnLayout {
+ id: pageRoot
+ Layout.alignment: Qt.AlignHCenter;
+ width: parent.width - 100
+ Layout.fillWidth: true
+ anchors.horizontalCenter: parent.horizontalCenter;
+
+ spacing: 10
+
+ ColumnLayout {
+ Layout.fillWidth: true
+ Layout.maximumWidth: wizardController.wizardSubViewWidth
+ Layout.topMargin: wizardController.wizardSubViewTopMargin
+ Layout.alignment: Qt.AlignHCenter
+ spacing: 0
+
+ WizardHeader {
+ title: qsTr("Monero can protect your internet connection") + translationManager.emptyString
+ subtitle: ""
+ }
+
+ ColumnLayout {
+ spacing: 20
+
+ Layout.topMargin: 10
+ Layout.fillWidth: true
+
+ MoneroComponents.TextPlain {
+ text: qsTr("Monero can optionally connect to the network using anonymizing software to better protect your identity. Would you like to enable this feature?") + translationManager.emptyString
+ themeTransitionBlackColor: MoneroComponents.Style._b_lightGreyFontColor
+ themeTransitionWhiteColor: MoneroComponents.Style._w_lightGreyFontColor
+ wrapMode: Text.Wrap
+ Layout.topMargin: 14
+ Layout.fillWidth: true
+
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 16
+ color: MoneroComponents.Style.lightGreyFontColor
+ }
+
+ MoneroComponents.WarningBox {
+ Layout.topMargin: 14
+ Layout.bottomMargin: 6
+ text: qsTr("Some countries and ISPs may prohibit or censor use of these networks. Please check your local laws and internet policies before using them.") + translationManager.emptyString
+ }
+
+ MoneroComponents.RadioButton {
+ id: handleProtectButton
+ text: qsTr("Protect my network connection") + translationManager.emptyString
+ fontSize: 16
+ enabled: !checked
+ checked: false
+ onClicked: {
+ handleProtectButton.checked = true;
+ handleUnprotectButton.checked = false;
+ persistentSettings.protectConnectionMode = 1;
+ }
+ }
+
+ MoneroComponents.RadioButton {
+ id: handleUnprotectButton
+ text: qsTr("Do not protect my connection") + translationManager.emptyString
+ fontSize: 16
+ enabled: !checked
+ checked: false
+ onClicked: {
+ handleProtectButton.checked = false;
+ handleUnprotectButton.checked = true;
+ persistentSettings.protectConnectionMode = 0;
+ }
+ }
+
+ WizardNav {
+ Layout.topMargin: 4
+ btnNext.enabled: handleProtectButton.checked || handleUnprotectButton.checked
+ progressSteps: 0
+
+ onPrevClicked: {
+ wizardController.wizardState = 'wizardModeSelection';
+ }
+
+ onNextClicked: {
+ wizardController.wizardState = 'wizardHome';
+ }
+ }
+ }
+ }
+ }
+}