Merge tag 'v0.7.0_rc2' into debian/sid

ubuntu/groovy
Jason Rhinelander 5 years ago
commit f509b10210

7
.gitattributes vendored

@ -0,0 +1,7 @@
external/date/test export-ignore
external/nlohmann/doc export-ignore
external/nlohmann/test export-ignore
external/nlohmann/benchmarks/data export-ignore
*.exe export-ignore
*.png export-ignore
*.gif export-ignore

@ -1,38 +1,51 @@
variables:
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
- test
# disabled because cannot find -luv -lcap when building
# disabled because gcc9 can't build net_if.hpp
#build:linux:
# image: alpine:latest
# tags:
# - linux
# stage: build
# before_script:
# - apk add --update g++ make cmake linux-headers libcap-dev libuv-dev
# - apk add --update g++ make cmake linux-headers libcap-dev libuv-dev curl-dev git
# script:
# - make STATIC_LINK=ON
# - make STATIC_LINK=ON DOWNLOAD_SODIUM=ON
# artifacts:
# paths:
# - "lokinet"
# we'll just try our travis set up for now
#build:linux_release:
# image: ubuntu:xenial
# tags:
# - linux
# stage: build
# before_script:
# - apt-get update && apt-get install -y binutils-gold build-essential bsdmainutils ca-certificates cmake curl git libcap-dev libcurl4-openssl-dev libsodium-dev libuv1-dev ninja-build
# script:
# - DOWNLOAD_SODIUM=ON STATIC_LINK=OFF make release
# artifacts:
# paths:
# - "build/daemon/lokinet"
# - "build/daemon/lokinetctl"
build:linux_release:
image: ubuntu:xenial
tags:
- linux
stage: build
before_script:
- apt-get update && apt-get install -y apt-transport-https curl
- curl https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
- echo 'deb https://apt.kitware.com/ubuntu/ xenial main' >/etc/apt/sources.list.d/kitware.list
- apt-get update && apt-get install -y build-essential ca-certificates cmake curl git libcap-dev pkg-config wget xz-utils
script:
- make static DOWNLOAD_SODIUM=ON
# alternatively: git describe --tag
- LOKINET_VERSION=$(./lokinet-static --version|sed s/lokinet-//)
- echo lokinet-linux-x64-v$LOKINET_VERSION
- mkdir lokinet-linux-x64-v$LOKINET_VERSION
- cp lokinet-bootstrap lokinet-linux-x64-v$LOKINET_VERSION
- cp build/daemon/lokinet lokinet-linux-x64-v$LOKINET_VERSION
- cp build/daemon/lokinetctl lokinet-linux-x64-v$LOKINET_VERSION
- cp docs/linux-setcap-readme.txt lokinet-linux-x64-v$LOKINET_VERSION
- tar cJf lokinet-linux-x64-v$LOKINET_VERSION.tar.xz lokinet-linux-x64-v$LOKINET_VERSION
- echo "lokinet-linux-x64-v$LOKINET_VERSION.tar.xz should be ready"
artifacts:
paths:
- lokinet-linux-x64-v*.tar.xz
build:linux_debug:
image: ubuntu:xenial
@ -40,31 +53,38 @@ build:linux_debug:
- linux
stage: build
before_script:
- apt-get update && apt-get install -y binutils-gold build-essential bsdmainutils ca-certificates cmake curl git libcap-dev libcurl4-openssl-dev libsodium-dev libuv1-dev ninja-build
- apt-get update && apt-get install -y apt-transport-https curl
- curl https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
- echo 'deb https://apt.kitware.com/ubuntu/ xenial main' >/etc/apt/sources.list.d/kitware.list
- apt-get update && apt-get install -y build-essential ca-certificates cmake curl git libcap-dev libcurl4-openssl-dev libuv1-dev ninja-build
script:
- DOWNLOAD_SODIUM=ON IS_NOTIFICATION=1 STATIC_LINK=OFF make
artifacts:
paths:
- "lokinet"
- "lokinetctl"
- build/daemon/lokinet
- build/daemon/lokinetctl
# needs libsodium (probably libuv and libcurl too)
# needs libuv and libcurl
#build:freebsd:
# tags:
# - freebsd
# stage: build
# script:
# - gmake
# - gmake DOWNLOAD_SODIUM=ON
# artifacts:
# paths:
# - "lokinet"
# need windows runner on lokiproject
#build:windows:
# tags:
# - windows
# stage: build
# script:
# - make STATIC_LINK=ON AVX2=OFF JSONRPC=OFF CC=gcc CXX=g++
#- make static CC=gcc CXX=g++
# can't use STATIC because LTO doesn't work on cross-compiled targets
# -DSTATIC_LINK_RUNTIME=ON -DLIBUV_ROOT=libuv
# - cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw[32].cmake -DDOWNLOAD_SODIUM=ON
# artifacts:
# paths:
# - "lokinet.exe"

@ -13,9 +13,10 @@ option(USE_AVX2 "enable avx2 code" OFF)
option(USE_NETNS "enable networking namespace support. Linux only" OFF)
option(NATIVE_BUILD "optimise for host system and FPU" ON)
option(EMBEDDED_CFG "optimise for older hardware or embedded systems" OFF)
if (NOT MSVC)
option(STATIC_LINK "link statically against dependencies" OFF)
option(STATIC_LINK_RUNTIME "link statically against compiler runtime, standard library and pthreads" OFF)
if (WIN32)
option(STATIC_LINK_RUNTIME "link statically against compiler runtime, standard library and pthreads" OFF)
else()
option(STATIC_LINK "link statically against dependencies" OFF)
endif()
option(SHADOW "use shadow testing framework. linux only" OFF)
option(XSAN "use sanitiser, if your system has it" OFF)
@ -78,11 +79,7 @@ if(NOT WIN32)
endif()
endif()
if(WIN32)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif(WIN32)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
@ -187,7 +184,6 @@ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
include(cmake/static_link_runtime.cmake)
include(cmake/static_link.cmake)
if(USE_NETNS)

@ -12,12 +12,24 @@ file(MAKE_DIRECTORY ${LIBSODIUM_PREFIX}/include)
include(ExternalProject)
include(ProcessorCount)
if (CMAKE_C_COMPILER_ARG1)
set(SODIUM_CONFIGURE ./configure --prefix=${LIBSODIUM_PREFIX} --enable-static --disable-shared CC=${CMAKE_C_COMPILER} CPPFLAGS=${CMAKE_C_COMPILER_ARG1})
else()
set(SODIUM_CONFIGURE ./configure --prefix=${LIBSODIUM_PREFIX} --enable-static --disable-shared CC=${CMAKE_C_COMPILER})
endif()
if (LIBSODIUM_CROSS_TARGET)
set(SODIUM_CONFIGURE ${SODIUM_CONFIGURE} --target=${LIBSODIUM_CROSS_TARGET} --host=${LIBSODIUM_CROSS_TARGET})
endif()
ExternalProject_Add(libsodium_external
BUILD_IN_SOURCE ON
PREFIX ${LIBSODIUM_PREFIX}
URL ${LIBSODIUM_URL}
URL_HASH ${LIBSODIUM_HASH}
CONFIGURE_COMMAND ./configure --prefix=${LIBSODIUM_PREFIX} --enable-static --disable-shared
CONFIGURE_COMMAND ${SODIUM_CONFIGURE}
BUILD_COMMAND make -j${PROCESSOR_COUNT}
INSTALL_COMMAND ${MAKE}
BUILD_BYPRODUCTS ${LIBSODIUM_PREFIX}/lib/libsodium.a ${LIBSODIUM_PREFIX}/include

@ -1,6 +1,7 @@
find_package(Git QUIET)
if(GIT_FOUND OR Git_FOUND)
set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index")
if(EXISTS ${GIT_INDEX_FILE} AND ( GIT_FOUND OR Git_FOUND) )
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
add_custom_command(
@ -11,9 +12,9 @@ if(GIT_FOUND OR Git_FOUND)
"-D" "DEST=${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
"-P" "${CMAKE_CURRENT_LIST_DIR}/GenVersion.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
"${CMAKE_CURRENT_SOURCE_DIR}/../.git/index")
"${GIT_INDEX_FILE}")
else()
message(WARNING "Git was not found! Setting version to to nogit")
message(STATUS "Git was not found! Setting version to to nogit")
set(VERSIONTAG "nogit")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
endif()

@ -1,38 +0,0 @@
if(NOT STATIC_LINK_RUNTIME)
return()
endif()
# not supported on Solaris - system libraries are not available as archives
# LTO is supported only for native builds
if(SOLARIS)
link_libraries( -static-libstdc++ -static-libgcc )
return()
endif()
if(NOT CMAKE_CROSSCOMPILING)
add_compile_options(-static -flto)
else()
add_compile_options(-static)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(APPLE)
link_libraries( -flto)
else()
link_libraries( -static -static-libstdc++ -pthread -flto )
endif()
return()
endif()
if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_AR "gcc-ar")
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "true")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH "true")
link_libraries( -flto -static-libstdc++ -static-libgcc -static ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS} )
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static" )
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
endif()

@ -5,13 +5,6 @@ endif()
enable_language(RC)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
if (MSVC OR MSVC_VERSION)
add_compile_options(/EHca /arch:AVX2 /MD)
add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
add_compile_options(-Wno-nonportable-system-include-path)
endif()
endif()
if(NOT MSVC_VERSION)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
@ -22,6 +15,15 @@ if(NOT MSVC_VERSION)
add_compile_options(-fno-ident -Wa,-mbig-obj)
link_libraries( -lws2_32 -lshlwapi -ldbghelp -luser32 -liphlpapi -lpsapi -luserenv )
add_definitions(-DWINVER=0x0500 -D_WIN32_WINNT=0x0500)
if (CMAKE_C_COMPILER_AR AND STATIC_LINK_RUNTIME)
add_compile_options(-flto)
set(CMAKE_AR ${CMAKE_C_COMPILER_AR})
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "true")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH "true")
link_libraries( -flto -static-libstdc++ -static-libgcc -static ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS} )
endif()
endif()
if(EMBEDDED_CFG)
@ -30,7 +32,7 @@ endif()
list(APPEND LIBTUNTAP_SRC ${TT_ROOT}/tuntap-windows.c)
get_filename_component(EV_SRC "llarp/ev/ev_libuv.cpp" ABSOLUTE)
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32 -DWINVER=0x0500)
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32)
set(EXE_LIBS ${STATIC_LIB} ws2_32 iphlpapi)
if(RELEASE_MOTTO)
@ -43,7 +45,7 @@ if (NOT STATIC_LINK_RUNTIME AND NOT MSVC)
message("for release builds, turn on STATIC_LINK_RUNTIME in cmake options")
endif()
if (STATIC_LINK_RUNTIME OR STATIC_LINK)
if (STATIC_LINK_RUNTIME)
set(LIBUV_USE_STATIC ON)
endif()

@ -2,6 +2,7 @@ set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
set(TOOLCHAIN_SUFFIX "-posix")
set(WIN64_CROSS_COMPILE ON)
set(LIBSODIUM_CROSS_TARGET x86_64-w64-mingw32)
set(TOOLCHAIN_PATHS
/usr/${TOOLCHAIN_PREFIX}

@ -2,6 +2,7 @@ set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
set(TOOLCHAIN_SUFFIX "")
set(WOW64_CROSS_COMPILE ON)
set(LIBSODIUM_CROSS_TARGET i686-w64-mingw32)
set(TOOLCHAIN_PATHS
/usr/${TOOLCHAIN_PREFIX}

@ -44,6 +44,7 @@ startWinsock()
perror("Failed to start Windows Sockets");
return err;
}
::CreateMutex(nullptr, FALSE, "lokinet_win32_daemon");
return 0;
}

@ -0,0 +1,16 @@
Lokinet needs certain capabilities to run to set up a virtual network interface and provide a DNS server. The preferred approach to using this is through the linux capabilities mechanism, which allows assigning limited capabilities without needing to run the entire process as root.
There are two main ways to do this:
1. If you are running lokinet via an init system such as systemd, you can specify the capabilities in the service file by adding:
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
into the [Service] section of the systemd service file. This will assign the necessary permissions when running the process and allow lokinet to work while running as a non-root user.
2. You can set the capabilities on the binary by using the setcap program (if not available you may need to install libcap2-bin on Debian/Ubuntu-based systems) and running:
setcap cap_net_admin,cap_net_bind_service=+eip lokinet
This grants the permissions whenever the lokinet binary is executed.

@ -152,7 +152,8 @@ extern "C"
int flags; /* ifr.ifr_flags on Unix */
char if_name[IF_NAMESIZE];
#if defined(Windows)
int idx; /* needed to set ipv6 address */
int idx; /* needed to set ipv6 address */
DWORD bindaddr; /* set DNS client address */
#endif
#if defined(FreeBSD)
int mode;

@ -37,6 +37,10 @@ namespace abyss
bool
ShouldClose(llarp_time_t now) const;
/// return true if the host header is correct
virtual bool
ValidateHost(const std::string& host) const = 0;
private:
ConnImpl* m_Impl;
};

@ -192,6 +192,7 @@ namespace abyss
authgen << ", " << opt.first << "=" << opt.second;
}
m_SendHeaders.clear();
m_SendHeaders.emplace("Host", "localhost");
m_SendHeaders.emplace("Authorization", authgen.str());
SendRequest();
return true;
@ -320,6 +321,7 @@ namespace abyss
std::string body;
std::stringstream ss;
body = m_RequestBody.dump();
m_SendHeaders.emplace("Host", "localhost");
m_SendHeaders.emplace("Content-Type", "application/json");
m_SendHeaders.emplace("Content-Length", std::to_string(body.size()));
m_SendHeaders.emplace("Accept", "application/json");

@ -96,7 +96,8 @@ namespace abyss
{
// TODO: header whitelist
return name == string_view("content-type")
|| name == string_view("content-length");
|| name == string_view("content-length")
|| name == string_view("host");
}
bool
@ -162,6 +163,17 @@ namespace abyss
{
m_BodyParser.reset(json::MakeParser(contentLength));
}
itr = Header.Headers.find("host");
if(itr == Header.Headers.end())
{
return WriteResponseSimple(400, "Bad Request", "text/plain",
"no host header provided");
}
if(not handler->ValidateHost(itr->second))
{
return WriteResponseSimple(400, "Bad Request", "text/plain",
"invalid host header");
}
}
if(!m_BodyParser->FeedData(buf, sz))
{

@ -207,6 +207,8 @@ struct llarp_tun_io
{
// TODO: more info?
char ifaddr[128];
// windows only
uint32_t dnsaddr;
int netmask;
char ifname[IFNAMSIZ + 1];

@ -58,6 +58,7 @@ win32_tun_io::setup()
llarp::LogWarn("failed to put interface up: ", ebuf);
return false;
}
tunif->bindaddr = t->dnsaddr;
if(tuntap_set_ip(tunif, t->ifaddr, t->ifaddr, t->netmask) == -1)
{
@ -234,501 +235,5 @@ exit_tun_loop()
DeleteCriticalSection(&HandlerMtx);
}
}
/*
// now zero-copy
ssize_t
TCPWrite(llarp_tcp_conn* conn, const byte_t* ptr, size_t sz)
{
llarp::ev_io* io = (llarp::ev_io*)conn->impl;
return uwrite(io->fd, (char*)ptr, sz);
}
llarp_win32_loop::~llarp_win32_loop()
{
exit_tun_loop();
}
namespace llarp
{
int
tcp_conn::read(byte_t* buf, size_t sz)
{
if(_shouldClose)
return -1;
ssize_t amount = uread(fd, (char*)buf, sz);
if(amount > 0)
{
if(tcp.read)
tcp.read(&tcp, llarp_buffer_t(buf, amount));
}
else
{
// error
_shouldClose = true;
return -1;
}
return 0;
}
void
tcp_conn::flush_write()
{
connected();
ev_io::flush_write();
}
ssize_t
tcp_conn::do_write(void* buf, size_t sz)
{
if(_shouldClose)
return -1;
return uwrite(fd, (char*)buf, sz);
}
void
tcp_conn::connect()
{
socklen_t slen = sizeof(sockaddr_in);
if(_addr.ss_family == AF_UNIX)
slen = sizeof(sockaddr_un);
else if(_addr.ss_family == AF_INET6)
slen = sizeof(sockaddr_in6);
int result = ::connect(fd, (const sockaddr*)&_addr, slen);
if(result == 0)
{
llarp::LogDebug("connected immedidately");
connected();
}
// Winsock 2.x no longer returns WSAEINPROGRESS
else if(WSAGetLastError() == WSAEWOULDBLOCK)
{
// in progress
llarp::LogDebug("connect in progress");
WSASetLastError(0);
return;
}
else if(_conn->error)
{
// wtf?
char ebuf[1024];
int err = WSAGetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, err, LANG_NEUTRAL,
ebuf, 1024, nullptr);
int l = strlen(ebuf);
ebuf[l - 2] = '\0'; // remove line break
llarp::LogError("error connecting: ", ebuf, " [", err, "]");
_conn->error(_conn);
}
}
int
tcp_serv::read(byte_t*, size_t)
{
int new_fd = ::accept(fd, nullptr, nullptr);
if(new_fd == -1)
{
char ebuf[1024];
int err = WSAGetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, err, LANG_NEUTRAL,
ebuf, 1024, nullptr);
int l = strlen(ebuf);
ebuf[l - 2] = '\0'; // remove line break
llarp::LogError("failed to accept on ", fd, ":", ebuf, " [", err, "]");
return -1;
}
// build handler
llarp::tcp_conn* connimpl = new tcp_conn(loop, new_fd);
connimpl->tcp.write = &TCPWrite;
connimpl->tcp.loop = loop;
if(loop->add_ev(connimpl, true))
{
// call callback
if(tcp->accepted)
tcp->accepted(tcp, &connimpl->tcp);
return 0;
}
// cleanup error
delete connimpl;
return -1;
}
bool
udp_listener::tick()
{
if(udp->tick)
udp->tick(udp);
return true;
}
int
udp_listener::read(byte_t* buf, size_t sz)
{
llarp_buffer_t b;
b.base = buf;
b.cur = b.base;
sockaddr_in6 src;
socklen_t slen = sizeof(sockaddr_in6);
sockaddr* addr = (sockaddr*)&src;
ssize_t ret = ::recvfrom(fd, (char*)b.base, sz, 0, addr, &slen);
if(ret < 0)
return -1;
if(static_cast< size_t >(ret) > sz)
return -1;
b.sz = ret;
if(udp->recvfrom)
udp->recvfrom(udp, addr, ManagedBuffer{b});
else
{
m_RecvPackets.emplace_back(
PacketEvent{llarp::Addr(*addr), PacketBuffer(ret)});
std::copy_n(buf, ret, m_RecvPackets.back().pkt.data());
}
return 0;
}
bool
udp_listener::RecvMany(llarp_pkt_list* pkts)
{
*pkts = std::move(m_RecvPackets);
m_RecvPackets = llarp_pkt_list();
return pkts->size() > 0;
}
static int
UDPSendTo(llarp_udp_io* udp, const sockaddr* to, const byte_t* ptr, size_t sz)
{
llarp::ev_io* io = (llarp::ev_io*)udp->impl;
return io->sendto(to, ptr, sz);
}
int
udp_listener::sendto(const sockaddr* to, const void* data, size_t sz)
{
socklen_t slen;
switch(to->sa_family)
{
case AF_INET:
slen = sizeof(struct sockaddr_in);
break;
case AF_INET6:
slen = sizeof(struct sockaddr_in6);
break;
default:
return -1;
}
ssize_t sent = ::sendto(fd, (char*)data, sz, 0, to, slen);
if(sent == -1)
{
char ebuf[1024];
int err = WSAGetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, err, LANG_NEUTRAL,
ebuf, 1024, nullptr);
llarp::LogWarn(ebuf);
}
return sent;
}
}; // namespace llarp
bool
llarp_win32_loop::tcp_connect(struct llarp_tcp_connecter* tcp,
const sockaddr* remoteaddr)
{
// create socket
int fd = usocket(remoteaddr->sa_family, SOCK_STREAM, 0);
if(fd == -1)
return false;
llarp::tcp_conn* conn = new llarp::tcp_conn(this, fd, remoteaddr, tcp);
conn->tcp.write = &TCPWrite;
add_ev(conn, true);
conn->connect();
return true;
}
llarp::ev_io*
llarp_win32_loop::bind_tcp(llarp_tcp_acceptor* tcp, const sockaddr* bindaddr)
{
int fd = usocket(bindaddr->sa_family, SOCK_STREAM, 0);
if(fd == -1)
return nullptr;
socklen_t sz = sizeof(sockaddr_in);
if(bindaddr->sa_family == AF_INET6)
{
sz = sizeof(sockaddr_in6);
}
// keep. inexplicably, windows now has unix domain sockets
// for now, use the ID numbers directly until this comes out of
// beta
else if(bindaddr->sa_family == AF_UNIX)
sz = sizeof(sockaddr_un);
if(::bind(fd, bindaddr, sz) == -1)
{
uclose(fd);
return nullptr;
}
if(ulisten(fd, 5) == -1)
{
uclose(fd);
return nullptr;
}
return new llarp::tcp_serv(this, fd, tcp);
}
bool
llarp_win32_loop::udp_listen(llarp_udp_io* l, const sockaddr* src)
{
auto ev = create_udp(l, src);
if(ev)
l->fd = ev->fd;
return ev && add_ev(ev, false);
}
bool
llarp_win32_loop::running() const
{
return (upollfd != nullptr);
}
bool
llarp_win32_loop::init()
{
if(!upollfd)
upollfd = upoll_create(1);
return upollfd != nullptr;
}
// OK, the event loop, as it exists now, will _only_
// work on sockets (and not very efficiently at that).
int
llarp_win32_loop::tick(int ms)
{
upoll_event_t events[1024];
int result;
result = upoll_wait(upollfd, events, 1024, ms);
bool didIO = false;
if(result > 0)
{
int idx = 0;
while(idx < result)
{
llarp::ev_io* ev = static_cast< llarp::ev_io* >(events[idx].data.ptr);
if(ev)
{
llarp::LogDebug(idx, " of ", result, " on ", ev->fd,
" events=", std::to_string(events[idx].events));
if(events[idx].events & UPOLLERR && WSAGetLastError())
{
IO([&]() -> ssize_t {
llarp::LogDebug("upoll error");
ev->error();
return 0;
});
}
else
{
// write THEN READ don't revert me
if(events[idx].events & UPOLLOUT)
{
IO([&]() -> ssize_t {
llarp::LogDebug("upoll out");
ev->flush_write();
return 0;
});
}
if(events[idx].events & UPOLLIN)
{
ssize_t amount = IO([&]() -> ssize_t {
llarp::LogDebug("upoll in");
return ev->read(readbuf, sizeof(readbuf));
});
if(amount > 0)
didIO = true;
}
}
}
++idx;
}
}
if(result != -1)
tick_listeners();
/// if we didn't get an io events we sleep to avoid 100% cpu use
if(!didIO)
std::this_thread::sleep_for(std::chrono::milliseconds(5));
return result;
}
int
llarp_win32_loop::run()
{
upoll_event_t events[1024];
int result;
do
{
result = upoll_wait(upollfd, events, 1024, EV_TICK_INTERVAL);
if(result > 0)
{
int idx = 0;
while(idx < result)
{
llarp::ev_io* ev = static_cast< llarp::ev_io* >(events[idx].data.ptr);
if(ev)
{
if(events[idx].events & UPOLLERR)
{
ev->error();
}
else
{
if(events[idx].events & UPOLLIN)
{
ev->read(readbuf, sizeof(readbuf));
}
if(events[idx].events & UPOLLOUT)
{
ev->flush_write();
}
}
}
++idx;
}
}
if(result != -1)
tick_listeners();
} while(upollfd);
return result;
}
int
llarp_win32_loop::udp_bind(const sockaddr* addr)
{
socklen_t slen;
switch(addr->sa_family)
{
case AF_INET:
slen = sizeof(struct sockaddr_in);
break;
case AF_INET6:
slen = sizeof(struct sockaddr_in6);
break;
default:
return -1;
}
int fd = usocket(addr->sa_family, SOCK_DGRAM, 0);
if(fd == -1)
{
perror("usocket()");
return -1;
}
if(addr->sa_family == AF_INET6)
{
// enable dual stack explicitly
int dual = 1;
if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&dual, sizeof(dual))
== -1)
{
// failed
perror("setsockopt()");
close(fd);
return -1;
}
}
llarp::Addr a(*addr);
llarp::LogDebug("bind to ", a);
if(bind(fd, addr, slen) == -1)
{
perror("bind()");
close(fd);
return -1;
}
return fd;
}
bool
llarp_win32_loop::close_ev(llarp::ev_io* ev)
{
return upoll_ctl(upollfd, UPOLL_CTL_DEL, ev->fd, nullptr) != -1;
}
// no tunnels here
llarp::ev_io*
llarp_win32_loop::create_tun(llarp_tun_io* tun)
{
UNREFERENCED_PARAMETER(tun);
return nullptr;
}
llarp::ev_io*
llarp_win32_loop::create_udp(llarp_udp_io* l, const sockaddr* src)
{
int fd = udp_bind(src);
if(fd == -1)
return nullptr;
llarp::ev_io* listener = new llarp::udp_listener(fd, l);
l->impl = listener;
l->sendto = &llarp::UDPSendTo;
return listener;
}
bool
llarp_win32_loop::add_ev(llarp::ev_io* e, bool write)
{
upoll_event_t ev;
ev.data.ptr = e;
ev.events = UPOLLIN | UPOLLERR;
if(write)
ev.events |= UPOLLOUT;
if(upoll_ctl(upollfd, UPOLL_CTL_ADD, e->fd, &ev) == -1)
{
delete e;
return false;
}
handlers.emplace_back(e);
return true;
}
bool
llarp_win32_loop::udp_close(llarp_udp_io* l)
{
bool ret = false;
llarp::udp_listener* listener = static_cast< llarp::udp_listener* >(l->impl);
if(listener)
{
close_ev(listener);
// remove handler
auto itr = handlers.begin();
while(itr != handlers.end())
{
if(itr->get() == listener)
itr = handlers.erase(itr);
else
++itr;
}
l->impl = nullptr;
ret = true;
}
return ret;
}
void
llarp_win32_loop::stop()
{
if(upollfd)
upoll_destroy(upollfd);
upollfd = nullptr;
llarp::LogDebug("destroy upoll");
}
void
llarp_win32_loop::tick_listeners()
{
llarp_ev_loop::tick_listeners();
for(auto& func : m_Tickers)
LogicCall(m_Logic, func);
}
*/
#endif

@ -100,90 +100,5 @@ struct win32_tun_io
}
};
// UDP event loop (no longer used, we libuv for now)
// PLEASE convert me to IOCPs so we don't have to use that
// EXTREMELY CURSED libuv event loop and its llarp_vpn_io_pipe
//
// For you see, on Windows, we have enough local user permissions to set
// up a VPN tunnel interface internally, and have lokinet consume this
// file descriptor directly. See win32_tun_io for this impl. llarp_vpn_io
// assumes that an external entity or process is required to inject packets
// into the VPN interface provided by the OS.
//
// Not only that, the win32 IOCP facility handles timing on its own, you can
// specify an interval to tick directly into the call to
// GetQueuedCompletionStatus(2)
/*struct llarp_win32_loop : public llarp_ev_loop
{
upoll_t* upollfd;
std::shared_ptr< llarp::Logic > m_Logic;
std::vector< std::function< void(void) > > m_Tickers;
llarp_win32_loop() : upollfd(nullptr)
{
}
bool
tcp_connect(struct llarp_tcp_connecter* tcp, const sockaddr* remoteaddr);
llarp::ev_io*
bind_tcp(llarp_tcp_acceptor* tcp, const sockaddr* bindaddr);
virtual bool
udp_listen(llarp_udp_io* l, const sockaddr* src);
~llarp_win32_loop();
bool
running() const;
bool
init();
int
tick(int ms);
int
run();
int
udp_bind(const sockaddr* addr);
bool
close_ev(llarp::ev_io* ev);
// no tunnels here
llarp::ev_io*
create_tun(llarp_tun_io* tun);
llarp::ev_io*
create_udp(llarp_udp_io* l, const sockaddr* src);
bool
add_ev(llarp::ev_io* e, bool write);
bool
udp_close(llarp_udp_io* l);
void
stop();
bool
add_ticker(std::function< void(void) > func) override
{
m_Tickers.emplace_back(func);
return true;
}
void
set_logic(std::shared_ptr< llarp::Logic > l) override
{
m_Logic = l;
}
void
tick_listeners() override;
};
*/
#endif
#endif

