mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-23 22:07:16 +01:00
commit
36afef3498
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
# i2pd
|
# i2pd
|
||||||
obj/*.o
|
*.o
|
||||||
router.info
|
router.info
|
||||||
router.keys
|
router.keys
|
||||||
i2p
|
i2p
|
||||||
|
@ -249,3 +249,9 @@ docs/generated
|
||||||
|
|
||||||
# gdb files
|
# gdb files
|
||||||
.gdb_history
|
.gdb_history
|
||||||
|
|
||||||
|
# cmake makefile
|
||||||
|
build/Makefile
|
||||||
|
|
||||||
|
# debian stuff
|
||||||
|
.pc/
|
11
ChangeLog
11
ChangeLog
|
@ -1,6 +1,17 @@
|
||||||
# for this file format description,
|
# for this file format description,
|
||||||
# see https://github.com/olivierlacan/keep-a-changelog
|
# see https://github.com/olivierlacan/keep-a-changelog
|
||||||
|
|
||||||
|
## [2.14.0] - 2017-06-01
|
||||||
|
### Added
|
||||||
|
- Transit traffic bandwidth limitation
|
||||||
|
- NTCP connections through HTTP and SOCKS proxies
|
||||||
|
- Ability to disable address helper for HTTP proxy
|
||||||
|
### Changed
|
||||||
|
- Reseed servers list
|
||||||
|
- Minimal required version is 4.0 for Android
|
||||||
|
### Fixed
|
||||||
|
- Ignore comments in addressbook feed
|
||||||
|
|
||||||
## [2.13.0] - 2017-04-06
|
## [2.13.0] - 2017-04-06
|
||||||
### Added
|
### Added
|
||||||
- Persist local destination's tags
|
- Persist local destination's tags
|
||||||
|
|
22
Makefile
22
Makefile
|
@ -7,6 +7,10 @@ I2PD := i2pd
|
||||||
GREP := grep
|
GREP := grep
|
||||||
DEPS := obj/make.dep
|
DEPS := obj/make.dep
|
||||||
|
|
||||||
|
LIB_SRC_DIR := libi2pd
|
||||||
|
LIB_CLIENT_SRC_DIR := libi2pd_client
|
||||||
|
DAEMON_SRC_DIR := daemon
|
||||||
|
|
||||||
include filelist.mk
|
include filelist.mk
|
||||||
|
|
||||||
USE_AESNI := yes
|
USE_AESNI := yes
|
||||||
|
@ -17,24 +21,23 @@ USE_UPNP := no
|
||||||
|
|
||||||
ifeq ($(WEBSOCKETS),1)
|
ifeq ($(WEBSOCKETS),1)
|
||||||
NEEDED_CXXFLAGS += -DWITH_EVENTS
|
NEEDED_CXXFLAGS += -DWITH_EVENTS
|
||||||
DAEMON_SRC += Websocket.cpp
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(UNAME),Darwin)
|
ifeq ($(UNAME),Darwin)
|
||||||
DAEMON_SRC += DaemonLinux.cpp
|
DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
|
||||||
ifeq ($(HOMEBREW),1)
|
ifeq ($(HOMEBREW),1)
|
||||||
include Makefile.homebrew
|
include Makefile.homebrew
|
||||||
else
|
else
|
||||||
include Makefile.osx
|
include Makefile.osx
|
||||||
endif
|
endif
|
||||||
else ifeq ($(shell echo $(UNAME) | $(GREP) -Ec '(Free|Open)BSD'),1)
|
else ifeq ($(shell echo $(UNAME) | $(GREP) -Ec '(Free|Open)BSD'),1)
|
||||||
DAEMON_SRC += DaemonLinux.cpp
|
DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
|
||||||
include Makefile.bsd
|
include Makefile.bsd
|
||||||
else ifeq ($(UNAME),Linux)
|
else ifeq ($(UNAME),Linux)
|
||||||
DAEMON_SRC += DaemonLinux.cpp
|
DAEMON_SRC += $(DAEMON_SRC_DIR)/UnixDaemon.cpp
|
||||||
include Makefile.linux
|
include Makefile.linux
|
||||||
else # win32 mingw
|
else
|
||||||
DAEMON_SRC += DaemonWin32.cpp Win32/Win32Service.cpp Win32/Win32App.cpp
|
DAEMON_SRC += Win32/DaemonWin32.cpp Win32/Win32Service.cpp Win32/Win32App.cpp
|
||||||
include Makefile.mingw
|
include Makefile.mingw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -42,11 +45,16 @@ ifeq ($(USE_MESHNET),yes)
|
||||||
NEEDED_CXXFLAGS += -DMESHNET
|
NEEDED_CXXFLAGS += -DMESHNET
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
NEEDED_CXXFLAGS += -I$(LIB_SRC_DIR) -I$(LIB_CLIENT_SRC_DIR)
|
||||||
|
|
||||||
all: mk_obj_dir $(ARLIB) $(ARLIB_CLIENT) $(I2PD)
|
all: mk_obj_dir $(ARLIB) $(ARLIB_CLIENT) $(I2PD)
|
||||||
|
|
||||||
mk_obj_dir:
|
mk_obj_dir:
|
||||||
@mkdir -p obj
|
@mkdir -p obj
|
||||||
@mkdir -p obj/Win32
|
@mkdir -p obj/Win32
|
||||||
|
@mkdir -p obj/$(LIB_SRC_DIR)
|
||||||
|
@mkdir -p obj/$(LIB_CLIENT_SRC_DIR)
|
||||||
|
@mkdir -p obj/$(DAEMON_SRC_DIR)
|
||||||
|
|
||||||
api: mk_obj_dir $(SHLIB) $(ARLIB)
|
api: mk_obj_dir $(SHLIB) $(ARLIB)
|
||||||
api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT)
|
api_client: mk_obj_dir $(SHLIB) $(ARLIB) $(SHLIB_CLIENT) $(ARLIB_CLIENT)
|
||||||
|
@ -70,7 +78,7 @@ obj/%.o: %.cpp
|
||||||
|
|
||||||
DAEMON_OBJS += $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
|
DAEMON_OBJS += $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
|
||||||
$(I2PD): $(DAEMON_OBJS) $(ARLIB) $(ARLIB_CLIENT)
|
$(I2PD): $(DAEMON_OBJS) $(ARLIB) $(ARLIB_CLIENT)
|
||||||
$(CXX) -o $@ $^ $(LDLIBS) $(LDFLAGS)
|
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
$(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
|
$(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
|
||||||
ifneq ($(USE_STATIC),yes)
|
ifneq ($(USE_STATIC),yes)
|
||||||
|
|
|
@ -9,9 +9,9 @@ LDFLAGS = -L${SSLROOT}/lib -L${BOOSTROOT}/lib
|
||||||
LDLIBS = -lz -lcrypto -lssl -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
LDLIBS = -lz -lcrypto -lssl -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
||||||
|
|
||||||
ifeq ($(USE_UPNP),yes)
|
ifeq ($(USE_UPNP),yes)
|
||||||
LDFLAGS += -ldl
|
LDFLAGS += -ldl
|
||||||
CXXFLAGS += -DUSE_UPNP
|
CXXFLAGS += -DUSE_UPNP
|
||||||
LDLIBS += -lminiupnpc
|
LDLIBS += -lminiupnpc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# OSX Notes
|
# OSX Notes
|
||||||
|
@ -20,7 +20,7 @@ endif
|
||||||
# Found no good way to detect it from command line. TODO: Might be some osx sysinfo magic
|
# Found no good way to detect it from command line. TODO: Might be some osx sysinfo magic
|
||||||
# note from psi: 2009 macbook does not have aesni
|
# note from psi: 2009 macbook does not have aesni
|
||||||
#ifeq ($(USE_AESNI),yes)
|
#ifeq ($(USE_AESNI),yes)
|
||||||
# CXXFLAGS += -maes -DAESNI
|
# CXXFLAGS += -maes -DAESNI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# Disabled, since it will be the default make rule. I think its better
|
# Disabled, since it will be the default make rule. I think its better
|
||||||
|
|
|
@ -31,27 +31,27 @@ ifeq ($(USE_STATIC),yes)
|
||||||
# NOTE: on glibc you will get this warning:
|
# NOTE: on glibc you will get this warning:
|
||||||
# Using 'getaddrinfo' in statically linked applications requires at runtime
|
# Using 'getaddrinfo' in statically linked applications requires at runtime
|
||||||
# the shared libraries from the glibc version used for linking
|
# the shared libraries from the glibc version used for linking
|
||||||
LIBDIR := /usr/lib
|
LIBDIR := /usr/lib
|
||||||
LDLIBS = $(LIBDIR)/libboost_system.a
|
LDLIBS = $(LIBDIR)/libboost_system.a
|
||||||
LDLIBS += $(LIBDIR)/libboost_date_time.a
|
LDLIBS += $(LIBDIR)/libboost_date_time.a
|
||||||
LDLIBS += $(LIBDIR)/libboost_filesystem.a
|
LDLIBS += $(LIBDIR)/libboost_filesystem.a
|
||||||
LDLIBS += $(LIBDIR)/libboost_program_options.a
|
LDLIBS += $(LIBDIR)/libboost_program_options.a
|
||||||
LDLIBS += $(LIBDIR)/libssl.a
|
LDLIBS += $(LIBDIR)/libssl.a
|
||||||
LDLIBS += $(LIBDIR)/libcrypto.a
|
LDLIBS += $(LIBDIR)/libcrypto.a
|
||||||
LDLIBS += $(LIBDIR)/libz.a
|
LDLIBS += $(LIBDIR)/libz.a
|
||||||
LDLIBS += -lpthread -static-libstdc++ -static-libgcc -lrt -ldl
|
LDLIBS += -lpthread -static-libstdc++ -static-libgcc -lrt -ldl
|
||||||
USE_AESNI := no
|
USE_AESNI := no
|
||||||
else
|
else
|
||||||
LDLIBS = -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
LDLIBS = -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# UPNP Support (miniupnpc 1.5 and higher)
|
# UPNP Support (miniupnpc 1.5 and higher)
|
||||||
ifeq ($(USE_UPNP),yes)
|
ifeq ($(USE_UPNP),yes)
|
||||||
CXXFLAGS += -DUSE_UPNP
|
CXXFLAGS += -DUSE_UPNP
|
||||||
ifeq ($(USE_STATIC),yes)
|
ifeq ($(USE_STATIC),yes)
|
||||||
LDLIBS += $(LIBDIR)/libminiupnpc.a
|
LDLIBS += $(LIBDIR)/libminiupnpc.a
|
||||||
else
|
else
|
||||||
LDLIBS += -lminiupnpc
|
LDLIBS += -lminiupnpc
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -4,31 +4,29 @@ WINDRES = windres
|
||||||
CXXFLAGS = -Os -D_MT -DWIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN
|
CXXFLAGS = -Os -D_MT -DWIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN
|
||||||
NEEDED_CXXFLAGS = -std=c++11
|
NEEDED_CXXFLAGS = -std=c++11
|
||||||
BOOST_SUFFIX = -mt
|
BOOST_SUFFIX = -mt
|
||||||
INCFLAGS = -I/usr/include/ -I/usr/local/include/
|
INCFLAGS = -I/usr/include/ -I/usr/local/include/ -I. -Idaemon
|
||||||
LDFLAGS = -Wl,-rpath,/usr/local/lib \
|
LDFLAGS = -Wl,-rpath,/usr/local/lib -Wl,-Bstatic -static-libgcc -static-libstdc++ -L/usr/local/lib
|
||||||
-L/usr/local/lib
|
|
||||||
|
|
||||||
# UPNP Support
|
# UPNP Support
|
||||||
ifeq ($(USE_UPNP),yes)
|
ifeq ($(USE_UPNP),yes)
|
||||||
CXXFLAGS += -DUSE_UPNP -DMINIUPNP_STATICLIB
|
CXXFLAGS += -DUSE_UPNP -DMINIUPNP_STATICLIB
|
||||||
LDLIBS = -Wl,-Bstatic -lminiupnpc
|
LDLIBS = -lminiupnpc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LDLIBS += \
|
LDLIBS += \
|
||||||
-Wl,-Bstatic -lboost_system$(BOOST_SUFFIX) \
|
-lboost_system$(BOOST_SUFFIX) \
|
||||||
-Wl,-Bstatic -lboost_date_time$(BOOST_SUFFIX) \
|
-lboost_date_time$(BOOST_SUFFIX) \
|
||||||
-Wl,-Bstatic -lboost_filesystem$(BOOST_SUFFIX) \
|
-lboost_filesystem$(BOOST_SUFFIX) \
|
||||||
-Wl,-Bstatic -lboost_program_options$(BOOST_SUFFIX) \
|
-lboost_program_options$(BOOST_SUFFIX) \
|
||||||
-Wl,-Bstatic -lssl \
|
-lssl \
|
||||||
-Wl,-Bstatic -lcrypto \
|
-lcrypto \
|
||||||
-Wl,-Bstatic -lz \
|
-lz \
|
||||||
-Wl,-Bstatic -lwsock32 \
|
-lwsock32 \
|
||||||
-Wl,-Bstatic -lws2_32 \
|
-lws2_32 \
|
||||||
-Wl,-Bstatic -lgdi32 \
|
-lgdi32 \
|
||||||
-Wl,-Bstatic -liphlpapi \
|
-liphlpapi \
|
||||||
-static-libgcc -static-libstdc++ \
|
-lstdc++ \
|
||||||
-Wl,-Bstatic -lstdc++ \
|
-lpthread
|
||||||
-Wl,-Bstatic -lpthread
|
|
||||||
|
|
||||||
ifeq ($(USE_WIN32_APP), yes)
|
ifeq ($(USE_WIN32_APP), yes)
|
||||||
CXXFLAGS += -DWIN32_APP
|
CXXFLAGS += -DWIN32_APP
|
||||||
|
@ -50,7 +48,7 @@ endif
|
||||||
|
|
||||||
ifeq ($(USE_ASLR),yes)
|
ifeq ($(USE_ASLR),yes)
|
||||||
LDFLAGS += -Wl,--nxcompat -Wl,--high-entropy-va \
|
LDFLAGS += -Wl,--nxcompat -Wl,--high-entropy-va \
|
||||||
-Wl,--dynamicbase,--export-all-symbols
|
-Wl,--dynamicbase,--export-all-symbols
|
||||||
endif
|
endif
|
||||||
|
|
||||||
obj/%.o : %.rc
|
obj/%.o : %.rc
|
||||||
|
|
|
@ -65,8 +65,9 @@ BTC: 1K7Ds6KUeR8ya287UC4rYTjvC96vXyZbDY
|
||||||
ZEC: t1cTckLuXsr1dwVrK4NDzfhehss4NvMadAJ
|
ZEC: t1cTckLuXsr1dwVrK4NDzfhehss4NvMadAJ
|
||||||
DASH: Xw8YUrQpYzP9tZBmbjqxS3M97Q7v3vJKUF
|
DASH: Xw8YUrQpYzP9tZBmbjqxS3M97Q7v3vJKUF
|
||||||
LTC: LKQirrYrDeTuAPnpYq5y7LVKtywfkkHi59
|
LTC: LKQirrYrDeTuAPnpYq5y7LVKtywfkkHi59
|
||||||
ANC: AQJYweYYUqM1nVfLqfoSMpUMfzxvS4Xd7z
|
|
||||||
DOGE: DNXLQKziRPAsD9H3DFNjk4fLQrdaSX893Y
|
DOGE: DNXLQKziRPAsD9H3DFNjk4fLQrdaSX893Y
|
||||||
|
ANC: AQJYweYYUqM1nVfLqfoSMpUMfzxvS4Xd7z
|
||||||
|
GST: GbD2JSQHBHCKLa9WTHmigJRpyFgmBj4woG
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#error this file is not editable by Microsoft Visual C++
|
#error this file is not editable by Microsoft Visual C++
|
||||||
#endif //APSTUDIO_INVOKED
|
#endif //APSTUDIO_INVOKED
|
||||||
|
|
||||||
#include "../version.h"
|
#include "../libi2pd/version.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include "../ClientContext.h"
|
#include "ClientContext.h"
|
||||||
#include "../Config.h"
|
#include "Config.h"
|
||||||
#include "../NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "../RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "../Transports.h"
|
#include "Transports.h"
|
||||||
#include "../Tunnel.h"
|
#include "Tunnel.h"
|
||||||
#include "../version.h"
|
#include "version.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "Win32App.h"
|
#include "Win32App.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "../Daemon.h"
|
#include "Daemon.h"
|
||||||
#include "../Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
I2PService *I2PService::s_service = NULL;
|
I2PService *I2PService::s_service = NULL;
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<ClInclude Include="..\LittleBigEndian.h" />
|
<ClInclude Include="..\LittleBigEndian.h" />
|
||||||
<ClInclude Include="..\Log.h" />
|
<ClInclude Include="..\Log.h" />
|
||||||
<ClInclude Include="..\NetDbRequests.h" />
|
<ClInclude Include="..\NetDbRequests.h" />
|
||||||
<ClInclude Include="..\NetDb.h" />
|
<ClInclude Include="..\NetDb.hpp" />
|
||||||
<ClInclude Include="..\NTCPSession.h" />
|
<ClInclude Include="..\NTCPSession.h" />
|
||||||
<ClInclude Include="..\Queue.h" />
|
<ClInclude Include="..\Queue.h" />
|
||||||
<ClInclude Include="..\Profiling.h" />
|
<ClInclude Include="..\Profiling.h" />
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
<ClInclude Include="..\Log.h">
|
<ClInclude Include="..\Log.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\NetDb.h">
|
<ClInclude Include="..\NetDb.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\NTCPSession.h">
|
<ClInclude Include="..\NTCPSession.h">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define I2Pd_AppName "i2pd"
|
#define I2Pd_AppName "i2pd"
|
||||||
#define I2Pd_ver "2.13.0"
|
#define I2Pd_ver "2.14.0"
|
||||||
#define I2Pd_Publisher "PurpleI2P"
|
#define I2Pd_Publisher "PurpleI2P"
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
|
|
1
android/.gitignore
vendored
1
android/.gitignore
vendored
|
@ -1,6 +1,7 @@
|
||||||
gen
|
gen
|
||||||
tests
|
tests
|
||||||
.idea
|
.idea
|
||||||
|
ant.properties
|
||||||
local.properties
|
local.properties
|
||||||
build.sh
|
build.sh
|
||||||
bin
|
bin
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.purplei2p.i2pd"
|
package="org.purplei2p.i2pd"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="2.13.0">
|
android:versionName="2.14.0"
|
||||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="24"/>
|
android:installLocation="auto">
|
||||||
|
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="25"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
|
|
@ -93,5 +93,4 @@
|
||||||
-->
|
-->
|
||||||
<!-- version-tag: 1 -->
|
<!-- version-tag: 1 -->
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := i2pd
|
LOCAL_MODULE := i2pd
|
||||||
LOCAL_CPP_FEATURES := rtti exceptions
|
LOCAL_CPP_FEATURES := rtti exceptions
|
||||||
LOCAL_C_INCLUDES += $(IFADDRS_PATH) ../..
|
LOCAL_C_INCLUDES += $(IFADDRS_PATH) $(LIB_SRC_PATH) $(LIB_CLIENT_SRC_PATH) $(DAEMON_SRC_PATH)
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
boost_system \
|
boost_system \
|
||||||
boost_date_time \
|
boost_date_time \
|
||||||
|
@ -12,59 +12,13 @@ LOCAL_STATIC_LIBRARIES := \
|
||||||
miniupnpc
|
miniupnpc
|
||||||
LOCAL_LDLIBS := -lz
|
LOCAL_LDLIBS := -lz
|
||||||
|
|
||||||
LOCAL_SRC_FILES := DaemonAndroid.cpp i2pd_android.cpp \
|
LOCAL_SRC_FILES := DaemonAndroid.cpp i2pd_android.cpp $(IFADDRS_PATH)/ifaddrs.c \
|
||||||
$(IFADDRS_PATH)/ifaddrs.c \
|
$(wildcard $(LIB_SRC_PATH)/*.cpp)\
|
||||||
../../HTTPServer.cpp ../../I2PControl.cpp ../../Daemon.cpp ../../Config.cpp \
|
$(wildcard $(LIB_CLIENT_SRC_PATH)/*.cpp)\
|
||||||
../../AddressBook.cpp \
|
$(DAEMON_SRC_PATH)/Daemon.cpp \
|
||||||
../../api.cpp \
|
$(DAEMON_SRC_PATH)/UPnP.cpp \
|
||||||
../../Base.cpp \
|
$(DAEMON_SRC_PATH)/HTTPServer.cpp \
|
||||||
../../BOB.cpp \
|
$(DAEMON_SRC_PATH)/I2PControl.cpp
|
||||||
../../ClientContext.cpp \
|
|
||||||
../../Crypto.cpp \
|
|
||||||
../../Datagram.cpp \
|
|
||||||
../../Destination.cpp \
|
|
||||||
../../Family.cpp \
|
|
||||||
../../FS.cpp \
|
|
||||||
../../Garlic.cpp \
|
|
||||||
../../Gzip.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 \
|
|
||||||
../../Streaming.cpp \
|
|
||||||
../../TransitTunnel.cpp \
|
|
||||||
../../Transports.cpp \
|
|
||||||
../../Tunnel.cpp \
|
|
||||||
../../TunnelEndpoint.cpp \
|
|
||||||
../../TunnelGateway.cpp \
|
|
||||||
../../TunnelPool.cpp \
|
|
||||||
../../Timestamp.cpp \
|
|
||||||
../../Event.cpp \
|
|
||||||
../../Gost.cpp \
|
|
||||||
../../WebSocks.cpp \
|
|
||||||
../../BloomFilter.cpp \
|
|
||||||
../../MatchedDestination.cpp \
|
|
||||||
../../util.cpp \
|
|
||||||
../../i2pd.cpp ../../UPnP.cpp
|
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#APP_ABI := x86
|
#APP_ABI := x86
|
||||||
APP_ABI := armeabi-v7a
|
APP_ABI := armeabi-v7a
|
||||||
#can be android-3 but will fail for x86 since arch-x86 is not present at ndkroot/platforms/android-3/ . libz is taken from there.
|
#can be android-3 but will fail for x86 since arch-x86 is not present at ndkroot/platforms/android-3/ . libz is taken from there.
|
||||||
APP_PLATFORM := android-9
|
APP_PLATFORM := android-14
|
||||||
|
|
||||||
# http://stackoverflow.com/a/21386866/529442 http://stackoverflow.com/a/15616255/529442 to enable c++11 support in Eclipse
|
# http://stackoverflow.com/a/21386866/529442 http://stackoverflow.com/a/15616255/529442 to enable c++11 support in Eclipse
|
||||||
NDK_TOOLCHAIN_VERSION := 4.9
|
NDK_TOOLCHAIN_VERSION := 4.9
|
||||||
|
@ -25,8 +25,15 @@ APP_OPTIM := debug
|
||||||
# git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git
|
# git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git
|
||||||
# git clone https://github.com/PurpleI2P/android-ifaddrs.git
|
# git clone https://github.com/PurpleI2P/android-ifaddrs.git
|
||||||
# change to your own
|
# change to your own
|
||||||
I2PD_LIBS_PATH=/path/to/libraries
|
I2PD_LIBS_PATH = /path/to/libraries
|
||||||
BOOST_PATH = $(I2PD_LIBS_PATH)/Boost-for-Android-Prebuilt
|
BOOST_PATH = $(I2PD_LIBS_PATH)/Boost-for-Android-Prebuilt
|
||||||
OPENSSL_PATH = $(I2PD_LIBS_PATH)/OpenSSL-for-Android-Prebuilt
|
OPENSSL_PATH = $(I2PD_LIBS_PATH)/OpenSSL-for-Android-Prebuilt
|
||||||
MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt
|
MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt
|
||||||
IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs
|
IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs
|
||||||
|
|
||||||
|
# don't change me
|
||||||
|
I2PD_SRC_PATH = $(PWD)/..
|
||||||
|
|
||||||
|
LIB_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd
|
||||||
|
LIB_CLIENT_SRC_PATH = $(I2PD_SRC_PATH)/libi2pd_client
|
||||||
|
DAEMON_SRC_PATH = $(I2PD_SRC_PATH)/daemon
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "DaemonAndroid.h"
|
#include "DaemonAndroid.h"
|
||||||
#include "../../Daemon.h"
|
#include "Daemon.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
#include <boost/exception_ptr.hpp>
|
#include <boost/exception_ptr.hpp>
|
||||||
|
@ -191,4 +191,3 @@ namespace android
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include "org_purplei2p_i2pd_I2PD_JNI.h"
|
#include "org_purplei2p_i2pd_I2PD_JNI.h"
|
||||||
#include "DaemonAndroid.h"
|
#include "DaemonAndroid.h"
|
||||||
#include "../../RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "../../Transports.h"
|
#include "Transports.h"
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getABICompiledWith
|
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getABICompiledWith
|
||||||
(JNIEnv * env, jclass clazz) {
|
(JNIEnv * env, jclass clazz) {
|
||||||
|
|
1
android/libs/.gitignore
vendored
1
android/libs/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
armeabi-v7a
|
|
Binary file not shown.
|
@ -6,7 +6,6 @@ import android.app.Service;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class ForegroundService extends Service {
|
public class ForegroundService extends Service {
|
||||||
|
@ -72,7 +71,7 @@ public class ForegroundService extends Service {
|
||||||
new Intent(this, I2PD.class), 0);
|
new Intent(this, I2PD.class), 0);
|
||||||
|
|
||||||
// Set the info for the views that show in the notification panel.
|
// Set the info for the views that show in the notification panel.
|
||||||
Notification notification = new NotificationCompat.Builder(this)
|
Notification notification = new Notification.Builder(this)
|
||||||
.setSmallIcon(R.drawable.itoopie_notification_icon) // the status icon
|
.setSmallIcon(R.drawable.itoopie_notification_icon) // the status icon
|
||||||
.setTicker(text) // the status text
|
.setTicker(text) // the status text
|
||||||
.setWhen(System.currentTimeMillis()) // the time stamp
|
.setWhen(System.currentTimeMillis()) // the time stamp
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
version: 2.13.{build}
|
version: 2.14.{build}
|
||||||
pull_requests:
|
pull_requests:
|
||||||
do_not_increment_build_number: true
|
do_not_increment_build_number: true
|
||||||
branches:
|
branches:
|
||||||
|
|
|
@ -8,6 +8,7 @@ project ( "i2pd" )
|
||||||
|
|
||||||
# configurale options
|
# configurale options
|
||||||
option(WITH_AESNI "Use AES-NI instructions set" OFF)
|
option(WITH_AESNI "Use AES-NI instructions set" OFF)
|
||||||
|
option(WITH_AVX "Use AVX instructions" OFF)
|
||||||
option(WITH_HARDENING "Use hardening compiler flags" OFF)
|
option(WITH_HARDENING "Use hardening compiler flags" OFF)
|
||||||
option(WITH_LIBRARY "Build library" ON)
|
option(WITH_LIBRARY "Build library" ON)
|
||||||
option(WITH_BINARY "Build binary" ON)
|
option(WITH_BINARY "Build binary" ON)
|
||||||
|
@ -25,44 +26,51 @@ option(WITH_WEBSOCKETS "Build with websocket ui" OFF)
|
||||||
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
|
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
|
||||||
set ( CMAKE_SOURCE_DIR ".." )
|
set ( CMAKE_SOURCE_DIR ".." )
|
||||||
|
|
||||||
|
set(LIBI2PD_SRC_DIR ../libi2pd)
|
||||||
|
set(LIBI2PD_CLIENT_SRC_DIR ../libi2pd_client)
|
||||||
|
|
||||||
|
include_directories(${LIBI2PD_SRC_DIR})
|
||||||
|
include_directories(${LIBI2PD_CLIENT_SRC_DIR})
|
||||||
|
|
||||||
set (LIBI2PD_SRC
|
set (LIBI2PD_SRC
|
||||||
"${CMAKE_SOURCE_DIR}/BloomFilter.cpp"
|
"${LIBI2PD_SRC_DIR}/BloomFilter.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Config.cpp"
|
"${LIBI2PD_SRC_DIR}/Config.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Crypto.cpp"
|
"${LIBI2PD_SRC_DIR}/Crypto.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Garlic.cpp"
|
"${LIBI2PD_SRC_DIR}/Garlic.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Gzip.cpp"
|
"${LIBI2PD_SRC_DIR}/Gzip.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/I2NPProtocol.cpp"
|
"${LIBI2PD_SRC_DIR}/HTTP.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Identity.cpp"
|
"${LIBI2PD_SRC_DIR}/I2NPProtocol.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/LeaseSet.cpp"
|
"${LIBI2PD_SRC_DIR}/Identity.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/FS.cpp"
|
"${LIBI2PD_SRC_DIR}/LeaseSet.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Log.cpp"
|
"${LIBI2PD_SRC_DIR}/FS.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/NTCPSession.cpp"
|
"${LIBI2PD_SRC_DIR}/Log.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/NetDbRequests.cpp"
|
"${LIBI2PD_SRC_DIR}/NTCPSession.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/NetDb.cpp"
|
"${LIBI2PD_SRC_DIR}/NetDbRequests.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Profiling.cpp"
|
"${LIBI2PD_SRC_DIR}/NetDb.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Reseed.cpp"
|
"${LIBI2PD_SRC_DIR}/Profiling.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/RouterContext.cpp"
|
"${LIBI2PD_SRC_DIR}/Reseed.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/RouterInfo.cpp"
|
"${LIBI2PD_SRC_DIR}/RouterContext.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SSU.cpp"
|
"${LIBI2PD_SRC_DIR}/RouterInfo.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SSUData.cpp"
|
"${LIBI2PD_SRC_DIR}/SSU.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SSUSession.cpp"
|
"${LIBI2PD_SRC_DIR}/SSUData.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Streaming.cpp"
|
"${LIBI2PD_SRC_DIR}/SSUSession.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Destination.cpp"
|
"${LIBI2PD_SRC_DIR}/Streaming.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/TransitTunnel.cpp"
|
"${LIBI2PD_SRC_DIR}/Destination.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Tunnel.cpp"
|
"${LIBI2PD_SRC_DIR}/TransitTunnel.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/TunnelGateway.cpp"
|
"${LIBI2PD_SRC_DIR}/Tunnel.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Transports.cpp"
|
"${LIBI2PD_SRC_DIR}/TunnelGateway.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/TunnelEndpoint.cpp"
|
"${LIBI2PD_SRC_DIR}/Transports.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/TunnelPool.cpp"
|
"${LIBI2PD_SRC_DIR}/TunnelEndpoint.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Base.cpp"
|
"${LIBI2PD_SRC_DIR}/TunnelPool.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/util.cpp"
|
"${LIBI2PD_SRC_DIR}/Base.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Datagram.cpp"
|
"${LIBI2PD_SRC_DIR}/util.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Family.cpp"
|
"${LIBI2PD_SRC_DIR}/Datagram.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Signature.cpp"
|
"${LIBI2PD_SRC_DIR}/Family.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Timestamp.cpp"
|
"${LIBI2PD_SRC_DIR}/Signature.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/api.cpp"
|
"${LIBI2PD_SRC_DIR}/Timestamp.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Event.cpp"
|
"${LIBI2PD_SRC_DIR}/api.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/Gost.cpp"
|
"${LIBI2PD_SRC_DIR}/Event.cpp"
|
||||||
|
"${LIBI2PD_SRC_DIR}/Gost.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_WEBSOCKETS)
|
if (WITH_WEBSOCKETS)
|
||||||
|
@ -89,31 +97,32 @@ install(TARGETS libi2pd
|
||||||
# install(EXPORT libi2pd DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
# install(EXPORT libi2pd DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
set (CLIENT_SRC
|
set (CLIENT_SRC
|
||||||
"${CMAKE_SOURCE_DIR}/AddressBook.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/AddressBook.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/BOB.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/BOB.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/ClientContext.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/ClientContext.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/MatchedDestination.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/MatchedDestination.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/I2PTunnel.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/I2PTunnel.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/I2PService.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/I2PService.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SAM.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/SAM.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/SOCKS.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/SOCKS.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/HTTP.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/HTTPProxy.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/HTTPProxy.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/I2CP.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/I2CP.cpp"
|
"${LIBI2PD_CLIENT_SRC_DIR}/WebSocks.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/WebSocks.cpp"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
if(WITH_WEBSOCKETS)
|
if(WITH_WEBSOCKETS)
|
||||||
list (APPEND CLIENT_SRC "${CMAKE_SOURCE_DIR}/Websocket.cpp")
|
list (APPEND CLIENT_SRC "${LIBI2PD_CLIENT_SRC_DIR}/Websocket.cpp")
|
||||||
endif ()
|
endif ()
|
||||||
add_library(i2pdclient ${CLIENT_SRC})
|
add_library(i2pdclient ${CLIENT_SRC})
|
||||||
|
|
||||||
|
set(DAEMON_SRC_DIR ../daemon)
|
||||||
|
|
||||||
set (DAEMON_SRC
|
set (DAEMON_SRC
|
||||||
"${CMAKE_SOURCE_DIR}/Daemon.cpp"
|
"${DAEMON_SRC_DIR}/Daemon.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/HTTPServer.cpp"
|
"${DAEMON_SRC_DIR}/HTTPServer.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/I2PControl.cpp"
|
"${DAEMON_SRC_DIR}/I2PControl.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/i2pd.cpp"
|
"${DAEMON_SRC_DIR}/i2pd.cpp"
|
||||||
"${CMAKE_SOURCE_DIR}/UPnP.cpp"
|
"${DAEMON_SRC_DIR}/UPnP.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_MESHNET)
|
if (WITH_MESHNET)
|
||||||
|
@ -178,22 +187,22 @@ endif ()
|
||||||
|
|
||||||
# compiler flags customization (by system)
|
# compiler flags customization (by system)
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp")
|
list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
|
||||||
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
|
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
|
||||||
add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" )
|
add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" )
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp")
|
list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
|
||||||
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
|
# "'sleep_for' is not a member of 'std::this_thread'" in gcc 4.7/4.8
|
||||||
add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" )
|
add_definitions( "-D_GLIBCXX_USE_NANOSLEEP=1" )
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp")
|
list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonLinux.cpp")
|
list (APPEND DAEMON_SRC "${DAEMON_SRC_DIR}/UnixDaemon.cpp")
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR MSYS)
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR MSYS)
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/DaemonWin32.cpp")
|
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/DaemonWin32.cpp")
|
||||||
if (WITH_GUI)
|
if (WITH_GUI)
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32App.cpp")
|
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32App.cpp")
|
||||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/DaemonWin32.cpp"
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/Win32/DaemonWin32.cpp"
|
||||||
PROPERTIES COMPILE_DEFINITIONS WIN32_APP)
|
PROPERTIES COMPILE_DEFINITIONS WIN32_APP)
|
||||||
endif ()
|
endif ()
|
||||||
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32Service.cpp")
|
list (APPEND DAEMON_SRC "${CMAKE_SOURCE_DIR}/Win32/Win32Service.cpp")
|
||||||
|
@ -205,6 +214,10 @@ if (WITH_AESNI)
|
||||||
add_definitions ( -DAESNI )
|
add_definitions ( -DAESNI )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WITH_AVX)
|
||||||
|
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx" )
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WITH_ADDRSANITIZER)
|
if (WITH_ADDRSANITIZER)
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" )
|
||||||
|
@ -275,7 +288,7 @@ endif ()
|
||||||
|
|
||||||
if (WITH_PCH)
|
if (WITH_PCH)
|
||||||
include_directories(BEFORE ${CMAKE_BINARY_DIR})
|
include_directories(BEFORE ${CMAKE_BINARY_DIR})
|
||||||
add_library(stdafx STATIC "${CMAKE_SOURCE_DIR}/stdafx.cpp")
|
add_library(stdafx STATIC "${LIBI2PD_SRC_DIR}/stdafx.cpp")
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(stdafx PRIVATE /Ycstdafx.h /Zm155)
|
target_compile_options(stdafx PRIVATE /Ycstdafx.h /Zm155)
|
||||||
add_custom_command(TARGET stdafx POST_BUILD
|
add_custom_command(TARGET stdafx POST_BUILD
|
||||||
|
@ -291,10 +304,10 @@ if (WITH_PCH)
|
||||||
get_directory_property(DEFS DEFINITIONS)
|
get_directory_property(DEFS DEFINITIONS)
|
||||||
string(REPLACE " " ";" FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTU}} ${DEFS}")
|
string(REPLACE " " ";" FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTU}} ${DEFS}")
|
||||||
add_custom_command(TARGET stdafx PRE_BUILD
|
add_custom_command(TARGET stdafx PRE_BUILD
|
||||||
COMMAND ${CMAKE_CXX_COMPILER} ${FLAGS} -c ${CMAKE_CURRENT_SOURCE_DIR}/../stdafx.h -o ${CMAKE_BINARY_DIR}/stdafx.h.gch
|
COMMAND ${CMAKE_CXX_COMPILER} ${FLAGS} -c ${CMAKE_CURRENT_SOURCE_DIR}/../libi2pd/stdafx.h -o ${CMAKE_BINARY_DIR}/stdafx.h.gch
|
||||||
)
|
)
|
||||||
target_compile_options(libi2pd PRIVATE -include stdafx.h)
|
target_compile_options(libi2pd PRIVATE -include libi2pd/stdafx.h)
|
||||||
target_compile_options(i2pdclient PRIVATE -include stdafx.h)
|
target_compile_options(i2pdclient PRIVATE -include libi2pd/stdafx.h)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(libi2pd stdafx)
|
target_link_libraries(libi2pd stdafx)
|
||||||
endif()
|
endif()
|
||||||
|
@ -371,6 +384,7 @@ message(STATUS "Compiler path : ${CMAKE_CXX_COMPILER}")
|
||||||
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
|
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
|
||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
message(STATUS " AESNI : ${WITH_AESNI}")
|
message(STATUS " AESNI : ${WITH_AESNI}")
|
||||||
|
message(STATUS " AVX : ${WITH_AVX}")
|
||||||
message(STATUS " HARDENING : ${WITH_HARDENING}")
|
message(STATUS " HARDENING : ${WITH_HARDENING}")
|
||||||
message(STATUS " LIBRARY : ${WITH_LIBRARY}")
|
message(STATUS " LIBRARY : ${WITH_LIBRARY}")
|
||||||
message(STATUS " BINARY : ${WITH_BINARY}")
|
message(STATUS " BINARY : ${WITH_BINARY}")
|
||||||
|
@ -402,7 +416,7 @@ if (WITH_BINARY)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options("${PROJECT_NAME}" PRIVATE /FIstdafx.h /Yustdafx.h /Zm155 "/Fp${CMAKE_BINARY_DIR}/stdafx.dir/$<CONFIG>/stdafx.pch")
|
target_compile_options("${PROJECT_NAME}" PRIVATE /FIstdafx.h /Yustdafx.h /Zm155 "/Fp${CMAKE_BINARY_DIR}/stdafx.dir/$<CONFIG>/stdafx.pch")
|
||||||
else()
|
else()
|
||||||
target_compile_options("${PROJECT_NAME}" PRIVATE -include stdafx.h)
|
target_compile_options("${PROJECT_NAME}" PRIVATE -include libi2pd/stdafx.h)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -453,7 +467,7 @@ install(FILES "C:/projects/openssl-$ENV{OPENSSL}/LICENSE"
|
||||||
OPTIONAL # for local builds only!
|
OPTIONAL # for local builds only!
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB_RECURSE I2PD_SOURCES "../*.cpp" "../build" "../Win32" "../Makefile*")
|
file(GLOB_RECURSE I2PD_SOURCES "../libi2pd/*.cpp" "../libi2pd_client/*.cpp" "../daemon/*.cpp" "../build" "../Win32" "../Makefile*")
|
||||||
install(FILES ${I2PD_SOURCES} DESTINATION src/ COMPONENT Source)
|
install(FILES ${I2PD_SOURCES} DESTINATION src/ COMPONENT Source)
|
||||||
# install(DIRECTORY ../ DESTINATION src/
|
# install(DIRECTORY ../ DESTINATION src/
|
||||||
# # OPTIONAL
|
# # OPTIONAL
|
||||||
|
@ -462,7 +476,7 @@ install(FILES ${I2PD_SOURCES} DESTINATION src/ COMPONENT Source)
|
||||||
# PATTERN "*.cpp"
|
# PATTERN "*.cpp"
|
||||||
# )
|
# )
|
||||||
|
|
||||||
file(GLOB I2PD_HEADERS "../*.h")
|
file(GLOB I2PD_HEADERS "../libi2pd/*.h" "../libi2pd_client/*.h" "../daemon/*.h")
|
||||||
install(FILES ${I2PD_HEADERS} DESTINATION src/ COMPONENT Headers)
|
install(FILES ${I2PD_HEADERS} DESTINATION src/ COMPONENT Headers)
|
||||||
# install(DIRECTORY ../ DESTINATION src/
|
# install(DIRECTORY ../ DESTINATION src/
|
||||||
# # OPTIONAL
|
# # OPTIONAL
|
||||||
|
@ -475,7 +489,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Purple I2P, a C++ I2P daemon")
|
||||||
set(CPACK_PACKAGE_VENDOR "Purple I2P")
|
set(CPACK_PACKAGE_VENDOR "Purple I2P")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../README.md")
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../README.md")
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE")
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE")
|
||||||
file(READ ../version.h version_h)
|
file(READ ../libi2pd/version.h version_h)
|
||||||
string(REGEX REPLACE ".*I2PD_VERSION_MAJOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${version_h}")
|
string(REGEX REPLACE ".*I2PD_VERSION_MAJOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${version_h}")
|
||||||
string(REGEX REPLACE ".*I2PD_VERSION_MINOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${version_h}")
|
string(REGEX REPLACE ".*I2PD_VERSION_MINOR ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${version_h}")
|
||||||
string(REGEX REPLACE ".*I2PD_VERSION_MICRO ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MICRO "${version_h}")
|
string(REGEX REPLACE ".*I2PD_VERSION_MICRO ([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MICRO "${version_h}")
|
||||||
|
|
|
@ -69,7 +69,8 @@ ipv6 = false
|
||||||
## Default is X for floodfill, L for regular node
|
## Default is X for floodfill, L for regular node
|
||||||
# bandwidth = L
|
# bandwidth = L
|
||||||
|
|
||||||
## Router will not accept transit tunnels at startup
|
## Router will not accept transit tunnels, disabling transit traffic completely
|
||||||
|
## (default = false)
|
||||||
# notransit = true
|
# notransit = true
|
||||||
|
|
||||||
## Router will be floodfill
|
## Router will be floodfill
|
||||||
|
@ -141,7 +142,7 @@ port = 4447
|
||||||
|
|
||||||
[sam]
|
[sam]
|
||||||
## Uncomment and set to 'true' to enable SAM Bridge
|
## Uncomment and set to 'true' to enable SAM Bridge
|
||||||
# enabled = false
|
enabled = true
|
||||||
## Address and port service will listen on
|
## Address and port service will listen on
|
||||||
# address = 127.0.0.1
|
# address = 127.0.0.1
|
||||||
# port = 7656
|
# port = 7656
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%define build_timestamp %(date +"%Y%m%d")
|
%define build_timestamp %(date +"%Y%m%d")
|
||||||
|
|
||||||
Name: i2pd
|
Name: i2pd
|
||||||
Version: 2.12.0
|
Version: 2.14.0
|
||||||
Release: %{build_timestamp}git%{?dist}
|
Release: %{build_timestamp}git%{?dist}
|
||||||
Summary: I2P router written in C++
|
Summary: I2P router written in C++
|
||||||
|
|
||||||
|
@ -103,6 +103,23 @@ getent passwd i2pd >/dev/null || \
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jun 01 2017 orignal <i2porignal@yandex.ru> - 2.14.0
|
||||||
|
- Added transit traffic bandwidth limitation
|
||||||
|
- Added NTCP connections through HTTP and SOCKS proxies
|
||||||
|
- Added ability to disable address helper for HTTP proxy
|
||||||
|
- Changed reseed servers list
|
||||||
|
|
||||||
|
* Thu Apr 06 2017 orignal <i2porignal@yandex.ru> - 2.13.0
|
||||||
|
- Added persist local destination's tags
|
||||||
|
- Added GOST signature types 9 and 10
|
||||||
|
- Added exploratory tunnels configuration
|
||||||
|
- Changed reseed servers list
|
||||||
|
- Changed inactive NTCP sockets get closed faster
|
||||||
|
- Changed some EdDSA speed up
|
||||||
|
- Fixed multiple acceptors for SAM
|
||||||
|
- Fixed follow on data after STREAM CREATE for SAM
|
||||||
|
- Fixed memory leaks
|
||||||
|
|
||||||
* Tue Feb 14 2017 orignal <i2porignal@yandex.ru> - 2.12.0
|
* Tue Feb 14 2017 orignal <i2porignal@yandex.ru> - 2.12.0
|
||||||
- Additional HTTP and SOCKS proxy tunnels
|
- Additional HTTP and SOCKS proxy tunnels
|
||||||
- Reseed from ZIP archive
|
- Reseed from ZIP archive
|
||||||
|
@ -120,7 +137,7 @@ getent passwd i2pd >/dev/null || \
|
||||||
- Fixed UPnP discovery bug, producing excessive CPU usage
|
- Fixed UPnP discovery bug, producing excessive CPU usage
|
||||||
- Handle multiple lookups of the same LeaseSet correctly
|
- Handle multiple lookups of the same LeaseSet correctly
|
||||||
|
|
||||||
* Tue Oct 20 2016 Anatolii Vorona <vorona.tolik@gmail.com> - 2.10.0-3
|
* Thu Oct 20 2016 Anatolii Vorona <vorona.tolik@gmail.com> - 2.10.0-3
|
||||||
- add support C7
|
- add support C7
|
||||||
- move rpm-related files to contrib folder
|
- move rpm-related files to contrib folder
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[IRC]
|
[IRC-IRC2P]
|
||||||
type = client
|
type = client
|
||||||
address = 127.0.0.1
|
address = 127.0.0.1
|
||||||
port = 6668
|
port = 6668
|
||||||
|
@ -6,6 +6,14 @@ destination = irc.postman.i2p
|
||||||
destinationport = 6667
|
destinationport = 6667
|
||||||
keys = irc-keys.dat
|
keys = irc-keys.dat
|
||||||
|
|
||||||
|
#[IRC-ILITA]
|
||||||
|
#type = client
|
||||||
|
#address = 127.0.0.1
|
||||||
|
#port = 6669
|
||||||
|
#destination = irc.ilita.i2p
|
||||||
|
#destinationport = 6667
|
||||||
|
#keys = irc-keys.dat
|
||||||
|
|
||||||
#[SMTP]
|
#[SMTP]
|
||||||
#type = client
|
#type = client
|
||||||
#address = 127.0.0.1
|
#address = 127.0.0.1
|
||||||
|
@ -22,12 +30,4 @@ keys = irc-keys.dat
|
||||||
#destinationport = 110
|
#destinationport = 110
|
||||||
#keys = pop3-keys.dat
|
#keys = pop3-keys.dat
|
||||||
|
|
||||||
#[MTN]
|
|
||||||
#type = client
|
|
||||||
#address = 127.0.0.1
|
|
||||||
#port = 8998
|
|
||||||
#destination = mtn.i2p-projekt.i2p
|
|
||||||
#destinationport = 4691
|
|
||||||
#keys = mtn-keys.dat
|
|
||||||
|
|
||||||
# see more examples in /usr/share/doc/i2pd/configuration.md.gz
|
# see more examples in /usr/share/doc/i2pd/configuration.md.gz
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
#include "HTTP.h"
|
#include "HTTP.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "Garlic.h"
|
#include "Garlic.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "Destination.h"
|
#include "Destination.h"
|
||||||
|
@ -115,6 +115,12 @@ namespace i2p
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrint(eLogInfo, "i2pd v", VERSION, " starting");
|
LogPrint(eLogInfo, "i2pd v", VERSION, " starting");
|
||||||
|
#ifdef AESNI
|
||||||
|
LogPrint(eLogInfo, "AESNI enabled");
|
||||||
|
#endif
|
||||||
|
#if defined(__AVX__)
|
||||||
|
LogPrint(eLogInfo, "AVX enabled");
|
||||||
|
#endif
|
||||||
LogPrint(eLogDebug, "FS: main config file: ", config);
|
LogPrint(eLogDebug, "FS: main config file: ", config);
|
||||||
LogPrint(eLogDebug, "FS: data directory: ", datadir);
|
LogPrint(eLogDebug, "FS: data directory: ", datadir);
|
||||||
|
|
||||||
|
@ -189,6 +195,9 @@ namespace i2p
|
||||||
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
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);
|
std::string family; i2p::config::GetOption("family", family);
|
||||||
i2p::context.SetFamily (family);
|
i2p::context.SetFamily (family);
|
||||||
if (family.length () > 0)
|
if (family.length () > 0)
|
||||||
|
@ -260,6 +269,7 @@ namespace i2p
|
||||||
LogPrint(eLogInfo, "Daemon: starting Transports");
|
LogPrint(eLogInfo, "Daemon: starting Transports");
|
||||||
if(!ssu) LogPrint(eLogInfo, "Daemon: ssu disabled");
|
if(!ssu) LogPrint(eLogInfo, "Daemon: ssu disabled");
|
||||||
if(!ntcp) LogPrint(eLogInfo, "Daemon: ntcp disabled");
|
if(!ntcp) LogPrint(eLogInfo, "Daemon: ntcp disabled");
|
||||||
|
|
||||||
i2p::transport::transports.Start(ntcp, ssu);
|
i2p::transport::transports.Start(ntcp, ssu);
|
||||||
if (i2p::transport::transports.IsBoundNTCP() || i2p::transport::transports.IsBoundSSU()) {
|
if (i2p::transport::transports.IsBoundNTCP() || i2p::transport::transports.IsBoundSSU()) {
|
||||||
LogPrint(eLogInfo, "Daemon: Transports started");
|
LogPrint(eLogInfo, "Daemon: Transports started");
|
|
@ -11,9 +11,8 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
#include "TransitTunnel.h"
|
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "HTTP.h"
|
#include "HTTP.h"
|
||||||
#include "LeaseSet.h"
|
#include "LeaseSet.h"
|
||||||
#include "Destination.h"
|
#include "Destination.h"
|
||||||
|
@ -109,6 +108,18 @@ namespace http {
|
||||||
s << seconds << " seconds";
|
s << seconds << " seconds";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ShowTraffic (std::stringstream& s, uint64_t bytes)
|
||||||
|
{
|
||||||
|
s << std::fixed << std::setprecision(2);
|
||||||
|
auto numKBytes = (double) bytes / 1024;
|
||||||
|
if (numKBytes < 1024)
|
||||||
|
s << numKBytes << " KiB";
|
||||||
|
else if (numKBytes < 1024 * 1024)
|
||||||
|
s << numKBytes / 1024 << " MiB";
|
||||||
|
else
|
||||||
|
s << numKBytes / 1024 / 1024 << " GiB";
|
||||||
|
}
|
||||||
|
|
||||||
static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, int bytes)
|
static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, int bytes)
|
||||||
{
|
{
|
||||||
std::string state;
|
std::string state;
|
||||||
|
@ -212,24 +223,14 @@ namespace http {
|
||||||
s << "<b>Family:</b> " << family << "<br>\r\n";
|
s << "<b>Family:</b> " << family << "<br>\r\n";
|
||||||
s << "<b>Tunnel creation success rate:</b> " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%<br>\r\n";
|
s << "<b>Tunnel creation success rate:</b> " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%<br>\r\n";
|
||||||
s << "<b>Received:</b> ";
|
s << "<b>Received:</b> ";
|
||||||
s << std::fixed << std::setprecision(2);
|
ShowTraffic (s, i2p::transport::transports.GetTotalReceivedBytes ());
|
||||||
auto numKBytesReceived = (double) i2p::transport::transports.GetTotalReceivedBytes () / 1024;
|
|
||||||
if (numKBytesReceived < 1024)
|
|
||||||
s << numKBytesReceived << " KiB";
|
|
||||||
else if (numKBytesReceived < 1024 * 1024)
|
|
||||||
s << numKBytesReceived / 1024 << " MiB";
|
|
||||||
else
|
|
||||||
s << numKBytesReceived / 1024 / 1024 << " GiB";
|
|
||||||
s << " (" << (double) i2p::transport::transports.GetInBandwidth () / 1024 << " KiB/s)<br>\r\n";
|
s << " (" << (double) i2p::transport::transports.GetInBandwidth () / 1024 << " KiB/s)<br>\r\n";
|
||||||
s << "<b>Sent:</b> ";
|
s << "<b>Sent:</b> ";
|
||||||
auto numKBytesSent = (double) i2p::transport::transports.GetTotalSentBytes () / 1024;
|
ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ());
|
||||||
if (numKBytesSent < 1024)
|
|
||||||
s << numKBytesSent << " KiB";
|
|
||||||
else if (numKBytesSent < 1024 * 1024)
|
|
||||||
s << numKBytesSent / 1024 << " MiB";
|
|
||||||
else
|
|
||||||
s << numKBytesSent / 1024 / 1024 << " GiB";
|
|
||||||
s << " (" << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << " KiB/s)<br>\r\n";
|
s << " (" << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << " KiB/s)<br>\r\n";
|
||||||
|
s << "<b>Transit:</b> ";
|
||||||
|
ShowTraffic (s, i2p::transport::transports.GetTotalTransitTransmittedBytes ());
|
||||||
|
s << " (" << (double) i2p::transport::transports.GetTransitBandwidth () / 1024 << " KiB/s)<br>\r\n";
|
||||||
s << "<b>Data path:</b> " << i2p::fs::GetDataDir() << "<br>\r\n";
|
s << "<b>Data path:</b> " << i2p::fs::GetDataDir() << "<br>\r\n";
|
||||||
s << "<div class='slide'\r\n><label for='slide1'>Hidden content. Press on text to see.</label>\r\n<input type='checkbox' id='slide1'/>\r\n<p class='content'>\r\n";
|
s << "<div class='slide'\r\n><label for='slide1'>Hidden content. Press on text to see.</label>\r\n<input type='checkbox' id='slide1'/>\r\n<p class='content'>\r\n";
|
||||||
s << "<b>Router Ident:</b> " << i2p::context.GetRouterInfo().GetIdentHashBase64() << "<br>\r\n";
|
s << "<b>Router Ident:</b> " << i2p::context.GetRouterInfo().GetIdentHashBase64() << "<br>\r\n";
|
|
@ -17,7 +17,7 @@
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "Daemon.h"
|
#include "Daemon.h"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "UPnP.h"
|
#include "UPnP.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "RouterInfo.h"
|
#include "RouterInfo.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
11
debian/changelog
vendored
11
debian/changelog
vendored
|
@ -1,3 +1,12 @@
|
||||||
|
i2pd (2.14.0-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* updated to version 2.14.0/0.9.30
|
||||||
|
* updated debian/control
|
||||||
|
* renamed logrotate to i2pd.logrotate
|
||||||
|
* fixed init.d script
|
||||||
|
|
||||||
|
-- orignal <orignal@i2pmail.org> Thu, 1 Jun 2017 14:00:00 +0000
|
||||||
|
|
||||||
i2pd (2.13.0-1) unstable; urgency=low
|
i2pd (2.13.0-1) unstable; urgency=low
|
||||||
|
|
||||||
* updated to version 2.13.0/0.9.29
|
* updated to version 2.13.0/0.9.29
|
||||||
|
@ -5,7 +14,7 @@ i2pd (2.13.0-1) unstable; urgency=low
|
||||||
* renamed logrotate to i2pd.logrotate
|
* renamed logrotate to i2pd.logrotate
|
||||||
* fixed init.d script
|
* fixed init.d script
|
||||||
|
|
||||||
-- orignal <orignal@i2pmail.org> Tue, 6 Apr 2017 14:00:00 +0000
|
-- orignal <orignal@i2pmail.org> Thu, 6 Apr 2017 14:00:00 +0000
|
||||||
|
|
||||||
i2pd (2.12.0-1) unstable; urgency=low
|
i2pd (2.12.0-1) unstable; urgency=low
|
||||||
|
|
||||||
|
|
4
debian/control
vendored
4
debian/control
vendored
|
@ -2,7 +2,7 @@ Source: i2pd
|
||||||
Section: net
|
Section: net
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: R4SAS <r4sas@i2pmail.org>
|
Maintainer: R4SAS <r4sas@i2pmail.org>
|
||||||
Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), gcc (>= 4.7) | clang (>= 3.3), libboost-system-dev (>= 1.46), libboost-date-time-dev, libboost-filesystem-dev, libboost-program-options-dev, libminiupnpc-dev, libssl-dev
|
Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), gcc (>= 4.7) | clang (>= 3.3), libboost-system-dev (>= 1.46), libboost-date-time-dev, libboost-filesystem-dev, libboost-program-options-dev, libminiupnpc-dev, libssl-dev, zlib1g-dev
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 3.9.6
|
||||||
Homepage: http://i2pd.website/
|
Homepage: http://i2pd.website/
|
||||||
Vcs-Git: git://github.com/PurpleI2P/i2pd.git
|
Vcs-Git: git://github.com/PurpleI2P/i2pd.git
|
||||||
|
@ -13,7 +13,7 @@ Architecture: any
|
||||||
Pre-Depends: adduser
|
Pre-Depends: adduser
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
Suggests: tor, privoxy
|
Suggests: tor, privoxy
|
||||||
Description: i2pd is a full-featured C++ implementation of I2P client.
|
Description: A full-featured C++ implementation of I2P client.
|
||||||
I2P (Invisible Internet Protocol) is a universal anonymous network layer. All
|
I2P (Invisible Internet Protocol) is a universal anonymous network layer. All
|
||||||
communications over I2P are anonymous and end-to-end encrypted, participants
|
communications over I2P are anonymous and end-to-end encrypted, participants
|
||||||
don't reveal their real IP addresses.
|
don't reveal their real IP addresses.
|
||||||
|
|
32
filelist.mk
32
filelist.mk
|
@ -1,16 +1,22 @@
|
||||||
LIB_SRC = \
|
#LIB_SRC = \
|
||||||
BloomFilter.cpp Gzip.cpp Crypto.cpp Datagram.cpp Garlic.cpp I2NPProtocol.cpp LeaseSet.cpp \
|
# BloomFilter.cpp Gzip.cpp Crypto.cpp Datagram.cpp Garlic.cpp I2NPProtocol.cpp LeaseSet.cpp \
|
||||||
Log.cpp NTCPSession.cpp NetDb.cpp NetDbRequests.cpp Profiling.cpp \
|
# Log.cpp NTCPSession.cpp NetDb.cpp NetDbRequests.cpp Profiling.cpp \
|
||||||
Reseed.cpp RouterContext.cpp RouterInfo.cpp Signature.cpp SSU.cpp \
|
# Reseed.cpp RouterContext.cpp RouterInfo.cpp Signature.cpp SSU.cpp \
|
||||||
SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \
|
# SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp TransitTunnel.cpp \
|
||||||
Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.cpp \
|
# Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp TunnelGateway.cpp \
|
||||||
Destination.cpp Base.cpp I2PEndian.cpp FS.cpp Config.cpp Family.cpp \
|
# Destination.cpp Base.cpp I2PEndian.cpp FS.cpp Config.cpp Family.cpp \
|
||||||
Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Event.cpp Gost.cpp
|
# Config.cpp HTTP.cpp Timestamp.cpp util.cpp api.cpp Event.cpp Gost.cpp
|
||||||
|
|
||||||
LIB_CLIENT_SRC = \
|
LIB_SRC = $(wildcard $(LIB_SRC_DIR)/*.cpp)
|
||||||
AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp MatchedDestination.cpp \
|
|
||||||
SAM.cpp SOCKS.cpp HTTPProxy.cpp I2CP.cpp WebSocks.cpp
|
#LIB_CLIENT_SRC = \
|
||||||
|
# AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp MatchedDestination.cpp \
|
||||||
|
# SAM.cpp SOCKS.cpp HTTPProxy.cpp I2CP.cpp WebSocks.cpp
|
||||||
|
|
||||||
|
LIB_CLIENT_SRC = $(wildcard $(LIB_CLIENT_SRC_DIR)/*.cpp)
|
||||||
|
|
||||||
# also: Daemon{Linux,Win32}.cpp will be added later
|
# also: Daemon{Linux,Win32}.cpp will be added later
|
||||||
DAEMON_SRC = \
|
#DAEMON_SRC = \
|
||||||
HTTPServer.cpp I2PControl.cpp UPnP.cpp Daemon.cpp i2pd.cpp
|
# HTTPServer.cpp I2PControl.cpp UPnP.cpp Daemon.cpp i2pd.cpp
|
||||||
|
|
||||||
|
DAEMON_SRC = $(wildcard $(DAEMON_SRC_DIR)/*.cpp)
|
||||||
|
|
|
@ -54,8 +54,10 @@ namespace config {
|
||||||
("notransit", value<bool>()->zero_tokens()->default_value(false), "Router will not accept transit tunnels at startup")
|
("notransit", value<bool>()->zero_tokens()->default_value(false), "Router will not accept transit tunnels at startup")
|
||||||
("floodfill", value<bool>()->zero_tokens()->default_value(false), "Router will be floodfill")
|
("floodfill", value<bool>()->zero_tokens()->default_value(false), "Router will be floodfill")
|
||||||
("bandwidth", value<std::string>()->default_value(""), "Bandwidth limit: integer in KBps or letters: L (32), O (256), P (2048), X (>9000)")
|
("bandwidth", value<std::string>()->default_value(""), "Bandwidth limit: integer in KBps or letters: L (32), O (256), P (2048), X (>9000)")
|
||||||
|
("share", value<int>()->default_value(100), "Limit of transit traffic from max bandwidth in percents. (default: 100")
|
||||||
("ntcp", value<bool>()->zero_tokens()->default_value(true), "Enable NTCP transport")
|
("ntcp", value<bool>()->zero_tokens()->default_value(true), "Enable NTCP transport")
|
||||||
("ssu", value<bool>()->zero_tokens()->default_value(true), "Enable SSU transport")
|
("ssu", value<bool>()->zero_tokens()->default_value(true), "Enable SSU transport")
|
||||||
|
("ntcpproxy", value<std::string>()->default_value(""), "proxy url for ntcp transport")
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
("svcctl", value<std::string>()->default_value(""), "Windows service management ('install' or 'remove')")
|
("svcctl", value<std::string>()->default_value(""), "Windows service management ('install' or 'remove')")
|
||||||
("insomnia", value<bool>()->zero_tokens()->default_value(false), "Prevent system from sleeping")
|
("insomnia", value<bool>()->zero_tokens()->default_value(false), "Prevent system from sleeping")
|
||||||
|
@ -116,7 +118,7 @@ namespace config {
|
||||||
|
|
||||||
options_description sam("SAM bridge options");
|
options_description sam("SAM bridge options");
|
||||||
sam.add_options()
|
sam.add_options()
|
||||||
("sam.enabled", value<bool>()->default_value(false), "Enable or disable SAM Application bridge")
|
("sam.enabled", value<bool>()->default_value(true), "Enable or disable SAM Application bridge")
|
||||||
("sam.address", value<std::string>()->default_value("127.0.0.1"), "SAM listen address")
|
("sam.address", value<std::string>()->default_value("127.0.0.1"), "SAM listen address")
|
||||||
("sam.port", value<uint16_t>()->default_value(7656), "SAM listen port")
|
("sam.port", value<uint16_t>()->default_value(7656), "SAM listen port")
|
||||||
;
|
;
|
||||||
|
@ -186,8 +188,8 @@ namespace config {
|
||||||
"https://reseed.atomike.ninja/,"
|
"https://reseed.atomike.ninja/,"
|
||||||
"https://reseed.memcpy.io/,"
|
"https://reseed.memcpy.io/,"
|
||||||
"https://reseed.onion.im/,"
|
"https://reseed.onion.im/,"
|
||||||
"https://itoopie.atomike.ninja/,"
|
"https://itoopie.atomike.ninja/"
|
||||||
"https://randomrng.ddns.net/"
|
// "https://randomrng.ddns.net/" // dead
|
||||||
), "Reseed URLs, separated by comma")
|
), "Reseed URLs, separated by comma")
|
||||||
;
|
;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "Destination.h"
|
#include "Destination.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "LeaseSet.h"
|
#include "LeaseSet.h"
|
||||||
#include "Garlic.h"
|
#include "Garlic.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "Datagram.h"
|
#include "Datagram.h"
|
||||||
|
|
|
@ -323,7 +323,7 @@ namespace crypto
|
||||||
for (int i = 63; i >= 0; i--)
|
for (int i = 63; i >= 0; i--)
|
||||||
{
|
{
|
||||||
uint16_t sum = buf[i] + other.buf[i] + carry;
|
uint16_t sum = buf[i] + other.buf[i] + carry;
|
||||||
ret.buf[i] = sum & 0xFF;
|
ret.buf[i] = sum;
|
||||||
carry = sum >> 8;
|
carry = sum >> 8;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -333,6 +333,7 @@ namespace crypto
|
||||||
{
|
{
|
||||||
for (int i = 63; i >= 0; i--)
|
for (int i = 63; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
if (!c) return;
|
||||||
c += buf[i];
|
c += buf[i];
|
||||||
buf[i] = c;
|
buf[i] = c;
|
||||||
c >>= 8;
|
c >>= 8;
|
|
@ -6,7 +6,7 @@
|
||||||
#include "I2PEndian.h"
|
#include "I2PEndian.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "Garlic.h"
|
#include "Garlic.h"
|
||||||
|
@ -332,7 +332,8 @@ namespace i2p
|
||||||
// replace record to reply
|
// replace record to reply
|
||||||
if (i2p::context.AcceptsTunnels () &&
|
if (i2p::context.AcceptsTunnels () &&
|
||||||
i2p::tunnel::tunnels.GetTransitTunnels ().size () <= g_MaxNumTransitTunnels &&
|
i2p::tunnel::tunnels.GetTransitTunnels ().size () <= g_MaxNumTransitTunnels &&
|
||||||
!i2p::transport::transports.IsBandwidthExceeded ())
|
!i2p::transport::transports.IsBandwidthExceeded () &&
|
||||||
|
!i2p::transport::transports.IsTransitBandwidthExceeded ())
|
||||||
{
|
{
|
||||||
auto transitTunnel = i2p::tunnel::CreateTransitTunnel (
|
auto transitTunnel = i2p::tunnel::CreateTransitTunnel (
|
||||||
bufbe32toh (clearText + BUILD_REQUEST_RECORD_RECEIVE_TUNNEL_OFFSET),
|
bufbe32toh (clearText + BUILD_REQUEST_RECORD_RECEIVE_TUNNEL_OFFSET),
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "Tunnel.h"
|
#include "Tunnel.h"
|
||||||
#include "LeaseSet.h"
|
#include "LeaseSet.h"
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
#include "I2NPProtocol.h"
|
#include "I2NPProtocol.h"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "NTCPSession.h"
|
#include "NTCPSession.h"
|
||||||
|
#include "HTTP.h"
|
||||||
|
#include "util.h"
|
||||||
#ifdef WITH_EVENTS
|
#ifdef WITH_EVENTS
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -116,7 +118,7 @@ namespace transport
|
||||||
m_Establisher->phase1.HXxorHI[i] ^= ident[i];
|
m_Establisher->phase1.HXxorHI[i] ^= ident[i];
|
||||||
|
|
||||||
boost::asio::async_write (m_Socket, boost::asio::buffer (&m_Establisher->phase1, sizeof (NTCPPhase1)), boost::asio::transfer_all (),
|
boost::asio::async_write (m_Socket, boost::asio::buffer (&m_Establisher->phase1, sizeof (NTCPPhase1)), boost::asio::transfer_all (),
|
||||||
std::bind(&NTCPSession::HandlePhase1Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
|
std::bind(&NTCPSession::HandlePhase1Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::ServerLogin ()
|
void NTCPSession::ServerLogin ()
|
||||||
|
@ -132,7 +134,7 @@ namespace transport
|
||||||
{
|
{
|
||||||
(void) bytes_transferred;
|
(void) bytes_transferred;
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: couldn't send Phase 1 message: ", ecode.message ());
|
LogPrint (eLogInfo, "NTCP: couldn't send Phase 1 message: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ();
|
Terminate ();
|
||||||
|
@ -149,7 +151,7 @@ namespace transport
|
||||||
{
|
{
|
||||||
(void) bytes_transferred;
|
(void) bytes_transferred;
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: phase 1 read error: ", ecode.message ());
|
LogPrint (eLogInfo, "NTCP: phase 1 read error: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ();
|
Terminate ();
|
||||||
|
@ -185,10 +187,10 @@ namespace transport
|
||||||
s->CreateAESKey (s->m_Establisher->phase1.pubKey);
|
s->CreateAESKey (s->m_Establisher->phase1.pubKey);
|
||||||
}).share ();
|
}).share ();
|
||||||
m_Server.GetService ().post ([s, keyCreated]()
|
m_Server.GetService ().post ([s, keyCreated]()
|
||||||
{
|
{
|
||||||
keyCreated.get ();
|
keyCreated.get ();
|
||||||
s->SendPhase2 ();
|
s->SendPhase2 ();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +212,7 @@ namespace transport
|
||||||
|
|
||||||
m_Encryption.Encrypt ((uint8_t *)&m_Establisher->phase2.encrypted, sizeof(m_Establisher->phase2.encrypted), (uint8_t *)&m_Establisher->phase2.encrypted);
|
m_Encryption.Encrypt ((uint8_t *)&m_Establisher->phase2.encrypted, sizeof(m_Establisher->phase2.encrypted), (uint8_t *)&m_Establisher->phase2.encrypted);
|
||||||
boost::asio::async_write (m_Socket, boost::asio::buffer (&m_Establisher->phase2, sizeof (NTCPPhase2)), boost::asio::transfer_all (),
|
boost::asio::async_write (m_Socket, boost::asio::buffer (&m_Establisher->phase2, sizeof (NTCPPhase2)), boost::asio::transfer_all (),
|
||||||
std::bind(&NTCPSession::HandlePhase2Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, tsB));
|
std::bind(&NTCPSession::HandlePhase2Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, tsB));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +220,7 @@ namespace transport
|
||||||
{
|
{
|
||||||
(void) bytes_transferred;
|
(void) bytes_transferred;
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: Couldn't send Phase 2 message: ", ecode.message ());
|
LogPrint (eLogInfo, "NTCP: Couldn't send Phase 2 message: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ();
|
Terminate ();
|
||||||
|
@ -235,7 +237,7 @@ namespace transport
|
||||||
{
|
{
|
||||||
(void) bytes_transferred;
|
(void) bytes_transferred;
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: Phase 2 read error: ", ecode.message (), ". Wrong ident assumed");
|
LogPrint (eLogInfo, "NTCP: Phase 2 read error: ", ecode.message (), ". Wrong ident assumed");
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
|
@ -318,20 +320,20 @@ namespace transport
|
||||||
s.Insert (m_Establisher->phase1.pubKey, 256); // x
|
s.Insert (m_Establisher->phase1.pubKey, 256); // x
|
||||||
s.Insert (m_Establisher->phase2.pubKey, 256); // y
|
s.Insert (m_Establisher->phase2.pubKey, 256); // y
|
||||||
s.Insert (m_RemoteIdentity->GetIdentHash (), 32); // ident
|
s.Insert (m_RemoteIdentity->GetIdentHash (), 32); // ident
|
||||||
s.Insert (tsA); // tsA
|
s.Insert (tsA); // tsA
|
||||||
s.Insert (m_Establisher->phase2.encrypted.timestamp, 4); // tsB
|
s.Insert (m_Establisher->phase2.encrypted.timestamp, 4); // tsB
|
||||||
s.Sign (keys, buf);
|
s.Sign (keys, buf);
|
||||||
|
|
||||||
m_Encryption.Encrypt(m_ReceiveBuffer, len, m_ReceiveBuffer);
|
m_Encryption.Encrypt(m_ReceiveBuffer, len, m_ReceiveBuffer);
|
||||||
boost::asio::async_write (m_Socket, boost::asio::buffer (m_ReceiveBuffer, len), boost::asio::transfer_all (),
|
boost::asio::async_write (m_Socket, boost::asio::buffer (m_ReceiveBuffer, len), boost::asio::transfer_all (),
|
||||||
std::bind(&NTCPSession::HandlePhase3Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, tsA));
|
std::bind(&NTCPSession::HandlePhase3Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, tsA));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::HandlePhase3Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsA)
|
void NTCPSession::HandlePhase3Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsA)
|
||||||
{
|
{
|
||||||
(void) bytes_transferred;
|
(void) bytes_transferred;
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: Couldn't send Phase 3 message: ", ecode.message ());
|
LogPrint (eLogInfo, "NTCP: Couldn't send Phase 3 message: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ();
|
Terminate ();
|
||||||
|
@ -351,7 +353,7 @@ namespace transport
|
||||||
void NTCPSession::HandlePhase3Received (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsB)
|
void NTCPSession::HandlePhase3Received (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsB)
|
||||||
{
|
{
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: Phase 3 read error: ", ecode.message ());
|
LogPrint (eLogInfo, "NTCP: Phase 3 read error: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ();
|
Terminate ();
|
||||||
|
@ -389,7 +391,7 @@ namespace transport
|
||||||
void NTCPSession::HandlePhase3ExtraReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsB, size_t paddingLen)
|
void NTCPSession::HandlePhase3ExtraReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsB, size_t paddingLen)
|
||||||
{
|
{
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: Phase 3 extra read error: ", ecode.message ());
|
LogPrint (eLogInfo, "NTCP: Phase 3 extra read error: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ();
|
Terminate ();
|
||||||
|
@ -444,21 +446,21 @@ namespace transport
|
||||||
s.Insert (tsA); // tsA
|
s.Insert (tsA); // tsA
|
||||||
s.Insert (tsB); // tsB
|
s.Insert (tsB); // tsB
|
||||||
auto& keys = i2p::context.GetPrivateKeys ();
|
auto& keys = i2p::context.GetPrivateKeys ();
|
||||||
auto signatureLen = keys.GetPublic ()->GetSignatureLen ();
|
auto signatureLen = keys.GetPublic ()->GetSignatureLen ();
|
||||||
s.Sign (keys, m_ReceiveBuffer);
|
s.Sign (keys, m_ReceiveBuffer);
|
||||||
size_t paddingSize = signatureLen & 0x0F; // %16
|
size_t paddingSize = signatureLen & 0x0F; // %16
|
||||||
if (paddingSize > 0) signatureLen += (16 - paddingSize);
|
if (paddingSize > 0) signatureLen += (16 - paddingSize);
|
||||||
m_Encryption.Encrypt (m_ReceiveBuffer, signatureLen, m_ReceiveBuffer);
|
m_Encryption.Encrypt (m_ReceiveBuffer, signatureLen, m_ReceiveBuffer);
|
||||||
|
|
||||||
boost::asio::async_write (m_Socket, boost::asio::buffer (m_ReceiveBuffer, signatureLen), boost::asio::transfer_all (),
|
boost::asio::async_write (m_Socket, boost::asio::buffer (m_ReceiveBuffer, signatureLen), boost::asio::transfer_all (),
|
||||||
std::bind(&NTCPSession::HandlePhase4Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
|
std::bind(&NTCPSession::HandlePhase4Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::HandlePhase4Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
void NTCPSession::HandlePhase4Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
||||||
{
|
{
|
||||||
(void) bytes_transferred;
|
(void) bytes_transferred;
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "NTCP: Couldn't send Phase 4 message: ", ecode.message ());
|
LogPrint (eLogWarning, "NTCP: Couldn't send Phase 4 message: ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
Terminate ();
|
Terminate ();
|
||||||
|
@ -478,7 +480,7 @@ namespace transport
|
||||||
void NTCPSession::HandlePhase4Received (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsA)
|
void NTCPSession::HandlePhase4Received (const boost::system::error_code& ecode, std::size_t bytes_transferred, uint32_t tsA)
|
||||||
{
|
{
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "NTCP: Phase 4 read error: ", ecode.message (), ". Check your clock");
|
LogPrint (eLogError, "NTCP: Phase 4 read error: ", ecode.message (), ". Check your clock");
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
|
@ -673,13 +675,13 @@ namespace transport
|
||||||
m_NextMessage = nullptr;
|
m_NextMessage = nullptr;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::Send (std::shared_ptr<i2p::I2NPMessage> msg)
|
void NTCPSession::Send (std::shared_ptr<i2p::I2NPMessage> msg)
|
||||||
{
|
{
|
||||||
m_IsSending = true;
|
m_IsSending = true;
|
||||||
boost::asio::async_write (m_Socket, CreateMsgBuffer (msg), boost::asio::transfer_all (),
|
boost::asio::async_write (m_Socket, CreateMsgBuffer (msg), boost::asio::transfer_all (),
|
||||||
std::bind(&NTCPSession::HandleSent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, std::vector<std::shared_ptr<I2NPMessage> >{ msg }));
|
std::bind(&NTCPSession::HandleSent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, std::vector<std::shared_ptr<I2NPMessage> >{ msg }));
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::const_buffers_1 NTCPSession::CreateMsgBuffer (std::shared_ptr<I2NPMessage> msg)
|
boost::asio::const_buffers_1 NTCPSession::CreateMsgBuffer (std::shared_ptr<I2NPMessage> msg)
|
||||||
|
@ -726,7 +728,7 @@ namespace transport
|
||||||
for (const auto& it: msgs)
|
for (const auto& it: msgs)
|
||||||
bufs.push_back (CreateMsgBuffer (it));
|
bufs.push_back (CreateMsgBuffer (it));
|
||||||
boost::asio::async_write (m_Socket, bufs, boost::asio::transfer_all (),
|
boost::asio::async_write (m_Socket, bufs, boost::asio::transfer_all (),
|
||||||
std::bind(&NTCPSession::HandleSent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, msgs));
|
std::bind(&NTCPSession::HandleSent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, msgs));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::HandleSent (const boost::system::error_code& ecode, std::size_t bytes_transferred, std::vector<std::shared_ptr<I2NPMessage> > msgs)
|
void NTCPSession::HandleSent (const boost::system::error_code& ecode, std::size_t bytes_transferred, std::vector<std::shared_ptr<I2NPMessage> > msgs)
|
||||||
|
@ -734,7 +736,7 @@ namespace transport
|
||||||
(void) msgs;
|
(void) msgs;
|
||||||
m_IsSending = false;
|
m_IsSending = false;
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "NTCP: Couldn't send msgs: ", ecode.message ());
|
LogPrint (eLogWarning, "NTCP: Couldn't send msgs: ", ecode.message ());
|
||||||
// we shouldn't call Terminate () here, because HandleReceive takes care
|
// we shouldn't call Terminate () here, because HandleReceive takes care
|
||||||
// TODO: 'delete this' statement in Terminate () must be eliminated later
|
// TODO: 'delete this' statement in Terminate () must be eliminated later
|
||||||
|
@ -788,7 +790,8 @@ namespace transport
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
NTCPServer::NTCPServer ():
|
NTCPServer::NTCPServer ():
|
||||||
m_IsRunning (false), m_Thread (nullptr), m_Work (m_Service),
|
m_IsRunning (false), m_Thread (nullptr), m_Work (m_Service),
|
||||||
m_TerminationTimer (m_Service), m_NTCPAcceptor (nullptr), m_NTCPV6Acceptor (nullptr)
|
m_TerminationTimer (m_Service), m_NTCPAcceptor (nullptr), m_NTCPV6Acceptor (nullptr),
|
||||||
|
m_ProxyType(eNoProxy), m_Resolver(m_Service), m_ProxyEndpoint(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,48 +806,63 @@ namespace transport
|
||||||
{
|
{
|
||||||
m_IsRunning = true;
|
m_IsRunning = true;
|
||||||
m_Thread = new std::thread (std::bind (&NTCPServer::Run, this));
|
m_Thread = new std::thread (std::bind (&NTCPServer::Run, this));
|
||||||
// create acceptors
|
// we are using a proxy, don't create any acceptors
|
||||||
auto& addresses = context.GetRouterInfo ().GetAddresses ();
|
if(UsingProxy())
|
||||||
for (const auto& address: addresses)
|
|
||||||
{
|
{
|
||||||
if (!address) continue;
|
// TODO: resolve proxy until it is resolved
|
||||||
if (address->transportStyle == i2p::data::RouterInfo::eTransportNTCP)
|
boost::asio::ip::tcp::resolver::query q(m_ProxyAddress, std::to_string(m_ProxyPort));
|
||||||
|
boost::system::error_code e;
|
||||||
|
auto itr = m_Resolver.resolve(q, e);
|
||||||
|
if(e)
|
||||||
{
|
{
|
||||||
if (address->host.is_v4())
|
LogPrint(eLogError, "NTCP: Failed to resolve proxy ", e.message());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ProxyEndpoint = new boost::asio::ip::tcp::endpoint(*itr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create acceptors
|
||||||
|
auto& addresses = context.GetRouterInfo ().GetAddresses ();
|
||||||
|
for (const auto& address: addresses)
|
||||||
|
{
|
||||||
|
if (!address) continue;
|
||||||
|
if (address->transportStyle == i2p::data::RouterInfo::eTransportNTCP)
|
||||||
{
|
{
|
||||||
try
|
if (address->host.is_v4())
|
||||||
{
|
{
|
||||||
m_NTCPAcceptor = new boost::asio::ip::tcp::acceptor (m_Service,
|
try
|
||||||
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), address->port));
|
{
|
||||||
} catch ( std::exception & ex ) {
|
m_NTCPAcceptor = new boost::asio::ip::tcp::acceptor (m_Service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), address->port));
|
||||||
/** fail to bind ip4 */
|
} catch ( std::exception & ex ) {
|
||||||
LogPrint(eLogError, "NTCP: Failed to bind to ip4 port ",address->port, ex.what());
|
/** fail to bind ip4 */
|
||||||
continue;
|
LogPrint(eLogError, "NTCP: Failed to bind to ip4 port ",address->port, ex.what());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogPrint (eLogInfo, "NTCP: Start listening TCP port ", address->port);
|
||||||
|
auto conn = std::make_shared<NTCPSession>(*this);
|
||||||
|
m_NTCPAcceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAccept, this, conn, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
else if (address->host.is_v6() && context.SupportsV6 ())
|
||||||
LogPrint (eLogInfo, "NTCP: Start listening TCP port ", address->port);
|
|
||||||
auto conn = std::make_shared<NTCPSession>(*this);
|
|
||||||
m_NTCPAcceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAccept, this,
|
|
||||||
conn, std::placeholders::_1));
|
|
||||||
}
|
|
||||||
else if (address->host.is_v6() && context.SupportsV6 ())
|
|
||||||
{
|
|
||||||
m_NTCPV6Acceptor = new boost::asio::ip::tcp::acceptor (m_Service);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
m_NTCPV6Acceptor->open (boost::asio::ip::tcp::v6());
|
m_NTCPV6Acceptor = new boost::asio::ip::tcp::acceptor (m_Service);
|
||||||
m_NTCPV6Acceptor->set_option (boost::asio::ip::v6_only (true));
|
try
|
||||||
|
{
|
||||||
|
m_NTCPV6Acceptor->open (boost::asio::ip::tcp::v6());
|
||||||
|
m_NTCPV6Acceptor->set_option (boost::asio::ip::v6_only (true));
|
||||||
|
m_NTCPV6Acceptor->bind (boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v6(), address->port));
|
||||||
|
m_NTCPV6Acceptor->listen ();
|
||||||
|
|
||||||
m_NTCPV6Acceptor->bind (boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v6(), address->port));
|
LogPrint (eLogInfo, "NTCP: Start listening V6 TCP port ", address->port);
|
||||||
m_NTCPV6Acceptor->listen ();
|
auto conn = std::make_shared<NTCPSession> (*this);
|
||||||
|
m_NTCPV6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAcceptV6, this, conn, std::placeholders::_1));
|
||||||
LogPrint (eLogInfo, "NTCP: Start listening V6 TCP port ", address->port);
|
} catch ( std::exception & ex ) {
|
||||||
auto conn = std::make_shared<NTCPSession> (*this);
|
LogPrint(eLogError, "NTCP: failed to bind to ip6 port ", address->port);
|
||||||
m_NTCPV6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAcceptV6,
|
continue;
|
||||||
this, conn, std::placeholders::_1));
|
}
|
||||||
} catch ( std::exception & ex ) {
|
|
||||||
LogPrint(eLogError, "NTCP: failed to bind to ip6 port ", address->port);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -869,14 +887,14 @@ namespace transport
|
||||||
{
|
{
|
||||||
m_IsRunning = false;
|
m_IsRunning = false;
|
||||||
m_TerminationTimer.cancel ();
|
m_TerminationTimer.cancel ();
|
||||||
if (m_NTCPAcceptor)
|
if (m_NTCPAcceptor)
|
||||||
{
|
{
|
||||||
delete m_NTCPAcceptor;
|
delete m_NTCPAcceptor;
|
||||||
m_NTCPAcceptor = nullptr;
|
m_NTCPAcceptor = nullptr;
|
||||||
}
|
}
|
||||||
if (m_NTCPV6Acceptor)
|
if (m_NTCPV6Acceptor)
|
||||||
{
|
{
|
||||||
delete m_NTCPV6Acceptor;
|
delete m_NTCPV6Acceptor;
|
||||||
m_NTCPV6Acceptor = nullptr;
|
m_NTCPV6Acceptor = nullptr;
|
||||||
}
|
}
|
||||||
m_Service.stop ();
|
m_Service.stop ();
|
||||||
|
@ -886,6 +904,11 @@ namespace transport
|
||||||
delete m_Thread;
|
delete m_Thread;
|
||||||
m_Thread = nullptr;
|
m_Thread = nullptr;
|
||||||
}
|
}
|
||||||
|
if(m_ProxyEndpoint)
|
||||||
|
{
|
||||||
|
delete m_ProxyEndpoint;
|
||||||
|
m_ProxyEndpoint = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,7 +979,7 @@ namespace transport
|
||||||
|
|
||||||
if (error != boost::asio::error::operation_aborted)
|
if (error != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
conn = std::make_shared<NTCPSession> (*this);
|
conn = std::make_shared<NTCPSession> (*this);
|
||||||
m_NTCPAcceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAccept, this,
|
m_NTCPAcceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAccept, this,
|
||||||
conn, std::placeholders::_1));
|
conn, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
@ -983,31 +1006,56 @@ namespace transport
|
||||||
|
|
||||||
if (error != boost::asio::error::operation_aborted)
|
if (error != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
conn = std::make_shared<NTCPSession> (*this);
|
conn = std::make_shared<NTCPSession> (*this);
|
||||||
m_NTCPV6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAcceptV6, this,
|
m_NTCPV6Acceptor->async_accept(conn->GetSocket (), std::bind (&NTCPServer::HandleAcceptV6, this,
|
||||||
conn, std::placeholders::_1));
|
conn, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPServer::Connect (const boost::asio::ip::address& address, int port, std::shared_ptr<NTCPSession> conn)
|
void NTCPServer::Connect(const boost::asio::ip::address & address, uint16_t port, std::shared_ptr<NTCPSession> conn)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "NTCP: Connecting to ", address ,":", port);
|
LogPrint (eLogDebug, "NTCP: Connecting to ", address ,":", port);
|
||||||
m_Service.post([=]()
|
m_Service.post([=]() {
|
||||||
{
|
|
||||||
if (this->AddNTCPSession (conn))
|
if (this->AddNTCPSession (conn))
|
||||||
{
|
{
|
||||||
|
|
||||||
auto timer = std::make_shared<boost::asio::deadline_timer>(m_Service);
|
auto timer = std::make_shared<boost::asio::deadline_timer>(m_Service);
|
||||||
timer->expires_from_now (boost::posix_time::seconds(NTCP_CONNECT_TIMEOUT));
|
timer->expires_from_now (boost::posix_time::seconds(NTCP_CONNECT_TIMEOUT));
|
||||||
timer->async_wait ([conn](const boost::system::error_code& ecode)
|
timer->async_wait ([conn](const boost::system::error_code& ecode) {
|
||||||
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
LogPrint (eLogInfo, "NTCP: Not connected in ", NTCP_CONNECT_TIMEOUT, " seconds");
|
||||||
{
|
conn->Terminate ();
|
||||||
LogPrint (eLogInfo, "NTCP: Not connected in ", NTCP_CONNECT_TIMEOUT, " seconds");
|
}
|
||||||
conn->Terminate ();
|
});
|
||||||
}
|
conn->GetSocket ().async_connect (boost::asio::ip::tcp::endpoint (address, port), std::bind (&NTCPServer::HandleConnect, this, std::placeholders::_1, conn, timer));
|
||||||
});
|
}
|
||||||
conn->GetSocket ().async_connect (boost::asio::ip::tcp::endpoint (address, port),
|
});
|
||||||
std::bind (&NTCPServer::HandleConnect, this, std::placeholders::_1, conn, timer));
|
}
|
||||||
|
|
||||||
|
void NTCPServer::ConnectWithProxy (const std::string& host, uint16_t port, RemoteAddressType addrtype, std::shared_ptr<NTCPSession> conn)
|
||||||
|
{
|
||||||
|
if(m_ProxyEndpoint == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_Service.post([=]() {
|
||||||
|
if (this->AddNTCPSession (conn))
|
||||||
|
{
|
||||||
|
|
||||||
|
auto timer = std::make_shared<boost::asio::deadline_timer>(m_Service);
|
||||||
|
auto timeout = NTCP_CONNECT_TIMEOUT * 5;
|
||||||
|
conn->SetTerminationTimeout(timeout * 2);
|
||||||
|
timer->expires_from_now (boost::posix_time::seconds(timeout));
|
||||||
|
timer->async_wait ([conn, timeout](const boost::system::error_code& ecode) {
|
||||||
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
|
{
|
||||||
|
LogPrint (eLogInfo, "NTCP: Not connected in ", timeout, " seconds");
|
||||||
|
i2p::data::netdb.SetUnreachable (conn->GetRemoteIdentity ()->GetIdentHash (), true);
|
||||||
|
conn->Terminate ();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
conn->GetSocket ().async_connect (*m_ProxyEndpoint, std::bind (&NTCPServer::HandleProxyConnect, this, std::placeholders::_1, conn, timer, host, port, addrtype));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1016,7 +1064,7 @@ namespace transport
|
||||||
{
|
{
|
||||||
timer->cancel ();
|
timer->cancel ();
|
||||||
if (ecode)
|
if (ecode)
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "NTCP: Connect error ", ecode.message ());
|
LogPrint (eLogInfo, "NTCP: Connect error ", ecode.message ());
|
||||||
if (ecode != boost::asio::error::operation_aborted)
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
i2p::data::netdb.SetUnreachable (conn->GetRemoteIdentity ()->GetIdentHash (), true);
|
i2p::data::netdb.SetUnreachable (conn->GetRemoteIdentity ()->GetIdentHash (), true);
|
||||||
|
@ -1031,6 +1079,191 @@ namespace transport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NTCPServer::UseProxy(ProxyType proxytype, const std::string & addr, uint16_t port)
|
||||||
|
{
|
||||||
|
m_ProxyType = proxytype;
|
||||||
|
m_ProxyAddress = addr;
|
||||||
|
m_ProxyPort = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NTCPServer::HandleProxyConnect(const boost::system::error_code& ecode, std::shared_ptr<NTCPSession> conn, std::shared_ptr<boost::asio::deadline_timer> timer, const std::string & host, uint16_t port, RemoteAddressType addrtype)
|
||||||
|
{
|
||||||
|
if(ecode)
|
||||||
|
{
|
||||||
|
LogPrint(eLogWarning, "NTCP: failed to connect to proxy ", ecode.message());
|
||||||
|
timer->cancel();
|
||||||
|
conn->Terminate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(m_ProxyType == eSocksProxy)
|
||||||
|
{
|
||||||
|
// TODO: support username/password auth etc
|
||||||
|
uint8_t buff[3] = {0x05, 0x01, 0x00};
|
||||||
|
boost::asio::async_write(conn->GetSocket(), boost::asio::buffer(buff, 3), boost::asio::transfer_all(), [=] (const boost::system::error_code & ec, std::size_t transferred) {
|
||||||
|
(void) transferred;
|
||||||
|
if(ec)
|
||||||
|
{
|
||||||
|
LogPrint(eLogWarning, "NTCP: socks5 write error ", ec.message());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
uint8_t readbuff[2];
|
||||||
|
boost::asio::async_read(conn->GetSocket(), boost::asio::buffer(readbuff, 2), [=](const boost::system::error_code & ec, std::size_t transferred) {
|
||||||
|
if(ec)
|
||||||
|
{
|
||||||
|
LogPrint(eLogError, "NTCP: socks5 read error ", ec.message());
|
||||||
|
timer->cancel();
|
||||||
|
conn->Terminate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(transferred == 2)
|
||||||
|
{
|
||||||
|
if(readbuff[1] == 0x00)
|
||||||
|
{
|
||||||
|
AfterSocksHandshake(conn, timer, host, port, addrtype);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (readbuff[1] == 0xff)
|
||||||
|
{
|
||||||
|
LogPrint(eLogError, "NTCP: socks5 proxy rejected authentication");
|
||||||
|
timer->cancel();
|
||||||
|
conn->Terminate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LogPrint(eLogError, "NTCP: socks5 server gave invalid response");
|
||||||
|
timer->cancel();
|
||||||
|
conn->Terminate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if(m_ProxyType == eHTTPProxy)
|
||||||
|
{
|
||||||
|
i2p::http::HTTPReq req;
|
||||||
|
req.method = "CONNECT";
|
||||||
|
req.version ="HTTP/1.1";
|
||||||
|
if(addrtype == eIP6Address)
|
||||||
|
req.uri = "[" + host + "]:" + std::to_string(port);
|
||||||
|
else
|
||||||
|
req.uri = host + ":" + std::to_string(port);
|
||||||
|
|
||||||
|
boost::asio::streambuf writebuff;
|
||||||
|
std::ostream out(&writebuff);
|
||||||
|
out << req.to_string();
|
||||||
|
|
||||||
|
boost::asio::async_write(conn->GetSocket(), writebuff.data(), boost::asio::transfer_all(), [=](const boost::system::error_code & ec, std::size_t transferred) {
|
||||||
|
(void) transferred;
|
||||||
|
if(ec)
|
||||||
|
LogPrint(eLogError, "NTCP: http proxy write error ", ec.message());
|
||||||
|
});
|
||||||
|
|
||||||
|
boost::asio::streambuf * readbuff = new boost::asio::streambuf;
|
||||||
|
boost::asio::async_read_until(conn->GetSocket(), *readbuff, "\r\n\r\n", [=] (const boost::system::error_code & ec, std::size_t transferred) {
|
||||||
|
if(ec)
|
||||||
|
{
|
||||||
|
LogPrint(eLogError, "NTCP: http proxy read error ", ec.message());
|
||||||
|
timer->cancel();
|
||||||
|
conn->Terminate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
readbuff->commit(transferred);
|
||||||
|
i2p::http::HTTPRes res;
|
||||||
|
if(res.parse(boost::asio::buffer_cast<const char*>(readbuff->data()), readbuff->size()) > 0)
|
||||||
|
{
|
||||||
|
if(res.code == 200)
|
||||||
|
{
|
||||||
|
timer->cancel();
|
||||||
|
conn->ClientLogin();
|
||||||
|
delete readbuff;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint(eLogError, "NTCP: http proxy rejected request ", res.code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LogPrint(eLogError, "NTCP: http proxy gave malformed response");
|
||||||
|
timer->cancel();
|
||||||
|
conn->Terminate();
|
||||||
|
delete readbuff;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LogPrint(eLogError, "NTCP: unknown proxy type, invalid state");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NTCPServer::AfterSocksHandshake(std::shared_ptr<NTCPSession> conn, std::shared_ptr<boost::asio::deadline_timer> timer, const std::string & host, uint16_t port, RemoteAddressType addrtype)
|
||||||
|
{
|
||||||
|
|
||||||
|
// build request
|
||||||
|
size_t sz = 0;
|
||||||
|
uint8_t buff[256];
|
||||||
|
uint8_t readbuff[256];
|
||||||
|
buff[0] = 0x05;
|
||||||
|
buff[1] = 0x01;
|
||||||
|
buff[2] = 0x00;
|
||||||
|
|
||||||
|
if(addrtype == eIP4Address)
|
||||||
|
{
|
||||||
|
buff[3] = 0x01;
|
||||||
|
auto addr = boost::asio::ip::address::from_string(host).to_v4();
|
||||||
|
auto addrbytes = addr.to_bytes();
|
||||||
|
auto addrsize = addrbytes.size();
|
||||||
|
memcpy(buff+4, addrbytes.data(), addrsize);
|
||||||
|
}
|
||||||
|
else if (addrtype == eIP6Address)
|
||||||
|
{
|
||||||
|
buff[3] = 0x04;
|
||||||
|
auto addr = boost::asio::ip::address::from_string(host).to_v6();
|
||||||
|
auto addrbytes = addr.to_bytes();
|
||||||
|
auto addrsize = addrbytes.size();
|
||||||
|
memcpy(buff+4, addrbytes.data(), addrsize);
|
||||||
|
}
|
||||||
|
else if (addrtype == eHostname)
|
||||||
|
{
|
||||||
|
buff[3] = 0x03;
|
||||||
|
size_t addrsize = host.size();
|
||||||
|
sz = addrsize + 1 + 4;
|
||||||
|
if (2 + sz > sizeof(buff))
|
||||||
|
{
|
||||||
|
// too big
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
buff[4] = (uint8_t) addrsize;
|
||||||
|
memcpy(buff+4, host.c_str(), addrsize);
|
||||||
|
}
|
||||||
|
htobe16buf(buff+sz, port);
|
||||||
|
sz += 2;
|
||||||
|
boost::asio::async_write(conn->GetSocket(), boost::asio::buffer(buff, sz), boost::asio::transfer_all(), [=](const boost::system::error_code & ec, std::size_t written) {
|
||||||
|
if(ec)
|
||||||
|
{
|
||||||
|
LogPrint(eLogError, "NTCP: failed to write handshake to socks proxy ", ec.message());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
boost::asio::async_read(conn->GetSocket(), boost::asio::buffer(readbuff, sz), [=](const boost::system::error_code & e, std::size_t transferred) {
|
||||||
|
if(e)
|
||||||
|
{
|
||||||
|
LogPrint(eLogError, "NTCP: socks proxy read error ", e.message());
|
||||||
|
}
|
||||||
|
else if(transferred == sz)
|
||||||
|
{
|
||||||
|
if( readbuff[1] == 0x00)
|
||||||
|
{
|
||||||
|
timer->cancel();
|
||||||
|
conn->ClientLogin();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!e)
|
||||||
|
i2p::data::netdb.SetUnreachable (conn->GetRemoteIdentity ()->GetIdentHash (), true);
|
||||||
|
timer->cancel();
|
||||||
|
conn->Terminate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void NTCPServer::ScheduleTermination ()
|
void NTCPServer::ScheduleTermination ()
|
||||||
{
|
{
|
||||||
m_TerminationTimer.expires_from_now (boost::posix_time::seconds(NTCP_TERMINATION_CHECK_TIMEOUT));
|
m_TerminationTimer.expires_from_now (boost::posix_time::seconds(NTCP_TERMINATION_CHECK_TIMEOUT));
|
||||||
|
@ -1045,15 +1278,14 @@ namespace transport
|
||||||
auto ts = i2p::util::GetSecondsSinceEpoch ();
|
auto ts = i2p::util::GetSecondsSinceEpoch ();
|
||||||
// established
|
// established
|
||||||
for (auto& it: m_NTCPSessions)
|
for (auto& it: m_NTCPSessions)
|
||||||
if (it.second->IsTerminationTimeoutExpired (ts))
|
if (it.second->IsTerminationTimeoutExpired (ts))
|
||||||
{
|
{
|
||||||
auto session = it.second;
|
auto session = it.second;
|
||||||
// Termniate modifies m_NTCPSession, so we postpone it
|
// Termniate modifies m_NTCPSession, so we postpone it
|
||||||
m_Service.post ([session]
|
m_Service.post ([session] {
|
||||||
{
|
|
||||||
LogPrint (eLogDebug, "NTCP: No activity for ", session->GetTerminationTimeout (), " seconds");
|
LogPrint (eLogDebug, "NTCP: No activity for ", session->GetTerminationTimeout (), " seconds");
|
||||||
session->Terminate ();
|
session->Terminate ();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// pending
|
// pending
|
||||||
for (auto it = m_PendingIncomingSessions.begin (); it != m_PendingIncomingSessions.end ();)
|
for (auto it = m_PendingIncomingSessions.begin (); it != m_PendingIncomingSessions.end ();)
|
|
@ -131,6 +131,21 @@ namespace transport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum RemoteAddressType
|
||||||
|
{
|
||||||
|
eIP4Address,
|
||||||
|
eIP6Address,
|
||||||
|
eHostname
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ProxyType
|
||||||
|
{
|
||||||
|
eNoProxy,
|
||||||
|
eSocksProxy,
|
||||||
|
eHTTPProxy
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
NTCPServer ();
|
NTCPServer ();
|
||||||
~NTCPServer ();
|
~NTCPServer ();
|
||||||
|
|
||||||
|
@ -140,10 +155,15 @@ namespace transport
|
||||||
bool AddNTCPSession (std::shared_ptr<NTCPSession> session);
|
bool AddNTCPSession (std::shared_ptr<NTCPSession> session);
|
||||||
void RemoveNTCPSession (std::shared_ptr<NTCPSession> session);
|
void RemoveNTCPSession (std::shared_ptr<NTCPSession> session);
|
||||||
std::shared_ptr<NTCPSession> FindNTCPSession (const i2p::data::IdentHash& ident);
|
std::shared_ptr<NTCPSession> FindNTCPSession (const i2p::data::IdentHash& ident);
|
||||||
void Connect (const boost::asio::ip::address& address, int port, std::shared_ptr<NTCPSession> conn);
|
void ConnectWithProxy (const std::string& addr, uint16_t port, RemoteAddressType addrtype, std::shared_ptr<NTCPSession> conn);
|
||||||
|
void Connect(const boost::asio::ip::address & address, uint16_t port, std::shared_ptr<NTCPSession> conn);
|
||||||
|
|
||||||
bool IsBoundV4() const { return m_NTCPAcceptor != nullptr; };
|
bool IsBoundV4() const { return m_NTCPAcceptor != nullptr; };
|
||||||
bool IsBoundV6() const { return m_NTCPV6Acceptor != nullptr; };
|
bool IsBoundV6() const { return m_NTCPV6Acceptor != nullptr; };
|
||||||
|
bool NetworkIsReady() const { return IsBoundV4() || IsBoundV6() || UsingProxy(); };
|
||||||
|
bool UsingProxy() const { return m_ProxyType != eNoProxy; };
|
||||||
|
|
||||||
|
void UseProxy(ProxyType proxy, const std::string & address, uint16_t port);
|
||||||
|
|
||||||
boost::asio::io_service& GetService () { return m_Service; };
|
boost::asio::io_service& GetService () { return m_Service; };
|
||||||
|
|
||||||
|
@ -155,6 +175,9 @@ namespace transport
|
||||||
|
|
||||||
void HandleConnect (const boost::system::error_code& ecode, std::shared_ptr<NTCPSession> conn, std::shared_ptr<boost::asio::deadline_timer> timer);
|
void HandleConnect (const boost::system::error_code& ecode, std::shared_ptr<NTCPSession> conn, std::shared_ptr<boost::asio::deadline_timer> timer);
|
||||||
|
|
||||||
|
void HandleProxyConnect(const boost::system::error_code& ecode, std::shared_ptr<NTCPSession> conn, std::shared_ptr<boost::asio::deadline_timer> timer, const std::string & host, uint16_t port, RemoteAddressType adddrtype);
|
||||||
|
void AfterSocksHandshake(std::shared_ptr<NTCPSession> conn, std::shared_ptr<boost::asio::deadline_timer> timer, const std::string & host, uint16_t port, RemoteAddressType adddrtype);
|
||||||
|
|
||||||
// timer
|
// timer
|
||||||
void ScheduleTermination ();
|
void ScheduleTermination ();
|
||||||
void HandleTerminationTimer (const boost::system::error_code& ecode);
|
void HandleTerminationTimer (const boost::system::error_code& ecode);
|
||||||
|
@ -170,6 +193,11 @@ namespace transport
|
||||||
std::map<i2p::data::IdentHash, std::shared_ptr<NTCPSession> > m_NTCPSessions; // access from m_Thread only
|
std::map<i2p::data::IdentHash, std::shared_ptr<NTCPSession> > m_NTCPSessions; // access from m_Thread only
|
||||||
std::list<std::shared_ptr<NTCPSession> > m_PendingIncomingSessions;
|
std::list<std::shared_ptr<NTCPSession> > m_PendingIncomingSessions;
|
||||||
|
|
||||||
|
ProxyType m_ProxyType;
|
||||||
|
std::string m_ProxyAddress;
|
||||||
|
uint16_t m_ProxyPort;
|
||||||
|
boost::asio::ip::tcp::resolver m_Resolver;
|
||||||
|
boost::asio::ip::tcp::endpoint * m_ProxyEndpoint;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// for HTTP/I2PControl
|
// for HTTP/I2PControl
|
|
@ -13,7 +13,7 @@
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "Garlic.h"
|
#include "Garlic.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
using namespace i2p::transport;
|
using namespace i2p::transport;
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef NETDB_H__
|
#ifndef NETDB_H__
|
||||||
#define NETDB_H__
|
#define NETDB_H__
|
||||||
|
// this file is called NetDb.hpp to resolve conflict with libc's netdb.h on case insensitive fs
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
|
@ -1,7 +1,7 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "I2NPProtocol.h"
|
#include "I2NPProtocol.h"
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "NetDbRequests.h"
|
#include "NetDbRequests.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
|
@ -14,7 +14,7 @@
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Identity.h"
|
#include "Identity.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "HTTP.h"
|
#include "HTTP.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "I2NPProtocol.h"
|
#include "I2NPProtocol.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
@ -17,8 +17,8 @@ namespace i2p
|
||||||
|
|
||||||
RouterContext::RouterContext ():
|
RouterContext::RouterContext ():
|
||||||
m_LastUpdateTime (0), m_AcceptsTunnels (true), m_IsFloodfill (false),
|
m_LastUpdateTime (0), m_AcceptsTunnels (true), m_IsFloodfill (false),
|
||||||
m_StartupTime (0), m_Status (eRouterStatusOK), m_Error (eRouterErrorNone),
|
m_StartupTime (0), m_ShareRatio (100), m_Status (eRouterStatusOK),
|
||||||
m_NetID (I2PD_NET_ID)
|
m_Error (eRouterErrorNone), m_NetID (I2PD_NET_ID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +246,13 @@ namespace i2p
|
||||||
else { SetBandwidth('K'); }
|
else { SetBandwidth('K'); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RouterContext::SetShareRatio (int percents)
|
||||||
|
{
|
||||||
|
if (percents < 0) percents = 0;
|
||||||
|
if (percents > 100) percents = 100;
|
||||||
|
m_ShareRatio = percents;
|
||||||
|
}
|
||||||
|
|
||||||
bool RouterContext::IsUnreachable () const
|
bool RouterContext::IsUnreachable () const
|
||||||
{
|
{
|
||||||
return m_RouterInfo.GetCaps () & i2p::data::RouterInfo::eUnreachable;
|
return m_RouterInfo.GetCaps () & i2p::data::RouterInfo::eUnreachable;
|
|
@ -54,6 +54,7 @@ namespace i2p
|
||||||
uint32_t GetStartupTime () const { return m_StartupTime; };
|
uint32_t GetStartupTime () const { return m_StartupTime; };
|
||||||
uint64_t GetLastUpdateTime () const { return m_LastUpdateTime; };
|
uint64_t GetLastUpdateTime () const { return m_LastUpdateTime; };
|
||||||
uint64_t GetBandwidthLimit () const { return m_BandwidthLimit; };
|
uint64_t GetBandwidthLimit () const { return m_BandwidthLimit; };
|
||||||
|
uint64_t GetTransitBandwidthLimit () const { return (m_BandwidthLimit*m_ShareRatio)/100LL; };
|
||||||
RouterStatus GetStatus () const { return m_Status; };
|
RouterStatus GetStatus () const { return m_Status; };
|
||||||
void SetStatus (RouterStatus status);
|
void SetStatus (RouterStatus status);
|
||||||
RouterError GetError () const { return m_Error; };
|
RouterError GetError () const { return m_Error; };
|
||||||
|
@ -74,6 +75,7 @@ namespace i2p
|
||||||
std::string GetFamily () const;
|
std::string GetFamily () const;
|
||||||
void SetBandwidth (int limit); /* in kilobytes */
|
void SetBandwidth (int limit); /* in kilobytes */
|
||||||
void SetBandwidth (char L); /* by letter */
|
void SetBandwidth (char L); /* by letter */
|
||||||
|
void SetShareRatio (int percents); // 0 - 100
|
||||||
bool AcceptsTunnels () const { return m_AcceptsTunnels; };
|
bool AcceptsTunnels () const { return m_AcceptsTunnels; };
|
||||||
void SetAcceptsTunnels (bool acceptsTunnels) { m_AcceptsTunnels = acceptsTunnels; };
|
void SetAcceptsTunnels (bool acceptsTunnels) { m_AcceptsTunnels = acceptsTunnels; };
|
||||||
bool SupportsV6 () const { return m_RouterInfo.IsV6 (); };
|
bool SupportsV6 () const { return m_RouterInfo.IsV6 (); };
|
||||||
|
@ -116,7 +118,8 @@ namespace i2p
|
||||||
uint64_t m_LastUpdateTime;
|
uint64_t m_LastUpdateTime;
|
||||||
bool m_AcceptsTunnels, m_IsFloodfill;
|
bool m_AcceptsTunnels, m_IsFloodfill;
|
||||||
uint64_t m_StartupTime; // in seconds since epoch
|
uint64_t m_StartupTime; // in seconds since epoch
|
||||||
uint32_t m_BandwidthLimit; // allowed bandwidth
|
uint64_t m_BandwidthLimit; // allowed bandwidth
|
||||||
|
int m_ShareRatio;
|
||||||
RouterStatus m_Status;
|
RouterStatus m_Status;
|
||||||
RouterError m_Error;
|
RouterError m_Error;
|
||||||
int m_NetID;
|
int m_NetID;
|
|
@ -12,7 +12,7 @@
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "RouterInfo.h"
|
#include "RouterInfo.h"
|
||||||
|
|
||||||
|
@ -264,6 +264,8 @@ namespace data
|
||||||
introducer.iTag = boost::lexical_cast<uint32_t>(value);
|
introducer.iTag = boost::lexical_cast<uint32_t>(value);
|
||||||
else if (!strcmp (key, "ikey"))
|
else if (!strcmp (key, "ikey"))
|
||||||
Base64ToByteStream (value, strlen (value), introducer.iKey, 32);
|
Base64ToByteStream (value, strlen (value), introducer.iKey, 32);
|
||||||
|
else if (!strcmp (key, "iexp"))
|
||||||
|
introducer.iExp = boost::lexical_cast<uint32_t>(value);
|
||||||
}
|
}
|
||||||
if (!s) return;
|
if (!s) return;
|
||||||
}
|
}
|
||||||
|
@ -478,6 +480,18 @@ namespace data
|
||||||
properties << ';';
|
properties << ';';
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
i = 0;
|
||||||
|
for (const auto& introducer: address.ssu->introducers)
|
||||||
|
{
|
||||||
|
if (introducer.iExp) // expiration is specified
|
||||||
|
{
|
||||||
|
WriteString ("iexp" + boost::lexical_cast<std::string>(i), properties);
|
||||||
|
properties << '=';
|
||||||
|
WriteString (boost::lexical_cast<std::string>(introducer.iExp), properties);
|
||||||
|
properties << ';';
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// write intro key
|
// write intro key
|
||||||
WriteString ("key", properties);
|
WriteString ("key", properties);
|
|
@ -73,10 +73,12 @@ namespace data
|
||||||
typedef Tag<32> IntroKey; // should be castable to MacKey and AESKey
|
typedef Tag<32> IntroKey; // should be castable to MacKey and AESKey
|
||||||
struct Introducer
|
struct Introducer
|
||||||
{
|
{
|
||||||
|
Introducer (): iExp (0) {};
|
||||||
boost::asio::ip::address iHost;
|
boost::asio::ip::address iHost;
|
||||||
int iPort;
|
int iPort;
|
||||||
IntroKey iKey;
|
IntroKey iKey;
|
||||||
uint32_t iTag;
|
uint32_t iTag;
|
||||||
|
uint32_t iExp;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SSUExt
|
struct SSUExt
|
|
@ -3,7 +3,7 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "SSU.h"
|
#include "SSU.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
|
@ -2,7 +2,7 @@
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "SSU.h"
|
#include "SSU.h"
|
||||||
#include "SSUData.h"
|
#include "SSUData.h"
|
||||||
#ifdef WITH_EVENTS
|
#ifdef WITH_EVENTS
|
|
@ -4,7 +4,7 @@
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "RouterContext.h"
|
#include "RouterContext.h"
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "NetDb.h"
|
#include "NetDb.hpp"
|
||||||
#include "SSU.h"
|
#include "SSU.h"
|
||||||
#include "SSUSession.h"
|
#include "SSUSession.h"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue