From 28c2ca8bf8f6b7923130a11144e80a064816857c Mon Sep 17 00:00:00 2001 From: anon5 Date: Tue, 14 Jun 2016 04:47:22 +0800 Subject: [PATCH 01/20] gitignore improved - added various generated files --- .gitignore | 4 ++++ build/.gitignore | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 build/.gitignore diff --git a/.gitignore b/.gitignore index d680e7ad..89a17a3c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,10 @@ router.keys i2p libi2pd.so netDb +/i2pd +/libi2pd.a +/libi2pdclient.a + # Autotools autom4te.cache diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 00000000..79c3f959 --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,10 @@ +# Various generated files +/CMakeFiles/ +/i2pd +/libi2pd.a +/libi2pdclient.a +/cmake_install.cmake +/CMakeCache.txt +/CPackConfig.cmake +/CPackSourceConfig.cmake +/install_manifest.txt From 58b058ab3a6ad9598c28684ac232ee111324461e Mon Sep 17 00:00:00 2001 From: anon5 Date: Tue, 14 Jun 2016 08:52:17 +0800 Subject: [PATCH 02/20] .apk builds. untested --- ClientContext.cpp | 8 +- Daemon.h | 2 +- DaemonLinux.cpp | 9 ++- HTTP.cpp | 19 ++++- HTTPServer.cpp | 10 ++- I2PControl.cpp | 8 +- Reseed.cpp | 8 +- RouterContext.cpp | 8 +- qt/.gitignore | 2 + qt/i2pd_qt/i2pd_qt.pro | 153 ++++++++++++++++++++++++++++++++++++++ qt/i2pd_qt/main.cpp | 21 ++++++ qt/i2pd_qt/mainwindow.cpp | 14 ++++ qt/i2pd_qt/mainwindow.h | 22 ++++++ qt/i2pd_qt/mainwindow.ui | 21 ++++++ qt/i2pd_qt/to_string.h | 19 +++++ 15 files changed, 314 insertions(+), 10 deletions(-) create mode 100644 qt/.gitignore create mode 100644 qt/i2pd_qt/i2pd_qt.pro create mode 100644 qt/i2pd_qt/main.cpp create mode 100644 qt/i2pd_qt/mainwindow.cpp create mode 100644 qt/i2pd_qt/mainwindow.h create mode 100644 qt/i2pd_qt/mainwindow.ui create mode 100644 qt/i2pd_qt/to_string.h diff --git a/ClientContext.cpp b/ClientContext.cpp index db1c8e6a..3e69510c 100644 --- a/ClientContext.cpp +++ b/ClientContext.cpp @@ -8,6 +8,12 @@ #include "Identity.h" #include "ClientContext.h" +#ifdef ANDROID +# include "to_string.h" +#else +# define to_string(x) std::to_string(x) +#endif + namespace i2p { namespace client @@ -292,7 +298,7 @@ namespace client template std::string ClientContext::GetI2CPOption (const Section& section, const std::string& name, const Type& value) const { - return section.second.get (boost::property_tree::ptree::path_type (name, '/'), std::to_string (value)); + return section.second.get (boost::property_tree::ptree::path_type (name, '/'), to_string (value)); } template diff --git a/Daemon.h b/Daemon.h index 977d9258..6b154ee4 100644 --- a/Daemon.h +++ b/Daemon.h @@ -52,7 +52,7 @@ namespace i2p void run (); }; #else - class DaemonLinux : public Daemon_Singleton + class DaemonLinux : public Daemon_Singleton { public: static DaemonLinux& Instance() diff --git a/DaemonLinux.cpp b/DaemonLinux.cpp index 1cc0fa85..4aceff07 100644 --- a/DaemonLinux.cpp +++ b/DaemonLinux.cpp @@ -74,9 +74,11 @@ namespace i2p } // point std{in,out,err} descriptors to /dev/null - stdin = freopen("/dev/null", "r", stdin); +#ifndef ANDROID + stdin = freopen("/dev/null", "r", stdin); stdout = freopen("/dev/null", "w", stdout); stderr = freopen("/dev/null", "w", stderr); +#endif } // Pidfile @@ -92,7 +94,12 @@ namespace i2p LogPrint(eLogError, "Daemon: could not create pid file ", pidfile, ": ", strerror(errno)); return false; } +#ifndef ANDROID if (lockf(pidFH, F_TLOCK, 0) != 0) +#else + //TODO ANDROID actually need to read man for this, blindly took a solution from . -anon5 + if (fcntl(pidFH, 1, 0) < 0) +#endif { LogPrint(eLogError, "Daemon: could not lock pid file ", pidfile, ": ", strerror(errno)); return false; diff --git a/HTTP.cpp b/HTTP.cpp index a23f5a72..dbb115af 100644 --- a/HTTP.cpp +++ b/HTTP.cpp @@ -10,6 +10,13 @@ #include #include +#ifdef ANDROID +# include "to_string.h" +# include +#else +# define to_string(x) std::to_string(x) +#endif + namespace i2p { namespace http { const std::vector HTTP_METHODS = { @@ -180,7 +187,11 @@ namespace http { out += user + "@"; } if (port) { - out += host + ":" + std::to_string(port); +#ifndef ANDROID + out += host + ":" + to_string(port); +#else + out += host + ":" + tostr::to_string(port); +#endif } else { out += host; } @@ -338,7 +349,11 @@ namespace http { if (status == "OK" && code != 200) status = HTTPCodeToStatus(code); // update if (body.length() > 0 && headers.count("Content-Length") == 0) - add_header("Content-Length", std::to_string(body.length()).c_str()); +#ifndef ANDROID + add_header("Content-Length", to_string(body.length()).c_str()); +#else + add_header("Content-Length", tostr::to_string(body.length()).c_str()); +#endif /* build response */ std::stringstream ss; ss << version << " " << code << " " << status << CRLF; diff --git a/HTTPServer.cpp b/HTTPServer.cpp index a48536a7..583c02da 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -25,6 +25,12 @@ // For image and info #include "version.h" +#ifdef ANDROID +# include "to_string.h" +#else +# define to_string(x) std::to_string(x) +#endif + namespace i2p { namespace http { const char *itoopieFavicon = @@ -230,8 +236,8 @@ namespace http { clientTunnelCount += i2p::tunnel::tunnels.CountInboundTunnels(); size_t transitTunnelCount = i2p::tunnel::tunnels.CountTransitTunnels(); - s << "Client Tunnels: " << std::to_string(clientTunnelCount) << " "; - s << "Transit Tunnels: " << std::to_string(transitTunnelCount) << "
\r\n"; + s << "Client Tunnels: " << to_string(clientTunnelCount) << " "; + s << "Transit Tunnels: " << to_string(transitTunnelCount) << "
\r\n"; } void ShowJumpServices (std::stringstream& s, const std::string& address) diff --git a/I2PControl.cpp b/I2PControl.cpp index c87db150..bad25f37 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -25,6 +25,12 @@ #include "version.h" #include "I2PControl.h" +#ifdef ANDROID +# include "to_string.h" +#else +# define to_string(x) std::to_string(x) +#endif + namespace i2p { namespace client @@ -315,7 +321,7 @@ namespace client } InsertParam (results, "API", api); results << ","; - std::string token = std::to_string(i2p::util::GetSecondsSinceEpoch ()); + std::string token = to_string(i2p::util::GetSecondsSinceEpoch ()); m_Tokens.insert (token); InsertParam (results, "Token", token); } diff --git a/Reseed.cpp b/Reseed.cpp index 6f27891d..b707429a 100644 --- a/Reseed.cpp +++ b/Reseed.cpp @@ -17,6 +17,12 @@ #include "util.h" +#ifdef ANDROID +# include "to_string.h" +#else +# define to_string(x) std::to_string(x) +#endif + namespace i2p { namespace data @@ -373,7 +379,7 @@ namespace data boost::asio::io_service service; boost::system::error_code ecode; auto it = boost::asio::ip::tcp::resolver(service).resolve ( - boost::asio::ip::tcp::resolver::query (u.host_, std::to_string (u.port_)), ecode); + boost::asio::ip::tcp::resolver::query (u.host_, to_string (u.port_)), ecode); if (!ecode) { boost::asio::ssl::context ctx(service, boost::asio::ssl::context::sslv23); diff --git a/RouterContext.cpp b/RouterContext.cpp index 5fa32a13..34d49553 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -12,6 +12,12 @@ #include "Family.h" #include "RouterContext.h" +#ifdef ANDROID +# include "to_string.h" +#else +# define to_string(x) std::to_string(x) +#endif + namespace i2p { RouterContext context; @@ -56,7 +62,7 @@ namespace i2p routerInfo.AddNTCPAddress (host.c_str(), port); routerInfo.SetCaps (i2p::data::RouterInfo::eReachable | i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC - routerInfo.SetProperty ("netId", std::to_string (I2PD_NET_ID)); + routerInfo.SetProperty ("netId", to_string (I2PD_NET_ID)); routerInfo.SetProperty ("router.version", I2P_VERSION); routerInfo.CreateBuffer (m_Keys); m_RouterInfo.SetRouterIdentity (GetIdentity ()); diff --git a/qt/.gitignore b/qt/.gitignore new file mode 100644 index 00000000..e3a93c87 --- /dev/null +++ b/qt/.gitignore @@ -0,0 +1,2 @@ +/build-i2pd_qt-Android_armeabi_v7a_GCC_4_9_Qt_5_6_0-Debug/ +/build-i2pd_qt-Desktop_Qt_5_6_0_GCC_64bit-Debug/ diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro new file mode 100644 index 00000000..f247cee4 --- /dev/null +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -0,0 +1,153 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-06-14T04:53:04 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = i2pd_qt +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp \ + ../../HTTPServer.cpp ../../I2PControl.cpp ../../UPnP.cpp ../../Daemon.cpp ../../Config.cpp \ + ../../AddressBook.cpp \ + ../../api.cpp \ + ../../Base.cpp \ + ../../BOB.cpp \ + ../../ClientContext.cpp \ + ../../Crypto.cpp \ + ../../DaemonLinux.cpp \ + ../../DaemonWin32.cpp \ + ../../Datagram.cpp \ + ../../Destination.cpp \ + ../../Family.cpp \ + ../../FS.cpp \ + ../../Garlic.cpp \ + ../../HTTP.cpp \ + ../../HTTPProxy.cpp \ + ../../I2CP.cpp \ + ../../I2NPProtocol.cpp \ + ../../I2PEndian.cpp \ + ../../I2PService.cpp \ + ../../I2PTunnel.cpp \ + ../../Identity.cpp \ + ../../LeaseSet.cpp \ + ../../Log.cpp \ + ../../NetDb.cpp \ + ../../NetDbRequests.cpp \ + ../../NTCPSession.cpp \ + ../../Profiling.cpp \ + ../../Reseed.cpp \ + ../../RouterContext.cpp \ + ../../RouterInfo.cpp \ + ../../SAM.cpp \ + ../../Signature.cpp \ + ../../SOCKS.cpp \ + ../../SSU.cpp \ + ../../SSUData.cpp \ + ../../SSUSession.cpp \ + ../../stdafx.cpp \ + ../../Streaming.cpp \ + ../../TransitTunnel.cpp \ + ../../Transports.cpp \ + ../../Tunnel.cpp \ + ../../TunnelEndpoint.cpp \ + ../../TunnelGateway.cpp \ + ../../TunnelPool.cpp \ + ../../util.cpp \ + ../../../android-ifaddrs/ifaddrs.c + +HEADERS += mainwindow.h \ + ../../HTTPServer.h ../../I2PControl.h ../../UPnP.h ../../Daemon.h ../../Config.h \ + to_string.h \ + ../../AddressBook.h \ + ../../api.h \ + ../../Base.h \ + ../../BOB.h \ + ../../ClientContext.h \ + ../../Crypto.h \ + ../../Datagram.h \ + ../../Destination.h \ + ../../Family.h \ + ../../FS.h \ + ../../Garlic.h \ + ../../HTTP.h \ + ../../HTTPProxy.h \ + ../../I2CP.h \ + ../../I2NPProtocol.h \ + ../../I2PEndian.h \ + ../../I2PService.h \ + ../../I2PTunnel.h \ + ../../Identity.h \ + ../../LeaseSet.h \ + ../../LittleBigEndian.h \ + ../../Log.h \ + ../../NetDb.h \ + ../../NetDbRequests.h \ + ../../NTCPSession.h \ + ../../Profiling.h \ + ../../Queue.h \ + ../../Reseed.h \ + ../../RouterContext.h \ + ../../RouterInfo.h \ + ../../SAM.h \ + ../../Signature.h \ + ../../SOCKS.h \ + ../../SSU.h \ + ../../SSUData.h \ + ../../SSUSession.h \ + ../../stdafx.h \ + ../../Streaming.h \ + ../../Timestamp.h \ + ../../TransitTunnel.h \ + ../../Transports.h \ + ../../TransportSession.h \ + ../../Tunnel.h \ + ../../TunnelBase.h \ + ../../TunnelConfig.h \ + ../../TunnelEndpoint.h \ + ../../TunnelGateway.h \ + ../../TunnelPool.h \ + ../../util.h \ + ../../version.h \ + ../../../android-ifaddrs/ifaddrs.h + +FORMS += mainwindow.ui + +CONFIG += mobility + +MOBILITY = + +LIBS += -lz + +android { +message("Using Android settings") +DEFINES += ANDROID=1 +# git clone https://github.com/emileb/Boost-for-Android-Prebuilt.git +# git clone https://github.com/anon5/OpenSSL-for-Android-Prebuilt.git +# git clone https://github.com/anon5/android-ifaddrs.git +INCLUDEPATH += /home/anon5/git/Boost-for-Android-Prebuilt/boost_1_53_0/include \ + /home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include \ + ../../../android-ifaddrs/ +equals(ANDROID_TARGET_ARCH, armeabi-v7a){ +LIBS += -L/home/anon5/git/Boost-for-Android-Prebuilt/boost_1_53_0/armeabi-v7a/lib \ + -L/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib \ +-lcrypto \ +-lssl \ +-lboost_system-gcc-mt-1_53 \ +-lboost_date_time-gcc-mt-1_53 \ +-lboost_filesystem-gcc-mt-1_53 \ +-lboost_program_options-gcc-mt-1_53 +} +} + +linux:!android { +message("Using Linux settings") +LIBS += -lcrypto -lssl -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread +} + diff --git a/qt/i2pd_qt/main.cpp b/qt/i2pd_qt/main.cpp new file mode 100644 index 00000000..db5c39e5 --- /dev/null +++ b/qt/i2pd_qt/main.cpp @@ -0,0 +1,21 @@ +#include "mainwindow.h" +#include +#include +#include "../../Daemon.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + + w.show(); + + if (Daemon.init(argc, argv)) + { + if (Daemon.start()) + Daemon.run (); + Daemon.stop(); + } + + return a.exec(); +} diff --git a/qt/i2pd_qt/mainwindow.cpp b/qt/i2pd_qt/mainwindow.cpp new file mode 100644 index 00000000..49d64fce --- /dev/null +++ b/qt/i2pd_qt/mainwindow.cpp @@ -0,0 +1,14 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/qt/i2pd_qt/mainwindow.h b/qt/i2pd_qt/mainwindow.h new file mode 100644 index 00000000..a3948a91 --- /dev/null +++ b/qt/i2pd_qt/mainwindow.h @@ -0,0 +1,22 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/qt/i2pd_qt/mainwindow.ui b/qt/i2pd_qt/mainwindow.ui new file mode 100644 index 00000000..7ebf8731 --- /dev/null +++ b/qt/i2pd_qt/mainwindow.ui @@ -0,0 +1,21 @@ + + MainWindow + + + + 0 + 0 + 800 + 480 + + + + MainWindow + + + + + + + + diff --git a/qt/i2pd_qt/to_string.h b/qt/i2pd_qt/to_string.h new file mode 100644 index 00000000..a4bcf480 --- /dev/null +++ b/qt/i2pd_qt/to_string.h @@ -0,0 +1,19 @@ +#ifndef TO_STRING_H +#define TO_STRING_H + +#include +#include + +namespace tostr { +template +std::string to_string(T value) +{ + std::ostringstream os ; + os << value ; + return os.str() ; +} +} + +using namespace tostr; + +#endif // TO_STRING_H From f672af9706b4d309f565431dc5fe72b45a51bdfd Mon Sep 17 00:00:00 2001 From: anon5 Date: Tue, 14 Jun 2016 13:20:34 +0800 Subject: [PATCH 03/20] .apk runs on emulator --- qt/i2pd_qt/docs/patch_openssl_so_libs.html | 59 ++++++++++++++++++++++ qt/i2pd_qt/i2pd_qt.pro | 22 ++++++-- 2 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 qt/i2pd_qt/docs/patch_openssl_so_libs.html diff --git a/qt/i2pd_qt/docs/patch_openssl_so_libs.html b/qt/i2pd_qt/docs/patch_openssl_so_libs.html new file mode 100644 index 00000000..0fb7d540 --- /dev/null +++ b/qt/i2pd_qt/docs/patch_openssl_so_libs.html @@ -0,0 +1,59 @@ + + + + +

