Commit Graph

62 Commits (8b321612da4e129b8eee4e02af755184d2405fe9)

Author SHA1 Message Date
Jeff Becker 7f27760c97
disable lokinet-bootstrap on windows builds 2 years ago
Jeff 871c3e3281
changeset for windows port
* wintun vpn platform for windows
* bundle config snippets into nsis installer for exit node, keyfile persisting, reduced hops mode.
* use wintun for vpn platform
* isolate all windows platform specific code into their own compilation units and libraries
* split up internal libraries into more specific components
* rename liblokinet.a target to liblokinet-amalgum.a to elimiate ambiguity with liblokinet.so
* DNS platform for win32
* rename llarp/ev/ev_libuv.{c,h}pp to llarp/ev/libuv.{c,h}pp as the old name was idiotic
* split up net platform into win32 and posix specific compilation units
* rename lokinet_init.c to easter_eggs.cpp as that is what they are for and it does not need to be a c compilation target
* add cmake option STRIP_SYMBOLS for seperating out debug symbols for windows builds
* intercept dns traffic on all interfaces on windows using windivert and feed it into lokinet
2 years ago
Jason Rhinelander f5376e98c2 Lower minimum version for swift binary
CMake apparently doesn't do anything with CMAKE_OSX_DEPLOYMENT_TARGET
for swift, which results in a 12+ minimum version.  This fixes it
(albeit in a hacky way since the only apple-sanctioned way to properly
set this appears to be "use xcode").

Shame on Apple, as usual.
2 years ago
Jason Rhinelander 2b7b1fcc79 Working signed macOS GUI build 2 years ago
jeff 181de210cd Build apple/macos GUI from lokinet project
This adds the gui as a submodule, and consolidates the GUI handling a
bit between the two platforms.
2 years ago
jeff b8896740de build gui and assemble app bundles into one singular app bundle 2 years ago
Jason Rhinelander 09372994bb macOS system extension support
Adds support for building Lokinet as a system extension, and fixes
various problems in the macos implementation found during development of
the system extension support.
2 years ago
Jason Rhinelander 49b2878209 Require explicit disabling of codesigning
Make the mac build require passing either an explicit -DCODESIGN=OFF or
the code signing identities.
2 years ago
Jason Rhinelander b81f7025c9
Replace logging with oxen-logger
Replaces custom logging system with spdlog-based oxen logging.  This
commit mainly replaces the backend logging with the spdlog-based system,
but doesn't (yet) convert all the existing LogWarn, etc. to use the new
format-based logging.

New logging statements will look like:

    llarp::log::warning(cat, "blah: {}", val);

where `cat` should be set up in each .cpp or cluster of .cpp files, as
described in the oxen-logging README.

As part of spdlog we get fmt, which gives us nice format strings, where
are applied generously in this commit.

Making types printable now requires two steps:
- add a ToString() method
- add this specialization:

      template <>
      constexpr inline bool llarp::IsToStringFormattable<llarp::Whatever> = true;

This will then allow the type to be printed as a "{}" value in a
fmt::format string.  This is applied to all our printable types here,
and all of the `operator<<` are removed.

This commit also:
- replaces various uses of `operator<<` to ToString()
- replaces various uses of std::stringstream with either fmt::format or
  plain std::string
- Rename some to_string and toString() methods to ToString() for
  consistency (and to work with fmt)
- Replace `stringify(...)` and `make_exception` usage with fmt::format
  (and remove stringify/make_exception from util/str.hpp).
2 years ago
Jeff e480e36f3d
generate windows rc for each executable target so we can set the executable name right for each one 2 years ago
Jeff f05c2ebc71
macro removals
clean up version cmake stuff

clean up generated cpp version stuff

make all the windows rc stuff get generated by cmake

bump release motto message

properly inject release motto into version
2 years ago
Jeff 97966976d0 Update CMakeLists.txt
dont depend on lokinet-shared target for sign target as we disabled it by default.
2 years ago
Jeff Becker 1feaec1169 build liblokinet on macos 2 years ago
Jeff Becker f38bf2770d move WITH_BOOTSTRAP option to root project CMakeLists.txt 2 years ago
Jason Rhinelander 488ed47cda Remove duplicate handling of jemalloc
We were linking/loading it in different ways, one with cmake option
`USE_JELLOC` and the other, older version `WITH_JEMALLOC`.  This removes
the latter (which was default OFF) and keeps the former (which was added
and has been default ON since 0.9.4 or so).

Also removes the `ifdef`ed JEMALLOC code in lokinet.cpp because we don't
need it; just linking to jemalloc is enough to get the malloc/free
replacements.
3 years ago
Jason Rhinelander 62d7192a50 Add mainnet/testnet bootstrap files into repo
We use them everywhere now (include the debs) so it makes sense to have
them bundled here rather than needing a download during package build
(in particular for debs that's considered a bad thing).
3 years ago
Jason Rhinelander 8df5005f54
Apply suggestions from code review 3 years ago
Jeff Becker 7e1236503c
make lokinet-bootstrap target toggleable
add cmake option to disable building lokinet-bootstrap binary
3 years ago
Jason Rhinelander 831cc23de1 Remove obsolete bigs
Removes stuff we didn't end up needing/using:
- Lokinet.modulemap
- apple bits from lokinet.cpp (we don't use lokinet.cpp at all on macos
  anymore).
- dnsproxy/extension C++ headers
- apple-specific network extension config in llarp::config::Config
3 years ago
Jason Rhinelander 92c7fb9872 LOKINET_VERSION -> built in lokinet_VERSION 3 years ago
Jason Rhinelander 8aef5d742d Re-enable LTO; target macos 10.12+ 3 years ago
Jason Rhinelander 329da951b7
Apple OS interface cleanup & refactoring
- Add a C callback interface (context_wrapper.h) between lokinet and the
  objective-C code so that:
  - we can use objective-C (rather than objective-C++), which seems more
    likely to be supported by Apple into the future;
  - we minimize the amount of code that needs to be aware of the Apple
    APIs.
  - this replaces apple logger objective c++ implementation with a plain
    c++ implementation that takes a very simple C callback (provided
    from the obj-c code) to actually make the call to NSLog.

- Add various documentation to the code of what is going on.

- Send all DNS traffic to the primary IP on the tun interface.  The
  match prefixes simply don't work as advertised, and have weird shit
  (like even if you get it working for some domains, "instagram.com"
  still doesn't because of god-knows-what Apple internal politics).

- Drop the dns proxy code as we don't need it anymore.

- Don't use 9.9.9.9 for default DNS.  (We might consider the unfiltered
  9.9.9.10 as an alternative default, but if we do it should be a global
  lokinet change rather than a Mac-specific change).

- Parse a lokinet.ini in the data directory, if it exists.  (Since we
  are sandboxed, it is an app-specific "home" directory so is probably
  buried god knows where, but at least the GUI ought to be able to get
  it to let users add things to it).

- This commit also adds a swift version of the PacketTunnelProvider
  glue, which ought to work in theory, but the *tooling* for cmake is so
  underdeveloped that I couldn't find any way to actually get the damn
  thing working.  So I'm committing it here anyway (and will revert it
  away in the next commit) in case we someday want to switch to it.

-
3 years ago
Jason Rhinelander 712b5a5608
Tweak icns generation to only run when necessary 3 years ago
jeff 1272a4fbe1
add dummy sign target for ci when we don't have signing keys
remove static macos from ci pipeline
3 years ago
jeff 7db2459469
macos sort of works now 3 years ago
Jason Rhinelander 81d27c35c1
Default CODESIGN_APPEX to CODESIGN_APP
Sometimes (e.g. dev builds) these can apparently be the same; sometimes
it seems they need to be different, because Apple.
3 years ago
Jason Rhinelander 3ab117a03b
Switch extension from a framework to an appex 3 years ago
Jason Rhinelander faf8a699a6
Set version into Info.plist, don't manually configure
cmake already treats the info plist as a file to be configured (not
merely copied) so we don't need to configure_file ourselves to a temp
file.
3 years ago
Jason Rhinelander 0bb00baacf
Various cmake build cleanups/refactors
- Added contrib/macos/README.txt with description of the cancer
  happening here.
- Add provisioningprofiles that Apple wants to make things work properly
- Made the entitlements files match the provisioningprofiles
- Remove configured entitlements files; we *can't* change any of the
  things here because they are closedly tied to the provisioningprofiles
  -- which means if someone wants to build their own Lokinet, they have
  to replace a bunch of crap and change application IDs throughout.
  This is the hostile-to-open-source Apple way.
- Remove unused old lokinet binary, as we're no longer using it on macos
- Use a POST_BUILD rather than install to copy things around into the
  right places
- Convert all the configure_file's to consistently use @ONLY
- Misc cleanups
3 years ago
jeff 5edd045c9b
add swift version bullshit file and additional bullshittery 3 years ago
jeff 0708a0d897
initial network extension code for macos
probably does not work
3 years ago
Jeff Becker 37a9bd768e
fix linking on win32 for lokinet.dll
only apply static link flags for executables
3 years ago
Jason Rhinelander 73a29d3b07 Link lokinet-bootstrap against libssl as well
Just crypto apparently isn't enough, at least on some arches/distros.
3 years ago
Jeff Becker 77de60af91
require openssl explicitly for lokinet-bootstrap 3 years ago
Jeff Becker 27c80a2638
add include directory for daemon directory so llarp/* includes work 3 years ago
Jeff Becker e8178a032e
lokinet-bootstrap native binary 3 years ago
Jeff Becker 4540c964f5
rework cmake install targets
* redo setcap on linux so that it's required to do install targets on linux
* add -DWITH_SETCAP=OFF option to bypass setcap requirement on linux
* remove lokinet-bootstrap.ps1 as we bundle the bootstrap in the win32 installer now
* remove references to lokinet-bootstrap.ps1 in cmake
3 years ago
Jeff Becker d4112b157c
add explicit check for setcap binary when doing setcap so when it's missing it's not a nop / silent failure 3 years ago
Jason Rhinelander 63a876cc78
Allow -DWITH_SETCAP=OFF to disable setcap during make install (#1363)
The debs don't want it (and so this will save needing to patch it out),
nor do you need it if running via a systemd service file that sets the
capabilities.
4 years ago
Jeff dfd8df5e7f
add uninstall target (#1340)
* add uninstall target

* * redo cmake uninstall
* remove lokinet-vpn python script
* don't install lokinet-vpn twice
4 years ago
Jeff Becker 9e24a5bfca
add check for no default route on down
fix macos bits for down
install lokinet-vpn with cmake
4 years ago
Jeff Becker a8239af73a
initial lokinet-vpn tool rewrite 4 years ago
Jeff Becker 242ab3caba
rename lokinet-exit too to lokinet-vpn
install lokinet-vpn tool for use with debian packaging
4 years ago
Jeff Becker 6af498092b
exit traffic via loki addresses 4 years ago
Jason Rhinelander c5faa86926 cmake refactor
Refactors many things in cmake to improve and simplify:

- don't use variable indirection for target names; target names are
*already* a variable of sorts.  (e.g. ${UTIL_LIB} is now just
lokinet-util).  cmake/basic_definitions.cmake is now gone.

- fix LTO enabling to use the standard cmake (3.9+) LTO mechanism rather
than shoving a bunch of flag hacks through link_libraries and
add_compile_options.  This also now enables LTO when building a shared
library (because previously the -flto hacks were only turned on in the
static code for some reason).

- build liblokinet as *either* shared library or static library, but not
both.  Building both makes things more complicated because they had
different names (lokinet-shared or lokinet-static) and seems pointless:
you generally want one or the other.  Now there is just the liblokinet
target, which will be shared or static depending on the value of
BUILD_SHARED_LIBS.

- Simplify lokinet-cryptography AVX2 code: just build *one* library, and
add in the additional AVX2 files when possible, rather than building two
and needing to merge them.

- Compress STATIC_LINK and STATIC_LINK_RUNTIME into just STATIC_LINK.
It makes no sense to use one of these (_RUNTIME) on Windows and the
other on non-Windows when they appear to try to do the same thing.

- remove a bunch of annotations from `endif(FOO)` -> `endif()`.

- move all the tuntap compilation code (including OS-specific source
file selection) into vendor/CMakeLists.txt and build tuntap as an
intermediate OBJECT library rather than keeping a global variable in 5
different files.

- move release motto define to root cmake; it made no sense being
duplicated in both unix.cmake and win32.cmake

- fix add_log_tag to not stomp on any existing source compile flags with
its definition.  Also use proper compile definition property instead of
cramming it into compile flags.

- make optimization/linker flags less hacky.  There's no reason for us
to force particular optimization flags because the cmake build type
already does that (e.g. -DCMAKE_BUILD_TYPE=Release does -O3).  Not doing
that also silences a bunch of cmake warnings because it thinks "-O0 -g3"
etc.  are link libraries (which is reasonable: that's what the code was
telling cmake they are).

- sets the default build type to RelWithDebInfo which gives us `-O2 -g`
if you don't specify a build type.

- Move PIC up (so that the things loaded in unix.cmake, notably libuv,
have it set).

- Add a custom `curl` interface library that carries the correct link
target and include paths for curl (system or bundled).
4 years ago
Stephen Shelton 9e7254f6fa
Rip out pass-through-to-curl functionality 4 years ago
Jeff Becker 9428689939
fix up cpack for macos 4 years ago
Jeff Becker 2922668e6b
initial lokinet-bootstrap in powershell for windows 4 years ago
Jeff Becker 2190da8c81
cpack win32 4 years ago
Jeff Becker 0f13591802
does not work 4 years ago