@ -37,8 +37,8 @@ namespace llarp
, m_Resolver(std::make_shared< dns::Proxy >(
r->netloop(), r->logic(), r->netloop(), r->logic(), this))
, m_Name(name)
, m_Tun{{0}, 0, {0}, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr}
, m_Tun{{0}, 0, 0, {0}, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}
, m_LocalResolverAddr("127.0.0.1", 53)
, m_InetToNetwork(name + "_exit_rx", r->netloop(), r->netloop())

@ -218,6 +218,8 @@ namespace llarp
dnsport = std::atoi(v.substr(pos + 1).c_str());
}
m_LocalResolverAddr = llarp::Addr(resolverAddr, dnsport);
// this field is ignored on all other platforms
tunif->dnsaddr = m_LocalResolverAddr.ton();
llarp::LogInfo(Name(), " binding DNS server to ", m_LocalResolverAddr);
}
if(k == "upstream-dns")

@ -286,12 +286,19 @@ namespace llarp
m_OurPaths.ForEach([&](auto& ptr) { ptr->FlushDownstream(m_Router); });
}
uint64_t
PathContext::CurrentTransitPaths()
{
SyncTransitMap_t::Lock_t lock(m_TransitPaths.first);
auto& map = m_TransitPaths.second;
return map.size() / 2;
}
void
PathContext::PutTransitHop(std::shared_ptr< TransitHop > hop)
{
MapPut< SyncTransitMap_t::Lock_t >(m_TransitPaths, hop->info.txID, hop);
MapPut< SyncTransitMap_t::Lock_t >(m_TransitPaths, hop->info.rxID, hop);
m_TransitHopCount++;
}
void
@ -310,7 +317,6 @@ namespace llarp
{
m_Router->outboundMessageHandler().QueueRemoveEmptyPath(itr->first);
itr = map.erase(itr);
m_TransitHopCount--;
}
else
++itr;

@ -165,10 +165,7 @@ namespace llarp
/// current number of transit paths we have
uint64_t
CurrentTransitPaths() const
{
return m_TransitHopCount;
}
CurrentTransitPaths();
private:
AbstractRouter* m_Router;
@ -176,7 +173,6 @@ namespace llarp
SyncOwnedPathsMap_t m_OurPaths;
bool m_AllowTransit;
util::DecayingHashSet< llarp::Addr > m_PathLimits;
uint64_t m_TransitHopCount = 0;
};
} // namespace path
} // namespace llarp

@ -276,7 +276,7 @@ namespace llarp
if(lookupRouters.size() > LookupPerTick)
{
static std::mt19937_64 rng{std::random_device{}()};
static std::mt19937_64 rng{llarp::randint()};
std::shuffle(lookupRouters.begin(), lookupRouters.end(), rng);
lookupRouters.resize(LookupPerTick);
}

@ -732,6 +732,8 @@ namespace llarp
nodedb()->RemoveIf([&](const RouterContact &rc) -> bool {
if(IsBootstrapNode(rc.pubkey))
return false;
if(not rc.IsPublicRouter())
return true;
return !_rcLookupHandler.RemoteIsAllowed(rc.pubkey);
});
}

@ -285,12 +285,16 @@ namespace llarp
struct Handler : public ::abyss::httpd::IRPCHandler
{
std::string expectedHostname;
AbstractRouter* router;
std::unordered_map< std::string, std::function< Response() > > m_dispatch;
Handler(::abyss::httpd::ConnImpl* conn, AbstractRouter* r)
Handler(::abyss::httpd::ConnImpl* conn, AbstractRouter* r,
std::string hostname)
: ::abyss::httpd::IRPCHandler(conn)
, expectedHostname(std::move(hostname))
, router(r)
, m_dispatch{
{"llarp.admin.die", [=]() { return KillRouter(); }},
{"llarp.admin.wakeup", [=]() { return StartRouter(); }},
{"llarp.admin.link.neighbor",
[=]() { return ListNeighbors(); }},
@ -304,6 +308,12 @@ namespace llarp
~Handler() override = default;
bool
ValidateHost(const std::string& host) const override
{
return host == "localhost" || host == expectedHostname;
}
Response
StartRouter() const
{
@ -317,6 +327,15 @@ namespace llarp
return router->ExtractStatus();
}
Response
KillRouter() const
{
if(not router->IsRunning())
return {{"error", "already stopping"}};
router->Stop();
return {{"status", "OK"}};
}
Response
ListExitLevels() const
{
@ -416,11 +435,15 @@ namespace llarp
: ::abyss::httpd::BaseReqHandler(reqtimeout), router(r)
{
}
std::string expectedHostname;
AbstractRouter* router;
::abyss::httpd::IRPCHandler*
CreateHandler(::abyss::httpd::ConnImpl* conn) override
{
return new Handler(conn, router);
return new Handler(conn, router, expectedHostname);
}
};
@ -447,15 +470,20 @@ namespace llarp
sockaddr_in saddr;
saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
saddr.sin_family = AF_INET;
saddr.sin_port = 0;
saddr.sin_port = 1190;
auto idx = addr.find_first_of(':');
if(idx != std::string::npos)
{
_handler.expectedHostname = addr.substr(0, idx);
Addr netaddr{addr.substr(0, idx), addr.substr(1 + idx)};
saddr.sin_addr.s_addr = netaddr.ton();
saddr.sin_port = htons(netaddr.port());
}
else
{
_handler.expectedHostname = addr;
}
return _handler.ServeAsync(router->netloop(), router->logic(),
(const sockaddr*)&saddr);
}

@ -1000,7 +1000,7 @@ namespace llarp
}
// filter check for address
if(m_state->m_RemoteLookupFilter.Insert(remote))
if(not m_state->m_RemoteLookupFilter.Insert(remote))
return false;
auto& lookups = m_state->m_PendingServiceLookups;

@ -10,6 +10,7 @@
#include <sys/endian.h>
#elif defined(__sun)
#include <sys/byteorder.h>
#include <endian.h>
#define htobe16(x) htons(x)
#define htole16(x) (x)
#define be16toh(x) ntohs(x)
@ -48,6 +49,9 @@
#define le64toh(x) OSSwapLittleToHostInt64(x)
#elif defined(_WIN32)
#include <winsock2.h>
#ifndef __LITTLE_ENDIAN__
#define __LITTLE_ENDIAN__
#endif
#define htobe16(x) htons(x)
#define htole16(x) (x)
#define be16toh(x) ntohs(x)

@ -36,6 +36,7 @@ namespace llarp
break;
case eLogTrace:
ss << "[TRC] ";
break;
case eLogDebug:
ss << "[DBG] ";
break;
@ -77,6 +78,7 @@ namespace llarp
{
case eLogNone:
break;
case eLogTrace:
case eLogDebug:
SetConsoleTextAttribute(fd1,
FOREGROUND_RED | FOREGROUND_GREEN

@ -107,6 +107,12 @@ struct ServerHandler : public abyss::httpd::IRPCHandler
{
}
bool
ValidateHost(const std::string & /*hostname */) const override
{
return true;
}
Response
HandleJSONRPC(Method_t method, const Params& /*params*/)
{

@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
namespace network.loki.lokinet.win32.ui
@ -15,6 +16,7 @@ namespace network.loki.lokinet.win32.ui
static void Main()
{
// Scrub any old lokinet process left behind
Mutex m = new Mutex(true, "lokinet_dotnet_ui");
Process[] old_pids = Process.GetProcessesByName("lokinet");
foreach (Process pid in old_pids)
{
@ -33,6 +35,7 @@ namespace network.loki.lokinet.win32.ui
}
catch
{ }
m.ReleaseMutex();
}
}
}

@ -37,10 +37,10 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.1")]
[assembly: AssemblyFileVersion("0.6.1")]
[assembly: AssemblyVersion("0.7.0")]
[assembly: AssemblyFileVersion("0.7.0")]
#if DEBUG
[assembly: AssemblyInformationalVersion("0.6.1-dev-{chash:8}")]
[assembly: AssemblyInformationalVersion("0.7.0-dev-{chash:8}")]
#else
[assembly: AssemblyInformationalVersion("0.6.1 (RELEASE_CODENAME)")]
[assembly: AssemblyInformationalVersion("0.7.0 (RELEASE_CODENAME)")]
#endif

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -417,9 +417,11 @@ tuntap_sys_set_ipv4(struct device *dev, t_tun_in_addr *s, uint32_t mask)
* inline */
dns.dhcp_opt = 6;
dns.length = 4;
dns.value[0] =
htonl(0x7F000001); /* apparently this doesn't show in network properties,
if (dev->bindaddr)
dns.value[0] = dev->bindaddr; /* apparently this doesn't show in network properties,
but it works */
else
dns.value[0] = htonl(0x7f000001);
dns.value[1] = 0;
ret = DeviceIoControl(dev->tun_fd, TAP_IOCTL_CONFIG_DHCP_SET_OPT, &dns,

@ -1,4 +1,8 @@
# Makefile for windows install pkg and helper library
# debug/internal builds need not support xp
# release builds *should*, but this does NOT remain a hard
# requirement for cutting releases, it can be pulled at any
# time really
CC=i686-w64-mingw32-gcc
CXX=i686-w64-mingw32-g++
@ -8,7 +12,7 @@ CFLAGS=-Ofast -march=nocona -mfpmath=sse
LIBS=-lws2_32
LDFLAGS=-static
all: regdbhelper.dll lokinet-bootstrap.exe 7z.exe dbghelp tcpv6 tap-win32
all: regdbhelper.dll lokinet-bootstrap.exe 7z.exe dbghelp tcpv6 tap-win32 qt5-ui
default: all
ifndef RELEASE
@ -37,45 +41,47 @@ lokinet-bootstrap.exe: mbedtls curl dbghelp
cp ../LICENSE .;unix2dos LICENSE LICENSE
dbghelp:
wget https://snowlight.net/loki/win32-dist/dbghelp32.dll
wget https://snowlight.net/loki/win32-dist/dbghelp64.dll
wget http://installer.lokinet.org/win32/dbghelp32.dll
wget http://installer.lokinet.org/win32/dbghelp64.dll
else
regdbhelper.dll:
wget https://snowlight.net/loki/win32-dist/dbghelp32.dll
wget https://snowlight.net/loki/win32-dist/dbghelp64.dll
wget https://snowlight.net/loki/win32-dist/regdbhelper.dll
wget http://installer.lokinet.org/win32/regdbhelper.dll
lokinet-bootstrap.exe:
wget https://snowlight.net/loki/win32-dist/lokinet-bootstrap.exe
wget http://installer.lokinet.org/win32/lokinet-bootstrap.exe
wget -O rootcerts.pem https://curl.haxx.se/ca/cacert.pem
cp ../LICENSE .;unix2dos LICENSE LICENSE
dbghelp:
:
wget http://installer.lokinet.org/win32/dbghelp32.dll
wget http://installer.lokinet.org/win32/dbghelp64.dll
endif
# Common rules
7z.exe:
wget https://snowlight.net/loki/win32-dist/7z.exe
wget http://installer.lokinet.org/win32/7z.exe
tcpv6:
wget https://snowlight.net/loki/win32-dist/inet6.7z
wget http://installer.lokinet.org/win32/inet6.7z
tap-win32:
wget https://snowlight.net/loki/win32-dist/tap-windows-9.21.2.7z
wget http://installer.lokinet.org/win32/tap-windows-9.21.2.7z
mv tap-windows-9.21.2.7z tuntapv9_n6.7z
wget https://snowlight.net/loki/win32-dist/tap-windows-9.9.2_3.7z
wget http://installer.lokinet.org/win32/tap-windows-9.9.2_3.7z
mv tap-windows-9.9.2_3.7z tuntapv9.7z
libuv:
git clone https://github.com/libuv/libuv.git
cd libuv; ./autogen.sh; ./configure --host=i686-w64-mingw32 --target=i686-w64-mingw32 CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" --disable-shared --prefix=$(PWD)
make -C libuv -j4 install
make -C libuv -j4 distclean
cd libuv; ./configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 CC=$(CC64) CXX=$(CXX64) CFLAGS="$(CFLAGS)" --disable-shared
make -C libuv -j4
cp libuv/.libs/libuv.a $(PWD)/lib64
libuv:
git clone https://github.com/despair86/libuv.git
cd libuv; ./autogen.sh; ./configure --host=i686-w64-mingw32 --target=i686-w64-mingw32 CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" --disable-shared --prefix=$(PWD)
make -C libuv -j4 install
make -C libuv -j4 distclean
cd libuv; ./configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 CC=$(CC64) CXX=$(CXX64) CFLAGS="$(CFLAGS)" --disable-shared
make -C libuv -j4
cp libuv/.libs/libuv.a $(PWD)/lib64
qt5-ui:
wget http://installer.lokinet.org/win32/lokinet-qt5-ui.7z
clean:
-rm -rf curl-7* include lib mbedtls-2* *.exe *.dll *.pem *.7z

@ -0,0 +1,4 @@
@echo off
copy lokinet.ini lokinet.old.ini
del lokinet.ini
%PROGRAMFILES%\Loki Project\Lokinet\lokinet -g

@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Lokinet"
#define MyAppVersion "0.6.1"
#define MyAppVersion "0.7.0"
#define MyAppPublisher "Loki Project"
#define MyAppURL "https://lokinet.org"
#define MyAppExeName "lokinetui.exe"
@ -11,7 +11,7 @@
#define DevPath "D:\dev\external\llarp\"
#endif
#include "version.txt"
#define RELEASE
; see ../LICENSE
[Setup]
@ -38,29 +38,31 @@ OutputDir={#DevPath}win32-setup
OutputBaseFilename=lokinet-win32
Compression=lzma2/ultra64
SolidCompression=yes
VersionInfoVersion=0.6.1
VersionInfoVersion=0.7.0
VersionInfoCompany=Loki Project
VersionInfoDescription=Lokinet for Microsoft® Windows® NT™
#ifndef RELEASE
VersionInfoTextVersion=0.6.1-dev-{#VCSRev}
VersionInfoProductTextVersion=0.6.1-dev-{#VCSRev}
VersionInfoTextVersion=0.7.0-dev-{#VCSRev}
VersionInfoProductTextVersion=0.7.0-dev-{#VCSRev}
#else
VersionInfoTextVersion=0.6.1
VersionInfoProductTextVersion=0.6.1 ({#Codename})
VersionInfoTextVersion=0.7.0
VersionInfoProductTextVersion=0.7.0 ({#Codename})
#endif
VersionInfoProductName=Lokinet
VersionInfoProductVersion=0.6.1
VersionInfoProductVersion=0.7.0
InternalCompressLevel=ultra64
MinVersion=0,5.0
ArchitecturesInstallIn64BitMode=x64
VersionInfoCopyright=Copyright ©2018-2020 Loki Project
AppMutex=lokinet_win32_daemon,lokinet_qt5_ui,lokinet_dotnet_ui
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked;
Name: "migrateconfigs"; Description: "Migrate existing configuration to enable modern UI"; MinVersion: 6.0
[Files]
; only one of these is installed
@ -88,19 +90,23 @@ Source: "{#DevPath}ui-win32\bin\release\lokinetui.exe.config"; DestDir: "{app}";
Source: "{#DevPath}ui-win32\bin\release\lokinetui.pdb"; DestDir: "{app}"; Flags: ignoreversion
#endif
; eh, might as well ship the 32-bit port of everything else
Source: "{#DevPath}build\testAll.exe"; DestDir: "{app}"; Flags: ignoreversion
;Source: "{#DevPath}build\testAll.exe"; DestDir: "{app}"; Flags: ignoreversion
;Source: "{#DevPath}build\catchAll.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#DevPath}build\lokinetctl.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "LICENSE"; DestDir: "{app}"; Flags: ignoreversion
Source: "lokinet-bootstrap.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "rootcerts.pem"; DestDir: "{app}"; Flags: ignoreversion
Source: "7z.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "inet6.7z"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall skipifsourcedoesntexist; MinVersion: 0,5.0; OnlyBelowVersion: 0,5.1; Check: not IsTcp6Installed
Source: "lokinet-qt5-ui.7z"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall; MinVersion: 0,6.0;
Source: "lokinet.ico"; DestDir: "{app}"; Flags: ignoreversion;
; Copy the correct tuntap driver for the selected platform
Source: "tuntapv9.7z"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall; OnlyBelowVersion: 0, 6.0; Check: not IsTapInstalled
Source: "tuntapv9_n6.7z"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall; MinVersion: 0,6.0; Check: not IsTapInstalled
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "regdbhelper.dll"; Flags: dontcopy
Source: "config_migration.bat"; DestDir: "{userappdata}\.lokinet"; Flags: deleteafterinstall; MinVersion: 0,6.0
; build only if we have the 32-bit bins as well
; (i.e. *not* a Travis CI build, travis isn't expected to have these around)
@ -131,6 +137,7 @@ Source: "C:\Windows\Fonts\iosevka-term-thinoblique.ttf"; DestDir: "{fonts}"; Fon
[UninstallDelete]
Type: filesandordirs; Name: "{app}\tap-windows*"
Type: filesandordirs; Name: "{app}\inet6_driver"; MinVersion: 0,5.0; OnlyBelowVersion: 0,5.1
Type: filesandordirs; Name: "{app}\lokinet-qt5-ui"; MinVersion: 0,6.0
Type: filesandordirs; Name: "{userappdata}\.lokinet"
[UninstallRun]
@ -154,6 +161,8 @@ begin
if Version.NTPlatform and (Version.Major = 5) and (Version.Minor = 0) and (FileExists(ExpandConstant('{tmp}\inet6.7z')) = true) then
// I need a better message...
MsgBox('Restart your computer, then set up IPv6 in Network Connections. [Adapter] > Properties > Install... > Protocol > Microsoft IPv6 Driver...', mbInformation, MB_OK);
if IsTaskSelected('migrateconfigs') then
MsgBox('Lokinet JSON-RPC API endpoint enabled. Any custom configuration was retained in %APPDATA%\.lokinet\lokinet.old.ini.', mbInformation, MB_OK);
end;
end;
@ -188,19 +197,23 @@ else
end;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; OnlyBelowVersion: 0, 6.0; IconFilename: "{app}\lokinet.ico"
Name: "{group}\{#MyAppName}"; Filename: "{app}\lokinet-qt5-ui\lokinetui.exe"; MinVersion: 0, 6.0; IconFilename: "{app}\lokinet.ico"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; OnlyBelowVersion: 0, 6.1
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; MinVersion: 0, 6.1
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; OnlyBelowVersion: 0,6.0; IconFilename: "{app}\lokinet.ico"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\lokinet-qt5-ui\lokinetui.exe"; Tasks: desktopicon; MinVersion: 0,6.0; IconFilename: "{app}\lokinet.ico"
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; OnlyBelowVersion: 0, 6.1; IconFilename: "{app}\lokinet.ico"
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\{#MyAppName}"; Filename: "{app}\lokinet-qt5-ui\lokinetui.exe"; Tasks: quicklaunchicon; MinVersion: 0, 6.1; IconFilename: "{app}\lokinet.ico"
[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; OnlyBelowVersion: 0, 6.0
Filename: "{app}\lokinet-qt5-ui\lokinetui.exe"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; MinVersion: 0,6.0
; wait until either one or two of these terminates
Filename: "{tmp}\7z.exe"; Parameters: "x tuntapv9.7z"; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "extract TUN/TAP-v9 driver"; StatusMsg: "Extracting driver..."; OnlyBelowVersion: 0, 6.0
Filename: "{tmp}\7z.exe"; Parameters: "x tuntapv9_n6.7z"; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "extract TUN/TAP-v9 driver"; StatusMsg: "Extracting driver..."; MinVersion: 0, 6.0
Filename: "{tmp}\7z.exe"; Parameters: "x inet6.7z"; WorkingDir: "{app}"; Flags: skipifdoesntexist runascurrentuser waituntilterminated skipifdoesntexist; Description: "extract inet6 driver"; StatusMsg: "Extracting IPv6 driver..."; MinVersion: 0, 5.0; OnlyBelowVersion: 0, 5.1
Filename: "{tmp}\7z.exe"; Parameters: "x lokinet-qt5-ui.7z -aoa"; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "installing modern Qt5 UI"; StatusMsg: "Installing modern Qt5 UI..."; MinVersion: 0, 6.0;
Filename: "{app}\lokinet-bootstrap.exe"; Parameters:"-L https://seed.lokinet.org/lokinet.signed --cacert rootcerts.pem -o ""{userappdata}\.lokinet\bootstrap.signed"""; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated; Description: "bootstrap dht"; StatusMsg: "Downloading initial RC..."
; then ask to install drivers
Filename: "{app}\tap-windows-9.9.2\install.bat"; WorkingDir: "{app}\tap-windows-9.9.2\"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "Install TUN/TAP-v9 driver"; StatusMsg: "Installing driver..."; OnlyBelowVersion: 0, 6.0; Check: not IsTapInstalled
@ -209,3 +222,4 @@ Filename: "{app}\tap-windows-9.21.2\install.bat"; WorkingDir: "{app}\tap-windows
; if it doesn't exist, then the inet6 driver appears to be installed
Filename: "{app}\inet6_driver\setup\hotfix.exe"; Parameters: "/m /z"; WorkingDir: "{app}\inet6_driver\setup\"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "Install IPv6 driver"; StatusMsg: "Installing IPv6..."; OnlyBelowVersion: 0, 5.1; Check: not FileExists(ExpandConstant('{sys}\drivers\tcpip6.sys'))
Filename: "{sys}\netsh.exe"; Parameters: "int ipv6 install"; Flags: runascurrentuser waituntilterminated; Description: "install ipv6 on whistler"; StatusMsg: "Installing IPv6..."; MinVersion: 0,5.1; OnlyBelowVersion: 0,6.0
Filename: "{userappdata}\.lokinet\config_migration.bat"; WorkingDir: "{userappdata}\.lokinet"; Flags: runascurrentuser waituntilterminated; Description: "migrate existing config"; StatusMsg: "Migrating old configuration..."; MinVersion: 0,6.0; Tasks: migrateconfigs;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Loading…
Cancel
Save