+ OpenSSL под Android в Qt + +

Запись от Wyn размещена 18.01.2016 в 18:22
Метки android, openssl, qt

Мини-руководство по тому, как быстро скомпилировать OpenSSL для Android и связать его с проектом Qt.
+Для Linux.

+Вначале действия полностью идентичны "расово-верному" руководству по компилянию OpenSSL для Android:
+Качаем исходники openssl нужной версии с их сайта, качаем setenv-android.sh(все ссылки на закачку выше по ссылке).
+Ложим их в одну папку. Запускаем консоль, переходим в ней в эту самую папку.
+Далее:
BashВыделить код
1
+2
+3
+
$ rm -rf openssl-1.0.1g/   # удаляем исходники(вместо версии 1.0.1g - подставляем свою), если они уже были распакованы
+$ tar xzf openssl-1.0.1g.tar.gz    # распаковываем исходники в подпапку
+$ chmod a+x setenv-android.sh    # разрешаем setenv-android.sh исполняться
Редактируем setenv-android.sh, настраивая там _ANDROID_EABI, _ANDROID_ARCH, _ANDROID_API на нужные значения.
+Дальше возвращаемся в консоль:
BashВыделить код
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+
$ export ANDROID_NDK_ROOT=путь_до_ANDROID_NDK # указываем путь до Android NDK для setenv-android.sh
+$ . ./setenv-android.sh # запускаем скрипт, чтобы он нам в окружение проставил необходимые далее переменные
+$ cd openssl-1.0.1g/
+$ perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
+# конфигурируем
+$ ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir=/usr/local/ssl/$ANDROID_API
+# собираем
+$ make depend
+$ make all
+# устанавливаем
+$ sudo -E make install CC=$ANDROID_TOOLCHAIN/arm-linux-androideabi-gcc RANLIB=$ANDROID_TOOLCHAIN/arm-linux-androideabi-ranlib
И тут начинается интересное. Андроид не принимает versioned shared object (это *.so.x и подобные). Казалось бы 2016 год, космические корабли уже давно бороздят просторы Большого театра, но вот те на.

+Однако, есть обходной приём - нужно заменить *.so.x.x.x на *_x_x_x.so. Простым переименованием файлов данную проблему здесь, разумеется, не решить. Нужно лезть внутрь и переименовывать soname и внутренние ссылки на другие versioned shared object. В интернете есть много способов по подобному переименованию. Большинство из них обещают райскую жизнь с rpl, забывая упомянуть, что утилита уже давно отпета и закопана на большинстве дистрибутивов. Или хитро-хитро редактируют makefile, что в итоге на место левой руки собирается правая нога. В целом множество путей из разряда "как потратить много времени на полную фигню".

+В итоге предлагаю решить данную проблему методом топора:
+Качаем hex-редактор, если ещё нет(в моём случае таковым оказался Okteta). Запускаем его из под рута(kdesu okteta), открываем в нём файлы openssldir/lib/libcrypto.so.1.0.0. Заменяем(ctrl+r) в нём символы ".so.1.0.0" на char "_1_0_0.so". Проделываем тоже самое с libssl.so.1.0.0. Всё, теперь осталось только переименовать сами файлы(в libcrypto_1_0_0.so и libssl_1_0_0.so) и поправить ссылки libssl.so и libcrypto.so, чтобы они вели на них.

+Чтобы подключить и использовать данную библиотеку в проекте нужно добавить в .pro:
BashВыделить код
1
+2
+3
+4
+5
+
android: {
+    INCLUDEPATH += /usr/local/ssl/android-21/include
+    LIBS += -L/usr/local/ssl/android-21/lib
+}
+LIBS += -lcrypto
А затем в настройках проекта, в Buld/Build Steps/Bulild Android Apk добавить libcrypto_1_0_0.so и libssl_1_0_0.so в список Additional Libraries.

+На этом всё. + +
+

Original: http://www.cyberforum.ru/blogs/748276/blog4086.html

+ + diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index f247cee4..8adfd140 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -135,14 +135,23 @@ INCLUDEPATH += /home/anon5/git/Boost-for-Android-Prebuilt/boost_1_53_0/include /home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include \ ../../../android-ifaddrs/ equals(ANDROID_TARGET_ARCH, armeabi-v7a){ +# http://stackoverflow.com/a/30235934/529442 LIBS += -L/home/anon5/git/Boost-for-Android-Prebuilt/boost_1_53_0/armeabi-v7a/lib \ - -L/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib \ --lcrypto \ --lssl \ +#/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ +#/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a \ -lboost_system-gcc-mt-1_53 \ -lboost_date_time-gcc-mt-1_53 \ -lboost_filesystem-gcc-mt-1_53 \ --lboost_program_options-gcc-mt-1_53 +-lboost_program_options-gcc-mt-1_53 \ +-L$$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/ -lcrypto -lssl + +PRE_TARGETDEPS += $$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ + $$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a + +DEPENDPATH += $$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include + +ANDROID_EXTRA_LIBS += /home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto_1_0_0.so \ + /home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl_1_0_0.so } } @@ -151,3 +160,8 @@ message("Using Linux settings") LIBS += -lcrypto -lssl -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread } + +unix:!macx: + + + From a5be4c9d0ed0c2d0077ba64c48d14e94007497f7 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 14 Jun 2016 11:55:44 -0400 Subject: [PATCH 04/20] moved std::to_string to util.h from android --- ClientContext.cpp | 8 +------- HTTP.cpp | 19 ++----------------- HTTPServer.cpp | 10 ++-------- I2PControl.cpp | 8 +------- Reseed.cpp | 9 +-------- RouterContext.cpp | 8 +------- util.h | 11 +++++++++++ 7 files changed, 19 insertions(+), 54 deletions(-) diff --git a/ClientContext.cpp b/ClientContext.cpp index 3e69510c..d545ea78 100644 --- a/ClientContext.cpp +++ b/ClientContext.cpp @@ -8,12 +8,6 @@ #include "Identity.h" #include "ClientContext.h" -#ifdef ANDROID -# include "to_string.h" -#else -# define to_string(x) std::to_string(x) -#endif - namespace i2p { namespace client @@ -298,7 +292,7 @@ namespace client template std::string ClientContext::GetI2CPOption (const Section& section, const std::string& name, const Type& value) const { - return section.second.get (boost::property_tree::ptree::path_type (name, '/'), to_string (value)); + return section.second.get (boost::property_tree::ptree::path_type (name, '/'), std::to_string (value)); } template diff --git a/HTTP.cpp b/HTTP.cpp index dbb115af..fa7809a5 100644 --- a/HTTP.cpp +++ b/HTTP.cpp @@ -10,13 +10,6 @@ #include #include -#ifdef ANDROID -# include "to_string.h" -# include -#else -# define to_string(x) std::to_string(x) -#endif - namespace i2p { namespace http { const std::vector HTTP_METHODS = { @@ -187,11 +180,7 @@ namespace http { out += user + "@"; } if (port) { -#ifndef ANDROID - out += host + ":" + to_string(port); -#else - out += host + ":" + tostr::to_string(port); -#endif + out += host + ":" + std::to_string(port); } else { out += host; } @@ -349,11 +338,7 @@ namespace http { if (status == "OK" && code != 200) status = HTTPCodeToStatus(code); // update if (body.length() > 0 && headers.count("Content-Length") == 0) -#ifndef ANDROID - add_header("Content-Length", to_string(body.length()).c_str()); -#else - add_header("Content-Length", tostr::to_string(body.length()).c_str()); -#endif + add_header("Content-Length", std::to_string(body.length()).c_str()); /* build response */ std::stringstream ss; ss << version << " " << code << " " << status << CRLF; diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 583c02da..ff693313 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -25,12 +25,6 @@ // For image and info #include "version.h" -#ifdef ANDROID -# include "to_string.h" -#else -# define to_string(x) std::to_string(x) -#endif - namespace i2p { namespace http { const char *itoopieFavicon = @@ -236,8 +230,8 @@ namespace http { clientTunnelCount += i2p::tunnel::tunnels.CountInboundTunnels(); size_t transitTunnelCount = i2p::tunnel::tunnels.CountTransitTunnels(); - s << "Client Tunnels: " << to_string(clientTunnelCount) << " "; - s << "Transit Tunnels: " << to_string(transitTunnelCount) << "
\r\n"; + s << "Client Tunnels: " << std::to_string(clientTunnelCount) << " "; + s << "Transit Tunnels: " << std::to_string(transitTunnelCount) << "
\r\n"; } void ShowJumpServices (std::stringstream& s, const std::string& address) diff --git a/I2PControl.cpp b/I2PControl.cpp index bad25f37..9eebb389 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -25,12 +25,6 @@ #include "version.h" #include "I2PControl.h" -#ifdef ANDROID -# include "to_string.h" -#else -# define to_string(x) std::to_string(x) -#endif - namespace i2p { namespace client @@ -321,7 +315,7 @@ namespace client } InsertParam (results, "API", api); results << ","; - std::string token = to_string(i2p::util::GetSecondsSinceEpoch ()); + std::string token = std::to_string(i2p::util::GetSecondsSinceEpoch ()); m_Tokens.insert (token); InsertParam (results, "Token", token); } diff --git a/Reseed.cpp b/Reseed.cpp index b707429a..722d7eff 100644 --- a/Reseed.cpp +++ b/Reseed.cpp @@ -16,13 +16,6 @@ #include "NetDb.h" #include "util.h" - -#ifdef ANDROID -# include "to_string.h" -#else -# define to_string(x) std::to_string(x) -#endif - namespace i2p { namespace data @@ -379,7 +372,7 @@ namespace data boost::asio::io_service service; boost::system::error_code ecode; auto it = boost::asio::ip::tcp::resolver(service).resolve ( - boost::asio::ip::tcp::resolver::query (u.host_, to_string (u.port_)), ecode); + boost::asio::ip::tcp::resolver::query (u.host_, std::to_string (u.port_)), ecode); if (!ecode) { boost::asio::ssl::context ctx(service, boost::asio::ssl::context::sslv23); diff --git a/RouterContext.cpp b/RouterContext.cpp index 34d49553..768750bb 100644 --- a/RouterContext.cpp +++ b/RouterContext.cpp @@ -12,12 +12,6 @@ #include "Family.h" #include "RouterContext.h" -#ifdef ANDROID -# include "to_string.h" -#else -# define to_string(x) std::to_string(x) -#endif - namespace i2p { RouterContext context; @@ -62,7 +56,7 @@ namespace i2p routerInfo.AddNTCPAddress (host.c_str(), port); routerInfo.SetCaps (i2p::data::RouterInfo::eReachable | i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC - routerInfo.SetProperty ("netId", to_string (I2PD_NET_ID)); + routerInfo.SetProperty ("netId", std::to_string (I2PD_NET_ID)); routerInfo.SetProperty ("router.version", I2P_VERSION); routerInfo.CreateBuffer (m_Keys); m_RouterInfo.SetRouterIdentity (GetIdentity ()); diff --git a/util.h b/util.h index f5dbc9aa..9f797158 100644 --- a/util.h +++ b/util.h @@ -7,6 +7,17 @@ #include #include +#ifdef ANDROID +namespace std +{ +template +std::string to_string(T value) +{ + return boost::lexical_cast(value); +} +} +#endif + namespace i2p { namespace util From 27ca3b4b01bf512f11e1b1634d64677e53e57395 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 14 Jun 2016 13:21:22 -0400 Subject: [PATCH 05/20] Enable C++11 --- qt/i2pd_qt/i2pd_qt.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index 8adfd140..789ba842 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = i2pd_qt TEMPLATE = app - +QMAKE_CXXFLAGS *= -std=c++11 SOURCES += main.cpp\ mainwindow.cpp \ From 756e86662beab1fe526d52602faf0fef8d5b3936 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 14 Jun 2016 14:37:22 -0400 Subject: [PATCH 06/20] fixed android build --- ClientContext.cpp | 1 + HTTP.cpp | 1 + HTTPServer.cpp | 1 + I2PControl.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/ClientContext.cpp b/ClientContext.cpp index d545ea78..2bc13969 100644 --- a/ClientContext.cpp +++ b/ClientContext.cpp @@ -6,6 +6,7 @@ #include "FS.h" #include "Log.h" #include "Identity.h" +#include "util.h" #include "ClientContext.h" namespace i2p diff --git a/HTTP.cpp b/HTTP.cpp index fa7809a5..eca21fde 100644 --- a/HTTP.cpp +++ b/HTTP.cpp @@ -6,6 +6,7 @@ * See full license text in LICENSE file at top of project tree */ +#include "util.h" #include "HTTP.h" #include #include diff --git a/HTTPServer.cpp b/HTTPServer.cpp index ff693313..5263c53d 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -21,6 +21,7 @@ #include "ClientContext.h" #include "HTTPServer.h" #include "Daemon.h" +#include "util.h" // For image and info #include "version.h" diff --git a/I2PControl.cpp b/I2PControl.cpp index 9eebb389..c0c87fd4 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -23,6 +23,7 @@ #include "Timestamp.h" #include "Transports.h" #include "version.h" +#include "util.h" #include "I2PControl.h" namespace i2p From b5723a6c18f7a2a9488a7df23dcc700357a57dc3 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 15 Jun 2016 09:31:52 -0400 Subject: [PATCH 07/20] use QT's main loop --- qt/i2pd_qt/i2pd_qt.pro | 26 +++++++++++++------------- qt/i2pd_qt/main.cpp | 10 ++++++---- qt/i2pd_qt/to_string.h | 19 ------------------- 3 files changed, 19 insertions(+), 36 deletions(-) delete mode 100644 qt/i2pd_qt/to_string.h diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index 789ba842..d1480522 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -12,6 +12,7 @@ TARGET = i2pd_qt TEMPLATE = app QMAKE_CXXFLAGS *= -std=c++11 + SOURCES += main.cpp\ mainwindow.cpp \ ../../HTTPServer.cpp ../../I2PControl.cpp ../../UPnP.cpp ../../Daemon.cpp ../../Config.cpp \ @@ -60,11 +61,10 @@ SOURCES += main.cpp\ ../../TunnelGateway.cpp \ ../../TunnelPool.cpp \ ../../util.cpp \ - ../../../android-ifaddrs/ifaddrs.c + /mnt/media/android/android-ifaddrs/ifaddrs.c HEADERS += mainwindow.h \ ../../HTTPServer.h ../../I2PControl.h ../../UPnP.h ../../Daemon.h ../../Config.h \ - to_string.h \ ../../AddressBook.h \ ../../api.h \ ../../Base.h \ @@ -115,7 +115,7 @@ HEADERS += mainwindow.h \ ../../TunnelPool.h \ ../../util.h \ ../../version.h \ - ../../../android-ifaddrs/ifaddrs.h + /mnt/media/android/android-ifaddrs/ifaddrs.h FORMS += mainwindow.ui @@ -131,27 +131,27 @@ DEFINES += ANDROID=1 # git clone https://github.com/emileb/Boost-for-Android-Prebuilt.git # git clone https://github.com/anon5/OpenSSL-for-Android-Prebuilt.git # git clone https://github.com/anon5/android-ifaddrs.git -INCLUDEPATH += /home/anon5/git/Boost-for-Android-Prebuilt/boost_1_53_0/include \ - /home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include \ - ../../../android-ifaddrs/ +INCLUDEPATH += /mnt/media/android/Boost-for-Android-Prebuilt/boost_1_53_0/include \ + /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include \ + /mnt/media/android/android-ifaddrs/ equals(ANDROID_TARGET_ARCH, armeabi-v7a){ # http://stackoverflow.com/a/30235934/529442 -LIBS += -L/home/anon5/git/Boost-for-Android-Prebuilt/boost_1_53_0/armeabi-v7a/lib \ +LIBS += -L/mnt/media/android/Boost-for-Android-Prebuilt/boost_1_53_0/armeabi-v7a/lib \ #/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ #/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a \ -lboost_system-gcc-mt-1_53 \ -lboost_date_time-gcc-mt-1_53 \ -lboost_filesystem-gcc-mt-1_53 \ -lboost_program_options-gcc-mt-1_53 \ --L$$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/ -lcrypto -lssl +-L/mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/ -lcrypto -lssl -PRE_TARGETDEPS += $$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ - $$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a +PRE_TARGETDEPS += /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ + /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a -DEPENDPATH += $$PWD/../../../OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include +DEPENDPATH += /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include -ANDROID_EXTRA_LIBS += /home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto_1_0_0.so \ - /home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl_1_0_0.so +ANDROID_EXTRA_LIBS += /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.so \ + /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.so } } diff --git a/qt/i2pd_qt/main.cpp b/qt/i2pd_qt/main.cpp index db5c39e5..d00a7dbf 100644 --- a/qt/i2pd_qt/main.cpp +++ b/qt/i2pd_qt/main.cpp @@ -8,14 +8,16 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); MainWindow w; - w.show(); - + int ret = -1; if (Daemon.init(argc, argv)) { if (Daemon.start()) - Daemon.run (); + { + w.show(); + ret = a.exec(); + } Daemon.stop(); } - return a.exec(); + return ret; } diff --git a/qt/i2pd_qt/to_string.h b/qt/i2pd_qt/to_string.h deleted file mode 100644 index a4bcf480..00000000 --- a/qt/i2pd_qt/to_string.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef TO_STRING_H -#define TO_STRING_H - -#include -#include - -namespace tostr { -template -std::string to_string(T value) -{ - std::ostringstream os ; - os << value ; - return os.str() ; -} -} - -using namespace tostr; - -#endif // TO_STRING_H From ff38a3bbfea4e195edf27847c5a351b97ff4b2c2 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 15 Jun 2016 10:17:02 -0400 Subject: [PATCH 08/20] don't demonize --- qt/i2pd_qt/main.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/qt/i2pd_qt/main.cpp b/qt/i2pd_qt/main.cpp index d00a7dbf..e7978bfe 100644 --- a/qt/i2pd_qt/main.cpp +++ b/qt/i2pd_qt/main.cpp @@ -3,20 +3,31 @@ #include #include "../../Daemon.h" +class DaemonQT: public i2p::util::Daemon_Singleton +{ + public: + + static DaemonQT& Instance() + { + static DaemonQT instance; + return instance; + } +}; + int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; int ret = -1; - if (Daemon.init(argc, argv)) + if (DaemonQT::Instance ().init(argc, argv)) { - if (Daemon.start()) + if (DaemonQT::Instance ().start()) { w.show(); ret = a.exec(); } - Daemon.stop(); + DaemonQT::Instance ().stop(); } return ret; From 70e502e55dca205149cafa587820af4a701674bf Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 15 Jun 2016 11:28:59 -0400 Subject: [PATCH 09/20] QT doesn't depend on Linux daemon anymore --- Daemon.h | 25 +++++++++++++++++++++---- DaemonLinux.cpp | 7 ------- HTTPServer.cpp | 6 +++--- qt/i2pd_qt/i2pd_qt.pro | 2 -- qt/i2pd_qt/main.cpp | 17 +++-------------- 5 files changed, 27 insertions(+), 30 deletions(-) diff --git a/Daemon.h b/Daemon.h index 6b154ee4..9f040683 100644 --- a/Daemon.h +++ b/Daemon.h @@ -3,10 +3,12 @@ #include -#ifdef _WIN32 -#define Daemon i2p::util::DaemonWin32::Instance() +#if defined(QT_GUI) + +#elif defined(_WIN32) + #else -#define Daemon i2p::util::DaemonLinux::Instance() + #endif namespace i2p @@ -36,7 +38,21 @@ namespace i2p Daemon_Singleton_Private &d; }; -#ifdef _WIN32 +#if defined(QT_GUI_LIB) // check if QT +#define Daemon i2p::util::DaemonQT::Instance() + class DaemonQT: public i2p::util::Daemon_Singleton + { + public: + + static DaemonQT& Instance() + { + static DaemonQT instance; + return instance; + } + }; + +#elif defined(_WIN32) +#define Daemon i2p::util::DaemonWin32::Instance() class DaemonWin32 : public Daemon_Singleton { public: @@ -52,6 +68,7 @@ namespace i2p void run (); }; #else +#define Daemon i2p::util::DaemonLinux::Instance() class DaemonLinux : public Daemon_Singleton { public: diff --git a/DaemonLinux.cpp b/DaemonLinux.cpp index 4aceff07..118fc5f5 100644 --- a/DaemonLinux.cpp +++ b/DaemonLinux.cpp @@ -74,11 +74,9 @@ namespace i2p } // point std{in,out,err} descriptors to /dev/null -#ifndef ANDROID stdin = freopen("/dev/null", "r", stdin); stdout = freopen("/dev/null", "w", stdout); stderr = freopen("/dev/null", "w", stderr); -#endif } // Pidfile @@ -94,12 +92,7 @@ namespace i2p LogPrint(eLogError, "Daemon: could not create pid file ", pidfile, ": ", strerror(errno)); return false; } -#ifndef ANDROID if (lockf(pidFH, F_TLOCK, 0) != 0) -#else - //TODO ANDROID actually need to read man for this, blindly took a solution from . -anon5 - if (fcntl(pidFH, 1, 0) < 0) -#endif { LogPrint(eLogError, "Daemon: could not lock pid file ", pidfile, ": ", strerror(errno)); return false; diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 5263c53d..dc504c58 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -365,7 +365,7 @@ namespace http { s << " Stop accepting tunnels
\r\n"; else s << " Start accepting tunnels
\r\n"; -#ifndef WIN32 +#if (!defined(WIN32) && !defined(QT_GUI_LIB)) if (Daemon.gracefullShutdownInterval) { s << " Cancel gracefull shutdown ("; s << Daemon.gracefullShutdownInterval; @@ -678,12 +678,12 @@ namespace http { i2p::context.SetAcceptsTunnels (false); else if (cmd == HTTP_COMMAND_SHUTDOWN_START) { i2p::context.SetAcceptsTunnels (false); -#ifndef WIN32 +#if (!defined(WIN32) && !defined(QT_GUI_LIB)) Daemon.gracefullShutdownInterval = 10*60; #endif } else if (cmd == HTTP_COMMAND_SHUTDOWN_CANCEL) { i2p::context.SetAcceptsTunnels (true); -#ifndef WIN32 +#if (!defined(WIN32) && !defined(QT_GUI_LIB)) Daemon.gracefullShutdownInterval = 0; #endif } else if (cmd == HTTP_COMMAND_SHUTDOWN_NOW) { diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index d1480522..cbde47b3 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -22,8 +22,6 @@ SOURCES += main.cpp\ ../../BOB.cpp \ ../../ClientContext.cpp \ ../../Crypto.cpp \ - ../../DaemonLinux.cpp \ - ../../DaemonWin32.cpp \ ../../Datagram.cpp \ ../../Destination.cpp \ ../../Family.cpp \ diff --git a/qt/i2pd_qt/main.cpp b/qt/i2pd_qt/main.cpp index e7978bfe..d00a7dbf 100644 --- a/qt/i2pd_qt/main.cpp +++ b/qt/i2pd_qt/main.cpp @@ -3,31 +3,20 @@ #include #include "../../Daemon.h" -class DaemonQT: public i2p::util::Daemon_Singleton -{ - public: - - static DaemonQT& Instance() - { - static DaemonQT instance; - return instance; - } -}; - int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; int ret = -1; - if (DaemonQT::Instance ().init(argc, argv)) + if (Daemon.init(argc, argv)) { - if (DaemonQT::Instance ().start()) + if (Daemon.start()) { w.show(); ret = a.exec(); } - DaemonQT::Instance ().stop(); + Daemon.stop(); } return ret; From b0e3339370e729b90078047b53bb584e2eab0b1f Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 15 Jun 2016 12:20:31 -0400 Subject: [PATCH 10/20] DaemonQT --- Daemon.h | 13 +++++-------- qt/i2pd_qt/DaemonQT.cpp | 39 +++++++++++++++++++++++++++++++++++++++ qt/i2pd_qt/i2pd_qt.pro | 3 ++- qt/i2pd_qt/main.cpp | 23 ----------------------- 4 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 qt/i2pd_qt/DaemonQT.cpp delete mode 100644 qt/i2pd_qt/main.cpp diff --git a/Daemon.h b/Daemon.h index 9f040683..2f7682eb 100644 --- a/Daemon.h +++ b/Daemon.h @@ -3,14 +3,6 @@ #include -#if defined(QT_GUI) - -#elif defined(_WIN32) - -#else - -#endif - namespace i2p { namespace util @@ -49,6 +41,11 @@ namespace i2p static DaemonQT instance; return instance; } + + bool init(int argc, char* argv[]); + bool start(); + bool stop(); + void run (); }; #elif defined(_WIN32) diff --git a/qt/i2pd_qt/DaemonQT.cpp b/qt/i2pd_qt/DaemonQT.cpp new file mode 100644 index 00000000..19a13c6e --- /dev/null +++ b/qt/i2pd_qt/DaemonQT.cpp @@ -0,0 +1,39 @@ +#include +#include "mainwindow.h" +#include +#include +#include "../../Daemon.h" + +namespace i2p +{ +namespace util +{ + std::unique_ptr app; + bool DaemonQT::init(int argc, char* argv[]) + { + app.reset (new QApplication (argc, argv)); + return Daemon_Singleton::init(argc, argv); + } + + bool DaemonQT::start() + { + return Daemon_Singleton::start(); + } + + bool DaemonQT::stop() + { + return Daemon_Singleton::stop(); + } + + void DaemonQT::run () + { + MainWindow w; + w.show (); + if (app) + { + app->exec(); + app.reset (nullptr); + } + } +} +} diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index cbde47b3..5dca2e51 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -13,7 +13,7 @@ TEMPLATE = app QMAKE_CXXFLAGS *= -std=c++11 -SOURCES += main.cpp\ +SOURCES += DaemonQT.cpp\ mainwindow.cpp \ ../../HTTPServer.cpp ../../I2PControl.cpp ../../UPnP.cpp ../../Daemon.cpp ../../Config.cpp \ ../../AddressBook.cpp \ @@ -59,6 +59,7 @@ SOURCES += main.cpp\ ../../TunnelGateway.cpp \ ../../TunnelPool.cpp \ ../../util.cpp \ + ../../i2pd.cpp \ /mnt/media/android/android-ifaddrs/ifaddrs.c HEADERS += mainwindow.h \ diff --git a/qt/i2pd_qt/main.cpp b/qt/i2pd_qt/main.cpp deleted file mode 100644 index d00a7dbf..00000000 --- a/qt/i2pd_qt/main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "mainwindow.h" -#include -#include -#include "../../Daemon.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - - int ret = -1; - if (Daemon.init(argc, argv)) - { - if (Daemon.start()) - { - w.show(); - ret = a.exec(); - } - Daemon.stop(); - } - - return ret; -} From 14c85fa975e3ca45421d603be8295b8ce509c173 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 15 Jun 2016 13:18:04 -0400 Subject: [PATCH 11/20] configurable pathes to dependancies --- qt/i2pd_qt/i2pd_qt.pro | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index 5dca2e51..b8b5adbb 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -12,6 +12,13 @@ TARGET = i2pd_qt TEMPLATE = app QMAKE_CXXFLAGS *= -std=c++11 +# git clone https://github.com/emileb/Boost-for-Android-Prebuilt.git +# git clone https://github.com/anon5/OpenSSL-for-Android-Prebuilt.git +# git clone https://github.com/anon5/android-ifaddrs.git +# change to your own +BOOST_PATH = /mnt/media/android/Boost-for-Android-Prebuilt +OPENSSL_PATH = /mnt/media/android/OpenSSL-for-Android-Prebuilt +IFADDRS_PATH = /mnt/media/android/android-ifaddrs SOURCES += DaemonQT.cpp\ mainwindow.cpp \ @@ -60,7 +67,7 @@ SOURCES += DaemonQT.cpp\ ../../TunnelPool.cpp \ ../../util.cpp \ ../../i2pd.cpp \ - /mnt/media/android/android-ifaddrs/ifaddrs.c + $$IFADDRS_PATH/ifaddrs.c HEADERS += mainwindow.h \ ../../HTTPServer.h ../../I2PControl.h ../../UPnP.h ../../Daemon.h ../../Config.h \ @@ -114,7 +121,7 @@ HEADERS += mainwindow.h \ ../../TunnelPool.h \ ../../util.h \ ../../version.h \ - /mnt/media/android/android-ifaddrs/ifaddrs.h + $$IFADDRS_PATH/ifaddrs.h FORMS += mainwindow.ui @@ -127,30 +134,27 @@ LIBS += -lz android { message("Using Android settings") DEFINES += ANDROID=1 -# git clone https://github.com/emileb/Boost-for-Android-Prebuilt.git -# git clone https://github.com/anon5/OpenSSL-for-Android-Prebuilt.git -# git clone https://github.com/anon5/android-ifaddrs.git -INCLUDEPATH += /mnt/media/android/Boost-for-Android-Prebuilt/boost_1_53_0/include \ - /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include \ - /mnt/media/android/android-ifaddrs/ +INCLUDEPATH += $$BOOST_PATH/boost_1_53_0/include \ + $$OPENSSL_PATH/openssl-1.0.2/include \ + $$IFADDRS_PATH equals(ANDROID_TARGET_ARCH, armeabi-v7a){ # http://stackoverflow.com/a/30235934/529442 -LIBS += -L/mnt/media/android/Boost-for-Android-Prebuilt/boost_1_53_0/armeabi-v7a/lib \ +LIBS += -L$$BOOST_PATH/boost_1_53_0/armeabi-v7a/lib \ #/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ #/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a \ -lboost_system-gcc-mt-1_53 \ -lboost_date_time-gcc-mt-1_53 \ -lboost_filesystem-gcc-mt-1_53 \ -lboost_program_options-gcc-mt-1_53 \ --L/mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/ -lcrypto -lssl +-L$$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/ -lcrypto -lssl -PRE_TARGETDEPS += /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ - /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a +PRE_TARGETDEPS += $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ + $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libssl.a -DEPENDPATH += /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/include +DEPENDPATH += $$OPENSSL_PATH/openssl-1.0.2/include -ANDROID_EXTRA_LIBS += /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.so \ - /mnt/media/android/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.so +ANDROID_EXTRA_LIBS += $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libcrypto.so \ + $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libssl.so } } From eb96edbd311dca4713657f01d143b0c72ffdd407 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 15 Jun 2016 14:43:29 -0400 Subject: [PATCH 12/20] separate DaemonQT and DaemonQTImpl --- Daemon.h | 8 ++++-- qt/i2pd_qt/DaemonQT.cpp | 61 +++++++++++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/Daemon.h b/Daemon.h index 2f7682eb..7467a518 100644 --- a/Daemon.h +++ b/Daemon.h @@ -1,6 +1,7 @@ #ifndef DAEMON_H__ #define DAEMON_H__ +#include #include namespace i2p @@ -32,6 +33,7 @@ namespace i2p #if defined(QT_GUI_LIB) // check if QT #define Daemon i2p::util::DaemonQT::Instance() + class DaemonQTImpl; class DaemonQT: public i2p::util::Daemon_Singleton { public: @@ -43,9 +45,11 @@ namespace i2p } bool init(int argc, char* argv[]); - bool start(); - bool stop(); void run (); + + private: + + std::shared_ptr m_Impl; }; #elif defined(_WIN32) diff --git a/qt/i2pd_qt/DaemonQT.cpp b/qt/i2pd_qt/DaemonQT.cpp index 19a13c6e..41242e3b 100644 --- a/qt/i2pd_qt/DaemonQT.cpp +++ b/qt/i2pd_qt/DaemonQT.cpp @@ -8,32 +8,57 @@ namespace i2p { namespace util { - std::unique_ptr app; - bool DaemonQT::init(int argc, char* argv[]) + class DaemonQTImpl: public std::enable_shared_from_this { - app.reset (new QApplication (argc, argv)); - return Daemon_Singleton::init(argc, argv); - } + public: - bool DaemonQT::start() - { - return Daemon_Singleton::start(); - } + DaemonQTImpl (int argc, char* argv[]): + m_App (argc, argv) + { + } + + void Run () + { + MainWindow w; + w.show (); + m_App.exec(); + } + + private: - bool DaemonQT::stop() + void StartDaemon () + { + Daemon.start (); + } + + void StopDaemon () + { + Daemon.stop (); + } + + bool IsRunning () const + { + return Daemon.running; + } + + private: + + QApplication m_App; + }; + + bool DaemonQT::init(int argc, char* argv[]) { - return Daemon_Singleton::stop(); + m_Impl = std::make_shared (argc, argv); + return Daemon_Singleton::init(argc, argv); } void DaemonQT::run () { - MainWindow w; - w.show (); - if (app) - { - app->exec(); - app.reset (nullptr); - } + if (m_Impl) + { + m_Impl->Run (); + m_Impl = nullptr; + } } } } From 5be147e8ccb9d22edf2acc30dde25cc1d1d3b6ed Mon Sep 17 00:00:00 2001 From: libre-net-society Date: Thu, 16 Jun 2016 01:11:42 +0300 Subject: [PATCH 13/20] More informative README and docs index --- README.md | 60 ++++++++++++++++++++++++++++++++------------------ docs/index.rst | 32 +++++++++++++++++---------- 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index b985abf4..0f4b2183 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,54 @@ i2pd ==== -Independent C++ implementation of I2P router +i2pd is a full-featured C++ implementation of +[I2P](https://geti2p.net/en/about/intro) client. -License -------- +I2P (Invisible Internet Project) is anonymous network which works on top of +public Internet. Privacy and anonymity are achieved by strong encryption and +bouncing your traffic through thousands of I2P nodes all around the world. -This project is licensed under the BSD 3-clause license, which can be found in the file -LICENSE in the root of the project source code. +We are building network which helps people to communicate and share information +without restrictions. -Donations ---------- +* [Website](http://i2pd.website) +* [Documentation](https://i2pd.readthedocs.io/en/latest/) +* [Wiki](https://github.com/PurpleI2P/i2pd/wiki) +* [Tickets/Issues](https://github.com/PurpleI2P/i2pd/issues) +* [Twitter](https://twitter.com/i2porignal) -BTC: 1K7Ds6KUeR8ya287UC4rYTjvC96vXyZbDY -LTC: LKQirrYrDeTuAPnpYq5y7LVKtywfkkHi59 -ANC: AQJYweYYUqM1nVfLqfoSMpUMfzxvS4Xd7z -DOGE: DNXLQKziRPAsD9H3DFNjk4fLQrdaSX893Y +Installing +---------- -Documentation: --------------- -http://i2pd.readthedocs.org +The easiest way to install i2pd is by using +[precompiled binaries](https://github.com/PurpleI2P/i2pd/releases/latest). +See [documentation](https://i2pd.readthedocs.io/en/latest/) for how to build +i2pd from source on your OS. -Supported OS ------------- +**Supported systems:** * Linux x86/x64 - [![Build Status](https://travis-ci.org/PurpleI2P/i2pd.svg?branch=openssl)](https://travis-ci.org/PurpleI2P/i2pd) * Windows - [![Build status](https://ci.appveyor.com/api/projects/status/1908qe4p48ff1x23?svg=true)](https://ci.appveyor.com/project/PurpleI2P/i2pd) * Mac OS X * FreeBSD +* Android *(coming soon)* + +Using i2pd +---------- + +See [documentation](https://i2pd.readthedocs.io/en/latest/) and +[example config file](https://github.com/PurpleI2P/i2pd/blob/openssl/docs/i2pd.conf). -More documentation ------------------- +Donations +--------- + +BTC: 1K7Ds6KUeR8ya287UC4rYTjvC96vXyZbDY +LTC: LKQirrYrDeTuAPnpYq5y7LVKtywfkkHi59 +ANC: AQJYweYYUqM1nVfLqfoSMpUMfzxvS4Xd7z +DOGE: DNXLQKziRPAsD9H3DFNjk4fLQrdaSX893Y + +License +------- -* [Building from source / unix](docs/build_notes_unix.md) -* [Building from source / windows](docs/build_notes_windows.md) -* [Configuring your i2pd](docs/configuration.md) -* [Github wiki](https://github.com/PurpleI2P/i2pd/wiki/) +This project is licensed under the BSD 3-clause license, which can be found in the file +LICENSE in the root of the project source code. diff --git a/docs/index.rst b/docs/index.rst index 3963dc3c..d0471add 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,20 +1,27 @@ i2pd ==== -`Website `_ | -`Github `_ | -`Issues `_ +i2pd is a full-featured C++ implementation of +`I2P `_ client. -i2pd is C++ implementation of `I2P `_. +* `Website `_ +* `GitHub `_ +* `Wiki `_ +* `Tickets/Issues `_ +* `Twitter `_ -Supports: ---------- - -* Complete I2P router functionality -* Floodfill -* HTTP and SOCKS proxy -* I2P client and server tunnels -* SAM and BOB interfaces +Installing +---------- + +The easiest way to install i2pd is by using +`precompiled binaries `_. +See documentation for how to build i2pd from source on your OS. + +Using i2pd +---------- + +See documentation and +`example config file `_. Contents: --------- @@ -28,3 +35,4 @@ Contents: configuration family + From ba330a42d652b249c1cfc19390b1f2e0fae244d3 Mon Sep 17 00:00:00 2001 From: xcps Date: Thu, 16 Jun 2016 09:15:30 -0400 Subject: [PATCH 14/20] Auto webconsole page refresh removed --- HTTPServer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index dc504c58..db27dee5 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -612,7 +612,6 @@ namespace http { HandleCommand (req, res, s); } else { ShowStatus (s); - res.add_header("Refresh", "5"); } ShowPageTail (s); From 675861c32324c2c5180377dbf7ecf670dc625720 Mon Sep 17 00:00:00 2001 From: xcps Date: Thu, 16 Jun 2016 09:18:46 -0400 Subject: [PATCH 15/20] Auto webconsole page refresh commented --- HTTPServer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index db27dee5..b40cef27 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -612,6 +612,7 @@ namespace http { HandleCommand (req, res, s); } else { ShowStatus (s); + //res.add_header("Refresh", "5"); } ShowPageTail (s); From ed561ad86b76f42344dc2dfed454495299387e65 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 16 Jun 2016 11:42:34 -0400 Subject: [PATCH 16/20] x86 build added --- qt/i2pd_qt/i2pd_qt.pro | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index b8b5adbb..355e94c7 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -156,6 +156,25 @@ DEPENDPATH += $$OPENSSL_PATH/openssl-1.0.2/include ANDROID_EXTRA_LIBS += $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libcrypto.so \ $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libssl.so } +equals(ANDROID_TARGET_ARCH, x86){ +# http://stackoverflow.com/a/30235934/529442 +LIBS += -L$$BOOST_PATH/boost_1_53_0/x86/lib \ +#/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ +#/home/anon5/git/OpenSSL-for-Android-Prebuilt/openssl-1.0.2/armeabi-v7a/lib/libssl.a \ +-lboost_system-gcc-mt-1_53 \ +-lboost_date_time-gcc-mt-1_53 \ +-lboost_filesystem-gcc-mt-1_53 \ +-lboost_program_options-gcc-mt-1_53 \ +-L$$OPENSSL_PATH/openssl-1.0.2/x86/lib/ -lcrypto -lssl + +PRE_TARGETDEPS += $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libcrypto.a \ + $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libssl.a + +DEPENDPATH += $$OPENSSL_PATH/openssl-1.0.2/include + +ANDROID_EXTRA_LIBS += $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libcrypto.so \ + $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libssl.so +} } linux:!android { From f2f760bda49086b23823ef5932b121aa28bde464 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 16 Jun 2016 14:29:32 -0400 Subject: [PATCH 17/20] link against correct openssl libs --- qt/i2pd_qt/i2pd_qt.pro | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index 355e94c7..80f89a1d 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -13,7 +13,7 @@ TEMPLATE = app QMAKE_CXXFLAGS *= -std=c++11 # git clone https://github.com/emileb/Boost-for-Android-Prebuilt.git -# git clone https://github.com/anon5/OpenSSL-for-Android-Prebuilt.git +# git clone https://github.com/hypnosis-i2p/OpenSSL-for-Android-Prebuilt # git clone https://github.com/anon5/android-ifaddrs.git # change to your own BOOST_PATH = /mnt/media/android/Boost-for-Android-Prebuilt @@ -153,8 +153,8 @@ PRE_TARGETDEPS += $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libcrypto.a \ DEPENDPATH += $$OPENSSL_PATH/openssl-1.0.2/include -ANDROID_EXTRA_LIBS += $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libcrypto.so \ - $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libssl.so +ANDROID_EXTRA_LIBS += $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libcrypto_1_0_0.so \ + $$OPENSSL_PATH/openssl-1.0.2/armeabi-v7a/lib/libssl_1_0_0.so } equals(ANDROID_TARGET_ARCH, x86){ # http://stackoverflow.com/a/30235934/529442 @@ -172,8 +172,8 @@ PRE_TARGETDEPS += $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libcrypto.a \ DEPENDPATH += $$OPENSSL_PATH/openssl-1.0.2/include -ANDROID_EXTRA_LIBS += $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libcrypto.so \ - $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libssl.so +ANDROID_EXTRA_LIBS += $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libcrypto_1_0_0.so \ + $$OPENSSL_PATH/openssl-1.0.2/x86/lib/libssl_1_0_0.so } } From 7ae563867c6bffd7de1ec5f47bbb3a09400585aa Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 16 Jun 2016 16:22:14 -0400 Subject: [PATCH 18/20] mainfest --- qt/i2pd_qt/android/AndroidManifest.xml | 60 ++++++++++++++++++++++++++ qt/i2pd_qt/i2pd_qt.pro | 5 +++ 2 files changed, 65 insertions(+) create mode 100644 qt/i2pd_qt/android/AndroidManifest.xml diff --git a/qt/i2pd_qt/android/AndroidManifest.xml b/qt/i2pd_qt/android/AndroidManifest.xml new file mode 100644 index 00000000..603776e7 --- /dev/null +++ b/qt/i2pd_qt/android/AndroidManifest.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index 80f89a1d..e5494b0a 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -185,5 +185,10 @@ LIBS += -lcrypto -lssl -lboost_system -lboost_date_time -lboost_filesystem -lboo unix:!macx: +DISTFILES += \ + android/AndroidManifest.xml + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + From b9cbdb2dc42a0bf915b6fd12981caac2472eb956 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 16 Jun 2016 18:20:07 -0400 Subject: [PATCH 19/20] Removed dependancy from stdafx --- qt/i2pd_qt/i2pd_qt.pro | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index e5494b0a..d820184f 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -12,9 +12,9 @@ TARGET = i2pd_qt TEMPLATE = app QMAKE_CXXFLAGS *= -std=c++11 -# git clone https://github.com/emileb/Boost-for-Android-Prebuilt.git -# git clone https://github.com/hypnosis-i2p/OpenSSL-for-Android-Prebuilt -# git clone https://github.com/anon5/android-ifaddrs.git +# git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git +# git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt +# git clone https://github.com/PuerpleI2P/android-ifaddrs.git # change to your own BOOST_PATH = /mnt/media/android/Boost-for-Android-Prebuilt OPENSSL_PATH = /mnt/media/android/OpenSSL-for-Android-Prebuilt @@ -57,7 +57,6 @@ SOURCES += DaemonQT.cpp\ ../../SSU.cpp \ ../../SSUData.cpp \ ../../SSUSession.cpp \ - ../../stdafx.cpp \ ../../Streaming.cpp \ ../../TransitTunnel.cpp \ ../../Transports.cpp \ @@ -107,7 +106,6 @@ HEADERS += mainwindow.h \ ../../SSU.h \ ../../SSUData.h \ ../../SSUSession.h \ - ../../stdafx.h \ ../../Streaming.h \ ../../Timestamp.h \ ../../TransitTunnel.h \ From 6264569ca042a38a8579a5d04a982d1cf7f6432f Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 17 Jun 2016 09:10:11 -0400 Subject: [PATCH 20/20] use /sdcard/i2pd at android --- FS.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/FS.cpp b/FS.cpp index 380ab2e5..89cdb7c8 100644 --- a/FS.cpp +++ b/FS.cpp @@ -54,6 +54,9 @@ namespace fs { dataDir = (home != NULL && strlen(home) > 0) ? home : ""; dataDir += "/Library/Application Support/" + appName; return; +#elif defined(ANDROID) + dataDir = "/sdcard/" + appName; // TODO: might not work for some devices + return; #else /* other unix */ char *home = getenv("HOME"); if (isService) {