Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lokinet iOS #542

Closed
wants to merge 85 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
c3bece6
Implement basic proof of concept
nielsandriesse Apr 3, 2019
b434046
Move files
nielsandriesse Apr 3, 2019
1cdfe9b
Update project file & add logo
nielsandriesse Apr 3, 2019
413ab84
Hook up C++ core
nielsandriesse Apr 8, 2019
7fbb925
Fix build
nielsandriesse Apr 10, 2019
be0ed9f
Fix configuration file creation
nielsandriesse Apr 10, 2019
a06ffbc
Hook up llarp_main_init
nielsandriesse Apr 10, 2019
7288e3c
Support verbose logging
nielsandriesse Apr 10, 2019
05a3047
Group files
nielsandriesse Apr 10, 2019
dea254f
Create LokiNetwork abstraction
nielsandriesse Apr 10, 2019
594a6d3
Clean
nielsandriesse Apr 10, 2019
718db77
Add bootstrap TODO
nielsandriesse Apr 10, 2019
b5a0e14
WIP
nielsandriesse Apr 11, 2019
e0d23c3
Fix key generation
nielsandriesse Apr 12, 2019
1021ffb
Wrap llarp_main_run
nielsandriesse Apr 12, 2019
1a7f1e2
Clean
nielsandriesse Apr 12, 2019
f21b11c
Rename LokiNetwork → Daemon
nielsandriesse Apr 12, 2019
0544a3a
Merge branch 'master' of https://github.com/loki-project/loki-network…
nielsandriesse Apr 12, 2019
888cbb8
Fix build
nielsandriesse Apr 12, 2019
69e7376
Create packet tunnel provider skeleton
nielsandriesse Apr 12, 2019
fdfd669
WIP
nielsandriesse Apr 12, 2019
7e1e8c3
Fix .gitignore
nielsandriesse Apr 15, 2019
6b84466
Fix cross compilation issues
nielsandriesse Apr 15, 2019
a7369c8
Silence warnings
nielsandriesse Apr 17, 2019
139858f
Fix permission issue
nielsandriesse Apr 17, 2019
9560bfc
Clean up core changes
nielsandriesse Apr 17, 2019
4f16a3c
Remove build artifacts
nielsandriesse Apr 17, 2019
f29b73f
Update .gitignore
nielsandriesse Apr 17, 2019
7c5159f
Fix minor logging issue
nielsandriesse Apr 17, 2019
19ded1e
Silence warnings attempt 2
nielsandriesse Apr 17, 2019
075d0b7
Fix tuntap.h issue
nielsandriesse Apr 18, 2019
527182e
WIP
nielsandriesse Apr 18, 2019
08460bb
Fix ev_kqueue.cpp issue
nielsandriesse Apr 18, 2019
2701f6c
Fix typo
nielsandriesse Apr 22, 2019
51f2bd1
Merge branch 'master' of https://github.com/loki-project/loki-network…
nielsandriesse Apr 23, 2019
91bb31d
Fix merge issue
nielsandriesse Apr 23, 2019
86c5de8
Remove build artifacts
nielsandriesse Apr 23, 2019
0c204e3
Remove more build artifacts
nielsandriesse Apr 23, 2019
e9c46f8
Remove even more build artifacts
nielsandriesse Apr 23, 2019
17bbbf8
Clean
nielsandriesse Apr 23, 2019
8482f52
Create Tunnel abstraction
nielsandriesse Apr 23, 2019
6bc37ef
Clean
nielsandriesse Apr 23, 2019
dc1d7e9
Ditch build folder entirely
nielsandriesse Apr 23, 2019
35cc9fc
Add README
nielsandriesse Apr 23, 2019
c6f7622
Remove redundant wrapper functions
nielsandriesse Apr 23, 2019
5666665
Simplify build logic
nielsandriesse Apr 24, 2019
2570756
Refactor LKTunnel
nielsandriesse Apr 24, 2019
00e9942
Use configuration file for tunnel
nielsandriesse Apr 24, 2019
6efe00a
Use Result for LKTunnel.configure(with:completionHandler:) as well
nielsandriesse Apr 24, 2019
62f35cc
Implement configuration file parsing
nielsandriesse Apr 24, 2019
c948c29
Clean
nielsandriesse Apr 24, 2019
853bdda
Fix Info.plist issue
nielsandriesse Apr 24, 2019
b90a2d9
Change overall approach
nielsandriesse Jul 8, 2019
a980ae5
Update .gitignore
nielsandriesse Jul 8, 2019
eb2838d
Clean
nielsandriesse Jul 8, 2019
ca4e090
Fix build
nielsandriesse Jul 9, 2019
008fc16
Support logging from network extension
nielsandriesse Jul 9, 2019
9bf59be
Debug
nielsandriesse Jul 9, 2019
735ff98
Use api.bind for tunnel address & port
nielsandriesse Jul 9, 2019
1a65fc3
Conform NWUDPSessionState to CustomStringConvertible
nielsandriesse Jul 9, 2019
5d96ddb
Create LKMessage
nielsandriesse Jul 9, 2019
868c1a4
Refactor
nielsandriesse Jul 9, 2019
5121479
Clean
nielsandriesse Jul 9, 2019
cef33ce
Add documentation
nielsandriesse Jul 9, 2019
a0c8c9f
Fix display name
nielsandriesse Jul 9, 2019
16e6f5d
Fix tunnel provider manager duplication issue
nielsandriesse Jul 9, 2019
d00085f
Ditch INIParser
nielsandriesse Jul 9, 2019
a705ff0
Prettify UI
nielsandriesse Jul 10, 2019
b99a325
Debug app group issue
nielsandriesse Jul 10, 2019
a62faac
Use llarp_main_run result code
nielsandriesse Jul 11, 2019
13bfee7
Clean
nielsandriesse Jul 11, 2019
961bbc0
Implement LKDaemon.stop() & add logging
nielsandriesse Jul 11, 2019
19f985a
Update README.md
nielsandriesse Jul 11, 2019
8318ed5
Merge branch 'master' of github.com:loki-project/loki-network
nielsandriesse Jul 11, 2019
1b02366
WIP
nielsandriesse Jul 11, 2019
dbc650e
Update ios.toolchain.cmake & clean
nielsandriesse Jul 11, 2019
45e95cd
Clean
nielsandriesse Jul 11, 2019
c2fa71f
Update README.md
nielsandriesse Jul 11, 2019
936590e
Update README.md
nielsandriesse Jul 11, 2019
b0363d4
Fix libuv issue
nielsandriesse Jul 12, 2019
a4a38bc
Fix missing llarp_main_setup argument
nielsandriesse Jul 12, 2019
d9e069c
Update libuv to 1.30.1
nielsandriesse Jul 12, 2019
650bfdc
Undo hack
nielsandriesse Jul 12, 2019
46791a8
Clean
nielsandriesse Jul 12, 2019
b17d58d
Fix incorrect libuv install name
nielsandriesse Jul 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Expand Up @@ -58,3 +58,15 @@ GTAGS
GRTAGS
GPATH
version.txt

# Xcode & MacOS
.DS_Store
xcuserdata/
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
ios/Core/
ios/Carthage/

17 changes: 14 additions & 3 deletions CMakeLists.txt
Expand Up @@ -11,7 +11,7 @@ option(AMD_RYZEN_HACK "hack for AMD Ryzen FPU bug (support FMA3 and FMA4 in FPU,
if (NOT MSVC)
option(STATIC_LINK_RUNTIME "link statically against compiler runtime, standard library and pthreads")
endif()
option(NON_PC_TARGET "non-pc target build: iphone, andriod, embedded non-i386 SBC, etc" )
option(NON_PC_TARGET "non-pc target build: iOS, Android, embedded non-i386 SBC, etc" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the compile-time options written in terms of PC/not PC?

The instructions this option is used to avoid are specific to x86_64; every other architecture doesn't have them. Shouldn't it be opt-in for x86_64, rather than opt-out for every other platform?

Following that logic, there's no need for an explicit compile-time flag.

# CMAKE_SYSTEM_PROCESSOR refers to the target architecture not the host system's one
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
  # this is just an example x86_64 specific flag
  set(CRYPTO_FLAGS -mfpmath=sse)
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")

Similar to as above removes the need for somewhat silly compound predicates such as

elseif(NOT ANDROID AND NOT IOS AND NOT NON_PC_TARGET)
  if (NOT USE_AVX2)

Copy link
Contributor

@despair86 despair86 Apr 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use AVX2 in i386 protected mode @liilac
(In fact, there's very little you can't do in protected mode beyond the increased address space per process, as PAE allows the supervisor to address extra core and slice it up into 4GB segments per process)

option(SHADOW "use shadow testing framework. linux only" )
option(ASAN "use address sanitiser, if your system has it" )
option(JEMALLOC "use jemalloc. Not required on BSD" )
Expand Down Expand Up @@ -70,6 +70,12 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
message( FATAL_ERROR "shadow-framework is Linux only" )
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)

if(${CMAKE_SYSTEM_NAME} MATCHES "iOS")
message("Compiling for iOS")
add_definitions(-DDarwin)
set(UV_LIB "ios/libuv/libuv-ios-arm64.dylib")
endif(${CMAKE_SYSTEM_NAME} MATCHES "iOS")

if(NOT DEBIAN AND NOT MSVC_VERSION)
set(OPTIMIZE_FLAGS -O3)
set(DEBUG_FLAGS -O0 -g3)
Expand Down Expand Up @@ -134,7 +140,7 @@ endif(WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)

if(DEBIAN)
add_definitions(-DDEBIAN)
elseif(NOT ANDROID AND NOT NON_PC_TARGET)
elseif(NOT ANDROID AND NOT iOS AND NOT NON_PC_TARGET)
if (NOT USE_AVX2)
# Public binary releases
set(CRYPTO_FLAGS -march=nocona -mtune=core2 -mfpmath=sse)
Expand Down Expand Up @@ -294,7 +300,12 @@ else()

add_log_tag(${EXE})

install(TARGETS ${EXE} RUNTIME DESTINATION bin)
if(APPLE)
install(TARGETS ${EXE} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
else()
install(TARGETS ${EXE} RUNTIME DESTINATION bin)
endif()

if(WIN32)
install(PROGRAMS ${CMAKE_SOURCE_DIR}/lokinet-bootstrap.exe DESTINATION bin)
else()
Expand Down
53 changes: 53 additions & 0 deletions abyss-main/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,53 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 6 additions & 0 deletions abyss-main/Images.xcassets/Contents.json
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
21 changes: 21 additions & 0 deletions abyss-main/Images.xcassets/LaunchImage.launchimage/Contents.json
@@ -0,0 +1,21 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 5 additions & 1 deletion cmake/unix.cmake
@@ -1,6 +1,10 @@
add_definitions(-DUNIX)
add_definitions(-DPOSIX)

if(${CMAKE_SYSTEM_NAME} MATCHES "iOS")
link_directories(../ios/libuv/libuv-ios-arm64.dylib)
endif()

if (STATIC_LINK_RUNTIME)
find_library(UV_LIB NAMES libuv.a)
else()
Expand All @@ -20,7 +24,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
find_library(FS_LIB NAMES c++experimental)
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR ${CMAKE_SYSTEM_NAME} MATCHES "iOS")
find_library(FS_LIB NAMES c++fs c++experimental stdc++fs)

if(FS_LIB STREQUAL FS_LIB-NOTFOUND)
Expand Down
6 changes: 2 additions & 4 deletions crypto/salsa20/xmm6int/salsa20_xmm6int-sse2.c
@@ -1,6 +1,4 @@
#if defined(ANDROID) || defined(RPI)

#else
#if __SSE2__
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -120,4 +118,4 @@ struct crypto_stream_salsa20_implementation
crypto_stream_salsa20_xmm6int_sse2_implementation = {
SODIUM_C99(.stream =) stream_sse2,
SODIUM_C99(.stream_xor_ic =) stream_sse2_xor_ic};
#endif
#endif
4 changes: 2 additions & 2 deletions crypto/salsa20/xmm6int/salsa20_xmm6int-sse2.h
Expand Up @@ -3,7 +3,7 @@

#include "../stream_salsa20.h"
#include <sodium/crypto_stream_salsa20.h>
#ifndef ANDROID
#if __SSE2__
extern struct crypto_stream_salsa20_implementation
crypto_stream_salsa20_xmm6int_sse2_implementation;
#endif
#endif
2 changes: 1 addition & 1 deletion daemon/main.cpp
Expand Up @@ -58,7 +58,7 @@ resolvePath(std::string conffname)
{
// implemented in netbsd, removed downstream for security reasons
// even though it is defined by POSIX.1-2001+
#if !defined(_WIN32) && !defined(__OpenBSD__)
#if !defined(_WIN32) && !defined(__OpenBSD__) && !defined(iOS)
wordexp_t exp_result;
wordexp(conffname.c_str(), &exp_result, 0);
char *resolvedPath = realpath(exp_result.we_wordv[0], NULL);
Expand Down
2 changes: 2 additions & 0 deletions include/tuntap.h
Expand Up @@ -42,6 +42,8 @@
#endif
#if defined Linux
#include <netinet/in.h>
#elif defined(iOS)
#include <net/ethernet.h>
#else
#include <netinet/if_ether.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions ios/Cartfile
@@ -0,0 +1,2 @@
github "mutualmobile/MMWormhole" ~> 2.0.0
github "mxcl/PromiseKit" ~> 6.10.0
2 changes: 2 additions & 0 deletions ios/Cartfile.resolved
@@ -0,0 +1,2 @@
github "mutualmobile/MMWormhole" "2.0.10"
github "mxcl/PromiseKit" "6.10.0"