mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9a6d894421
8 changed files with 34 additions and 31 deletions
|
@ -53,7 +53,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
|||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
ENABLE_LANGUAGE(RC)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lshlwapi")
|
||||
else()
|
||||
|
|
4
Makefile
4
Makefile
|
@ -198,7 +198,7 @@ android: android-gradle
|
|||
|
||||
windows-debug-configure: clean
|
||||
mkdir -p '$(BUILD_ROOT)'
|
||||
$(CONFIG_CMD) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw32.cmake' -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
|
||||
$(CONFIG_CMD) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw.cmake' -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
|
||||
|
||||
windows-debug: windows-debug-configure
|
||||
$(MAKE) -C '$(BUILD_ROOT)'
|
||||
|
@ -206,7 +206,7 @@ windows-debug: windows-debug-configure
|
|||
|
||||
windows-release-configure: clean
|
||||
mkdir -p '$(BUILD_ROOT)'
|
||||
$(CONFIG_CMD) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw32.cmake' -DCMAKE_BUILD_TYPE=Release -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
|
||||
$(CONFIG_CMD) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw.cmake' -DCMAKE_BUILD_TYPE=Release -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
|
||||
|
||||
windows-release: windows-release-configure
|
||||
$(MAKE) -C '$(BUILD_ROOT)'
|
||||
|
|
|
@ -18,8 +18,8 @@ set(USING_CLANG ON)
|
|||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-clang)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-clang++)
|
||||
else()
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
endif()
|
||||
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
# requires wget to be installed for ca bundle download
|
||||
|
||||
# to build:
|
||||
# $ [g]make prepare;[g]make libhttp
|
||||
# make prepare; make libhttp
|
||||
|
||||
# set this beforehand if you use clang
|
||||
# make sure to preset CFLAGS if you use non-ix86 platform
|
||||
# or non-GNU-compat C compilation system
|
||||
CC ?= cc
|
||||
CFLAGS ?= -Ofast -march=nocona -mfpmath=sse
|
||||
# Uncomment these if you're on a 32-bit Linux?
|
||||
# CC = cc
|
||||
# CFLAGS = -Ofast -march=nocona -mfpmath=sse
|
||||
|
||||
# path to mbedtls headers/libs and system libs
|
||||
# if you have local copies of libs in this folder,
|
||||
|
@ -17,8 +18,8 @@ CFLAGS ?= -Ofast -march=nocona -mfpmath=sse
|
|||
#
|
||||
# -lsocket -lnsl on Sun
|
||||
# -lws2_32 on windows nt
|
||||
INCLUDE ?=
|
||||
LIBS ?=
|
||||
#INCLUDE :=
|
||||
#LIBS :=
|
||||
|
||||
.PHONY: download prepare all default
|
||||
|
||||
|
@ -48,7 +49,7 @@ libhttp.dll: cacerts.o miniz.o libhttp.o uri.o internal.o
|
|||
$(CC) -fPIC $(CFLAGS) $^ -s -shared -o $@ -static -lmbedx509 -lmbedtls -lmbedcrypto $(LIBS)
|
||||
|
||||
libhttp.so: cacerts.o miniz.o libhttp.o uri.o internal.o
|
||||
$(CC) -fPIC $(CFLAGS) $^ -s -shared -o $@ -static -lmbedx509 -lmbedtls -lmbedcrypto $(LIBS)
|
||||
$(CC) $^ -fPIC $(CFLAGS) -shared -o $@ $(LIBS) -lmbedx509 -lmbedtls -lmbedcrypto $(SYS_LIBS)
|
||||
|
||||
clean:
|
||||
-@rm base64enc
|
||||
|
|
|
@ -4,19 +4,23 @@
|
|||
|
||||
### requirements
|
||||
|
||||
- mbedtls 2.13.0 or later, for both host and windows
|
||||
- wget for host (to download Netscape CA bundle from cURL website)
|
||||
- mbedtls 2.13.0 or later, for both host and target (if cross-compiling)
|
||||
- wget for host (to download Netscape root certificate store from cURL website)
|
||||
- Also included is a patch that can be applied to the mbedtls source to enable features like AES-NI in protected mode, plus some networking fixes for win32, see `../contrib/lokinet-bootstrap-winnt/mbedtls-win32.patch`
|
||||
|
||||
build:
|
||||
|
||||
$ [g]make prepare; [g]make libhttp.[so|dll]
|
||||
$ make prepare; make libhttp.[so|dll]
|
||||
|
||||
if you have installed mbedtls in a different path, define INCLUDE and LIBS with the path to the mbedtls headers, library search path, and any extra system libraries required (libsocket/libnsl on Sun, `ws2_32.lib` on Windows)
|
||||
## Useful build-time variables
|
||||
|
||||
- INCLUDE: path to mbedtls headers
|
||||
- LIBS: path to mbedtls libraries
|
||||
- SYS_LIBS: system-specific link libraries (`-lsocket -lnsl` on Sun systems, `-lws2_32` [or `-lwsock32` if IPv6 is disabled] on Windows)
|
||||
|
||||
## Usage
|
||||
|
||||
- include libhttp.h in your source
|
||||
- link against libhttp.[so|dll]
|
||||
|
||||
-rick
|
||||
-rick
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
void free_parsed_url(url_parsed)
|
||||
|
@ -47,21 +52,13 @@ url_t *url_parsed;
|
|||
free(url_parsed);
|
||||
}
|
||||
|
||||
parse_url(url, verify_host, parsed_url)
|
||||
parse_url(url, verify_host, parsed_url)
|
||||
char *url;
|
||||
bool verify_host;
|
||||
url_t *parsed_url;
|
||||
{
|
||||
char *local_url;
|
||||
char *token;
|
||||
char *token_host;
|
||||
char *host_port;
|
||||
char *host_ip;
|
||||
|
||||
char *token_ptr;
|
||||
char *host_token_ptr;
|
||||
|
||||
char *path = NULL;
|
||||
char *local_url, *token, *token_host, *host_port, *host_ip, *token_ptr;
|
||||
char *host_token_ptr, *path = NULL;
|
||||
|
||||
/* Copy our string */
|
||||
local_url = strdup(url);
|
||||
|
@ -71,7 +68,7 @@ url_t *parsed_url;
|
|||
|
||||
/* Host:Port */
|
||||
token = strtok_r(NULL, "/", &token_ptr);
|
||||
if (token)
|
||||
if (token)
|
||||
host_port = strdup(token);
|
||||
else
|
||||
host_port = (char *) calloc(1, sizeof(char));
|
||||
|
@ -138,4 +135,4 @@ url_t *parsed_url;
|
|||
free(local_url);
|
||||
free(host_port);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@ add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
|
|||
target_include_directories(${UTIL_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC absl::synchronization)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC absl::optional absl::variant absl::strings absl::hash)
|
||||
|
||||
# cut back on fluff
|
||||
if (NOT WIN32)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC cppbackport)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC absl::optional absl::variant absl::strings absl::hash cppbackport)
|
||||
endif(NOT WIN32)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
|
|
@ -838,6 +838,7 @@ namespace llarp
|
|||
{
|
||||
if(StrEq(key, "type") && StrEq(val, "syslog"))
|
||||
{
|
||||
// TODO(despair): write event log syslog class
|
||||
#if defined(_WIN32)
|
||||
LogError("syslog not supported on win32");
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue