From eba824f5d0a11bfb8e991324011a26a3e6408e32 Mon Sep 17 00:00:00 2001 From: MXPLRS | Kirill Date: Wed, 12 Oct 2016 19:03:35 +0300 Subject: [PATCH 01/25] script for inno setup --- Win32/installer.iss | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Win32/installer.iss diff --git a/Win32/installer.iss b/Win32/installer.iss new file mode 100644 index 00000000..fe348a4c --- /dev/null +++ b/Win32/installer.iss @@ -0,0 +1,32 @@ +#define I2Pd_AppName "i2pd" +#define I2Pd_ver "2.10.0" + +[Setup] +AppName={#I2Pd_AppName} +AppVersion={#I2Pd_ver} +DefaultDirName={pf}\I2Pd +DefaultGroupName=I2Pd +UninstallDisplayIcon={app}\I2Pd.exe +OutputDir=. +LicenseFile=../LICENSE +OutputBaseFilename=setup_{#I2Pd_AppName}_v{#I2Pd_ver} +InternalCompressLevel=ultra64 +Compression=lzma/ultra64 +SolidCompression=true +ArchitecturesInstallIn64BitMode=x64 + +[Files] +Source: "..\i2pd_x86.exe"; DestDir: "{app}"; DestName: "i2pd.exe"; Flags: ignoreversion; Check: not IsWin64 +Source: "..\i2pd_x64.exe"; DestDir: "{app}"; DestName: "i2pd.exe"; Flags: ignoreversion; Check: IsWin64 +Source: "..\README.md"; DestDir: "{app}"; DestName: "Readme.txt"; Flags: onlyifdoesntexist +Source: "..\docs\i2pd.conf"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist +Source: "..\docs\subscriptions.txt"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist +Source: "..\docs\tunnels.conf"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist +Source: "..\contrib\certificates"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs + +[Icons] +Name: "{group}\I2Pd"; Filename: "{app}\i2pd.exe" +Name: "{group}\Readme"; Filename: "{app}\Readme.txt" + +[UninstallDelete] +Type: filesandordirs; Name: {app}\* From 85c7bfa160cfb6d42717ee13d2e23da880af2b2c Mon Sep 17 00:00:00 2001 From: MXPLRS | Kirill Date: Wed, 12 Oct 2016 19:30:20 +0300 Subject: [PATCH 02/25] Update installer.iss --- Win32/installer.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Win32/installer.iss b/Win32/installer.iss index fe348a4c..7bfe63d9 100644 --- a/Win32/installer.iss +++ b/Win32/installer.iss @@ -22,7 +22,7 @@ Source: "..\README.md"; DestDir: "{app}"; DestName: "Readme.txt"; Flags: onlyifd Source: "..\docs\i2pd.conf"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist Source: "..\docs\subscriptions.txt"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist Source: "..\docs\tunnels.conf"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist -Source: "..\contrib\certificates"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs +Source: "..\contrib\*"; DestDir: "{userappdata}\i2pd"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs [Icons] Name: "{group}\I2Pd"; Filename: "{app}\i2pd.exe" From e45e5df37754a74956917a1e9c293e6f5835f885 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 12 Oct 2016 12:31:27 -0400 Subject: [PATCH 03/25] openssl 1.1 DSA functions --- Crypto.cpp | 7 ++----- Crypto.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Crypto.cpp b/Crypto.cpp index 885c65f4..94d1c4c6 100644 --- a/Crypto.cpp +++ b/Crypto.cpp @@ -135,11 +135,8 @@ namespace crypto DSA * CreateDSA () { DSA * dsa = DSA_new (); - dsa->p = BN_dup (dsap); - dsa->q = BN_dup (dsaq); - dsa->g = BN_dup (dsag); - dsa->priv_key = NULL; - dsa->pub_key = NULL; + DSA_set0_pqg (dsa, BN_dup (dsap), BN_dup (dsaq), BN_dup (dsag)); + DSA_set0_key (dsa, NULL, NULL); return dsa; } diff --git a/Crypto.h b/Crypto.h index a66f51b7..19ea0a13 100644 --- a/Crypto.h +++ b/Crypto.h @@ -279,6 +279,16 @@ namespace crypto void InitCrypto (bool precomputation); void TerminateCrypto (); + +// take care about openssl version +#include +#if (OPENSSL_VERSION_NUMBER < 0x010100000) // 1.1.0 +// define getters and setters introduced in 1.1.0 +inline int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) { d->p = p; d->q = q; d->g = g; return 1; } +inline int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) { d->pub_key = pub_key; d->priv_key = priv_key; return 1; } + +#endif + } } From fbf75ea3b9df45704af7dc69b6333264afcc33c8 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 12 Oct 2016 13:28:22 -0400 Subject: [PATCH 04/25] check if signer/verifier is set already --- Identity.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Identity.cpp b/Identity.cpp index 99da059e..30051914 100644 --- a/Identity.cpp +++ b/Identity.cpp @@ -309,6 +309,7 @@ namespace data void IdentityEx::CreateVerifier () const { + if (m_Verifier) return; // don't create again auto keyType = GetSigningKeyType (); switch (keyType) { @@ -476,6 +477,7 @@ namespace data void PrivateKeys::CreateSigner () const { + if (m_Signer) return; switch (m_Public->GetSigningKeyType ()) { case SIGNING_KEY_TYPE_DSA_SHA1: From 32b47bee2ca71a7a0b4e801be5dc27b39f6ed45c Mon Sep 17 00:00:00 2001 From: l-n-s Date: Wed, 12 Oct 2016 17:52:07 +0000 Subject: [PATCH 05/25] Update README.md Add link to Russian docs --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1fbf6c43..f4e0e3cf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ i2pd ==== +[Русская версия](https://github.com/PurpleI2P/i2pd_docs_ru/blob/master/README.md) + i2pd (I2P Daemon) is a full-featured C++ implementation of I2P client. I2P (Invisible Internet Protocol) is a universal anonymous network layer. From 07a1651fa205d5d328c5279c2fc0c1752dbcbd26 Mon Sep 17 00:00:00 2001 From: l-n-s Date: Thu, 13 Oct 2016 07:45:30 +0000 Subject: [PATCH 06/25] Update usage.md fix for readthedocs --- docs/usage.md | 66 +++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index cb678cb4..9480a556 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -35,19 +35,19 @@ If you wish to run your own website in Invisible Internet, follow those steps: 2) Configure i2pd to create HTTP server tunnel. Put in your ~/.i2pd/tunnels.conf file: - [anon-website] - type = http - host = 127.0.0.1 - port = 8080 - keys = anon-website.dat + [anon-website] + type = http + host = 127.0.0.1 + port = 8080 + keys = anon-website.dat 3) Restart i2pd. 4) Find b32 destination of your website. -Go to webconsole -> [I2P tunnels page](http://127.0.0.1:7070/?page=i2p_tunnels). Look for Sever tunnels and you will see address like \.b32.i2p next to anon-website. + Go to webconsole -> [I2P tunnels page](http://127.0.0.1:7070/?page=i2p_tunnels). Look for Sever tunnels and you will see address like \.b32.i2p next to anon-website. -Website is now available in Invisible Internet by visiting this address. + Website is now available in Invisible Internet by visiting this address. 5) (Optional) Register short and rememberable .i2p domain on [inr.i2p](http://inr.i2p). @@ -58,51 +58,51 @@ Website is now available in Invisible Internet by visiting this address. 1) Run your IRC server software and find out which host:port it uses (for example, 127.0.0.1:5555). -For small private IRC servers you can use [miniircd](https://github.com/jrosdahl/miniircd), for large public networks [UnreadIRCd](https://www.unrealircd.org/). + For small private IRC servers you can use [miniircd](https://github.com/jrosdahl/miniircd), for large public networks [UnreadIRCd](https://www.unrealircd.org/). 2) Configure i2pd to create IRC server tunnel. -Simplest case, if your server does not support WebIRC, add this to ~/.i2pd/tunnels.conf: + Simplest case, if your server does not support WebIRC, add this to ~/.i2pd/tunnels.conf: - [anon-chatserver] - type = irc - host = 127.0.0.1 - port = 5555 - keys = chatserver-key.dat + [anon-chatserver] + type = irc + host = 127.0.0.1 + port = 5555 + keys = chatserver-key.dat -And that is it. + And that is it. -Alternatively, if your IRC server supports WebIRC, for example, UnreadIRCd, put this into UnrealIRCd config: + Alternatively, if your IRC server supports WebIRC, for example, UnreadIRCd, put this into UnrealIRCd config: - webirc { - mask 127.0.0.1; - password your_password; - }; + webirc { + mask 127.0.0.1; + password your_password; + }; -Also change line: + Also change line: - modes-on-connect "+ixw"; + modes-on-connect "+ixw"; -to + to - modes-on-connect "+iw"; + modes-on-connect "+iw"; -And this in ~/.i2pd/tunnels.conf: + And this in ~/.i2pd/tunnels.conf: - [anon-chatserver] - type = irc - host = 127.0.0.1 - port = 5555 - keys = chatserver-key.dat - webircpassword = your_password + [anon-chatserver] + type = irc + host = 127.0.0.1 + port = 5555 + keys = chatserver-key.dat + webircpassword = your_password 3) Restart i2pd. 4) Find b32 destination of your anonymous IRC server. -Go to webconsole -> [I2P tunnels page](http://127.0.0.1:7070/?page=i2p_tunnels). Look for Sever tunnels and you will see address like \.b32.i2p next to anon-chatserver. + Go to webconsole -> [I2P tunnels page](http://127.0.0.1:7070/?page=i2p_tunnels). Look for Sever tunnels and you will see address like \.b32.i2p next to anon-chatserver. -Clients will use this address to connect to your server anonymously. + Clients will use this address to connect to your server anonymously. ### Connect to anonymous IRC server From bde5d27a202b055188c43df868e69b46cbd0ed8e Mon Sep 17 00:00:00 2001 From: l-n-s Date: Thu, 13 Oct 2016 16:56:23 +0000 Subject: [PATCH 07/25] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f4e0e3cf..368223fa 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ i2pd from source on your OS. * Mac OS X * FreeBSD * Android +* iOS Using i2pd ---------- From f687728c3aa2d33df8c96fe35f02b64aa38ab308 Mon Sep 17 00:00:00 2001 From: l-n-s Date: Sun, 16 Oct 2016 10:59:48 +0000 Subject: [PATCH 08/25] edit link to usage documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 368223fa..77527562 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ i2pd from source on your OS. Using i2pd ---------- -See [documentation](https://i2pd.readthedocs.io/en/latest/) and +See [documentation](https://i2pd.readthedocs.io/en/latest/usage.html) and [example config file](https://github.com/PurpleI2P/i2pd/blob/openssl/docs/i2pd.conf). Donations From 04ee419951171b84139722f5b6efae937a45c6ed Mon Sep 17 00:00:00 2001 From: l-n-s Date: Sun, 16 Oct 2016 11:04:59 +0000 Subject: [PATCH 09/25] small fixes for docs --- docs/build_notes_unix.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/build_notes_unix.md b/docs/build_notes_unix.md index 18e51e62..970024d2 100644 --- a/docs/build_notes_unix.md +++ b/docs/build_notes_unix.md @@ -4,8 +4,9 @@ Building on Unix systems First of all we need to make sure that all dependencies are satisfied. This doc is trying to cover: -* [Debian/Ubuntu](#debianubuntu) (contains packaging instructions) -* [Fedora/Centos](#fedoracentos) +* [Debian/Ubuntu](#debian-ubuntu) (contains packaging instructions) +* [Fedora/Centos](#fedora-centos) +* [Fedora/Centos](#mac-os-x) * [FreeBSD](#freebsd) Make sure you have all required dependencies for your system successfully installed. @@ -73,7 +74,8 @@ sudo yum install make cmake gcc gcc-c++ *Latest Fedora system using [DNF](https://en.wikipedia.org/wiki/DNF_(software)) instead of YUM by default, you may prefer to use DNF, but YUM should be ok* -> *Centos 7 has CMake 2.8.11 in the official repositories that too old to build i2pd, CMake >=2.8.12 is required* +> *Centos 7 has CMake 2.8.11 in the official repositories that too old to build i2pd, CMake >=2.8.12 is required.* +> > You could build CMake for Centos manualy(WARNING there are a lot of build dependencies!): > ```bash > wget https://kojipkgs.fedoraproject.org/packages/cmake/2.8.12/3.fc21/src/cmake-2.8.12-3.fc21.src.rpm @@ -95,7 +97,7 @@ miniupnpc-devel MAC OS X -------- -Requires homebrew +Requires [homebrew](http://brew.sh/) ```bash brew install libressl boost From 1ceda52f5924f4d5730b8ae944f87c0a7d9565c5 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 16 Oct 2016 07:52:45 -0400 Subject: [PATCH 10/25] 2.10.0 --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 00064c00..3814f5f4 100644 --- a/version.h +++ b/version.h @@ -7,7 +7,7 @@ #define MAKE_VERSION(a,b,c) STRINGIZE(a) "." STRINGIZE(b) "." STRINGIZE(c) #define I2PD_VERSION_MAJOR 2 -#define I2PD_VERSION_MINOR 9 +#define I2PD_VERSION_MINOR 10 #define I2PD_VERSION_MICRO 0 #define I2PD_VERSION_PATCH 0 #define I2PD_VERSION MAKE_VERSION(I2PD_VERSION_MAJOR, I2PD_VERSION_MINOR, I2PD_VERSION_MICRO) @@ -21,7 +21,7 @@ #define I2P_VERSION_MAJOR 0 #define I2P_VERSION_MINOR 9 -#define I2P_VERSION_MICRO 26 +#define I2P_VERSION_MICRO 27 #define I2P_VERSION_PATCH 0 #define I2P_VERSION MAKE_VERSION(I2P_VERSION_MAJOR, I2P_VERSION_MINOR, I2P_VERSION_MICRO) From a943cc09fe8a4d7295ac63c6e96e96448e48bf22 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 16 Oct 2016 07:58:26 -0400 Subject: [PATCH 11/25] 2.10.0 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6600f8e4..45c5ca67 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +i2pd (2.10.0-1) unstable; urgency=low + + * updated to version 2.10.0/0.9.27 + * eliminated subsriptions.txt + + -- orignal Sun, 16 2016 13:55:40 +0000 + i2pd (2.9.0-1) unstable; urgency=low * updated to version 2.9.0 From 12c67b5db4ef24a0744a1477c557d5bc9f39a71c Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 16 Oct 2016 08:35:48 -0400 Subject: [PATCH 12/25] 2.10.0 --- android/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index b6cc6f26..b7e13979 100755 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="2.10.0"> From c42e2fe02ddea91807a1f479d1f6a160e76c8682 Mon Sep 17 00:00:00 2001 From: l-n-s Date: Sun, 16 Oct 2016 13:17:00 +0000 Subject: [PATCH 13/25] Update i2pd.conf --- docs/i2pd.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/i2pd.conf b/docs/i2pd.conf index 9ade3663..5e2770f6 100644 --- a/docs/i2pd.conf +++ b/docs/i2pd.conf @@ -92,6 +92,8 @@ ipv6 = false # name = I2Pd [reseed] +## Enable or disable reseed data verification. +verify = true ## URLs to request reseed data from, separated by comma ## Default: "mainline" I2P Network reseeds # urls = https://reseed.i2p-projekt.de/,https://i2p.mooo.com/netDb/,https://netdb.i2p2.no/ From 2edd64470be91b19048548fce32ea8cd86da5d9c Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 16 Oct 2016 09:19:48 -0400 Subject: [PATCH 14/25] Update changelog --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 45c5ca67..639629d1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ i2pd (2.10.0-1) unstable; urgency=low * updated to version 2.10.0/0.9.27 - * eliminated subsriptions.txt + * reseed.verify set to true by default -- orignal Sun, 16 2016 13:55:40 +0000 From 3643d6b5d5077f6c81120b23b8fc404264b9dbc9 Mon Sep 17 00:00:00 2001 From: MXPLRS | Kirill Date: Mon, 17 Oct 2016 07:37:40 +0300 Subject: [PATCH 15/25] Update changelog --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 639629d1..1ecafa34 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,7 @@ i2pd (2.10.0-1) unstable; urgency=low * updated to version 2.10.0/0.9.27 * reseed.verify set to true by default - -- orignal Sun, 16 2016 13:55:40 +0000 + -- orignal Sun, 16 Oct 2016 13:55:40 +0000 i2pd (2.9.0-1) unstable; urgency=low From d97acacae60da84d5ee34e56111fd93c530ecc21 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 17 Oct 2016 18:45:20 -0400 Subject: [PATCH 16/25] sequential LeaseSet request --- Destination.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index d400259c..80eecaa2 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -373,26 +373,24 @@ namespace client for (int i = 0; i < num; i++) { i2p::data::IdentHash peerHash (buf + 33 + i*32); - auto floodfill = i2p::data::netdb.FindRouter (peerHash); - if (floodfill) + if (!request->excluded.count (peerHash) && !i2p::data::netdb.FindRouter (peerHash)) { - LogPrint (eLogInfo, "Destination: Requesting ", key.ToBase64 (), " at ", peerHash.ToBase64 ()); - if (SendLeaseSetRequest (key, floodfill, request)) - found = true; - } - else - { LogPrint (eLogInfo, "Destination: Found new floodfill, request it"); // TODO: recheck this message i2p::data::netdb.RequestDestination (peerHash); } } - if (!found) - LogPrint (eLogError, "Destination: Suggested floodfills are not presented in netDb"); + + auto floodfill = i2p::data::netdb.GetClosestFloodfill (key, request->excluded); + if (floodfill) + { + LogPrint (eLogInfo, "Destination: Requesting ", key.ToBase64 (), " at ", floodfill->GetIdentHash ().ToBase64 ()); + if (SendLeaseSetRequest (key, floodfill, request)) + found = true; + } } - else - LogPrint (eLogInfo, "Destination: ", key.ToBase64 (), " was not found on ", MAX_NUM_FLOODFILLS_PER_REQUEST, " floodfills"); if (!found) - { + { + LogPrint (eLogInfo, "Destination: ", key.ToBase64 (), " was not found on ", MAX_NUM_FLOODFILLS_PER_REQUEST, " floodfills"); if (request->requestComplete) request->requestComplete (nullptr); m_LeaseSetRequests.erase (key); } From 442a0c48e7f6ce7c67b06a3839a6360d695e1430 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 19 Oct 2016 10:23:02 -0400 Subject: [PATCH 17/25] fixed #675. I2LUA define --- Destination.cpp | 2 ++ Destination.h | 15 +++++++++------ NetDb.h | 1 - 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index 80eecaa2..d020d96e 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -716,6 +716,7 @@ namespace client return false; } +#ifdef I2LUA void ClientDestination::Ready(ReadyPromise & p) { ScheduleCheckForReady(&p); @@ -739,6 +740,7 @@ namespace client else // we are not ready ScheduleCheckForReady(p); } +#endif void ClientDestination::HandleDataMessage (const uint8_t * buf, size_t len) { diff --git a/Destination.h b/Destination.h index 22ffa603..e2d532e8 100644 --- a/Destination.h +++ b/Destination.h @@ -8,7 +8,9 @@ #include #include #include +#ifdef I2LUA #include +#endif #include #include "Identity.h" #include "TunnelPool.h" @@ -145,18 +147,19 @@ namespace client class ClientDestination: public LeaseSetDestination { public: +#ifdef I2LUA // type for informing that a client destination is ready typedef std::promise > ReadyPromise; + // informs promise with shared_from_this() when this destination is ready to use + // if cancelled before ready, informs promise with nullptr + void Ready(ReadyPromise & p); +#endif ClientDestination (const i2p::data::PrivateKeys& keys, bool isPublic, const std::map * params = nullptr); ~ClientDestination (); bool Start (); bool Stop (); - - // informs promise with shared_from_this() when this destination is ready to use - // if cancelled before ready, informs promise with nullptr - void Ready(ReadyPromise & p); const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; }; void Sign (const uint8_t * buf, int len, uint8_t * signature) const { m_Keys.Sign (buf, len, signature); }; @@ -191,10 +194,10 @@ namespace client std::shared_ptr GetSharedFromThis () { return std::static_pointer_cast(shared_from_this ()); } void PersistTemporaryKeys (); - +#ifdef I2LUA void ScheduleCheckForReady(ReadyPromise * p); void HandleCheckForReady(const boost::system::error_code & ecode, ReadyPromise * p); - +#endif private: i2p::data::PrivateKeys m_Keys; diff --git a/NetDb.h b/NetDb.h index d8ee148a..d295ebbe 100644 --- a/NetDb.h +++ b/NetDb.h @@ -8,7 +8,6 @@ #include #include #include -#include #include "Base.h" #include "Gzip.h" From cb324ca723e9cc890ea3d71bec1eac360987aef0 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 19 Oct 2016 12:54:13 -0400 Subject: [PATCH 18/25] portable windows data directory --- FS.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/FS.cpp b/FS.cpp index a809e8c4..84b30f21 100644 --- a/FS.cpp +++ b/FS.cpp @@ -45,9 +45,19 @@ namespace fs { return; } #if defined(WIN32) || defined(_WIN32) - char localAppData[MAX_PATH]; - SHGetFolderPath(NULL, CSIDL_APPDATA, 0, NULL, localAppData); - dataDir = std::string(localAppData) + "\\" + appName; + char localAppData[MAX_PATH]; + // check executable directory first + GetModuleFileName (NULL, localAppData, MAX_PATH); + auto execPath = boost::filesystem::path(localAppData).parent_path(); + // if config file exists in .exe's folder use it + if(boost::filesystem::exists(execPath/"i2pd.conf")) // TODO: magic string + dataDir = execPath.string (); + else + { + // otherwise %appdata% + SHGetFolderPath(NULL, CSIDL_APPDATA, 0, NULL, localAppData); + dataDir = std::string(localAppData) + "\\" + appName; + } return; #elif defined(MAC_OSX) char *home = getenv("HOME"); @@ -57,12 +67,12 @@ namespace fs { #else /* other unix */ #if defined(ANDROID) if (boost::filesystem::exists("/sdcard")) - { - dataDir = "/sdcard/" + appName; + { + dataDir = "/sdcard/" + appName; return; - } - // otherwise use /data/files -#endif + } + // otherwise use /data/files +#endif char *home = getenv("HOME"); if (isService) { dataDir = "/var/lib/" + appName; @@ -112,10 +122,10 @@ namespace fs { bool CreateDirectory (const std::string& path) { - if (boost::filesystem::exists(path) && + if (boost::filesystem::exists(path) && boost::filesystem::is_directory (boost::filesystem::status (path))) return true; return boost::filesystem::create_directory(path); - } + } void HashedStorage::SetPlace(const std::string &path) { root = path + i2p::fs::dirSep + name; @@ -125,7 +135,7 @@ namespace fs { if (!boost::filesystem::exists(root)) { boost::filesystem::create_directories(root); } - + for (size_t i = 0; i < count; i++) { auto p = root + i2p::fs::dirSep + prefix1 + chars[i]; if (boost::filesystem::exists(p)) From 0df04501076a14e33894975a862560a02d7a001c Mon Sep 17 00:00:00 2001 From: Anatolii Vorona Date: Thu, 20 Oct 2016 12:18:59 +0200 Subject: [PATCH 19/25] added spec and service files --- i2pd.service | 16 +++++++ i2pd.spec | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 i2pd.service create mode 100644 i2pd.spec diff --git a/i2pd.service b/i2pd.service new file mode 100644 index 00000000..b14af025 --- /dev/null +++ b/i2pd.service @@ -0,0 +1,16 @@ +[Unit] +Description=I2P router +After=network.target + +[Service] +User=i2pd +Group=i2pd +Type=simple +ExecStart=/usr/bin/i2pd --service +PIDFile=/var/lib/i2pd/i2pd.pid +Restart=always +PrivateTmp=true + +[Install] +WantedBy=multi-user.target + diff --git a/i2pd.spec b/i2pd.spec new file mode 100644 index 00000000..8b66d911 --- /dev/null +++ b/i2pd.spec @@ -0,0 +1,129 @@ +Name: i2pd +Version: 2.10.0 +Release: 2%{?dist} +Summary: I2P router written in C++ + +License: BSD +URL: https://github.com/PurpleI2P/i2pd +Source0: https://github.com/PurpleI2P/i2pd/archive/%{version}/%name-%version.tar.gz +Source1: i2pd.service + +%if 0%{?rhel} == 7 +BuildRequires: cmake3 +%else +BuildRequires: cmake +%endif + +BuildRequires: chrpath +BuildRequires: gcc-c++ +BuildRequires: zlib-devel +BuildRequires: boost-devel +BuildRequires: openssl-devel +BuildRequires: miniupnpc-devel +BuildRequires: systemd-units + +%description +C++ implementation of I2P. + + +%package systemd +Summary: Files to run I2P router under systemd +Requires: i2pd +Requires: systemd +Requires(pre): %{_sbindir}/useradd %{_sbindir}/groupadd +Obsoletes: %{name}-daemon + + +%description systemd +C++ implementation of I2P. + +This package contains systemd unit file to run i2pd as a system service +using dedicated user's permissions. + + +%prep +%setup -q + + +%build +cd build +%if 0%{?rhel} == 7 +%cmake3 \ + -DWITH_LIBRARY=OFF \ + -DWITH_UPNP=ON \ + -DWITH_HARDENING=ON \ + -DBUILD_SHARED_LIBS:BOOL=OFF +%else +%cmake \ + -DWITH_LIBRARY=OFF \ + -DWITH_UPNP=ON \ + -DWITH_HARDENING=ON \ + -DBUILD_SHARED_LIBS:BOOL=OFF +%endif + +make %{?_smp_mflags} + + +%install +cd build +chrpath -d i2pd +install -D -m 755 i2pd %{buildroot}%{_bindir}/i2pd +install -D -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/i2pd.service +install -d -m 700 %{buildroot}/%{_sharedstatedir}/i2pd + + +%pre systemd +getent group i2pd >/dev/null || %{_sbindir}/groupadd -r i2pd +getent passwd i2pd >/dev/null || \ + %{_sbindir}/useradd -r -g i2pd -s %{_sbindir}/nologin \ + -d %{_sharedstatedir}/i2pd -c 'I2P Service' i2pd + + +%post systemd +%systemd_post i2pd.service + + +%preun systemd +%systemd_preun i2pd.service + + +%postun systemd +%systemd_postun_with_restart i2pd.service + + +%files +%doc LICENSE README.md +%_bindir/i2pd + + +%files systemd +/%_unitdir/i2pd.service +%dir %attr(0700,i2pd,i2pd) %_sharedstatedir/i2pd + + +%changelog +* Tue Oct 20 2016 Anatolii Vorona - 2.10.0-2 +- add support C7 + +* Sun Oct 16 2016 Oleg Girko - 2.10.0-1 +- update to 2.10.0 + +* Sun Aug 14 2016 Oleg Girko - 2.9.0-1 +- update to 2.9.0 + +* Sun Aug 07 2016 Oleg Girko - 2.8.0-2 +- rename daemon subpackage to systemd + +* Sat Aug 06 2016 Oleg Girko - 2.8.0-1 +- update to 2.8.0 +- remove wrong rpath from i2pd binary +- add daemon subpackage with systemd unit file + +* Sat May 21 2016 Oleg Girko - 2.7.0-1 +- update to 2.7.0 + +* Tue Apr 05 2016 Oleg Girko - 2.6.0-1 +- update to 2.6.0 + +* Tue Jan 26 2016 Yaroslav Sidlovsky - 2.3.0-1 +- initial package for version 2.3.0 From f4cb4c1756e5e52501a0f2d2f45b2f8ade5a6398 Mon Sep 17 00:00:00 2001 From: BOPOHA Date: Thu, 20 Oct 2016 13:41:41 +0200 Subject: [PATCH 20/25] fixed Centos 7 notes --- docs/build_notes_unix.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/build_notes_unix.md b/docs/build_notes_unix.md index 970024d2..b1cc4148 100644 --- a/docs/build_notes_unix.md +++ b/docs/build_notes_unix.md @@ -74,16 +74,6 @@ sudo yum install make cmake gcc gcc-c++ *Latest Fedora system using [DNF](https://en.wikipedia.org/wiki/DNF_(software)) instead of YUM by default, you may prefer to use DNF, but YUM should be ok* -> *Centos 7 has CMake 2.8.11 in the official repositories that too old to build i2pd, CMake >=2.8.12 is required.* -> -> You could build CMake for Centos manualy(WARNING there are a lot of build dependencies!): -> ```bash -> wget https://kojipkgs.fedoraproject.org/packages/cmake/2.8.12/3.fc21/src/cmake-2.8.12-3.fc21.src.rpm -> yum-builddep cmake-2.8.12-3.fc21.src.rpm -> rpmbuild --rebuild cmake-2.8.12-3.fc21.src.rpm -> yum install ~/rpmbuild/RPMS/x86_64/cmake-2.8.12-3.el7.centos.x86_64.rpm -> ``` - Also you will need a bunch of development libraries ```bash sudo yum install boost-devel openssl-devel @@ -93,6 +83,15 @@ If you need UPnP support (don't forget to run CMake with `WITH_UPNP=ON`) miniupn ```bash miniupnpc-devel ``` +> *Centos 7 has CMake 2.8.11 in the official repositories that too old to build i2pd, CMake >=2.8.12 is required.* +> +> But you can use cmake3 from the epel repository: +> ```bash +> yum install epel-release -y +> yum install make cmake3 gcc gcc-c++ miniupnpc-devel boost-devel openssl-devel -y +> cmake3 -DWITH_LIBRARY=OFF -DWITH_UPNP=ON -DWITH_HARDENING=ON -DBUILD_SHARED_LIBS:BOOL=OFF +> make +> ``` MAC OS X -------- From b683c07d5560e4813c7a2c3a684e0d50c6f31ac5 Mon Sep 17 00:00:00 2001 From: l-n-s Date: Thu, 20 Oct 2016 13:08:38 +0000 Subject: [PATCH 21/25] move rpm-related files to contrib folder --- i2pd.service => contrib/rpm/i2pd.service | 0 i2pd.spec => contrib/rpm/i2pd.spec | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename i2pd.service => contrib/rpm/i2pd.service (100%) rename i2pd.spec => contrib/rpm/i2pd.spec (100%) diff --git a/i2pd.service b/contrib/rpm/i2pd.service similarity index 100% rename from i2pd.service rename to contrib/rpm/i2pd.service diff --git a/i2pd.spec b/contrib/rpm/i2pd.spec similarity index 100% rename from i2pd.spec rename to contrib/rpm/i2pd.spec From c15e53e9c070380c1950c7a763330c462cc39b88 Mon Sep 17 00:00:00 2001 From: Anatolii Vorona Date: Thu, 20 Oct 2016 15:49:56 +0200 Subject: [PATCH 22/25] fix paths --- contrib/rpm/i2pd.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/rpm/i2pd.spec b/contrib/rpm/i2pd.spec index 8b66d911..bb58d28d 100644 --- a/contrib/rpm/i2pd.spec +++ b/contrib/rpm/i2pd.spec @@ -1,12 +1,11 @@ Name: i2pd Version: 2.10.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: I2P router written in C++ License: BSD URL: https://github.com/PurpleI2P/i2pd Source0: https://github.com/PurpleI2P/i2pd/archive/%{version}/%name-%version.tar.gz -Source1: i2pd.service %if 0%{?rhel} == 7 BuildRequires: cmake3 @@ -68,7 +67,7 @@ make %{?_smp_mflags} cd build chrpath -d i2pd install -D -m 755 i2pd %{buildroot}%{_bindir}/i2pd -install -D -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/i2pd.service +install -D -m 644 %{_builddir}/%{name}-%{version}/contrib/rpm/i2pd.service %{buildroot}/%{_unitdir}/i2pd.service install -d -m 700 %{buildroot}/%{_sharedstatedir}/i2pd @@ -102,8 +101,9 @@ getent passwd i2pd >/dev/null || \ %changelog -* Tue Oct 20 2016 Anatolii Vorona - 2.10.0-2 +* Tue Oct 20 2016 Anatolii Vorona - 2.10.0-3 - add support C7 +- move rpm-related files to contrib folder * Sun Oct 16 2016 Oleg Girko - 2.10.0-1 - update to 2.10.0 From ed09c1171bc2b5ce3e41d8051d7e404343026005 Mon Sep 17 00:00:00 2001 From: Vlad Glagolev Date: Thu, 20 Oct 2016 10:37:45 -0400 Subject: [PATCH 23/25] fixed build with LibreSSL --- Crypto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Crypto.h b/Crypto.h index 19ea0a13..4408a193 100644 --- a/Crypto.h +++ b/Crypto.h @@ -282,7 +282,7 @@ namespace crypto // take care about openssl version #include -#if (OPENSSL_VERSION_NUMBER < 0x010100000) // 1.1.0 +#if (OPENSSL_VERSION_NUMBER < 0x010100000) || defined(LIBRESSL_VERSION_NUMBER) // 1.1.0 or LibreSSL // define getters and setters introduced in 1.1.0 inline int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) { d->p = p; d->q = q; d->g = g; return 1; } inline int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) { d->pub_key = pub_key; d->priv_key = priv_key; return 1; } From 25c188496131f71ae752e6ae40b147e7f4e48e4a Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 20 Oct 2016 15:20:08 -0400 Subject: [PATCH 24/25] correct stream termination --- I2PTunnel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index be48b83a..0ce9a7e3 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -175,7 +175,9 @@ namespace client Write (m_StreamBuffer, bytes_transferred); // postpone termination else Terminate (); - } + } + else + Terminate (); } else Write (m_StreamBuffer, bytes_transferred); From b68381db5802eea64120f3f4095ce55089bc64fe Mon Sep 17 00:00:00 2001 From: Vlad Glagolev Date: Sat, 22 Oct 2016 16:38:45 -0400 Subject: [PATCH 25/25] fixed build with OpenBSD --- DaemonLinux.cpp | 2 ++ Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DaemonLinux.cpp b/DaemonLinux.cpp index 22d7dec8..87e50a72 100644 --- a/DaemonLinux.cpp +++ b/DaemonLinux.cpp @@ -75,10 +75,12 @@ namespace i2p return false; } +#if !defined(__OpenBSD__) // point std{in,out,err} descriptors to /dev/null stdin = freopen("/dev/null", "r", stdin); stdout = freopen("/dev/null", "w", stdout); stderr = freopen("/dev/null", "w", stderr); +#endif } // Pidfile diff --git a/Makefile b/Makefile index 147bedd4..5cb32004 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ ifeq ($(UNAME),Darwin) else include Makefile.osx endif -else ifeq ($(shell echo $(UNAME) | $(GREP) -c FreeBSD),1) +else ifeq ($(shell echo $(UNAME) | $(GREP) -Ec '(Free|Open)BSD'),1) DAEMON_SRC += DaemonLinux.cpp include Makefile.bsd else ifeq ($(UNAME),Linux)