Full Code of oxen-io/loki-network for AI

dev 8b592d5c06d2 cached
503 files
2.0 MB
537.1k tokens
2016 symbols
1 requests
Download .txt
Showing preview only (2,146K chars total). Download the full file or copy to clipboard to get everything.
Repository: oxen-io/loki-network
Branch: dev
Commit: 8b592d5c06d2
Files: 503
Total size: 2.0 MB

Directory structure:
gitextract_c7sekzv8/

├── .clang-format
├── .clang-tidy
├── .dir-locals.el
├── .dockerignore
├── .drone.jsonnet
├── .gitattributes
├── .github/
│   ├── CONTRIBUTING.md
│   ├── ISSUE_TEMPLATE/
│   │   └── bug_report.md
│   └── workflows/
│       └── clean_issues.yml
├── .gitignore
├── .gitmodules
├── .swift-version
├── CMakeLists.txt
├── CONTRIBUTING.md
├── CONTRIBUTING_es.md
├── LICENSE
├── cmake/
│   ├── CMakeGraphVizOptions.cmake
│   ├── DownloadLibSodium.cmake
│   ├── FindJemalloc.cmake
│   ├── GenVersion.cmake
│   ├── MacroEnsureOutOfSourceBuild.cmake
│   ├── StaticBuild.cmake
│   ├── TargetArch.cmake
│   ├── Version.cmake
│   ├── add_import_library.cmake
│   ├── cmake_uninstall.cmake.in
│   ├── coverage.cmake
│   ├── cross_compile.cmake
│   ├── enable_lto.cmake
│   ├── gui-option.cmake
│   ├── gui.cmake
│   ├── installer.cmake
│   ├── libatomic.cmake
│   ├── macos.cmake
│   ├── ngtcp2_lib.cmake
│   ├── solaris.cmake
│   ├── target_link_libraries_system.cmake
│   ├── unix.cmake
│   ├── win32.cmake
│   └── win32_installer_deps.cmake
├── contrib/
│   ├── NetworkManager/
│   │   └── dnsmasq/
│   │       ├── README.md
│   │       └── lokinet.conf
│   ├── android-configure.sh
│   ├── android.sh
│   ├── apparmor/
│   │   └── usr.bin.lokinet
│   ├── apply-patches.sh
│   ├── bencode-dump.py
│   ├── bootstrap/
│   │   ├── mainnet.signed
│   │   ├── make-bootstrap-list.sh
│   │   ├── readme.txt
│   │   └── testnet.signed
│   ├── ci/
│   │   ├── docker/
│   │   │   ├── readme.md
│   │   │   └── rebuild-docker-images.py
│   │   ├── drone-check-static-libs.sh
│   │   ├── drone-debs-upload.sh
│   │   ├── drone-format-verify.sh
│   │   ├── drone-gdb.sh
│   │   ├── drone-run-router-hive.sh
│   │   ├── drone-static-upload.sh
│   │   └── gdb-filter.py
│   ├── cross/
│   │   ├── android.toolchain.cmake
│   │   ├── cross.toolchain.cmake
│   │   ├── mingw32.cmake
│   │   ├── mingw64.cmake
│   │   └── mingw_core.cmake
│   ├── cross.sh
│   ├── deb.oxen.io.gpg
│   ├── format-version.sh
│   ├── format.sh
│   ├── git-hook-pre-push.sh
│   ├── hex-to-base32z.py
│   ├── keygen.py
│   ├── liblokinet/
│   │   ├── CMakeLists.txt
│   │   ├── readme.md
│   │   └── udptest.cpp
│   ├── liblokinet_jank_test.cpp
│   ├── lokinet-resolvconf
│   ├── mac-configure.sh
│   ├── mac.sh
│   ├── macos/
│   │   ├── InfoPlist.strings
│   │   ├── installer.tiff
│   │   ├── lokinet-extension.Info.plist.in
│   │   ├── lokinet-extension.dev.provisionprofile
│   │   ├── lokinet-extension.plugin.entitlements.plist
│   │   ├── lokinet-extension.release.provisionprofile
│   │   ├── lokinet-extension.sysext.entitlements.plist
│   │   ├── lokinet-newsyslog.conf
│   │   ├── lokinet.Info.plist.in
│   │   ├── lokinet.dev.provisionprofile
│   │   ├── lokinet.plugin.entitlements.plist
│   │   ├── lokinet.release.provisionprofile
│   │   ├── lokinet.sysext.entitlements.plist
│   │   ├── mk-icns.sh
│   │   ├── notarize.py.in
│   │   ├── seticon.swift
│   │   └── sign.sh.in
│   ├── make-ico.sh
│   ├── omq-rpc.py
│   ├── patches/
│   │   ├── libzmq-mingw-unistd.patch
│   │   ├── libzmq-mingw-wepoll.patch
│   │   └── unbound-delete-crash-fix.patch
│   ├── py/
│   │   ├── .gitignore
│   │   ├── admin/
│   │   │   ├── .gitignore
│   │   │   ├── lokinetmon
│   │   │   └── requirements.txt
│   │   ├── ffi-example/
│   │   │   └── lokinet.py
│   │   ├── keygen/
│   │   │   ├── .gitignore
│   │   │   ├── keygen.py
│   │   │   └── readme.md
│   │   ├── lnproxy/
│   │   │   ├── lnproxy/
│   │   │   │   └── __main__.py
│   │   │   └── readme.md
│   │   └── quic_tester.py
│   ├── readme-installer.txt
│   ├── systemd-resolved/
│   │   ├── README.md
│   │   ├── lokinet.pkla
│   │   └── lokinet.rules
│   ├── tarball.sh
│   ├── windows-configure.sh
│   └── windows.sh
├── daemon/
│   ├── CMakeLists.txt
│   ├── lokinet-cntrl.cpp
│   ├── lokinet.cpp
│   ├── lokinet.swift
│   ├── utils.cpp
│   └── utils.hpp
├── docs/
│   ├── CMakeLists.txt
│   ├── Doxyfile.in
│   ├── LICENSE
│   ├── architecture.md
│   ├── config.json
│   ├── dns-overview.md
│   ├── doxygen.md
│   ├── exit-setup.md
│   ├── fix-markdown.sh
│   ├── ideal-ux.md
│   ├── index.md.in
│   ├── install.md
│   ├── liblokinet-dev-guide.md
│   ├── macos-signing.txt
│   ├── mkdocs.yml
│   ├── net-comparisons.md
│   ├── project-structure.md
│   ├── readme.md
│   ├── refactor_notes.md
│   ├── snapps-dev-guide.md
│   ├── spanish/
│   │   ├── LICENSE
│   │   ├── README
│   │   └── vision-general.txt
│   ├── tcp-over-quic.md
│   └── we-cannot-make-sandwiches.md
├── external/
│   └── CMakeLists.txt
├── include/
│   ├── llarp.hpp
│   ├── lokinet/
│   │   ├── addr.h
│   │   ├── context.h
│   │   ├── export.h
│   │   ├── misc.h
│   │   ├── srv.h
│   │   ├── stream.h
│   │   └── udp.h
│   ├── lokinet.h
│   └── lokinet.hpp
├── jni/
│   ├── CMakeLists.txt
│   ├── java/
│   │   └── src/
│   │       └── network/
│   │           └── loki/
│   │               └── lokinet/
│   │                   ├── LokinetConfig.java
│   │                   └── LokinetDaemon.java
│   ├── lokinet_config.cpp
│   ├── lokinet_daemon.cpp
│   ├── lokinet_jni_common.hpp
│   ├── network_loki_lokinet_LokinetConfig.h
│   ├── network_loki_lokinet_LokinetDaemon.h
│   ├── network_loki_lokinet_LokinetVPN.h
│   ├── network_loki_lokinet_LokinetVPN_VPNInfo.h
│   ├── network_loki_lokinet_Lokinet_JNI.h
│   └── readme.md
├── llarp/
│   ├── CMakeLists.txt
│   ├── address/
│   │   ├── address.cpp
│   │   ├── address.hpp
│   │   ├── ip_range.cpp
│   │   ├── ip_range.hpp
│   │   ├── map.hpp
│   │   ├── types.hpp
│   │   ├── utils.cpp
│   │   └── utils.hpp
│   ├── android/
│   │   ├── ifaddrs.c
│   │   └── ifaddrs.h
│   ├── app.xml
│   ├── apple/
│   │   ├── CMakeLists.txt
│   │   ├── DNSTrampoline.h
│   │   ├── DNSTrampoline.m
│   │   ├── PacketTunnelProvider.m
│   │   ├── context.hpp
│   │   ├── context_wrapper.cpp
│   │   ├── context_wrapper.h
│   │   ├── route_manager.cpp
│   │   ├── route_manager.hpp
│   │   ├── vpn_interface.cpp
│   │   ├── vpn_interface.hpp
│   │   ├── vpn_platform.cpp
│   │   └── vpn_platform.hpp
│   ├── auth/
│   │   ├── auth.cpp
│   │   ├── auth.hpp
│   │   ├── file.cpp
│   │   ├── file.hpp
│   │   ├── rpc.cpp
│   │   ├── rpc.hpp
│   │   ├── session.cpp
│   │   └── session.hpp
│   ├── config/
│   │   ├── config.cpp
│   │   ├── config.hpp
│   │   ├── definition.cpp
│   │   ├── definition.hpp
│   │   ├── ini.cpp
│   │   └── ini.hpp
│   ├── consensus/
│   │   ├── reachability_testing.cpp
│   │   └── reachability_testing.hpp
│   ├── constants/
│   │   ├── apple.hpp
│   │   ├── files.hpp
│   │   ├── link_layer.hpp
│   │   ├── net.hpp
│   │   ├── path.hpp
│   │   ├── platform.hpp
│   │   ├── proto.hpp
│   │   ├── version.cpp.in
│   │   └── version.hpp
│   ├── contact/
│   │   ├── client_contact.cpp
│   │   ├── client_contact.hpp
│   │   ├── client_intro.cpp
│   │   ├── client_intro.hpp
│   │   ├── contactdb.cpp
│   │   ├── contactdb.hpp
│   │   ├── relay_contact.cpp
│   │   ├── relay_contact.hpp
│   │   ├── router_id.cpp
│   │   ├── router_id.hpp
│   │   ├── sns.cpp
│   │   └── sns.hpp
│   ├── context.cpp
│   ├── crypto/
│   │   ├── constants.hpp
│   │   ├── crypto.cpp
│   │   ├── crypto.hpp
│   │   ├── key_manager.cpp
│   │   ├── key_manager.hpp
│   │   ├── keys.cpp
│   │   ├── keys.hpp
│   │   ├── types.cpp
│   │   └── types.hpp
│   ├── dns/
│   │   ├── dns.hpp
│   │   ├── message.cpp
│   │   ├── message.hpp
│   │   ├── name.cpp
│   │   ├── name.hpp
│   │   ├── nm_platform.cpp
│   │   ├── nm_platform.hpp
│   │   ├── platform.cpp
│   │   ├── platform.hpp
│   │   ├── question.cpp
│   │   ├── question.hpp
│   │   ├── rr.cpp
│   │   ├── rr.hpp
│   │   ├── sd_platform.cpp
│   │   ├── sd_platform.hpp
│   │   ├── serialize.cpp
│   │   ├── serialize.hpp
│   │   ├── server.cpp
│   │   ├── server.hpp
│   │   ├── srv_data.cpp
│   │   ├── srv_data.hpp
│   │   └── string.hpp
│   ├── ev/
│   │   ├── fd_poller.cpp
│   │   ├── fd_poller.hpp
│   │   ├── tcp.cpp
│   │   ├── tcp.hpp
│   │   ├── udp.cpp
│   │   └── udp.hpp
│   ├── handlers/
│   │   ├── session.cpp
│   │   ├── session.hpp
│   │   ├── tun.cpp
│   │   ├── tun.hpp
│   │   └── tun_base.hpp
│   ├── link/
│   │   ├── connection.cpp
│   │   ├── connection.hpp
│   │   ├── endpoint.cpp
│   │   ├── endpoint.hpp
│   │   ├── link_manager.cpp
│   │   └── link_manager.hpp
│   ├── linux/
│   │   ├── dbus.cpp
│   │   ├── dbus.hpp
│   │   └── sd_service_manager.cpp
│   ├── lokinet.cpp
│   ├── lokinet_shared.cpp
│   ├── messages/
│   │   ├── common.cpp
│   │   ├── common.hpp
│   │   ├── dht.cpp
│   │   ├── dht.hpp
│   │   ├── fetch.cpp
│   │   ├── fetch.hpp
│   │   ├── path.cpp
│   │   ├── path.hpp
│   │   ├── session.cpp
│   │   └── session.hpp
│   ├── net/
│   │   ├── id.hpp
│   │   ├── ip_headers.hpp
│   │   ├── ip_packet.cpp
│   │   ├── ip_packet.hpp
│   │   ├── net.h
│   │   ├── net_if.hpp
│   │   ├── platform.hpp
│   │   ├── policy.cpp
│   │   ├── policy.hpp
│   │   ├── posix.cpp
│   │   ├── utils.cpp
│   │   ├── utils.hpp
│   │   └── win32.cpp
│   ├── nodedb-bootstraps.cpp.in
│   ├── nodedb.cpp
│   ├── nodedb.hpp
│   ├── path/
│   │   ├── build_stats.cpp
│   │   ├── build_stats.hpp
│   │   ├── hopid.cpp
│   │   ├── hopid.hpp
│   │   ├── path.cpp
│   │   ├── path.hpp
│   │   ├── path_context.cpp
│   │   ├── path_context.hpp
│   │   ├── path_handler.cpp
│   │   ├── path_handler.hpp
│   │   ├── transit_hop.cpp
│   │   └── transit_hop.hpp
│   ├── profiling.cpp
│   ├── profiling.hpp
│   ├── router/
│   │   ├── route_poker.cpp
│   │   ├── route_poker.hpp
│   │   ├── router.cpp
│   │   └── router.hpp
│   ├── rpc/
│   │   ├── json_binary_proxy.cpp
│   │   ├── json_binary_proxy.hpp
│   │   ├── json_bt.hpp
│   │   ├── json_conversions.cpp
│   │   ├── json_conversions.hpp
│   │   ├── oxend_rpc.cpp
│   │   ├── oxend_rpc.hpp
│   │   ├── param_parser.hpp
│   │   ├── rpc_request.hpp
│   │   ├── rpc_request_decorators.hpp
│   │   ├── rpc_request_definitions.hpp
│   │   ├── rpc_request_parser.cpp
│   │   ├── rpc_request_parser.hpp
│   │   ├── rpc_server.cpp
│   │   └── rpc_server.hpp
│   ├── session/
│   │   ├── session.cpp
│   │   └── session.hpp
│   ├── simulation/
│   │   ├── sim_context.cpp
│   │   └── sim_context.hpp
│   ├── util/
│   │   ├── aligned.hpp
│   │   ├── bspan.hpp
│   │   ├── buffer.cpp
│   │   ├── buffer.hpp
│   │   ├── common.hpp
│   │   ├── compare_ptr.hpp
│   │   ├── decaying_hashset.hpp
│   │   ├── decaying_hashtable.hpp
│   │   ├── exceptions.hpp
│   │   ├── file.cpp
│   │   ├── file.hpp
│   │   ├── formattable.hpp
│   │   ├── logging/
│   │   │   ├── buffer.hpp
│   │   │   └── callback_sink.hpp
│   │   ├── logging.cpp
│   │   ├── logging.hpp
│   │   ├── lokinet_init.h
│   │   ├── mem.cpp
│   │   ├── mem.h
│   │   ├── mem.hpp
│   │   ├── nop_service_manager.cpp
│   │   ├── random.hpp
│   │   ├── service_manager.hpp
│   │   ├── str.cpp
│   │   ├── str.hpp
│   │   ├── thread/
│   │   │   ├── barrier.hpp
│   │   │   ├── queue.hpp
│   │   │   ├── queue_manager.cpp
│   │   │   ├── queue_manager.hpp
│   │   │   ├── threading.cpp
│   │   │   └── threading.hpp
│   │   ├── time.cpp
│   │   ├── time.hpp
│   │   ├── zstd.cpp
│   │   └── zstd.hpp
│   ├── vpn/
│   │   ├── android.hpp
│   │   ├── common.hpp
│   │   ├── egres_packet_router.cpp
│   │   ├── egres_packet_router.hpp
│   │   ├── linux.hpp
│   │   ├── packet_intercept.hpp
│   │   ├── packet_io.hpp
│   │   ├── packet_router.cpp
│   │   ├── packet_router.hpp
│   │   ├── platform.cpp
│   │   ├── platform.hpp
│   │   ├── win32.cpp
│   │   └── win32.hpp
│   └── win32/
│       ├── adapters.hpp
│       ├── dll.cpp
│       ├── dll.hpp
│       ├── exception.cpp
│       ├── exception.hpp
│       ├── exec.cpp
│       ├── exec.hpp
│       ├── guid.hpp
│       ├── handle.hpp
│       ├── service_manager.cpp
│       ├── service_manager.hpp
│       ├── version.rc.in
│       ├── win32_inet.c
│       ├── win32_intrnl.c
│       ├── windivert.cpp
│       ├── windivert.hpp
│       ├── wintun.cpp
│       └── wintun.hpp
├── pybind/
│   ├── CMakeLists.txt
│   ├── common.hpp
│   ├── llarp/
│   │   ├── config.cpp
│   │   ├── context.cpp
│   │   ├── crypto/
│   │   │   └── types.cpp
│   │   ├── dht/
│   │   │   └── dht_types.cpp
│   │   ├── handlers/
│   │   │   ├── pyhandler.cpp
│   │   │   └── pyhandler.hpp
│   │   ├── logger.cpp
│   │   ├── path/
│   │   │   ├── path_hop_config.cpp
│   │   │   └── path_types.cpp
│   │   ├── peerstats.cpp
│   │   ├── router.cpp
│   │   ├── router_contact.cpp
│   │   ├── router_id.cpp
│   │   ├── service/
│   │   │   └── address.cpp
│   │   └── tooling/
│   │       ├── router_event.cpp
│   │       └── router_hive.cpp
│   ├── module.cpp
│   └── readme.md
├── readme.md
├── readme_es.md
├── readme_fr.md
├── readme_ru.md
├── test/
│   ├── CMakeLists.txt
│   ├── check_main.cpp
│   ├── config/
│   │   ├── test_llarp_config_definition.cpp
│   │   ├── test_llarp_config_ini.cpp
│   │   ├── test_llarp_config_output.cpp
│   │   └── test_llarp_config_values.cpp
│   ├── crypto/
│   │   ├── test_llarp_crypto.cpp
│   │   ├── test_llarp_crypto_types.cpp
│   │   └── test_llarp_key_manager.cpp
│   ├── dns/
│   │   └── test_llarp_dns_dns.cpp
│   ├── hive/
│   │   ├── conftest.py
│   │   ├── hive.py
│   │   ├── test_path_builds.py
│   │   └── test_peer_stats.py
│   ├── mocks/
│   │   ├── mock_context.hpp
│   │   ├── mock_network.hpp
│   │   ├── mock_router.hpp
│   │   └── mock_vpn.hpp
│   ├── net/
│   │   ├── test_ip_address.cpp
│   │   ├── test_llarp_net.cpp
│   │   └── test_sock_addr.cpp
│   ├── nodedb/
│   │   └── test_nodedb.cpp
│   ├── path/
│   │   └── test_path.cpp
│   ├── peerstats/
│   │   ├── test_peer_db.cpp
│   │   └── test_peer_types.cpp
│   ├── readme.md
│   ├── router/
│   │   └── test_llarp_router_version.cpp
│   ├── routing/
│   │   ├── test_llarp_routing_obtainexitmessage.cpp
│   │   └── test_llarp_routing_transfer_traffic.cpp
│   ├── service/
│   │   ├── test_llarp_service_address.cpp
│   │   ├── test_llarp_service_identity.cpp
│   │   └── test_llarp_service_name.cpp
│   ├── test_llarp_encrypted_frame.cpp
│   ├── test_llarp_router_contact.cpp
│   ├── test_util.cpp
│   ├── test_util.hpp
│   ├── util/
│   │   ├── meta/
│   │   │   └── test_llarp_util_memfn.cpp
│   │   ├── test_llarp_util_aligned.cpp
│   │   ├── test_llarp_util_bencode.cpp
│   │   ├── test_llarp_util_bits.cpp
│   │   ├── test_llarp_util_decaying_hashset.cpp
│   │   ├── test_llarp_util_log_level.cpp
│   │   ├── test_llarp_util_str.cpp
│   │   └── thread/
│   │       ├── test_llarp_util_queue.cpp
│   │       └── test_llarp_util_queue_manager.cpp
│   └── win32/
│       └── test.rc
└── win32-setup/
    ├── .gitignore
    ├── Makefile
    ├── config_migration.bat
    ├── curl-win32.patch
    ├── extra_create_icons.nsis
    ├── extra_delete_icons.nsis
    ├── extra_install.nsis
    ├── extra_preinstall.nsis
    ├── extra_uninstall.nsis
    ├── libsodium-1.0.17-win32.patch
    ├── libsodium-1.0.18-win32.patch
    ├── lokinet-win32.iss
    ├── mbedtls-win32.patch
    ├── notes.txt
    └── regdb_helper.c

================================================
FILE CONTENTS
================================================

================================================
FILE: .clang-format
================================================
BasedOnStyle: Google

# alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlinesLeft: 'true'
AlignOperands: 'false'
AlignTrailingComments: 'true'
ColumnLimit: 120
PointerAlignment: Left
QualifierAlignment: Custom
QualifierOrder: ['inline', 'static', 'constexpr', 'const', 'type']
ReferenceAlignment: Left

# bracing
BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel: true
  AfterClass: true
  AfterControlStatement: true
  AfterEnum: true
  AfterFunction: true
  AfterNamespace: true
  AfterObjCDeclaration: true
  AfterStruct: true
  AfterUnion: true
  AfterExternBlock: true
  BeforeCatch: true
  BeforeElse: true
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false

# breaking
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: 'true'
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: BeforeColon

# indentation
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
IndentWidth: 4
NamespaceIndentation: All

# shorties
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: 'false'
AllowShortLoopsOnASingleLine: 'false'

# spacing
KeepEmptyLinesAtTheStartOfBlocks: 'false'
PenaltyBreakString: '3'
SpaceBeforeParens: ControlStatements
SpacesInAngles: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: c++20
UseTab: Never

# wrapping
PackConstructorInitializers: NextLine
BinPackParameters: 'false'
BinPackArguments: 'false'

# Include block sorting in the following order:
#   - Main header for source file (clang-format default prioritizes this first)
#   - Relative path includes in quotation marks
#   - Absolute path includes in angle brackets
#   - External dependencies
#   - System dependencies
SortIncludes: CaseInsensitive
IncludeBlocks: Regroup
IncludeCategories:
  - Regex: '".+\.h'
    Priority: 2
  - Regex: '^<llarp'
    Priority: 3
  - Regex: '<winsock2\.h>'
    Priority: 4
  - Regex: '<windows\.h>'
    Priority: 5
  - Regex: '^<.*\.h(pp)?>$'
    Priority: 6
  - Regex: '(<)(.)+(>)'
    Priority: 7


================================================
FILE: .clang-tidy
================================================
HeaderFilterRegex: 'llarp/.*'
Checks: 
'readability-else-after-return,
clang-analyzer-core-*,modernize-*,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,
bugprone-*,
-bugprone-easily-swappable-parameters'


================================================
FILE: .dir-locals.el
================================================
((c++-mode
  (eval add-hook 'before-save-hook #'clang-format-buffer nil t))
 (c-mode
  (eval add-hook 'before-save-hook #'clang-format-buffer nil t)))


================================================
FILE: .dockerignore
================================================
build/
.vscode/
lokinet
lokinet.exe


================================================
FILE: .drone.jsonnet
================================================
local default_deps_base = std.set([
  'g++',
  'libcli11-dev',
  'libcurl4-openssl-dev',
  'libevent-dev',
  'libfmt-dev',
  'libgnutls28-dev',
  'libsodium-dev',
  'libspdlog-dev',
  'libsqlite3-dev',
  'libssl-dev',
  'libsystemd-dev',
  'libunbound-dev',
  'libzmq3-dev',
  'libzstd-dev',
  'make',
  'nettle-dev',
  'nlohmann-json3-dev',
  'python3-dev',
]);
local default_deps(add=[], remove=[]) = std.setDiff(
  std.setUnion(default_deps_base, if std.isArray(add) then std.set(add) else [add]),
  std.set(if std.isArray(remove) then std.set(remove) else [remove])
);
local static_deps = std.set(['g++', 'python3-dev', 'automake', 'libtool']);
local oxen_repo_default = ['liboxen-logging-dev', 'liboxenmq-dev', 'liboxenc-dev', 'liboxen-quic-dev'];
local docker_base = 'registry.oxen.rocks/';


local submodule_commands = [
  'git fetch --tags',
  'git submodule update --init --recursive --depth=1 --jobs=4',
];
local submodules = {
  name: 'submodules',
  image: 'drone/git',
  commands: submodule_commands,
};

// cmake options for static deps mirror
local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https://oxen.rocks/deps ' else '');

local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q';

local kitware_repo(distro) = [
  'eatmydata ' + apt_get_quiet + ' install -y curl ca-certificates',
  'curl -sSL https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - >/usr/share/keyrings/kitware-archive-keyring.gpg',
  'echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ' + distro + ' main" >/etc/apt/sources.list.d/kitware.list',
  'eatmydata ' + apt_get_quiet + ' update',
];

local debian_backports(distro, pkgs) = [
  'echo "deb http://deb.debian.org/debian ' + distro + '-backports main" >/etc/apt/sources.list.d/' + distro + '-backports.list',
  'eatmydata ' + apt_get_quiet + ' update',
  'eatmydata ' + apt_get_quiet + ' install -y ' + std.join(' ', std.map(function(x) x + '/' + distro + '-backports', pkgs)),
];

// Regular build on a debian-like system:
local debian_pipeline(name,
                      image,
                      arch='amd64',
                      deps=default_deps(),
                      extra_setup=[],
                      build_type='Release',
                      lto=false,
                      werror=true,
                      cmake_extra='',
                      local_mirror=true,
                      extra_cmds=[],
                      jobs=6,
                      tests=false,  // FIXME TODO: temporary until test suite is fixed
                      oxen_repo=oxen_repo_default,
                      allow_fail=false) = {
  kind: 'pipeline',
  type: 'docker',
  name: name,
  platform: { arch: arch },
  trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
  steps: [
    submodules,
    {
      name: 'build',
      image: image,
      pull: 'always',
      [if allow_fail then 'failure']: 'ignore',
      environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
      commands: [
                  'echo "Building on ${DRONE_STAGE_MACHINE}"',
                  'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
                  apt_get_quiet + ' update',
                  apt_get_quiet + ' install -y eatmydata',
                ] + (
                  if std.length(oxen_repo) > 0 then [
                    'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release',
                    'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
                    'echo deb http://deb.oxen.io $$(lsb_release -sc) main >/etc/apt/sources.list.d/oxen.list',
                    'eatmydata ' + apt_get_quiet + ' update',
                    apt_get_quiet + ' install -y ' + std.join(' ', oxen_repo),
                  ] else []
                ) + extra_setup
                + [
                  'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
                  'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y gdb cmake git pkg-config ccache ' + std.join(' ', deps),
                  'mkdir build',
                  'cd build',
                  'cmake .. -DWITH_SETCAP=OFF -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE=' + build_type + ' ' +
                  '-DWARN_DEPRECATED=OFF ' +
                  (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') +
                  '-DWITH_LTO=' + (if lto then 'ON ' else 'OFF ') +
                  '-DWITH_TESTS=' + (if tests then 'ON ' else 'OFF ') +
                  cmake_extra +
                  ci_dep_mirror(local_mirror),
                  'VERBOSE=1 make -j' + jobs,
                  'cd ..',
                ]
                + (if tests then ['./contrib/ci/drone-gdb.sh ./build/test/testAll --use-colour yes'] else [])
                + extra_cmds,
    },
  ],
};
local apk_builder(name, image, extra_cmds=[], allow_fail=false, jobs=6) = {
  kind: 'pipeline',
  type: 'docker',
  name: name,
  platform: { arch: 'amd64' },
  trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
  steps: [
    submodules,
    {
      name: 'build',
      image: image,
      pull: 'always',
      [if allow_fail then 'failure']: 'ignore',
      environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, ANDROID: 'android' },
      commands: [
        'VERBOSE=1 JOBS=' + jobs + ' NDK=/usr/lib/android-ndk ./contrib/android.sh',
        'git clone https://github.com/oxen-io/lokinet-flutter-app lokinet-mobile',
        'cp -av build-android/out/* lokinet-mobile/lokinet_lib/android/src/main/jniLibs/',
        'cd lokinet-mobile',
        'flutter build apk --debug',
        'cd  ..',
        'cp lokinet-mobile/build/app/outputs/apk/debug/app-debug.apk lokinet.apk',
      ] + extra_cmds,
    },
  ],
};
// windows cross compile on debian
local windows_cross_pipeline(name,
                             image,
                             gui_image=docker_base + 'nodejs-lts',
                             arch='amd64',
                             build_type='Release',
                             lto=false,
                             werror=false,
                             cmake_extra='',
                             local_mirror=true,
                             extra_cmds=[],
                             jobs=6,
                             allow_fail=false) = {
  kind: 'pipeline',
  type: 'docker',
  name: name,
  platform: { arch: arch },
  trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
  steps: [
    submodules,
    {
      name: 'GUI',
      image: gui_image,
      pull: 'always',
      [if allow_fail then 'failure']: 'ignore',
      commands: [
        'echo "Building on ${DRONE_STAGE_MACHINE}"',
        'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
        apt_get_quiet + ' update',
        apt_get_quiet + ' install -y eatmydata',
        'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y p7zip-full wine',
        'cd gui',
        'yarn install --frozen-lockfile',
        'USE_SYSTEM_7ZA=true DISPLAY= WINEDEBUG=-all yarn win32',
      ],
    },
    {
      name: 'build',
      image: image,
      pull: 'always',
      [if allow_fail then 'failure']: 'ignore',
      environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, WINDOWS_BUILD_NAME: 'x64' },
      commands: [
        'echo "Building on ${DRONE_STAGE_MACHINE}"',
        'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
        apt_get_quiet + ' update',
        apt_get_quiet + ' install -y eatmydata',
        'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y build-essential cmake git pkg-config ccache g++-mingw-w64-x86-64-posix nsis zip icoutils automake libtool librsvg2-bin bison',
        'JOBS=' + jobs + ' VERBOSE=1 ./contrib/windows.sh -DSTRIP_SYMBOLS=ON -DGUI_EXE=$${DRONE_WORKSPACE}/gui/release/Lokinet-GUI_portable.exe' +
        ci_dep_mirror(local_mirror),
      ] + extra_cmds,
    },
  ],
};

// linux cross compile on debian
local linux_cross_pipeline(name,
                           cross_targets,
                           arch='amd64',
                           build_type='Release',
                           cmake_extra='',
                           local_mirror=true,
                           extra_cmds=[],
                           jobs=6,
                           allow_fail=false) = {
  kind: 'pipeline',
  type: 'docker',
  name: name,
  platform: { arch: arch },
  trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
  steps: [
    submodules,
    {
      name: 'build',
      image: docker_base + 'debian-stable-cross',
      pull: 'always',
      [if allow_fail then 'failure']: 'ignore',
      environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, CROSS_TARGETS: std.join(':', cross_targets) },
      commands: [
        'echo "Building on ${DRONE_STAGE_MACHINE}"',
        'VERBOSE=1 JOBS=' + jobs + ' ./contrib/cross.sh ' + std.join(' ', cross_targets) +
        ' -- ' + cmake_extra + ci_dep_mirror(local_mirror),
      ],
    },
  ],
};

// Builds a snapshot .deb on a debian-like system by merging into the debian/* or ubuntu/* branch
local deb_builder(image, distro, distro_branch, arch='amd64', oxen_repo=oxen_repo_default) = {
  kind: 'pipeline',
  type: 'docker',
  name: 'DEB (' + distro + (if arch == 'amd64' then '' else '/' + arch) + ')',
  platform: { arch: arch },
  environment: { distro_branch: distro_branch, distro: distro },
  steps: [
    submodules,
    {
      name: 'build',
      image: image,
      pull: 'always',
      failure: 'ignore',
      environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
      commands: [
        'echo "Building on ${DRONE_STAGE_MACHINE}"',
        'echo "man-db man-db/auto-update boolean false" | debconf-set-selections',
      ] + (if oxen_repo then [
             'cp contrib/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
             'echo deb http://deb.oxen.io $${distro} main >/etc/apt/sources.list.d/oxen.list',
           ] else []) + [
        apt_get_quiet + ' update',
        apt_get_quiet + ' install -y eatmydata',
        'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git devscripts equivs ccache git-buildpackage python3-dev',
        |||
          # Look for the debian branch in this repo first, try upstream if that fails.
          if ! git checkout $${distro_branch}; then
              git remote add --fetch upstream https://github.com/oxen-io/lokinet.git &&
              git checkout $${distro_branch}
          fi
        |||,
        // Tell the merge how to resolve conflicts in the source .drone.jsonnet (we don't
        // care about it at all since *this* .drone.jsonnet is already loaded).
        'git config merge.ours.driver true',
        'echo .drone.jsonnet merge=ours >>.gitattributes',

        'git merge ${DRONE_COMMIT}',
        'export DEBEMAIL="${DRONE_COMMIT_AUTHOR_EMAIL}" DEBFULLNAME="${DRONE_COMMIT_AUTHOR_NAME}"',
        'gbp dch -S -s "HEAD^" --spawn-editor=never -U low',
        'eatmydata mk-build-deps --install --remove --tool "' + apt_get_quiet + ' -o Debug::pkgProblemResolver=yes --no-install-recommends -y"',
        'export DEB_BUILD_OPTIONS="parallel=$$(nproc)"',
        //'grep -q lib debian/lokinet-bin.install || echo "/usr/lib/lib*.so*" >>debian/lokinet-bin.install',
        'debuild -e CCACHE_DIR -b',
        './contrib/ci/drone-debs-upload.sh ' + distro,
      ],
    },
  ],
};

local clang(version) = debian_pipeline(
  'Debian sid/clang-' + version,
  docker_base + 'debian-sid-clang',
  deps=default_deps(add='clang-' + version, remove='g++'),
  cmake_extra='-DCMAKE_C_COMPILER=clang-' + version + ' -DCMAKE_CXX_COMPILER=clang++-' + version + ' '
);

local full_llvm(version) = debian_pipeline(
  'Debian sid/llvm-' + version,
  docker_base + 'debian-sid-clang',
  deps=default_deps(add=['clang-' + version, ' lld-' + version, ' libc++-' + version + '-dev', 'libc++abi-' + version + '-dev', 'libngtcp2-crypto-gnutls-dev', 'libngtcp2-dev'],
                    remove='g++'),
  oxen_repo=[],
  cmake_extra='-DCMAKE_C_COMPILER=clang-' + version +
              ' -DCMAKE_CXX_COMPILER=clang++-' + version +
              ' -DCMAKE_CXX_FLAGS=-stdlib=libc++ ' +
              std.join(' ', [
                '-DCMAKE_' + type + '_LINKER_FLAGS=-fuse-ld=lld-' + version
                for type in ['EXE', 'MODULE', 'SHARED']
              ]) +
              ' -DOXEN_LOGGING_FORCE_SUBMODULES=ON'
);

// Macos build
local mac_builder(name,
                  build_type='Release',
                  arch='arm64',
                  werror=true,
                  cmake_extra='',
                  local_mirror=true,
                  extra_cmds=[],
                  jobs=6,
                  codesign='-DCODESIGN=OFF',
                  allow_fail=false) = {
  kind: 'pipeline',
  type: 'exec',
  name: name,
  platform: { os: 'darwin', arch: arch },
  steps: [
    { name: 'submodules', commands: submodule_commands },
    {
      name: 'build',
      environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
      commands: [
        'echo "Building on ${DRONE_STAGE_MACHINE}"',
        // If you don't do this then the C compiler doesn't have an include path containing
        // basic system headers.  WTF apple:
        'export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"',
        'ulimit -n 1024',  // because macos sets ulimit to 256 for some reason yeah idk
        './contrib/mac-configure.sh ' + ci_dep_mirror(local_mirror) + '-DWARN_DEPRECATED=OFF ' + codesign,
        'cd build-mac',
        // We can't use the 'package' target here because making a .dmg requires an active logged in
        // macos gui to invoke Finder to invoke the partitioning tool to create a partitioned (!)
        // disk image.  Most likely the GUI is required because if you lose sight of how pretty the
        // surface of macOS is you might see how ugly the insides are.
        'ninja -j' + jobs + ' assemble_gui',
        'cd ..',
      ] + extra_cmds,
    },
  ],
};

local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
  kind: 'pipeline',
  type: 'docker',
  name: name,
  platform: { arch: 'amd64' },
  trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } },
  steps: [
    submodules,
    {
      name: 'build',
      image: image,
      pull: 'always',
      [if allow_fail then 'failure']: 'ignore',
      environment: { SSH_KEY: { from_secret: 'SSH_KEY' } },
      commands: [
        'cmake -S . -B build-docs',
        'make -C build-docs doc',
      ] + extra_cmds,
    },
  ],
};


[
  {
    name: 'lint check',
    kind: 'pipeline',
    type: 'docker',
    steps: [{
      name: 'build',
      image: docker_base + 'lint',
      pull: 'always',
      commands: [
        'echo "Building on ${DRONE_STAGE_MACHINE}"',
        apt_get_quiet + ' update',
        apt_get_quiet + ' install -y eatmydata',
        'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y git clang-format-16 jsonnet',
        './contrib/ci/drone-format-verify.sh',
      ],
    }],
  },
  // documentation builder
  //docs_pipeline('Documentation',
  //              docker_base + 'docbuilder',
  //              extra_cmds=['UPLOAD_OS=docs ./contrib/ci/drone-static-upload.sh']),

  // Debian sid
  debian_pipeline('Debian sid', docker_base + 'debian-sid'),
  debian_pipeline('Debian sid/debug', docker_base + 'debian-sid', build_type='Debug'),
  debian_pipeline('Debian sid/debug [arm64]', docker_base + 'debian-sid', build_type='Debug', arch='arm64', jobs=4),

  clang(17),
  full_llvm(17),
  clang(19),
  full_llvm(19),

  // Debian 14
  debian_pipeline('Debian 14', docker_base + 'debian-forky'),
  debian_pipeline('Debian 14 [i386]', docker_base + 'debian-forky/i386'),
  debian_pipeline('Debian 14 [arm64]', docker_base + 'debian-forky', arch='arm64', jobs=4),
  debian_pipeline('Debian 14 [armhf]', docker_base + 'debian-forky/arm32v7', arch='arm64', jobs=4),

  // Debian 13
  debian_pipeline('Debian 13', docker_base + 'debian-trixie'),
  debian_pipeline('Debian 13 [arm64]', docker_base + 'debian-trixie', arch='arm64', jobs=4),

  // Debian 12
  debian_pipeline('Debian 12', docker_base + 'debian-bookworm'),
  debian_pipeline('Debian 12 static/debug',
                  docker_base + 'debian-bookworm',
                  build_type='Debug',
                  deps=static_deps,
                  oxen_repo=[],
                  cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON'),

  // Static debian 12 armhf (upload to builds.lokinet.dev)
  debian_pipeline('Debian 12 static [armhf]',
                  docker_base + 'debian-bookworm/arm32v7',
                  arch='arm64',
                  deps=static_deps,
                  oxen_repo=[],
                  cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' +
                              '-DCMAKE_CXX_FLAGS="-march=armv7-a+fp -Wno-psabi" -DCMAKE_C_FLAGS="-march=armv7-a+fp" ' +
                              '-DNATIVE_BUILD=OFF -DWITH_SYSTEMD=OFF -DWITH_BOOTSTRAP=OFF',
                  extra_cmds=[
                    './contrib/ci/drone-check-static-libs.sh',
                    'UPLOAD_OS=linux-armhf ./contrib/ci/drone-static-upload.sh',
                  ],
                  jobs=4),

  // Ubuntu
  debian_pipeline('Ubuntu latest', docker_base + 'ubuntu-rolling'),
  debian_pipeline('Ubuntu 24.04', docker_base + 'ubuntu-noble'),
  debian_pipeline('Ubuntu 22.04', docker_base + 'ubuntu-jammy'),

  // Static ubuntu jammy amd64 build (upload to builds.lokinet.dev)
  debian_pipeline('Ubuntu 22.04 static',
                  docker_base + 'ubuntu-jammy',
                  deps=static_deps,
                  lto=true,
                  tests=false,
                  oxen_repo=[],
                  cmake_extra='-DBUILD_STATIC_DEPS=ON -DBUILD_SHARED_LIBS=OFF -DSTATIC_LINK=ON ' +
                              '-DCMAKE_CXX_FLAGS="-march=x86-64 -mtune=haswell" ' +
                              '-DCMAKE_C_FLAGS="-march=x86-64 -mtune=haswell" ' +
                              '-DNATIVE_BUILD=OFF -DWITH_SYSTEMD=OFF -DWITH_BOOTSTRAP=OFF -DBUILD_LIBLOKINET=OFF',
                  extra_cmds=[
                    './contrib/ci/drone-check-static-libs.sh',
                    './contrib/ci/drone-static-upload.sh',
                  ]),


  // cross compile targets
  // Aug 11: these are exhibiting some dumb failures in libsodium and external deps, TOFIX later
  //linux_cross_pipeline('Cross Compile (arm/arm64)', cross_targets=['arm-linux-gnueabihf', 'aarch64-linux-gnu']),
  //linux_cross_pipeline('Cross Compile (ppc64le)', cross_targets=['powerpc64le-linux-gnu']),

  // Not currently building successfully:
  //linux_cross_pipeline('Cross Compile (mips)', cross_targets=['mips-linux-gnu', 'mipsel-linux-gnu']),

  // android apk builder
  // Aug 11: this is also failing in openssl, TOFIX later
  //apk_builder('android apk', docker_base + 'flutter', extra_cmds=['UPLOAD_OS=android ./contrib/ci/drone-static-upload.sh']),

  // Windows builds (x64)
  /*
  windows_cross_pipeline('Windows (x64)',
                         docker_base + 'debian-win32-cross',
                         extra_cmds=[
                           './contrib/ci/drone-static-upload.sh',
                         ]),
  */

  /*
  // integration tests
  debian_pipeline('Router Hive',
                  docker_base + 'ubuntu-lts',
                  deps=default_deps(add=['python3-dev', 'python3-pytest', 'python3-pybind11']),
                  cmake_extra='-DWITH_HIVE=ON'),

  // Deb builds:
  deb_builder(docker_base + 'debian-sid-builder', 'sid', 'debian/sid'),
  deb_builder(docker_base + 'debian-bullseye-builder', 'bullseye', 'debian/bullseye'),
  deb_builder(docker_base + 'ubuntu-jammy-builder', 'jammy', 'ubuntu/jammy'),
  deb_builder(docker_base + 'debian-sid-builder', 'sid', 'debian/sid', arch='arm64'),
  */

  // Macos builds:
  /*
  mac_builder('macOS (Release, arm64)', extra_cmds=[
    './contrib/ci/drone-check-static-libs.sh',
    './contrib/ci/drone-static-upload.sh',
  ]),
  mac_builder('macOS (Debug, arm64)', build_type='Debug'),
  */
]


================================================
FILE: .gitattributes
================================================
external/date/test export-ignore
external/nlohmann/doc export-ignore
external/nlohmann/test export-ignore
external/nlohmann/benchmarks/data export-ignore
*.signed binary


================================================
FILE: .github/CONTRIBUTING.md
================================================

* RUN `make format && make lint -j8` BEFORE COMMITING ALWAYS.

* no tabs


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

**Screenshots Or Logs**
If applicable, add screenshots or log files to help explain your problem.

**Device and Operating system (please complete the following information):**
 - OS: [e.g. iOS, Windows, Android]
-  Device: [ e.g. Mac, PC, IPhone]
 - Lokinet Version number or Git commit hash:


================================================
FILE: .github/workflows/clean_issues.yml
================================================
name: Close incomplete issues
on:
  schedule:
    - cron: "30 1 * * *"

jobs:
  close-issues:
    runs-on: ubuntu-latest
    permissions:
      issues: write
    steps:
      - uses: actions/stale@v4.1.1
        with:
          only-labels: incomplete
          days-before-issue-stale: 14
          days-before-issue-close: 7
          stale-issue-label: "stale"
          stale-issue-message: "This issue is stale because it has been 'incomplete' for 14 days with no activity."
          close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale."
          days-before-pr-stale: -1
          days-before-pr-close: -1
          repo-token: ${{ secrets.GITHUB_TOKEN }}


================================================
FILE: .gitignore
================================================
*~
*\#*

*.a
*.o
*.so

/build*/
**/__pycache__/**

llarpd
*.test
*.bin

*.ninja
cmake_install.cmake
CMakeFiles
CMakeCache.txt
.ninja_log
.ninja_deps
/.cache/
/compile_commands.json

callgrind.*
.gdb_history

*.sig
*.signed
!/contrib/bootstrap/mainnet.signed
!/contrib/bootstrap/testnet.signed
*.key

shadow.data
shadow.config.xml
*.log
*.pdf
*.xz

testnet_tmp


*.pid
vsproject/
.vs

*.ini


.gradle/
.idea
.vscode
build64/
build2/
/contrib/lokinet-bootstrap-winnt/cacert.pem
/contrib/lokinet-bootstrap-winnt/data.enc
/contrib/lokinet-bootstrap-winnt/out.bine
default.profraw

# ctags shit
GTAGS
GRTAGS
GPATH
version.txt

lokinet-bootstrap.exe
regdbhelper.dll
# xcode
xcuserdata/

scc.py


================================================
FILE: .gitmodules
================================================
[submodule "external/nlohmann"]
	path = external/nlohmann
	url = https://github.com/nlohmann/json.git
[submodule "test/Catch2"]
	path = test/Catch2
	url = https://github.com/catchorg/Catch2
[submodule "external/pybind11"]
	path = external/pybind11
	url = https://github.com/pybind/pybind11
	branch = stable
[submodule "external/sqlite_orm"]
	path = external/sqlite_orm
	url = https://github.com/fnc12/sqlite_orm
[submodule "external/oxen-mq"]
	path = external/oxen-mq
	url = https://github.com/oxen-io/oxen-mq
[submodule "gui"]
	path = gui
	url = https://github.com/oxen-io/lokinet-gui.git
[submodule "external/CLI11"]
	path = external/CLI11
	url = https://github.com/CLIUtils/CLI11.git
[submodule "external/oxen-libquic"]
	path = external/oxen-libquic
	url = https://github.com/oxen-io/oxen-libquic.git


================================================
FILE: .swift-version
================================================
5.4.2


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.13...3.24)  # 3.13 is buster's version

# Cmake 3.24+ breaks extraction timestamps by default, hurray, but the option to not break
# timestamps fails in cmake <3.24, extra hurray!
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
    cmake_policy(SET CMP0135 OLD)
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Has to be set before `project()`, and ignored on non-macos:
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15 CACHE STRING "macOS deployment target (Apple clang only)")

set(lokinet_full_def ON)
if(IOS)
  set(lokinet_full_def OFF)
endif()

# These two are not exclusive: daemon requires full platform, but the main lokinet library itself
# can support both.
option(LOKINET_FULL "build with full client/relay support. Disabling this will only allow embedded lokinet usage" ${lokinet_full_def})
option(LOKINET_DAEMON "build lokinet daemon and associated utils (requires LOKINET_FULL)" ${LOKINET_FULL})

if(LOKINET_DAEMON AND NOT LOKINET_FULL)
  message(FATAL_ERROR "Cannot use LOKINET_DAEMON without LOKINET_FULL platform support!")
endif()

option(LOKINET_GRAPH_DEPENDENCIES "Produce graphviz representation of cmake dependencies" OFF)

option(LOKINET_VERSION_SO "Add the project version to the shared library filename, e.g. liblokinet1.2.3.so instead of liblokinet.so" OFF)

set(LANGS C CXX)
if(APPLE AND LOKINET_DAEMON)
  set(LANGS ${LANGS} OBJC Swift)
endif()

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
  foreach(lang ${LANGS})
    if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/ccache")
      message(STATUS "Enabling ccache for ${lang}")
      set(CMAKE_${lang}_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE STRING "")
    endif()
  endforeach()
endif()


project(lokinet
    VERSION 0.10.0
    DESCRIPTION "lokinet - IP packet onion router"
    LANGUAGES ${LANGS})

if(APPLE)
    # Apple build number: must be incremented to submit a new build for the same lokinet version,
    # should be reset to 0 when the lokinet version increments.
    set(LOKINET_APPLE_BUILD 5)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# Core options
option(LOKINET_AVX2 "enable avx2 code" OFF)
option(LOKINET_NATIVE_BUILD "optimise for host system and FPU" ON)
option(LOKINET_XSAN "use sanitiser, if your system has it (requires -DCMAKE_BUILD_TYPE=Debug)" OFF)
option(LOKINET_JEMALLOC "Link to jemalloc for memory allocations, if found (requires non-static build)" ON)
option(LOKINET_COVERAGE "generate coverage data" OFF)
option(LOKINET_WARNINGS_AS_ERRORS "treat all warnings as errors. turn off for development, on for release" OFF)
option(LOKINET_TESTS "build unit tests" OFF)
option(LOKINET_HIVE "build simulation stubs" OFF)
option(LOKINET_PACKAGE "builds extra components for making an installer (with 'make package')" OFF)
option(LOKINET_PEERSTATS "build with experimental peerstats db support" OFF)
option(LOKINET_STRIP "strip off all debug symbols into an external archive for all executables built" OFF)
option(LOKINET_DEBUG_PATH_SEED "enable support for the debug-mode [paths]:debug-path-seed option for reproducible, non-random paths" OFF)

set(LOKINET_BOOTSTRAP_FALLBACK_MAINNET "${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed" CACHE PATH "Fallback bootstrap path (mainnet)")
set(LOKINET_BOOTSTRAP_FALLBACK_TESTNET "${PROJECT_SOURCE_DIR}/contrib/bootstrap/testnet.signed" CACHE PATH "Fallback bootstrap path (testnet)")

include(cmake/enable_lto.cmake)

option(CROSS_PLATFORM "cross compiler platform" "Linux")
option(CROSS_PREFIX "toolchain cross compiler prefix" "")

option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_STATIC_DEPS "Download, build, and statically link against core dependencies" OFF)
option(STATIC_LINK "link statically against dependencies" ${BUILD_STATIC_DEPS})
if(BUILD_STATIC_DEPS AND NOT STATIC_LINK)
  message(FATAL_ERROR "Option BUILD_STATIC_DEPS requires STATIC_LINK to be enabled as well")
endif()

if(BUILD_STATIC_DEPS AND BUILD_SHARED_LIBS)
  message(FATAL_ERROR "Incompatible options: BUILD_STATIC_DEPS cannot be used with BUILD_SHARED_LIBS")
endif()

if(BUILD_STATIC_DEPS)
  set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
  include(cmake/StaticBuild.cmake)
endif()

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()

# set(debug OFF)
# if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
#   set(debug ON)
#   add_definitions(-DLOKINET_DEBUG)
# endif()

option(LOKINET_WARN_DEPRECATED "show deprecation warnings" OFF)

include(CheckCXXSourceCompiles)
include(CheckLibraryExists)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

include(cmake/target_link_libraries_system.cmake)
include(cmake/add_import_library.cmake)
include(cmake/libatomic.cmake)

if (STATIC_LINK)
  set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
  message(STATUS "setting static library suffix search")
endif()

include(cmake/gui-option.cmake)

include(cmake/solaris.cmake)
include(cmake/win32.cmake)
include(cmake/macos.cmake)

# No in-source building
include(MacroEnsureOutOfSourceBuild)
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out-of-source build.  Create a build directory and run 'cmake ${CMAKE_SOURCE_DIR} [options]'.")

# Always build PIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

include(cmake/unix.cmake)

if(NOT WIN32)
  if(IOS OR ANDROID)
    set(NON_PC_TARGET ON)
  else()
    include(TargetArch)
    target_architecture(COMPILE_ARCH)
    if(COMPILE_ARCH MATCHES i386 OR COMPILE_ARCH MATCHES x86_64)
      set(NON_PC_TARGET OFF)
    else()
      set(NON_PC_TARGET ON)
    endif()
  endif()
endif()

find_package(PkgConfig REQUIRED)

if(NOT TARGET sodium)
  # Allow -DLOKINET_DOWNLOAD_SODIUM=FORCE to download without even checking for a local libsodium
  option(LOKINET_DOWNLOAD_SODIUM "Allow libsodium to be downloaded and built locally if not found on the system" OFF)
  if(NOT LOKINET_DOWNLOAD_SODIUM STREQUAL "FORCE" AND NOT BUILD_STATIC_DEPS)
    pkg_check_modules(SODIUM libsodium>=1.0.18 IMPORTED_TARGET)
  endif()

  add_library(sodium INTERFACE)
  if(SODIUM_FOUND AND NOT LOKINET_DOWNLOAD_SODIUM STREQUAL "FORCE" AND NOT BUILD_STATIC_DEPS)
    target_link_libraries(sodium INTERFACE PkgConfig::SODIUM)
  else()
    if(NOT LOKINET_DOWNLOAD_SODIUM AND NOT BUILD_STATIC_DEPS)
      message(FATAL_ERROR "Could not find libsodium >= 1.0.18; either install it on your system or use -DLOKINET_DOWNLOAD_SODIUM=ON to download and build an internal copy")
    endif()
    message(STATUS "Sodium >= 1.0.18 not found, but LOKINET_DOWNLOAD_SODIUM specified, so downloading it")
    include(DownloadLibSodium)
    target_link_libraries(sodium INTERFACE sodium_vendor)
  endif()

  # Need this target export so that loki-mq properly picks up sodium
  export(TARGETS sodium NAMESPACE sodium:: FILE sodium-exports.cmake)
endif()

set(warning_flags -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-function -Werror=vla)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  list(APPEND warning_flags -Wno-unknown-warning-option)
endif()

if(LOKINET_WARNINGS_AS_ERRORS)
  list(APPEND warning_flags -Werror -Wno-error=array-bounds)
endif()

# GCC 12's stringop-overflow warnings are really broken, with tons and tons of false positives all
# over the place (not just in our code, but also in its own stdlibc++ code).  It's better in 13
# w.r.t. stdlibc++, but our code still throws tons of warnings, so disable it for now.
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
    list(APPEND warning_flags -Wno-stringop-overflow)
endif()
list(APPEND warning_flags -Wno-deprecated-declarations)

add_library(lokinet-base-internal_warnings INTERFACE)

# If we blindly add these directly as compile_options then they get passed to swiftc on Apple and
# break, so we use a generate expression to set them only for C++/C/ObjC
target_compile_options(lokinet-base-internal_warnings INTERFACE "$<$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:OBJC>>:${warning_flags}>")

if(LOKINET_XSAN)
  string(APPEND CMAKE_CXX_FLAGS_DEBUG " -fsanitize=${LOKINET_XSAN} -fno-omit-frame-pointer -fno-sanitize-recover")
  foreach(type EXE MODULE SHARED STATIC)
    string(APPEND CMAKE_${type}_LINKER_FLAGS_DEBUG " -fsanitize=${LOKINET_XSAN} -fno-omit-frame-pointer -fno-sanitize-recover")
  endforeach()
  message(STATUS "Doing a ${LOKINET_XSAN} sanitizer build")
endif()

include(cmake/coverage.cmake)

# these vars are set by the cmake toolchain spec
if (WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
  include(cmake/cross_compile.cmake)
endif()

if(NOT APPLE)
  if(LOKINET_NATIVE_BUILD)
    if(CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le)
      add_compile_options(-mcpu=native -mtune=native)
    else()
      add_compile_options(-march=native -mtune=native)
    endif()
  elseif(NOT NON_PC_TARGET)
    if (LOKINET_AVX2)
      add_compile_options(-march=haswell -mtune=haswell -mfpmath=sse)
    else()
      # Public binary releases
      add_compile_options(-march=nocona -mtune=haswell -mfpmath=sse)
    endif()
  endif()
endif()

# now have libevent2.21 w/ pthreads
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)

unset(GIT_VERSION)
unset(GIT_VERSION_REAL)

if(NOT GIT_VERSION)
  exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION_UNSTRIP)
  string(STRIP "${GIT_VERSION_UNSTRIP}" GIT_VERSION)
endif()

string(REGEX REPLACE "^fatal.*$" nogit GIT_VERSION_REAL "${GIT_VERSION}")

find_package(PkgConfig REQUIRED)

if (NOT BUILD_STATIC_DEPS)
  pkg_check_modules(UNBOUND libunbound REQUIRED IMPORTED_TARGET)
  add_library(libunbound INTERFACE)
  target_link_libraries(libunbound INTERFACE PkgConfig::UNBOUND)

  pkg_check_modules(SD libsystemd IMPORTED_TARGET)
  # Default WITH_SYSTEMD to true if we found it
  option(WITH_SYSTEMD "enable systemd integration for sd_notify" ${SD_FOUND})
endif()

add_subdirectory(external)

# interface library for setting common includes, linkage and flags
add_library(lokinet-base INTERFACE)
target_include_directories(lokinet-base INTERFACE . include)
target_link_libraries(lokinet-base INTERFACE oxen::quic fmt::fmt nlohmann_json::nlohmann_json)

target_compile_features(lokinet-base INTERFACE cxx_std_20)

add_library(lokinet-base-internal INTERFACE)
target_include_directories(lokinet-base-internal INTERFACE include/lokinet)
if(NOT LOKINET_FULL)
  target_compile_definitions(lokinet-base-internal INTERFACE LOKINET_EMBEDDED_ONLY)
endif()

target_link_libraries(lokinet-base-internal INTERFACE lokinet-base-internal_warnings)

if (TARGET lokinet_static_deps)
  target_link_libraries(lokinet-base-internal INTERFACE lokinet_static_deps)
endif()

if(WITH_SYSTEMD AND (NOT ANDROID))
  if(NOT SD_FOUND)
    message(FATAL_ERROR "libsystemd not found")
  endif()
  target_link_libraries(lokinet-base INTERFACE PkgConfig::SD)
  target_compile_definitions(lokinet-base INTERFACE WITH_SYSTEMD)
endif()

if(LOKINET_JEMALLOC AND NOT STATIC_LINK)
  pkg_check_modules(JEMALLOC jemalloc IMPORTED_TARGET)
  if(JEMALLOC_FOUND)
    target_link_libraries(lokinet-base INTERFACE PkgConfig::JEMALLOC)
  else()
    message(STATUS "jemalloc not found, not linking to jemalloc")
  endif()
else()
  message(STATUS "jemalloc support disabled")
endif()


if(ANDROID)
  target_link_libraries(lokinet-base INTERFACE log)
  target_compile_definitions(lokinet-base INTERFACE ANDROID)
  set(ANDROID_PLATFORM_SRC android/ifaddrs.c)
endif()

if(LOKINET_HIVE)
  add_definitions(-DLOKINET_HIVE)
endif()

add_subdirectory(llarp)

if(LOKINET_DAEMON)
  add_subdirectory(daemon)
endif()

if(LOKINET_HIVE)
  add_subdirectory(pybind)
endif()
if(LOKINET_TESTS OR LOKINET_HIVE)
  add_subdirectory(test)
endif()
if(ANDROID)
  add_subdirectory(jni)
endif()

add_subdirectory(docs)

include(cmake/gui.cmake)

if(APPLE AND LOKINET_FULL)
  macos_target_setup()
endif()

add_executable(liblokinet_jank_test EXCLUDE_FROM_ALL contrib/liblokinet_jank_test.cpp)
target_link_libraries(liblokinet_jank_test PRIVATE liblokinet)

# uninstall target
if(NOT TARGET uninstall)
  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY)

  add_custom_target(uninstall
    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

if(LOKINET_PACKAGE AND NOT APPLE)
  include(cmake/installer.cmake)
endif()

if(TARGET package)
  add_dependencies(package assemble_gui)
endif()


================================================
FILE: CONTRIBUTING.md
================================================
[Español](CONTRIBUTING_es.md)
# Do

* Act like a responsible adult.

* RUN `./contrib/format.sh` BEFORE COMMITING ALWAYS.

# Do NOT

* Bring off topic or non technical issues to the issue tracker.

* Pester contributors.

# We WILL

* Merge Spelling mistake corrections (I have lots of those because spelling is HARD)

* Merge code based on its correctness, Including patches via email from (pseudo/fully) anonymous contributors.

# We WILL NOT

* Accept patches with tabs

* Merge large and pointless or pedantic changes, (i.e. code formatting shift)

## additional notes

github's ui doesn't seem accept this file as a real code of conduct.


================================================
FILE: CONTRIBUTING_es.md
================================================
[Ingles](CONTRIBUTING.md)
# Lo que debe

* Actuar como un adulto responsable.

* CORRER `make format` SIEMPRE ANTES DEL COMMIT.

# Lo que NO debe

* Plantear asuntos fuera de lugar o que no son tecnicos en el registro de problemas.

* Ser un contribuyente molestoso.

# Lo que nosotros HAREMOS

* Integrar correcciones de Ortografia (Yo tengo un monton porque la ortografia es COMPLICADA)

* Integrar codigo en base a que tan correcto es, Incluyendo parches recibidos por correo electronico de contribuyentes (pseudo/completamente) anonimos.

# Lo que nosotros NO HAREMOS

* Aceptar parches con tabulaciones

* Integrar cambios grandes sin sentido o pedantes, (por ejemplo codigo con cambios de formato)

## notas adicionales

github no parece aceptar este archivo como un codigo de conducta real.


================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

================================================
FILE: cmake/CMakeGraphVizOptions.cmake
================================================
set(GRAPHVIZ_GRAPH_NAME "graph.dot" CACHE STRING "")
set(GRAPHVIZ_GENERATE_PER_TARGET FALSE CACHE BOOL "")
set(GRAPHVIZ_GENERATE_DEPENDERS FALSE CACHE BOOL "")
set(GRAPHVIZ_OBJECT_LIBS OFF CACHE BOOL "")


================================================
FILE: cmake/DownloadLibSodium.cmake
================================================
set(LIBSODIUM_PREFIX ${CMAKE_BINARY_DIR}/libsodium)
set(LIBSODIUM_URL https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18.tar.gz https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz)
set(LIBSODIUM_HASH SHA512=17e8638e46d8f6f7d024fe5559eccf2b8baf23e143fadd472a7d29d228b186d86686a5e6920385fe2020729119a5f12f989c3a782afbd05a8db4819bb18666ef)

if(SODIUM_TARBALL_URL)
    # make a build time override of the tarball url so we can fetch it if the original link goes away
    set(LIBSODIUM_URL ${SODIUM_TARBALL_URL})
endif()


file(MAKE_DIRECTORY ${LIBSODIUM_PREFIX}/include)

include(ExternalProject)
include(ProcessorCount)
ProcessorCount(PROCESSOR_COUNT)
if(PROCESSOR_COUNT EQUAL 0)
    set(PROCESSOR_COUNT 1)
endif()

set(sodium_cc ${CMAKE_C_COMPILER})
if(CCACHE_PROGRAM)
  set(sodium_cc "${CCACHE_PROGRAM} ${sodium_cc}")
endif()
set(SODIUM_CONFIGURE ./configure --prefix=${LIBSODIUM_PREFIX} --enable-static --disable-shared --with-pic --quiet CC=${sodium_cc})
if (CMAKE_C_COMPILER_ARG1)
  set(SODIUM_CONFIGURE ${SODIUM_CONFIGURE} CPPFLAGS=${CMAKE_C_COMPILER_ARG1})
endif()

if (CROSS_TARGET)
    set(SODIUM_CONFIGURE ${SODIUM_CONFIGURE} --target=${CROSS_TARGET} --host=${CROSS_TARGET})
endif()


ExternalProject_Add(libsodium_external
    BUILD_IN_SOURCE ON
    PREFIX ${LIBSODIUM_PREFIX}
    URL ${LIBSODIUM_URL}
    URL_HASH ${LIBSODIUM_HASH}
    CONFIGURE_COMMAND ${SODIUM_CONFIGURE}
    PATCH_COMMAND patch -p1 -d <SOURCE_DIR> < ${CMAKE_SOURCE_DIR}/win32-setup/libsodium-1.0.18-win32.patch
    BUILD_COMMAND make -j${PROCESSOR_COUNT}
    INSTALL_COMMAND ${MAKE}
    BUILD_BYPRODUCTS ${LIBSODIUM_PREFIX}/lib/libsodium.a ${LIBSODIUM_PREFIX}/include
    )

add_library(sodium_vendor STATIC IMPORTED GLOBAL)
add_dependencies(sodium_vendor libsodium_external)
set_target_properties(sodium_vendor PROPERTIES
    IMPORTED_LOCATION ${LIBSODIUM_PREFIX}/lib/libsodium.a
    INTERFACE_INCLUDE_DIRECTORIES ${LIBSODIUM_PREFIX}/include
    )


================================================
FILE: cmake/FindJemalloc.cmake
================================================
#
# Find the JEMALLOC client includes and library
# 

# This module defines
# JEMALLOC_INCLUDE_DIR, where to find jemalloc.h
# JEMALLOC_LIBRARIES, the libraries to link against
# JEMALLOC_FOUND, if false, you cannot build anything that requires JEMALLOC

# also defined, but not for general use are
# JEMALLOC_LIBRARY, where to find the JEMALLOC library.

set( JEMALLOC_FOUND 0 )

if ( UNIX )
  FIND_PATH( JEMALLOC_INCLUDE_DIR
    NAMES
      jemalloc/jemalloc.h
    PATHS
      /usr/include
      /usr/include/jemalloc
      /usr/local/include
      /usr/local/include/jemalloc
      $ENV{JEMALLOC_ROOT}
      $ENV{JEMALLOC_ROOT}/include
  DOC
    "Specify include-directories that might contain jemalloc.h here."
  )
  FIND_LIBRARY( JEMALLOC_LIBRARY 
    NAMES
      jemalloc libjemalloc JEMALLOC
    PATHS
      /usr/lib
      /usr/lib/jemalloc
      /usr/local/lib
      /usr/local/lib/jemalloc
      /usr/local/jemalloc/lib
      $ENV{JEMALLOC_ROOT}/lib
      $ENV{JEMALLOC_ROOT}
    DOC "Specify library-locations that might contain the jemalloc library here."
  )

  if ( JEMALLOC_LIBRARY )
    if ( JEMALLOC_INCLUDE_DIR )
      set( JEMALLOC_FOUND 1 )
      message( STATUS "Found JEMALLOC library: ${JEMALLOC_LIBRARY}")
      message( STATUS "Found JEMALLOC headers: ${JEMALLOC_INCLUDE_DIR}")
    else ( JEMALLOC_INCLUDE_DIR )
      message(FATAL_ERROR "Could not find jemalloc headers! Please install jemalloc libraries and headers")
    endif ( JEMALLOC_INCLUDE_DIR )
  endif ( JEMALLOC_LIBRARY )
  add_library(jemalloc SHARED IMPORTED)
  set_target_properties(jemalloc PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${JEMALLOC_INCLUDE_DUR}"
    IMPORTED_LOCATION "${JEMALLOC_LIBRARY}")
  mark_as_advanced( JEMALLOC_FOUND JEMALLOC_LIBRARY JEMALLOC_EXTRA_LIBRARIES JEMALLOC_INCLUDE_DIR )
endif (UNIX)


================================================
FILE: cmake/GenVersion.cmake
================================================
# Copyright (c) 2014-2019, The Monero Project
# Copyright (c)      2019, The Loki Project
# 
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
# 
# 1. Redistributions of source code must retain the above copyright notice, this list of
#    conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
#    of conditions and the following disclaimer in the documentation and/or other
#    materials provided with the distribution.
# 
# 3. Neither the name of the copyright holder nor the names of its contributors may be
#    used to endorse or promote products derived from this software without specific
#    prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers

# Check what commit we're on
execute_process(COMMAND "${GIT}" rev-parse --short HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)

if(RET)
	# Something went wrong, set the version tag to -unknown
    message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.")
    set(VERSIONTAG "unknown")
else()
	message(STATUS "You are currently on commit ${COMMIT}")

	# Get all the tags
	execute_process(COMMAND "${GIT}" rev-list --tags --max-count=1 --abbrev-commit RESULT_VARIABLE RET OUTPUT_VARIABLE TAGGEDCOMMIT OUTPUT_STRIP_TRAILING_WHITESPACE)

    if(NOT TAGGEDCOMMIT)
        message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.")
        set(VERSIONTAG "${COMMIT}")
    else()
        # Check if we're building that tagged commit or a different one
        if(COMMIT STREQUAL TAGGEDCOMMIT)
            message(STATUS "${COMMIT} is a tagged release; setting version tag to 'release'")
            set(VERSIONTAG "release")
        else()
            message(STATUS "You are not building a tagged release; setting version tag to '${COMMIT}'")
            set(VERSIONTAG "${COMMIT}")
        endif()
    endif()
endif()

configure_file("${SRC}" "${DEST}" @ONLY)


================================================
FILE: cmake/MacroEnsureOutOfSourceBuild.cmake
================================================
# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)

# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license:
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 
# 1. Redistributions of source code must retain the copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products 
#    derived from this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)

   string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource)
   if (_insource)
     message(SEND_ERROR "${_errorMessage}")
     message(FATAL_ERROR "Remove the file CMakeCache.txt in ${CMAKE_SOURCE_DIR} first.")
   endif (_insource)

endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)


================================================
FILE: cmake/StaticBuild.cmake
================================================
# cmake bits to do a full static build, downloading and building all dependencies.

# Most of these are CACHE STRINGs so that you can override them using -DWHATEVER during cmake
# invocation to override.

include_guard(GLOBAL)

include("${CMAKE_CURRENT_LIST_DIR}/../external/oxen-libquic/cmake/StaticBuild.cmake")

set(LOCAL_MIRROR "" CACHE STRING "local mirror path/URL for lib downloads")

set(EXPAT_VERSION 2.7.1 CACHE STRING "expat version")
string(REPLACE "." "_" EXPAT_TAG "R_${EXPAT_VERSION}")
set(EXPAT_MIRROR ${LOCAL_MIRROR} https://github.com/libexpat/libexpat/releases/download/${EXPAT_TAG}
    CACHE STRING "expat download mirror(s)")
set(EXPAT_SOURCE expat-${EXPAT_VERSION}.tar.xz)
set(EXPAT_HASH SHA512=4c9a6c1c1769d2c4404da083dd3013dbc73883da50e2b7353db2349a420e9b6d27cac7dbcb645991d6c7cdbf79bd88486fc1ac353084ce48e61081fb56e13d46
    CACHE STRING "expat source hash")

set(UNBOUND_VERSION 1.23.0 CACHE STRING "unbound version")
set(UNBOUND_MIRROR ${LOCAL_MIRROR} https://nlnetlabs.nl/downloads/unbound CACHE STRING "unbound download mirror(s)")
set(UNBOUND_SOURCE unbound-${UNBOUND_VERSION}.tar.gz)
set(UNBOUND_HASH SHA512=9b5ca48f4f5189f168f76396f5895f39262a4333e589f8c64bb9298a55c6266f626a4a4399370c68edd9f6318215a401146bf9e16a101c54decf623668a398af
    CACHE STRING "unbound source hash")

set(SQLITE3_VERSION 3500200 CACHE STRING "sqlite3 version")
set(SQLITE3_MIRROR ${LOCAL_MIRROR} https://www.sqlite.org/2025
    CACHE STRING "sqlite3 download mirror(s)")
set(SQLITE3_SOURCE sqlite-autoconf-${SQLITE3_VERSION}.tar.gz)
set(SQLITE3_HASH SHA3_256=e4d2b4332988f479ec032ccff00963a9bbd24a3a0f0222b4e249653fa680b4c0
  CACHE STRING "sqlite3 source hash")

set(SODIUM_VERSION 1.0.20 CACHE STRING "libsodium version")
set(SODIUM_MIRROR ${LOCAL_MIRROR}
  https://download.libsodium.org/libsodium/releases
  https://github.com/jedisct1/libsodium/releases/download/${SODIUM_VERSION}-RELEASE
  CACHE STRING "libsodium mirror(s)")
set(SODIUM_SOURCE libsodium-${SODIUM_VERSION}.tar.gz)
set(SODIUM_HASH SHA512=7ea165f3c1b1609790e30a16348b9dfdc5731302da00c07c65e125c8ab115c75419a5631876973600f8a4b560ca2c8267001770b68f2eb3eebc9ba095d312702
  CACHE STRING "libsodium source hash")

set(ZMQ_VERSION 4.3.5 CACHE STRING "libzmq version")
set(ZMQ_MIRROR ${LOCAL_MIRROR} https://github.com/zeromq/libzmq/releases/download/v${ZMQ_VERSION}
    CACHE STRING "libzmq mirror(s)")
set(ZMQ_SOURCE zeromq-${ZMQ_VERSION}.tar.gz)
set(ZMQ_HASH SHA512=a71d48aa977ad8941c1609947d8db2679fc7a951e4cd0c3a1127ae026d883c11bd4203cf315de87f95f5031aec459a731aec34e5ce5b667b8d0559b157952541
    CACHE STRING "libzmq source hash")

set(ZLIB_VERSION 1.3.1 CACHE STRING "zlib version")
set(ZLIB_MIRROR ${LOCAL_MIRROR} https://zlib.net
    CACHE STRING "zlib mirror(s)")
set(ZLIB_SOURCE zlib-${ZLIB_VERSION}.tar.xz)
set(ZLIB_HASH SHA256=38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32
  CACHE STRING "zlib source hash")

set(ZSTD_VERSION 1.5.7 CACHE STRING "zstd version")
set(ZSTD_MIRROR ${LOCAL_MIRROR} https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}
    CACHE STRING "zstd mirror(s)")
set(ZSTD_SOURCE zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_HASH SHA256=eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3
    CACHE STRING "zstd source hash")

include(ExternalProject)

set(DEPS_DESTDIR ${CMAKE_BINARY_DIR}/static-deps)
set(DEPS_SOURCEDIR ${CMAKE_BINARY_DIR}/static-deps-sources)

include_directories(BEFORE SYSTEM ${DEPS_DESTDIR}/include)

file(MAKE_DIRECTORY ${DEPS_DESTDIR}/include)

set(deps_cc "${CMAKE_C_COMPILER}")
set(deps_cxx "${CMAKE_CXX_COMPILER}")
if(CMAKE_C_COMPILER_LAUNCHER)
  set(deps_cc "${CMAKE_C_COMPILER_LAUNCHER} ${deps_cc}")
endif()
if(CMAKE_CXX_COMPILER_LAUNCHER)
  set(deps_cxx "${CMAKE_CXX_COMPILER_LAUNCHER} ${deps_cxx}")
endif()


function(expand_urls output source_file)
  set(expanded)
  foreach(mirror ${ARGN})
    list(APPEND expanded "${mirror}/${source_file}")
  endforeach()
  set(${output} "${expanded}" PARENT_SCOPE)
endfunction()


add_library(lokinet_static_deps INTERFACE)

function(add_static_target target ext_target libname)
  add_library(${target} STATIC IMPORTED GLOBAL)
  add_dependencies(${target} ${ext_target})
  target_link_libraries(lokinet_static_deps INTERFACE ${target})
  set_target_properties(${target} PROPERTIES
    IMPORTED_LOCATION ${DEPS_DESTDIR}/lib/${libname}
  )
  if (ARGN)
    target_link_libraries(${target} INTERFACE ${ARGN})
  endif()
endfunction()


set(cross_host "")
set(cross_rc "")
if(CMAKE_CROSSCOMPILING)
  set(cross_host "--host=${ARCH_TRIPLET}")
  if (ARCH_TRIPLET MATCHES mingw AND CMAKE_RC_COMPILER)
    set(cross_rc "WINDRES=${CMAKE_RC_COMPILER}")
  endif()
endif()
if(ANDROID)
  set(android_toolchain_suffix linux-android)
  set(android_compiler_suffix linux-android23)
  if(CMAKE_ANDROID_ARCH_ABI MATCHES x86_64)
    set(android_machine x86_64)
    set(cross_host "--host=x86_64-linux-android")
    set(android_compiler_prefix x86_64)
    set(android_compiler_suffix linux-android23)
    set(android_toolchain_prefix x86_64)
    set(android_toolchain_suffix linux-android)
  elseif(CMAKE_ANDROID_ARCH_ABI MATCHES x86)
    set(android_machine x86)
    set(cross_host "--host=i686-linux-android")
    set(android_compiler_prefix i686)
    set(android_compiler_suffix linux-android23)
    set(android_toolchain_prefix i686)
    set(android_toolchain_suffix linux-android)
  elseif(CMAKE_ANDROID_ARCH_ABI MATCHES armeabi-v7a)
    set(android_machine arm)
    set(cross_host "--host=armv7a-linux-androideabi")
    set(android_compiler_prefix armv7a)
    set(android_compiler_suffix linux-androideabi23)
    set(android_toolchain_prefix arm)
    set(android_toolchain_suffix linux-androideabi)
  elseif(CMAKE_ANDROID_ARCH_ABI MATCHES arm64-v8a)
    set(android_machine arm64)
    set(cross_host "--host=aarch64-linux-android")
    set(android_compiler_prefix aarch64)
    set(android_compiler_suffix linux-android23)
    set(android_toolchain_prefix aarch64)
    set(android_toolchain_suffix linux-android)
  else()
    message(FATAL_ERROR "unknown android arch: ${CMAKE_ANDROID_ARCH_ABI}")
  endif()
  set(deps_cc "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_compiler_prefix}-${android_compiler_suffix}-clang")
  set(deps_cxx "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_compiler_prefix}-${android_compiler_suffix}-clang++")
  set(deps_ld "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_compiler_prefix}-${android_toolchain_suffix}-ld")
  set(deps_ranlib "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_toolchain_prefix}-${android_toolchain_suffix}-ranlib")
  set(deps_ar "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${android_toolchain_prefix}-${android_toolchain_suffix}-ar")
endif()

set(deps_CFLAGS "-O2")
set(deps_CXXFLAGS "-O2")

if(WITH_LTO)
  set(deps_CFLAGS "${deps_CFLAGS} -flto")
endif()

if(APPLE)
  set(deps_CFLAGS "${deps_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
  set(deps_CXXFLAGS "${deps_CXXFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()

if(_winver)
  set(deps_CFLAGS "${deps_CFLAGS} -D_WIN32_WINNT=${_winver}")
  set(deps_CXXFLAGS "${deps_CXXFLAGS} -D_WIN32_WINNT=${_winver}")
endif()


if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
  set(_make $(MAKE))
else()
  set(_make make)
endif()


# Builds a target; takes the target name (e.g. "readline") and builds it in an external project with
# target name suffixed with `_external`.  Its upper-case value is used to get the download details
# (from the variables set above).  The following options are supported and passed through to
# ExternalProject_Add if specified.  If omitted, these defaults are used:
set(build_def_DEPENDS "")
set(build_def_PATCH_COMMAND "")
set(build_def_CONFIGURE_COMMAND ./configure ${cross_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic
    "CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}" "CXXFLAGS=${deps_CXXFLAGS}" ${cross_rc})
set(build_def_BUILD_COMMAND ${_make})
set(build_def_INSTALL_COMMAND ${_make} install)
set(build_def_BUILD_BYPRODUCTS ${DEPS_DESTDIR}/lib/lib___TARGET___.a ${DEPS_DESTDIR}/include/___TARGET___.h)

function(build_external target)
  set(options DEPENDS PATCH_COMMAND CONFIGURE_COMMAND BUILD_COMMAND INSTALL_COMMAND BUILD_BYPRODUCTS)
  cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "${options}")
  foreach(o ${options})
    if(NOT DEFINED arg_${o})
      set(arg_${o} ${build_def_${o}})
    endif()
  endforeach()
  string(REPLACE ___TARGET___ ${target} arg_BUILD_BYPRODUCTS "${arg_BUILD_BYPRODUCTS}")

  if(arg_CONFIGURE_COMMAND MATCHES "^DEFAULT_CMAKE")
      string(REGEX REPLACE "^DEFAULT_CMAKE(;?)" "CMAKE_ARGS;-DCMAKE_INSTALL_PREFIX=${DEPS_DESTDIR}\\1" configure "${arg_CONFIGURE_COMMAND}")
  else()
    set(configure CONFIGURE_COMMAND ${arg_CONFIGURE_COMMAND})
  endif()

  string(TOUPPER "${target}" prefix)
  expand_urls(urls ${${prefix}_SOURCE} ${${prefix}_MIRROR})
  ExternalProject_Add("${target}_external"
    DEPENDS ${arg_DEPENDS}
    BUILD_IN_SOURCE ON
    PREFIX ${DEPS_SOURCEDIR}
    URL ${urls}
    URL_HASH ${${prefix}_HASH}
    DOWNLOAD_NO_PROGRESS ON
    PATCH_COMMAND ${arg_PATCH_COMMAND}
    ${configure}
    BUILD_COMMAND ${arg_BUILD_COMMAND}
    INSTALL_COMMAND ${arg_INSTALL_COMMAND}
    BUILD_BYPRODUCTS ${arg_BUILD_BYPRODUCTS}
  )
endfunction()

if(NOT TARGET sodium)
  build_external(sodium CONFIGURE_COMMAND ./configure ${cross_host} ${cross_rc} --prefix=${DEPS_DESTDIR} --disable-shared
            --enable-static --with-pic "CC=${deps_cc}" "CFLAGS=${deps_CFLAGS}")
  add_static_target(sodium sodium_external libsodium.a)
endif()


if(LOKINET_PEERSTATS)
  build_external(sqlite3)
  add_static_target(sqlite3 sqlite3_external libsqlite3.a)
endif()


if(NOT TARGET libzstd::static)
  build_external(zstd
      CONFIGURE_COMMAND DEFAULT_CMAKE
        -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_TESTS=OFF -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_DICTBUILDER=OFF
      SOURCE_SUBDIR build/cmake
      BUILD_BYPRODUCTS
        ${DEPS_DESTDIR}/lib/libzstd.a
        ${DEPS_DESTDIR}/include/zstd.h
  )
  # Use the same libzstd::static target name as libsession-util so that we can use libsession's
  # static zstd if we are being built as part of libsession:
  add_static_target(libzstd::static zstd_external libzstd.a)
endif()


if(LOKINET_FULL)

  build_external(zlib
    CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env "CC=${deps_cc}" "CFLAGS=${deps_CFLAGS} -fPIC" ${cross_extra} ./configure --prefix=${DEPS_DESTDIR} --static
    BUILD_BYPRODUCTS
      ${DEPS_DESTDIR}/lib/libz.a
      ${DEPS_DESTDIR}/include/zlib.h
  )
  add_static_target(zlib zlib_external libz.a)

  build_external(expat
    CONFIGURE_COMMAND ./configure ${cross_host} --prefix=${DEPS_DESTDIR} --enable-static
    --disable-shared --with-pic --without-examples --without-tests --without-docbook --without-xmlwf
    "CC=${deps_cc}" "CFLAGS=${deps_CFLAGS}"
  )
  add_static_target(expat expat_external libexpat.a)


  if(WIN32)
    set(unbound_patch
      PATCH_COMMAND ${PROJECT_SOURCE_DIR}/contrib/apply-patches.sh
          ${PROJECT_SOURCE_DIR}/contrib/patches/unbound-delete-crash-fix.patch)
  endif()
  build_external(unbound
    DEPENDS nettle_external expat_external
    ${unbound_patch}
    CONFIGURE_COMMAND ./configure ${cross_host} ${cross_rc} --prefix=${DEPS_DESTDIR}
    --with-libunbound-only --disable-shared --enable-static
    --with-pic --$<IF:$<BOOL:${WITH_LTO}>,enable,disable>-flto
    --with-nettle=${DEPS_DESTDIR} --with-libexpat=${DEPS_DESTDIR}
    --without-ssl
    "CC=${deps_cc}" "CFLAGS=${deps_CFLAGS}" "LDFLAGS=${unbound_ldflags}"
  )
  add_static_target(libunbound unbound_external libunbound.a)
  if(NOT WIN32)
    set_target_properties(libunbound PROPERTIES INTERFACE_LINK_LIBRARIES "hogweed::hogweed;nettle::nettle")
  else()
    set_target_properties(libunbound PROPERTIES INTERFACE_LINK_LIBRARIES "hogweed::hogweed;nettle::nettle;ws2_32;crypt32;iphlpapi")
  endif()



  if(ARCH_TRIPLET MATCHES mingw)
    option(WITH_WEPOLL "use wepoll zmq poller (crashy)" OFF)
    if(WITH_WEPOLL)
      set(zmq_extra --with-poller=wepoll)
    endif()
  endif()


  build_external(zmq
    DEPENDS sodium_external
    CONFIGURE_COMMAND ./configure ${cross_host} --prefix=${DEPS_DESTDIR} --enable-static --disable-shared
      --disable-curve-keygen --enable-curve --disable-drafts --disable-libunwind --with-libsodium
      --without-pgm --without-norm --without-vmci --without-docs --with-pic --disable-Werror --disable-libbsd ${zmq_extra}
      "CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS} -fstack-protector" "CXXFLAGS=${deps_CXXFLAGS} -fstack-protector"
      "sodium_CFLAGS=-I${DEPS_DESTDIR}/include" "sodium_LIBS=-L${DEPS_DESTDIR}/lib -lsodium"
  )
  add_static_target(libzmq zmq_external libzmq.a)


  set(libzmq_link_libs "sodium")
  if(CMAKE_CROSSCOMPILING AND ARCH_TRIPLET MATCHES mingw)
    list(APPEND libzmq_link_libs iphlpapi)
  endif()

  set_target_properties(libzmq PROPERTIES
    INTERFACE_LINK_LIBRARIES "${libzmq_link_libs}"
    INTERFACE_COMPILE_DEFINITIONS "ZMQ_STATIC")

endif(LOKINET_FULL)


================================================
FILE: cmake/TargetArch.cmake
================================================
# Based on the Qt 5 processor detection code, so should be very accurate
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)

# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."

set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
    #if defined(__ARM_ARCH_7__) \\
        || defined(__ARM_ARCH_7A__) \\
        || defined(__ARM_ARCH_7R__) \\
        || defined(__ARM_ARCH_7M__) \\
        || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
        #error cmake_ARCH armv7
    #elif defined(__ARM_ARCH_6__) \\
        || defined(__ARM_ARCH_6J__) \\
        || defined(__ARM_ARCH_6T2__) \\
        || defined(__ARM_ARCH_6Z__) \\
        || defined(__ARM_ARCH_6K__) \\
        || defined(__ARM_ARCH_6ZK__) \\
        || defined(__ARM_ARCH_6M__) \\
        || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
        #error cmake_ARCH armv6
    #elif defined(__ARM_ARCH_5TEJ__) \\
        || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
        #error cmake_ARCH armv5
    #else
        #error cmake_ARCH arm
    #endif
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
    #error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
    #error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
    #error cmake_ARCH ia64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
      || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC)  \\
      || defined(_M_MPPC) || defined(_M_PPC)
    #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
        #error cmake_ARCH ppc64
    #else
        #error cmake_ARCH ppc
    #endif
#endif

#error cmake_ARCH unknown
")

# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple

function(target_architecture output_var)
    if(APPLE AND CMAKE_OSX_ARCHITECTURES)
        # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
        # First let's normalize the order of the values

        # Note that it's not possible to compile PowerPC applications if you are using
        # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
        # disable it by default
        # See this page for more information:
        # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4

        # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
        # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.

        foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
            if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
                set(osx_arch_ppc TRUE)
            elseif("${osx_arch}" STREQUAL "i386")
                set(osx_arch_i386 TRUE)
            elseif("${osx_arch}" STREQUAL "x86_64")
                set(osx_arch_x86_64 TRUE)
            elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
                set(osx_arch_ppc64 TRUE)
            else()
                message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
            endif()
        endforeach()

        # Now add all the architectures in our normalized order
        if(osx_arch_ppc)
            list(APPEND ARCH ppc)
        endif()

        if(osx_arch_i386)
            list(APPEND ARCH i386)
        endif()

        if(osx_arch_x86_64)
            list(APPEND ARCH x86_64)
        endif()

        if(osx_arch_ppc64)
            list(APPEND ARCH ppc64)
        endif()
    else()
        file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")

        enable_language(C)

        # Detect the architecture in a rather creative way...
        # This compiles a small C program which is a series of ifdefs that selects a
        # particular #error preprocessor directive whose message string contains the
        # target architecture. The program will always fail to compile (both because
        # file is not a valid C program, and obviously because of the presence of the
        # #error preprocessor directives... but by exploiting the preprocessor in this
        # way, we can detect the correct target architecture even when cross-compiling,
        # since the program itself never needs to be run (only the compiler/preprocessor)
        try_run(
            run_result_unused
            compile_result_unused
            "${CMAKE_BINARY_DIR}"
            "${CMAKE_BINARY_DIR}/arch.c"
            COMPILE_OUTPUT_VARIABLE ARCH
            CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
        )

        # Parse the architecture name from the compiler output
        string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")

        # Get rid of the value marker leaving just the architecture name
        string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")

        # If we are compiling with an unknown architecture this variable should
        # already be set to "unknown" but in the case that it's empty (i.e. due
        # to a typo in the code), then set it to unknown
        if (NOT ARCH)
            set(ARCH unknown)
        endif()
    endif()

    set(${output_var} "${ARCH}" PARENT_SCOPE)
endfunction()


================================================
FILE: cmake/Version.cmake
================================================
# We do this via a custom command that re-invokes a cmake script because we need the DEPENDS on .git/index so that we will re-run it (to regenerate the commit tag in the version) whenever the current commit changes. If we used a configure_file directly here, it would only re-run when something else causes cmake to re-run.

if(LOKINET_VERSIONTAG)
  set(VERSIONTAG "${LOKINET_VERSIONTAG}")
  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
else()
  set(VERSIONTAG "${GIT_VERSION}")
  set(GIT_INDEX_FILE "${PROJECT_SOURCE_DIR}/.git/index")
  find_package(Git)
  if(EXISTS "${GIT_INDEX_FILE}" AND ( GIT_FOUND OR Git_FOUND) )
      message(STATUS "Found Git: ${GIT_EXECUTABLE}")
      set(genversion_args "-DGIT=${GIT_EXECUTABLE}")
      foreach(v lokinet_VERSION lokinet_VERSION_MAJOR lokinet_VERSION_MINOR lokinet_VERSION_PATCH RELEASE_MOTTO)
          list(APPEND genversion_args "-D${v}=${${v}}")
      endforeach()

      add_custom_command(
          OUTPUT            "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp"
          COMMAND           "${CMAKE_COMMAND}"
          ${genversion_args}
          "-D" "SRC=${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in"
          "-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"
          "${GIT_INDEX_FILE}")
  else()
    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/constants/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp" @ONLY)
  endif()
endif()


if(WIN32)
  foreach(exe IN ITEMS lokinet lokinet-vpn lokinet-bootstrap)
    set(lokinet_EXE_NAME "${exe}.exe")
    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/win32/version.rc.in" "${CMAKE_BINARY_DIR}/${exe}.rc" @ONLY)
    set_property(SOURCE "${CMAKE_BINARY_DIR}/${exe}.rc" PROPERTY GENERATED 1)
  endforeach()
endif()

add_custom_target(genversion_cpp DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/constants/version.cpp")
if(WIN32)
  add_custom_target(genversion_rc DEPENDS "${CMAKE_BINARY_DIR}/lokinet.rc" "${CMAKE_BINARY_DIR}/lokinet-vpn.rc" "${CMAKE_BINARY_DIR}/lokinet-bootstrap.rc")
else()
  add_custom_target(genversion_rc)
endif()
add_custom_target(genversion DEPENDS genversion_cpp genversion_rc)


================================================
FILE: cmake/add_import_library.cmake
================================================
function(add_import_library libname)
  add_library(libname SHARED IMPORTED)
  if(NOT TARGET libname)
    message(FATAL "unable to find library ${libname}")
  endif()
endfunction()


================================================
FILE: cmake/cmake_uninstall.cmake.in
================================================
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif()

file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
    exec_program(
      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
      OUTPUT_VARIABLE rm_out
      RETURN_VALUE rm_retval
      )
    if(NOT "${rm_retval}" STREQUAL 0)
      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
    endif()
  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
  endif()
endforeach()


================================================
FILE: cmake/coverage.cmake
================================================
if (LOKINET_COVERAGE)
  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    add_compile_options( -fprofile-instr-generate -fcoverage-mapping )
    link_libraries( -fprofile-instr-generate )
  else()
    add_compile_options( --coverage -g0 )
    link_libraries( --coverage )
  endif()
endif()


================================================
FILE: cmake/cross_compile.cmake
================================================
# dynamic linking does this all the time
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  option(NO_LIBGCC "use libunwind+compiler-rt instead, must already be installed in mingw-w64 sysroot" OFF)
  add_compile_options(-Wno-unused-command-line-argument -Wno-c++11-narrowing)
  add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
  if (NO_LIBGCC)
    find_library(UNWIND_LIB unwind)
    link_libraries(${UNWIND_LIB})
    find_library(PSAPI_LIB psapi)
    link_libraries(${PSAPI_LIB})
  endif(NO_LIBGCC)
else()
  # found it. this is GNU only
  add_compile_options(-Wno-cast-function-type)
endif()


================================================
FILE: cmake/enable_lto.cmake
================================================
# -flto
include(CheckIPOSupported)
option(WITH_LTO "enable lto on compile time" ON)
if(WITH_LTO)
  if(WIN32)
    message(FATAL_ERROR "LTO not supported on win32 targets, please set -DWITH_LTO=OFF")
  endif()
  check_ipo_supported(RESULT IPO_ENABLED OUTPUT ipo_error)
  if(IPO_ENABLED)
    message(STATUS "LTO enabled")
  else()
    message(WARNING "LTO not supported by compiler: ${ipo_error}")
  endif()
else()
  message(STATUS "LTO disabled")
  set(IPO_ENABLED OFF)
endif()

function(enable_lto)
  if(IPO_ENABLED)
    set_target_properties(${ARGN} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
  endif()
endfunction()


================================================
FILE: cmake/gui-option.cmake
================================================
set(default_build_gui OFF)
if(LOKINET_DAEMON AND (APPLE OR WIN32))
  set(default_build_gui ON)
endif()

if(WIN32)
  set(GUI_EXE "" CACHE FILEPATH "path to a pre-built Windows GUI .exe to use (implies -DLOKINET_GUI=OFF)")
  if(GUI_EXE)
    set(default_build_gui OFF)
  endif()
endif()

option(LOKINET_GUI "build electron gui from 'gui' submodule source" ${default_build_gui})

if(LOKINET_GUI AND GUI_EXE)
  message(FATAL_ERROR "-DGUI_EXE=... and -DLOKINET_GUI=ON are mutually exclusive")
endif()


================================================
FILE: cmake/gui.cmake
================================================

if(WIN32 AND GUI_EXE)
  message(STATUS "using pre-built lokinet gui executable: ${GUI_EXE}")
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${GUI_EXE}" "${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe")
elseif(LOKINET_GUI)
  message(STATUS "Building lokinet-gui from source")

  set(default_gui_target pack)
  if(APPLE)
    set(default_gui_target macos:raw)
  elseif(WIN32)
    set(default_gui_target win32)
  endif()

  set(GUI_YARN_TARGET "${default_gui_target}" CACHE STRING "yarn target for building the GUI")
  set(GUI_YARN_EXTRA_OPTS "" CACHE STRING "extra options to pass into the yarn build command")

  # allow manually specifying yarn with -DYARN=
  if(NOT YARN)
    find_program(YARN NAMES yarnpkg yarn REQUIRED)
  endif()
  message(STATUS "Building lokinet-gui with yarn ${YARN}, target ${GUI_YARN_TARGET}")

  if(NOT WIN32)
    add_custom_target(lokinet-gui
      COMMAND ${YARN} install --frozen-lockfile &&
      ${YARN} ${GUI_YARN_EXTRA_OPTS} ${GUI_YARN_TARGET}
      WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/gui")
  endif()

  if(APPLE)
    add_custom_target(assemble_gui ALL
      DEPENDS assemble lokinet-gui
      COMMAND mkdir "${lokinet_app}/Contents/Helpers"
      COMMAND cp -a "${PROJECT_SOURCE_DIR}/gui/release/mac/Lokinet-GUI.app" "${lokinet_app}/Contents/Helpers/"
      COMMAND mkdir -p "${lokinet_app}/Contents/Resources/en.lproj"
      COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${lokinet_app}/Contents/Resources/en.lproj/"
      COMMAND cp "${lokinet_app}/Contents/Resources/icon.icns" "${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/icon.icns"
      COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/en.lproj/"
      COMMAND /usr/libexec/PlistBuddy
      -c "Delete :CFBundleDisplayName"
      -c "Add :LSHasLocalizedDisplayName bool true"
      -c "Add :CFBundleDevelopmentRegion string en"
      -c "Set :CFBundleShortVersionString ${lokinet_VERSION}"
      -c "Set :CFBundleVersion ${lokinet_VERSION}.${LOKINET_APPLE_BUILD}"
      "${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Info.plist"
    )
  elseif(WIN32)
    file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/gui")
    add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe"
      COMMAND ${YARN} install --frozen-lockfile &&
      USE_SYSTEM_7ZA=true DISPLAY= WINEDEBUG=-all WINEPREFIX="${PROJECT_BINARY_DIR}/wineprefix" ${YARN} ${GUI_YARN_EXTRA_OPTS} ${GUI_YARN_TARGET}
      COMMAND ${CMAKE_COMMAND} -E copy_if_different
      "${PROJECT_SOURCE_DIR}/gui/release/Lokinet-GUI_portable.exe"
      "${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe"
      WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/gui")
    add_custom_target(assemble_gui ALL COMMAND "true" DEPENDS "${PROJECT_BINARY_DIR}/gui/lokinet-gui.exe")
  else()
    message(FATAL_ERROR "Building/bundling the GUI from this repository is not supported on this platform")
  endif()
else()
  message(STATUS "not building gui")
endif()

if(NOT TARGET assemble_gui)
  add_custom_target(assemble_gui COMMAND "true")
endif()


================================================
FILE: cmake/installer.cmake
================================================
set(CPACK_PACKAGE_VENDOR "lokinet.org")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://lokinet.org/")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/contrib/readme-installer.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")

if(WIN32)
  include(cmake/win32_installer_deps.cmake)
  install(FILES ${CMAKE_SOURCE_DIR}/contrib/configs/00-exit.ini DESTINATION share/conf.d COMPONENT exit_configs)
  install(FILES ${CMAKE_SOURCE_DIR}/contrib/configs/00-keyfile.ini DESTINATION share/conf.d COMPONENT keyfile_configs)
  install(FILES ${CMAKE_SOURCE_DIR}/contrib/configs/00-debug-log.ini DESTINATION share/conf.d COMPONENT debug_configs)
  get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
  list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified" "lokinet" "gui" "exit_configs" "keyfile_configs" "debug_configs")
  list(APPEND CPACK_COMPONENTS_ALL "lokinet" "gui" "exit_configs" "keyfile_configs" "debug_configs")
elseif(APPLE)
  set(CPACK_GENERATOR DragNDrop;ZIP)
  get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
  list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified")
endif()

include(CPack)

if(WIN32)
  cpack_add_component(lokinet
    DISPLAY_NAME "lokinet"
    DESCRIPTION "core required lokinet files"
    REQUIRED)

  cpack_add_component(gui
    DISPLAY_NAME "lokinet gui"
    DESCRIPTION "electron based control panel for lokinet")

  cpack_add_component(exit_configs
    DISPLAY_NAME "auto-enable exit"
    DESCRIPTION "automatically enable usage of exit.loki as an exit node\n"
    DISABLED)

  cpack_add_component(keyfile_configs
    DISPLAY_NAME "persist address"
    DESCRIPTION "persist .loki address across restarts of lokinet\nnot recommended when enabling exit nodes"
    DISABLED)

  cpack_add_component(debug_configs
    DISPLAY_NAME "debug logging"
    DESCRIPTION "enable debug spew log level by default"
    DISABLED)
endif()


================================================
FILE: cmake/libatomic.cmake
================================================
function(check_working_cxx_atomics64 varname)
  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
  if (EMBEDDED_CFG)
    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -m32 -march=i486")
  elseif(MSVC OR MSVC_VERSION)
    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -arch:IA32 -std:c++14")
  else()
  # CMAKE_CXX_STANDARD does not propagate to cmake compile tests
    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++14")
  endif()
  check_cxx_source_compiles("
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
  uint64_t i = x.load(std::memory_order_relaxed);
  return 0;
}
" ${varname})
  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
endfunction()

function(link_libatomic)
  check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)

  if(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
    message(STATUS "Have working 64bit atomics")
    return()
  endif()

  if (NOT MSVC AND NOT MSVC_VERSION)
    check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
    if (HAVE_CXX_LIBATOMICS64)
      message(STATUS "Have 64bit atomics via library")
      list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
      check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
      if (HAVE_CXX_ATOMICS64_WITH_LIB)
        message(STATUS "Can link with libatomic")
        link_libraries(-latomic)
        return()
      endif()
    endif()
  endif()
  if (MSVC OR MSVC_VERSION)
    message(FATAL_ERROR "Host compiler must support 64-bit std::atomic! (What does MSVC do to inline atomics?)")
  else()
    message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
  endif()
endfunction()


================================================
FILE: cmake/macos.cmake
================================================
if((NOT APPLE) OR NOT LOKINET_DAEMON)
  return()
endif()


option(MACOS_SYSTEM_EXTENSION
  "Build the network extension as a system extension rather than a plugin.  This must be ON for non-app store release builds, and must be OFF for dev builds and Mac App Store distribution builds"
  OFF)
option(CODESIGN "codesign the resulting app and extension" ON)
set(CODESIGN_ID "" CACHE STRING "codesign the macos app using this key identity; if empty we'll try to guess")
set(default_profile_type "dev")
if(MACOS_SYSTEM_EXTENSION)
  set(default_profile_type "release")
endif()
set(CODESIGN_PROFILE "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet.${default_profile_type}.provisionprofile" CACHE FILEPATH
  "Path to a .provisionprofile to use for the main app")
set(CODESIGN_EXT_PROFILE "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet-extension.${default_profile_type}.provisionprofile" CACHE FILEPATH
  "Path to a .provisionprofile to use for the lokinet extension")

if(CODESIGN AND NOT CODESIGN_ID)
  if(MACOS_SYSTEM_EXTENSION)
    set(codesign_cert_pattern "Developer ID Application")
  else()
    set(codesign_cert_pattern "Apple Development")
  endif()
  execute_process(
    COMMAND security find-identity -v -p codesigning
    COMMAND sed -n "s/^ *[0-9][0-9]*)  *\\([A-F0-9]\\{40\\}\\)  *\"\\(${codesign_cert_pattern}.*\\)\"\$/\\1 \\2/p"
    RESULT_VARIABLE find_id_exit_code
    OUTPUT_VARIABLE find_id_output)
  if(NOT find_id_exit_code EQUAL 0)
    message(FATAL_ERROR "Finding signing identities with security find-identity failed; try specifying an id using -DCODESIGN_ID=...")
  endif()

  string(REGEX MATCHALL "(^|\n)[0-9A-F]+" find_id_sign_id "${find_id_output}")
  if(NOT find_id_sign_id)
    message(FATAL_ERROR "Did not find any \"${codesign_cert_pattern}\" identity; try specifying an id using -DCODESIGN_ID=...")
  endif()
  if (find_id_sign_id MATCHES ";")
    message(FATAL_ERROR "Found multiple \"${codesign_cert_pattern}\" identities:\n${find_id_output}\nSpecify an identify using -DCODESIGN_ID=...")
  endif()
  set(CODESIGN_ID "${find_id_sign_id}" CACHE STRING "" FORCE)
endif()

if(CODESIGN)
  message(STATUS "Codesigning using ${CODESIGN_ID}")

  if (NOT MACOS_NOTARIZE_USER AND NOT MACOS_NOTARIZE_PASS AND NOT MACOS_NOTARIZE_ASC AND EXISTS "$ENV{HOME}/.notarization.cmake")
    message(STATUS "Loading notarization info from ~/.notarization.cmake")
    include("$ENV{HOME}/.notarization.cmake")
  endif()

  if (MACOS_NOTARIZE_USER AND MACOS_NOTARIZE_PASS AND MACOS_NOTARIZE_ASC)
    message(STATUS "Enabling notarization with account ${MACOS_NOTARIZE_ASC}/${MACOS_NOTARIZE_USER}")
  else()
    message(WARNING "You have not set one or more of MACOS_NOTARIZE_USER, MACOS_NOTARIZE_PASS, MACOS_NOTARIZE_ASC: notarization will fail; see contrib/macos/README.txt")
  endif()

else()
  message(WARNING "Codesigning disabled; the resulting build will not run on most macOS systems")
endif()


foreach(prof IN ITEMS CODESIGN_PROFILE CODESIGN_EXT_PROFILE)
  if(NOT ${prof})
    message(WARNING "Missing a ${prof} provisioning profile: Apple will most likely log an uninformative error message to the system log and then kill harmless kittens if you try to run the result")
  elseif(NOT EXISTS "${${prof}}")
    message(FATAL_ERROR "Provisioning profile ${${prof}} does not exist; fix your -D${prof} path")
  endif()
endforeach()
message(STATUS "Using ${CODESIGN_PROFILE} app provisioning profile")
message(STATUS "Using ${CODESIGN_EXT_PROFILE} extension provisioning profile")



set(lokinet_installer "${PROJECT_BINARY_DIR}/Lokinet ${PROJECT_VERSION}")
if(NOT CODESIGN)
  set(lokinet_installer "${lokinet_installer}-UNSIGNED")
endif()
set(lokinet_app "${lokinet_installer}/Lokinet.app")


if(MACOS_SYSTEM_EXTENSION)
  set(lokinet_ext_dir Contents/Library/SystemExtensions)
else()
  set(lokinet_ext_dir Contents/PlugIns)
endif()

if(CODESIGN)
  if(MACOS_SYSTEM_EXTENSION)
    set(LOKINET_ENTITLEMENTS_TYPE sysext)
    set(notarize_py_is_sysext True)
  else()
    set(LOKINET_ENTITLEMENTS_TYPE plugin)
    set(notarize_py_is_sysext False)
  endif()

  configure_file(
    "${PROJECT_SOURCE_DIR}/contrib/macos/sign.sh.in"
    "${PROJECT_BINARY_DIR}/sign.sh"
    @ONLY)

  add_custom_target(
    sign
    DEPENDS "${PROJECT_BINARY_DIR}/sign.sh"
    COMMAND "${PROJECT_BINARY_DIR}/sign.sh"
    )

  if(MACOS_NOTARIZE_USER AND MACOS_NOTARIZE_PASS AND MACOS_NOTARIZE_ASC)
    configure_file(
      "${PROJECT_SOURCE_DIR}/contrib/macos/notarize.py.in"
      "${PROJECT_BINARY_DIR}/notarize.py"
      @ONLY)
    add_custom_target(
      notarize
      DEPENDS "${PROJECT_BINARY_DIR}/notarize.py" sign
      COMMAND "${PROJECT_BINARY_DIR}/notarize.py"
      )
  else()
    message(WARNING "You have not set one or more of MACOS_NOTARIZE_USER, MACOS_NOTARIZE_PASS, MACOS_NOTARIZE_ASC: notarization disabled")
  endif()
else()
  add_custom_target(sign COMMAND "true")
  add_custom_target(notarize DEPENDS sign COMMAND "true")
endif()

set(mac_icon "${PROJECT_BINARY_DIR}/lokinet.icns")
add_custom_command(OUTPUT "${mac_icon}"
  COMMAND ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg "${mac_icon}"
  DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh)
add_custom_target(icon DEPENDS "${mac_icon}")

if(LOKINET_PACKAGE)
  add_executable(seticon "${PROJECT_SOURCE_DIR}/contrib/macos/seticon.swift")
  add_custom_command(OUTPUT "${lokinet_installer}.dmg"
    DEPENDS notarize seticon
    COMMAND create-dmg
      --volname "Lokinet ${PROJECT_VERSION}"
      --volicon lokinet.icns
      --background "${PROJECT_SOURCE_DIR}/contrib/macos/installer.tiff"
      --text-size 16
      --icon-size 128
      --window-size 555 440
      --icon Lokinet.app 151 196
      --hide-extension Lokinet.app
      --app-drop-link 403 196
      --eula "${PROJECT_SOURCE_DIR}/LICENSE"
      --no-internet-enable
      "${lokinet_installer}.dmg"
      "${lokinet_installer}"
      COMMAND ./seticon lokinet.icns "${lokinet_installer}.dmg"
  )
  add_custom_target(dmg DEPENDS "${lokinet_installer}.dmg")
endif()


# Called later to set things up, after the main lokinet targets are set up
function(macos_target_setup)

  if(NOT LOKINET_DAEMON)
    return()
  endif()

  if(MACOS_SYSTEM_EXTENSION)
    target_compile_definitions(lokinet PRIVATE MACOS_SYSTEM_EXTENSION)
  endif()

  set_target_properties(lokinet
    PROPERTIES
    OUTPUT_NAME Lokinet
    MACOSX_BUNDLE TRUE
    MACOSX_BUNDLE_INFO_STRING "Lokinet IP Packet Onion Router"
    MACOSX_BUNDLE_BUNDLE_NAME "Lokinet"
    MACOSX_BUNDLE_BUNDLE_VERSION "${lokinet_VERSION}"
    MACOSX_BUNDLE_LONG_VERSION_STRING "${lokinet_VERSION}"
    MACOSX_BUNDLE_SHORT_VERSION_STRING "${lokinet_VERSION_MAJOR}.${lokinet_VERSION_MINOR}"
    MACOSX_BUNDLE_GUI_IDENTIFIER "org.lokinet"
    MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet.Info.plist.in"
    MACOSX_BUNDLE_COPYRIGHT "© 2022, The Oxen Project"
  )

  add_custom_target(copy_bootstrap
    DEPENDS lokinet-extension
    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed
      $<TARGET_BUNDLE_DIR:lokinet-extension>/Contents/Resources/bootstrap.signed
  )


  add_dependencies(lokinet lokinet-extension icon)


  if(CODESIGN_PROFILE)
    add_custom_target(copy_prov_prof
      DEPENDS lokinet
      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CODESIGN_PROFILE}
        $<TARGET_BUNDLE_DIR:lokinet>/Contents/embedded.provisionprofile
    )
  else()
    add_custom_target(copy_prov_prof COMMAND true)
  endif()

  add_custom_target(assemble ALL
    DEPENDS lokinet lokinet-extension icon copy_prov_prof copy_bootstrap
    COMMAND rm -rf "${lokinet_app}"
    COMMAND mkdir -p "${lokinet_installer}"
    COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet> "${lokinet_app}"
    COMMAND mkdir -p "${lokinet_app}/${lokinet_ext_dir}"
    COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet-extension> "${lokinet_app}/${lokinet_ext_dir}/"
    COMMAND mkdir -p "${lokinet_app}/Contents/Resources"
    COMMAND cp -a "${mac_icon}" "${lokinet_app}/Contents/Resources/icon.icns"
  )

  if(LOKINET_GUI)
    add_dependencies(sign assemble_gui)
  else()
    add_dependencies(sign assemble)
  endif()
endfunction()


================================================
FILE: cmake/ngtcp2_lib.cmake
================================================
# ngtcp2's top-level CMakeLists.txt loads a bunch of crap we don't want (examples, a conflicting
# 'check' target, etc.); instead we directly include it's lib subdirectory to build just the
# library, but we have to set up a couple things to make that work:
function(add_ngtcp2_lib)
  file(STRINGS ngtcp2/CMakeLists.txt ngtcp2_project_line REGEX "^project\\(ngtcp2 ")
  if(NOT ngtcp2_project_line MATCHES "^project\\(ngtcp2 VERSION ([0-9]+)\\.([0-9]+)\\.([0-9]+)\\)$")
    message(FATAL_ERROR "Unable to extract ngtcp2 version from ngtcp2/CMakeLists.txt (found '${ngtcp2_project_line}')")
  endif()

  set(PACKAGE_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
  include(ngtcp2/cmake/Version.cmake)
  HexVersion(PACKAGE_VERSION_NUM ${CMAKE_MATCH_1} ${CMAKE_MATCH_2} ${CMAKE_MATCH_3})
  configure_file("ngtcp2/lib/includes/ngtcp2/version.h.in" "ngtcp2/lib/includes/ngtcp2/version.h" @ONLY)

  set(BUILD_SHARED_LIBS OFF)

  # Checks for header files.
  include(CheckIncludeFile)
  check_include_file("arpa/inet.h"   HAVE_ARPA_INET_H)
  check_include_file("netinet/in.h"  HAVE_NETINET_IN_H)
  check_include_file("stddef.h"      HAVE_STDDEF_H)
  check_include_file("stdint.h"      HAVE_STDINT_H)
  check_include_file("stdlib.h"      HAVE_STDLIB_H)
  check_include_file("string.h"      HAVE_STRING_H)
  check_include_file("unistd.h"      HAVE_UNISTD_H)
  check_include_file("sys/endian.h"  HAVE_SYS_ENDIAN_H)
  check_include_file("endian.h"      HAVE_ENDIAN_H)
  check_include_file("byteswap.h"    HAVE_BYTESWAP_H)

  include(CheckTypeSize)
  check_type_size("ssize_t" SIZEOF_SSIZE_T)
  if(SIZEOF_SSIZE_T STREQUAL "")
    set(ssize_t ptrdiff_t)
  endif()

  include(CheckSymbolExists)
  if(HAVE_ENDIAN_H)
    check_symbol_exists(be64toh "endian.h" HAVE_BE64TOH)
  endif()
  if(NOT HAVE_BE64TO AND HAVE_SYS_ENDIAN_H)
    check_symbol_exists(be64toh "sys/endian.h" HAVE_BE64TOH)
  endif()

  check_symbol_exists(bswap_64 "byteswap.h" HAVE_BSWAP_64)

  configure_file(ngtcp2/cmakeconfig.h.in ngtcp2/config.h)
  include_directories("${CMAKE_CURRENT_BINARY_DIR}/ngtcp2") # for config.h
  set(ENABLE_STATIC_LIB ON FORCE BOOL)
  set(ENABLE_SHARED_LIB OFF FORCE BOOL)
  add_subdirectory(ngtcp2/lib EXCLUDE_FROM_ALL)

  target_compile_definitions(ngtcp2_static PRIVATE -DHAVE_CONFIG_H -D_GNU_SOURCE)
endfunction()


================================================
FILE: cmake/solaris.cmake
================================================
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
  set(SOLARIS ON)
  set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lsocket -lnsl")
  add_definitions(-D_POSIX_PTHREAD_SEMANTICS)
endif()


================================================
FILE: cmake/target_link_libraries_system.cmake
================================================
# This adds a dependency as a "system" dep - e.g -isystem
function(target_link_libraries_system target)
  set(libs ${ARGN})
  foreach(lib ${libs})
    get_target_property(lib_include_dirs ${lib} INTERFACE_INCLUDE_DIRECTORIES)
    target_include_directories(${target} SYSTEM PUBLIC ${lib_include_dirs})
    target_link_libraries(${target} PUBLIC ${lib})
  endforeach(lib)
endfunction()


================================================
FILE: cmake/unix.cmake
================================================
if(NOT ANDROID)
  if(NOT UNIX)
    return()
  endif()
endif()

include(CheckCXXSourceCompiles)
include(CheckLibraryExists)

add_definitions(-DUNIX)
add_definitions(-DPOSIX)

if(EMBEDDED_CFG OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  link_libatomic()
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
  add_definitions(-D_BSD_SOURCE)
  add_definitions(-D_GNU_SOURCE)
  add_definitions(-D_XOPEN_SOURCE=700)
endif()


================================================
FILE: cmake/win32.cmake
================================================
if(NOT WIN32)
  return()
endif()
if (NOT STATIC_LINK)
  message(FATAL_ERROR "windows requires static builds (thanks balmer)")
endif()

enable_language(RC)

option(WITH_WINDOWS_32 "build 32 bit windows" OFF)

# unlike unix where you get a *single* compiler ID string in .comment
# GNU ld sees fit to merge *all* the .ident sections in object files
# to .r[o]data section one after the other!
add_compile_options(-fno-ident -Wa,-mbig-obj)

function(expand_urls output source_file)
  set(expanded)
  foreach(mirror ${ARGN})
    list(APPEND expanded "${mirror}/${source_file}")
  endforeach()
  set(${output} "${expanded}" PARENT_SCOPE)
endfunction()

function(add_static_target target ext_target libname)
  add_library(${target} STATIC IMPORTED GLOBAL)
  add_dependencies(${target} ${ext_target})
  set_target_properties(${target} PROPERTIES
    IMPORTED_LOCATION ${DEPS_DESTDIR}/lib/${libname}
  )
endfunction()

if(EMBEDDED_CFG)
  link_libatomic()
endif()

set(WINTUN_VERSION 0.14.1 CACHE STRING "wintun version")
set(WINTUN_MIRROR ${LOCAL_MIRROR} https://www.wintun.net/builds
  CACHE STRING "wintun mirror(s)")
set(WINTUN_SOURCE wintun-${WINTUN_VERSION}.zip)
set(WINTUN_HASH SHA256=07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51
  CACHE STRING "wintun source hash")

set(WINDIVERT_VERSION 2.2.2-A CACHE STRING "windivert version")
set(WINDIVERT_MIRROR ${LOCAL_MIRROR} https://reqrypt.org/download
  CACHE STRING "windivert mirror(s)")
set(WINDIVERT_SOURCE WinDivert-${WINDIVERT_VERSION}.zip)
set(WINDIVERT_HASH SHA512=92eb2ef98ced175d44de1cdb7c52f2ebc534b6a997926baeb83bfe94cba9287b438f796aff11f6163918bcdbc25bcd4e3383715f139f690d207ce219f846a345
  CACHE STRING "windivert source hash")

expand_urls(WINTUN_URL ${WINTUN_SOURCE} ${WINTUN_MIRROR})
expand_urls(WINDIVERT_URL ${WINDIVERT_SOURCE} ${WINDIVERT_MIRROR})

message(STATUS "Downloading wintun from ${WINTUN_URL}")
file(DOWNLOAD ${WINTUN_URL} ${CMAKE_BINARY_DIR}/wintun.zip EXPECTED_HASH ${WINTUN_HASH})
message(STATUS "Downloading windivert from ${WINDIVERT_URL}")
file(DOWNLOAD ${WINDIVERT_URL} ${CMAKE_BINARY_DIR}/windivert.zip EXPECTED_HASH ${WINDIVERT_HASH})

execute_process(COMMAND ${CMAKE_COMMAND} -E tar x ${CMAKE_BINARY_DIR}/wintun.zip
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

execute_process(COMMAND ${CMAKE_COMMAND} -E tar x ${CMAKE_BINARY_DIR}/windivert.zip
  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})


================================================
FILE: cmake/win32_installer_deps.cmake
================================================
install(DIRECTORY ${CMAKE_BINARY_DIR}/gui DESTINATION share COMPONENT gui)

if(WITH_WINDOWS_32)
  install(FILES ${CMAKE_BINARY_DIR}/wintun/bin/x86/wintun.dll DESTINATION bin COMPONENT lokinet)
  install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x86/WinDivert.sys DESTINATION lib COMPONENT lokinet)
  install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x86/WinDivert.dll DESTINATION bin COMPONENT lokinet)
else()
  install(FILES ${CMAKE_BINARY_DIR}/wintun/bin/amd64/wintun.dll DESTINATION bin COMPONENT lokinet)
  install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x64/WinDivert64.sys DESTINATION lib COMPONENT lokinet)
  install(FILES ${CMAKE_BINARY_DIR}/WinDivert-${WINDIVERT_VERSION}/x64/WinDivert.dll DESTINATION bin COMPONENT lokinet)
endif()

set(BOOTSTRAP_FILE "${PROJECT_SOURCE_DIR}/contrib/bootstrap/mainnet.signed")
install(FILES ${BOOTSTRAP_FILE} DESTINATION share COMPONENT lokinet RENAME bootstrap.signed)

set(win_ico "${PROJECT_BINARY_DIR}/lokinet.ico")
add_custom_command(OUTPUT "${win_ico}"
  COMMAND ${PROJECT_SOURCE_DIR}/contrib/make-ico.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg "${win_ico}"
  DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg ${PROJECT_SOURCE_DIR}/contrib/make-ico.sh)
add_custom_target(icon ALL DEPENDS "${win_ico}")

set(CPACK_PACKAGE_INSTALL_DIRECTORY "Lokinet")
set(CPACK_NSIS_MUI_ICON "${PROJECT_BINARY_DIR}/lokinet.ico")
set(CPACK_NSIS_DEFINES "RequestExecutionLevel admin")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)

function(read_nsis_file filename outvar)
  file(STRINGS "${filename}" _outvar)
  list(TRANSFORM _outvar REPLACE "\\\\" "\\\\\\\\")
  list(JOIN _outvar "\\n" out)
  set(${outvar} ${out} PARENT_SCOPE)
endfunction()

read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_preinstall.nsis" _extra_preinstall)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_install.nsis" _extra_install)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_uninstall.nsis" _extra_uninstall)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_create_icons.nsis" _extra_create_icons)
read_nsis_file("${CMAKE_SOURCE_DIR}/win32-setup/extra_delete_icons.nsis" _extra_delete_icons)

set(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "${_extra_preinstall}")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${_extra_install}")
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${_extra_uninstall}")
set(CPACK_NSIS_CREATE_ICONS_EXTRA "${_extra_create_icons}")
set(CPACK_NSIS_DELETE_ICONS_EXTRA "${_extra_delete_icons}")

set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")


================================================
FILE: contrib/NetworkManager/dnsmasq/README.md
================================================
Place in `/etc/NetworkManager/dnsmasq.d/lokinet.conf`.

To make use of this, first install dnsmasq.

Then enable NetworkManager dnsmasq backend by editing `/etc/NetworkManager/NetworkManager.conf` to something like:
```
[main]
dns=dnsmasq
```
If NetworkManager is currently running, restart it for changes to take effect:
```
sudo systemctl restart NetworkManager
```


================================================
FILE: contrib/NetworkManager/dnsmasq/lokinet.conf
================================================
server=/loki/snode/127.3.2.1


================================================
FILE: contrib/android-configure.sh
================================================
#!/bin/bash
set -e

default_abis="armeabi-v7a arm64-v8a x86_64"
build_abis=${ABIS:-$default_abis}

test x$NDK = x && test -e /usr/lib/android-ndk && export NDK=/usr/lib/android-ndk
test x$NDK = x && exit 1

echo "building abis: $build_abis"

root=$(readlink -f "$1")
shift
build=$(readlink -f "$1")
shift
mkdir -p $build
cd $build

for abi in $build_abis; do
    mkdir -p build-$abi
    cd build-$abi
    cmake \
        -S "$root" -B . \
        -G 'Unix Makefiles' \
        -DANDROID=ON \
        -DANDROID_ABI=$abi \
        -DANDROID_ARM_MODE=arm \
        -DANDROID_PLATFORM=android-23 \
        -DANDROID_API=23 \
        -DANDROID_STL=c++_static \
        -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
        -DBUILD_STATIC_DEPS=ON \
        -DLOKINET_PACKAGE=ON \
        -DBUILD_SHARED_LIBS=OFF \
        -DBUILD_TESTING=OFF \
        -DLOKINET_TESTS=OFF \
        -DLOKINET_BOOTSTRAP=OFF \
        -DLOKINET_NATIVE_BUILD=OFF \
        -DSTATIC_LINK=ON \
        -DWITH_SYSTEMD=OFF \
        -DFORCE_OXENMQ_SUBMODULE=ON \
        -DFORCE_OXENC_SUBMODULE=ON \
        -DFORCE_FMT_SUBMODULE=ON \
        -DFORCE_SPDLOG_SUBMODULE=ON \
        -DFORCE_NLOHMANN_SUBMODULE=ON \
        -DSUBMODULE_CHECK=OFF \
        -DWITH_LTO=OFF \
        -DCMAKE_BUILD_TYPE=Release \
        "$@"
    cd -
done
rm -f $build/Makefile
echo "# generated makefile" >> $build/Makefile
echo "all: $build_abis" >> $build/Makefile
for abi in $build_abis; do
    echo -ne "$abi:\n\t" >> $build/Makefile
    echo -ne '$(MAKE) -C ' >> $build/Makefile
    echo "build-$abi lokinet-android" >> $build/Makefile
    echo -ne "\tmkdir -p out/$abi && cp build-$abi/jni/liblokinet-android.so out/$abi/liblokinet-android.so\n\n" >> $build/Makefile
    echo -ne "clean-$abi:\n\t" >> $build/Makefile
    echo -ne '$(MAKE) -C ' >> $build/Makefile
    echo "build-$abi clean" >> $build/Makefile
done

echo -ne "clean:" >> $build/Makefile
for targ in $build_abis ; do echo -ne " clean-$targ" >> $build/Makefile ; done
echo "" >> $build/Makefile


================================================
FILE: contrib/android.sh
================================================
#!/bin/bash
set -e
set +x

root="$(readlink -f $(dirname $0)/../)"
cd "$root"
./contrib/android-configure.sh . build-android "$@"
make -C build-android -j ${JOBS:-$(nproc)}


================================================
FILE: contrib/apparmor/usr.bin.lokinet
================================================
# Last Modified: Fri 05 Feb 2021 08:13:58 PM UTC
#include <tunables/global>

profile lokinet /usr/bin/lokinet {
  #include <abstractions/base>
  #include <abstractions/nameservice>

  capability net_admin,
  capability net_bind_service,

  network inet dgram,
  network inet6 dgram,
  network netlink raw,

  /etc/loki/lokinet.ini r,
  /dev/net/tun rw,
  /usr/bin/lokinet mr,

  owner /{var/,}lib/lokinet/ rw,
  owner /{var/,}lib/lokinet/** rwk,
  owner ${HOME}/.lokinet/ rw,
  owner ${HOME}/.lokinet/** rwk,
  owner @{PROC}/@{pid}/task/@{pid}/comm rw,
  owner /tmp/lokinet.*/{**,} rw,

  #include if exists <local/usr.bin.lokinet>
}


================================================
FILE: contrib/apply-patches.sh
================================================
#!/usr/bin/env bash
for f in "$@" ; do
    patch -p1 -i "$f"
done


================================================
FILE: contrib/bencode-dump.py
================================================
#!/usr/bin/python3

import sys
import pprint

if len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == '-'):
    f = sys.stdin.buffer
elif len(sys.argv) != 2 or sys.argv[1].startswith('-'):
    print("Usage: {} FILE -- dumps a bencoded file".format(sys.argv[0]), file=sys.stderr)
    sys.exit(1)
else:
    f = open(sys.argv[1], 'rb')


initial = f.peek(2)
is_hex = False
if initial.startswith(b'64') or initial.startswith(b'6c'):
    print("Input looks like hex bencoded data; parsing as hex input", file=sys.stderr)
    is_hex = True

class HexPrinter():
    def __init__(self, data):
        self.data = data

    def __repr__(self):
        return "hex({} bytes):'{}'".format(len(self.data), self.data.hex())


def next_byte():
    if is_hex:
        pair = f.read(2)
        assert pair is not None and len(pair) == 2
        b = int(pair, 16).to_bytes(1, 'big')
    else:
        b = f.read(1)
    assert b is not None and len(b) == 1
    return b


def parse_int():
    s = b''
    x = next_byte()
    while x in b"0123456789-":
        s += x
        x = next_byte()
    assert x == b'e' and len(s) > 0, "Invalid integer encoding"
    return int(s)


def parse_string(s):
    x = next_byte()
    while x in b"0123456789":
        s += x
        x = next_byte()
    assert x == b':', "Invalid string encoding"
    s = int(s)
    if is_hex:
        data = bytes.fromhex(f.read(2*s).decode('ascii'))
    else:
        data = f.read(s)
    assert len(data) == s, "Truncated string data"
    # If the string is ascii then convert to string:
    if all(0x20 <= b <= 0x7e for b in data):
        return data.decode()
    # Otherwise display as hex:
    return HexPrinter(data)


def parse_dict():
    d = {}
    last_key = None
    while True:
        t = next_byte()
        if t == b'e':
            return d
        assert t in b"0123456789", "Invalid dict: dict keys must be strings"
        key = parse_string(t)
        raw_key = key.data if isinstance(key, HexPrinter) else key.encode()
        if last_key is not None and raw_key <= last_key:
            print("Warning: found out-of-order dict keys ({} after {})".format(raw_key, last_key), file=sys.stderr)
        last_key = raw_key
        t = next_byte()
        d[key] = parse_thing(t)


def parse_list():
    l = []
    while True:
        t = next_byte()
        if t == b'e':
            return l
        l.append(parse_thing(t))


def parse_thing(t):
    if t == b'd':
        return parse_dict()
    if t == b'l':
        return parse_list()
    if t == b'i':
        return parse_int()
    if t in b"0123456789":
        return parse_string(t)
    assert False, "Parsing error: encountered invalid type '{}'".format(t)


pprint.PrettyPrinter(
        indent=2
        ).pprint(parse_thing(next_byte()))


================================================
FILE: contrib/bootstrap/make-bootstrap-list.sh
================================================
#!/usr/bin/env bash
echo -n 'l'
for arg in $@ ; do cat "$arg" ; done
echo -n 'e'


================================================
FILE: contrib/bootstrap/readme.txt
================================================
usage:

./make-bootstrap-list.sh $(find $HOME/.lokinet/netdb | grep \\.signed$) > bootstrap.signed


================================================
FILE: contrib/ci/docker/readme.md
================================================
## drone-ci docker jizz

To rebuild all ci images and push them to the oxen registry server do:

    $ docker login registry.oxen.rocks
    $ ./rebuild-docker-images.py

If you aren't part of the Oxen team, you'll likely need to set up your own registry and change
registry.oxen.rocks to your own domain name in order to do anything useful with this.


================================================
FILE: contrib/ci/docker/rebuild-docker-images.py
================================================
#!/usr/bin/env python3

import subprocess
import tempfile
import optparse
import sys
from concurrent.futures import ThreadPoolExecutor
import threading

parser = optparse.OptionParser()
parser.add_option("--no-cache", action="store_true",
                  help="Run `docker build` with the `--no-cache` option to ignore existing images")
parser.add_option("--parallel", "-j", type="int", default=1,
                  help="Run up to this many builds in parallel")
parser.add_option("--distro", type="string", default="",
                  help="Build only this distro; should be DISTRO-CODE or DISTRO-CODE/ARCH, "
                       "e.g. debian-sid/amd64")
(options, args) = parser.parse_args()

registry_base = 'registry.oxen.rocks/lokinet-ci-'

distros = [*(('debian', x) for x in ('sid', 'stable', 'testing', 'bullseye', 'buster')),
           *(('ubuntu', x) for x in ('rolling', 'lts', 'impish', 'hirsute', 'focal', 'bionic'))]

if options.distro:
    d = options.distro.split('-')
    if len(d) != 2 or d[0] not in ('debian', 'ubuntu') or not d[1]:
        print("Bad --distro value '{}'".format(options.distro), file=sys.stderr)
        sys.exit(1)
    distros = [(d[0], d[1].split('/')[0])]


manifests = {}  # "image:latest": ["image/amd64", "image/arm64v8", ...]
manifestlock = threading.Lock()


def arches(distro):
    if options.distro and '/' in options.distro:
        arch = options.distro.split('/')
        if arch not in ('amd64', 'i386', 'arm64v8', 'arm32v7'):
            print("Bad --distro value '{}'".format(options.distro), file=sys.stderr)
            sys.exit(1)
        return [arch]

    a = ['amd64', 'arm64v8', 'arm32v7']
    if distro[0] == 'debian' or distro == ('ubuntu', 'bionic'):
        a.append('i386')  # i386 builds don't work on later ubuntu
    return a


hacks = {
    registry_base + 'ubuntu-bionic-builder': """g++-8 \
            && mkdir -p /usr/lib/x86_64-linux-gnu/pgm-5.2/include""",
}


failure = False

lineno = 0
linelock = threading.Lock()


def print_line(myline, value):
    linelock.acquire()
    global lineno
    if sys.__stdout__.isatty():
        jump = lineno - myline
        print("\033[{jump}A\r\033[K{value}\033[{jump}B\r".format(jump=jump, value=value), end='')
        sys.stdout.flush()
    else:
        print(value)
    linelock.release()


def run_or_report(*args, myline):
    try:
        subprocess.run(
            args, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding='utf8')
    except subprocess.CalledProcessError as e:
        with tempfile.NamedTemporaryFile(suffix=".log", delete=False) as log:
            log.write("Error running {}: {}\n\nOutput:\n\n".format(' '.join(args), e).encode())
            log.write(e.output.encode())
            global failure
            failure = True
            print_line(myline, "\033[31;1mError! See {} for details".format(log.name))
            raise e


def build_tag(tag_base, arch, contents):
    if failure:
        raise ChildProcessError()

    linelock.acquire()
    global lineno
    myline = lineno
    lineno += 1
    print()
    linelock.release()

    with tempfile.NamedTemporaryFile() as dockerfile:
        dockerfile.write(contents.encode())
        dockerfile.flush()

        tag = '{}/{}'.format(tag_base, arch)
        print_line(myline, "\033[33;1mRebuilding     \033[35;1m{}\033[0m".format(tag))
        run_or_report('docker', 'build', '--pull', '-f', dockerfile.name, '-t', tag,
                      *(('--no-cache',) if options.no_cache else ()), '.', myline=myline)
        print_line(myline, "\033[33;1mPushing        \033[35;1m{}\033[0m".format(tag))
        run_or_report('docker', 'push', tag, myline=myline)
        print_line(myline, "\033[32;1mFinished build \033[35;1m{}\033[0m".format(tag))

        latest = tag_base + ':latest'
        global manifests
        manifestlock.acquire()
        if latest in manifests:
            manifests[latest].append(tag)
        else:
            manifests[latest] = [tag]
        manifestlock.release()


def base_distro_build(distro, arch):
    tag = '{r}{distro[0]}-{distro[1]}-base'.format(r=registry_base, distro=distro)
    codename = 'latest' if distro == ('ubuntu', 'lts') else distro[1]
    build_tag(tag, arch, """
FROM {}/{}:{}
RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections'
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
    && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
    && apt-get -o=Dpkg::Use-Pty=0 -q autoremove -y \
        {hacks}
""".format(arch, distro[0], codename, hacks=hacks.get(tag, '')))


def distro_build(distro, arch):
    prefix = '{r}{distro[0]}-{distro[1]}'.format(r=registry_base, distro=distro)
    fmtargs = dict(arch=arch, distro=distro, prefix=prefix)

    # (distro)-(codename)-base: Base image from upstream: we sync the repos, but do nothing else.
    if (distro, arch) != (('debian', 'stable'), 'amd64'):  # debian-stable-base/amd64 already built
        base_distro_build(distro, arch)

    # (distro)-(codename)-builder: Deb builder image used for building debs; we add the basic tools
    # we use to build debs, not including things that should come from the dependencies in the
    # debian/control file.
    build_tag(prefix + '-builder', arch, """
FROM {prefix}-base/{arch}
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
    && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
    && apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \
        ccache \
        devscripts \
        equivs \
        g++ \
        git \
        git-buildpackage \
        openssh-client \
        {hacks}
""".format(**fmtargs, hacks=hacks.get(prefix + '-builder', '')))

    # (distro)-(codename): Basic image we use for most builds.  This takes the -builder and adds
    # most dependencies found in our packages.
    build_tag(prefix, arch, """
FROM {prefix}-builder/{arch}
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
    && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
    && apt-get -o=Dpkg::Use-Pty=0 --no-install-recommends -q install -y \
        automake \
        ccache \
        cmake \
        eatmydata \
        g++ \
        gdb \
        git \
        libboost-program-options-dev \
        libboost-serialization-dev \
        libboost-thread-dev \
        libcurl4-openssl-dev \
        libevent-dev \
        libgtest-dev \
        libhidapi-dev \
        libjemalloc-dev \
        libminiupnpc-dev \
        libreadline-dev \
        libsodium-dev \
        libsqlite3-dev \
        libssl-dev \
        libsystemd-dev \
        libtool \
        libunbound-dev \
        libunwind8-dev \
        libusb-1.0.0-dev \
        libuv1-dev \
        libzmq3-dev \
        lsb-release \
        make \
        nettle-dev \
        ninja-build \
        openssh-client \
        patch \
        pkg-config \
        pybind11-dev \
        python3-dev \
        python3-pip \
        python3-pybind11 \
        python3-pytest \
        python3-setuptools \
        qttools5-dev \
        {hacks}
""".format(**fmtargs, hacks=hacks.get(prefix, '')))


# Android and flutter builds on top of debian-stable-base and adds a ton of android crap; we
# schedule this job as soon as the debian-sid-base/amd64 build finishes, because they easily take
# the longest and are by far the biggest images.
def android_builds():
    build_tag(registry_base + 'android', 'amd64', """
FROM {r}debian-stable-base
RUN /bin/bash -c 'sed -i "s/main/main contrib/g" /etc/apt/sources.list'
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
    && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
    && apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \
        android-sdk \
        automake \
        ccache \
        cmake \
        curl \
        git \
        google-android-ndk-installer \
        libtool \
        make \
        openssh-client \
        patch \
        pkg-config \
        wget \
        xz-utils \
        zip \
    && git clone https://github.com/Shadowstyler/android-sdk-licenses.git /tmp/android-sdk-licenses \
    && cp -a /tmp/android-sdk-licenses/*-license /usr/lib/android-sdk/licenses \
    && rm -rf /tmp/android-sdk-licenses
""".format(r=registry_base))

    build_tag(registry_base + 'flutter', 'amd64', """
FROM {r}android
RUN cd /opt \
    && curl https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.2.2-stable.tar.xz \
        | tar xJv \
    && ln -s /opt/flutter/bin/flutter /usr/local/bin/ \
    && flutter precache
""".format(r=registry_base))


# lint is a tiny build (on top of debian-stable-base) with just formatting checking tools
def lint_build():
    build_tag(registry_base + 'lint', 'amd64', """
FROM {r}debian-stable-base
RUN apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \
    clang-format-11 \
    eatmydata \
    git \
    jsonnet
""".format(r=registry_base))


def nodejs_build():
    build_tag(registry_base + 'nodejs', 'amd64', """
FROM node:14.16.1
RUN /bin/bash -c 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections'
RUN apt-get -o=Dpkg::Use-Pty=0 -q update \
    && apt-get -o=Dpkg::Use-Pty=0 -q dist-upgrade -y \
    && apt-get -o=Dpkg::Use-Pty=0 -q install --no-install-recommends -y \
        ccache \
        cmake \
        eatmydata \
        g++ \
        gdb \
        git \
        make \
        ninja-build \
        openssh-client \
        patch \
        pkg-config \
        wine
""")


# Start debian-stable-base/amd64 on its own, because other builds depend on it and we want to get
# those (especially android/flutter) fired off as soon as possible (because it's slow and huge).
if ('debian', 'stable') in distros:
    base_distro_build(['debian', 'stable'], 'amd64')

executor = ThreadPoolExecutor(max_workers=max(options.parallel, 1))

if options.distro:
    jobs = []
else:
    jobs = [executor.submit(b) for b in (android_builds, lint_build, nodejs_build)]

for d in distros:
    for a in arches(d):
        jobs.append(executor.submit(distro_build, d, a))
while len(jobs):
    j = jobs.pop(0)
    try:
        j.result()
    except (ChildProcessError, subprocess.CalledProcessError):
        for k in jobs:
            k.cancel()


if failure:
    print("Error(s) occured, aborting!", file=sys.stderr)
    sys.exit(1)


print("\n\n\033[32;1mAll builds finished successfully; pushing manifests...\033[0m\n")


def push_manifest(latest, tags):
    if failure:
        raise ChildProcessError()

    linelock.acquire()
    global lineno
    myline = lineno
    lineno += 1
    print()
    linelock.release()

    subprocess.run(['docker', 'manifest', 'rm', latest], stderr=subprocess.DEVNULL, check=False)
    print_line(myline, "\033[33;1mCreating manifest \033[35;1m{}\033[0m".format(latest))
    run_or_report('docker', 'manifest', 'create', latest, *tags, myline=myline)
    print_line(myline, "\033[33;1mPushing manifest  \033[35;1m{}\033[0m".format(latest))
    run_or_report('docker', 'manifest', 'push', latest, myline=myline)
    print_line(myline, "\033[32;1mFinished manifest \033[35;1m{}\033[0m".format(latest))


for latest, tags in manifests.items():
    jobs.append(executor.submit(push_manifest, latest, tags))

while len(jobs):
    j = jobs.pop(0)
    try:
        j.result()
    except (ChildProcessError, subprocess.CalledProcessError):
        for k in jobs:
            k.cancel()


print("\n\n\033[32;1mAll done!\n")


================================================
FILE: contrib/ci/drone-check-static-libs.sh
================================================
#!/usr/bin/env bash

# Script used with Drone CI to check that a statically build lokinet only links against the expected
# base system libraries.  Expects to be run with pwd of the project directory with a build in
# `build` or $1 (if given).

set -o errexit

build=${1:-build}

bad=
if [ "$DRONE_STAGE_OS" == "darwin" ]; then
    if otool -L ${build}/llarp/apple/org.lokinet.network-extension.systemextension/Contents/MacOS/org.lokinet.network-extension | \
        grep -Ev '^llarp/apple:|^\t(/usr/lib/lib(System\.|c\+\+|objc))|/System/Library/Frameworks/(CoreFoundation|NetworkExtension|Foundation|Network)\.framework'; then
        bad=1
    fi
elif [ "$DRONE_STAGE_OS" == "linux" ]; then
    if ldd ${build}/daemon/lokinet | grep -Ev '(linux-vdso|ld-linux-(x86-64|armhf|aarch64)|lib(pthread|dl|rt|stdc\+\+|gcc_s|c|m))\.so'; then
        bad=1
    fi
else
    echo -e "\n\n\n\n\e[31;1mDon't know how to check linked libs on $DRONE_STAGE_OS\e[0m\n\n\n"
    exit 1
fi

if [ -n "$bad" ]; then
    echo -e "\n\n\n\n\e[31;1mlokinet links to unexpected libraries\e[0m\n\n\n"
    exit 1
fi

echo -e "\n\n\n\n\e[32;1mNo unexpected linked libraries found\e[0m\n\n\n"


================================================
FILE: contrib/ci/drone-debs-upload.sh
================================================
#!/bin/bash

# Script used with Drone CI to upload debs from the deb building pipelines (because specifying all
# this in .drone.jsonnet is too painful).  This is expected to run from the base project dir after
# having build with debuild (which will leave the debs in ..).

set -o errexit

distro="$1"

if [ -z "$distro" ]; then
    echo "Bad usage: need distro name as first argument"
    exit 1
fi

if [ -z "$SSH_KEY" ]; then
    echo -e "\n\n\n\e[31;1mUnable to upload debs: SSH_KEY not set\e[0m"
    # Just warn but don't fail, so that this doesn't trigger a build failure for untrusted builds
    exit 0
fi

echo "$SSH_KEY" >~/ssh_key

set -o xtrace  # Don't start tracing until *after* we write the ssh key

chmod 600 ~/ssh_key

upload_to="oxen.rocks/debs/${DRONE_REPO// /_}@${DRONE_BRANCH// /_}/$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}/$distro/$DRONE_STAGE_ARCH"

# sftp doesn't have any equivalent to mkdir -p, so we have to split the above up into a chain of
# -mkdir a/, -mkdir a/b/, -mkdir a/b/c/, ... commands.  The leading `-` allows the command to fail
# without error.
upload_dirs=(${upload_to//\// })
mkdirs=
dir_tmp=""
for p in "${upload_dirs[@]}"; do
    dir_tmp="$dir_tmp$p/"
    mkdirs="$mkdirs
-mkdir $dir_tmp"
done

sftp -i ~/ssh_key -b - -o StrictHostKeyChecking=off drone@oxen.rocks <<SFTP
$mkdirs
put ../*.*deb $upload_to
SFTP

set +o xtrace

echo -e "\n\n\n\n\e[32;1mUploaded debs to https://${upload_to}/\e[0m\n\n\n"



================================================
FILE: contrib/ci/drone-format-verify.sh
================================================
#!/usr/bin/env bash
test "x$IGNORE" != "x" && exit 0

. $(dirname $0)/../format-version.sh

repo=$(readlink -e $(dirname $0)/../../)
$CLANG_FORMAT -i $(find $repo/jni $repo/daemon $repo/llarp $repo/include $repo/pybind | grep -E '\.[hc](pp)?$')
jsonnetfmt -i $repo/.drone.jsonnet
git --no-pager diff --exit-code --color || (echo -ne '\n\n\e[31;1mLint check failed; please run ./contrib/format.sh\e[0m\n\n' ; exit 1)


================================================
FILE: contrib/ci/drone-gdb.sh
================================================
#!/usr/bin/env bash
rm -f crash.out.txt exit.out.txt
gdb -q -x $(readlink -e $(dirname $0))/gdb-filter.py --args $@
test -e crash.out.txt && cat crash.out.txt
exit $(cat exit.out.txt)


================================================
FILE: contrib/ci/drone-run-router-hive.sh
================================================
#!/usr/bin/env bash
export PYTHONPATH=pybind
rm -f crash.out.txt exit.out.txt
gdb -q -x $(readlink -e $(dirname $0))/gdb-filter.py --args /usr/bin/python3 -m pytest ../test/
test -e crash.out.txt && cat crash.out.txt
exit $(cat exit.out.txt)


================================================
FILE: contrib/ci/drone-static-upload.sh
================================================
#!/usr/bin/env bash

# Script used with Drone CI to upload build artifacts (because specifying all this in
# .drone.jsonnet is too painful).



set -o errexit

if [ -z "$SSH_KEY" ]; then
    echo -e "\n\n\n\e[31;1mUnable to upload artifact: SSH_KEY not set\e[0m"
    # Just warn but don't fail, so that this doesn't trigger a build failure for untrusted builds
    exit 0
fi

echo "$SSH_KEY" >ssh_key

set -o xtrace  # Don't start tracing until *after* we write the ssh key

chmod 600 ssh_key

os="$UPLOAD_OS"
if [ -z "$os" ]; then
    if [ "$DRONE_STAGE_OS" == "darwin" ]; then
        os="macos-$DRONE_STAGE_ARCH"
    elif [ -n "$WINDOWS_BUILD_NAME" ]; then
        os="windows-$WINDOWS_BUILD_NAME"
    else
        os="$DRONE_STAGE_OS-$DRONE_STAGE_ARCH"
    fi
fi

if [ -n "$DRONE_TAG" ]; then
    # For a tag build use something like `lokinet-linux-amd64-v1.2.3`
    base="lokinet-$os-$DRONE_TAG"
else
    # Otherwise build a length name from the datetime and commit hash, such as:
    # lokinet-linux-amd64-20200522T212342Z-04d7dcc54
    base="lokinet-$os-$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}"
fi

mkdir -v "$base"
if [ -e build/win32 ]; then
    # save debug symbols
    cp -av build/win32/daemon/debug-symbols.tar.xz "$base-debug-symbols.tar.xz"
    # save installer
    cp -av build/win32/*.exe "$base"
    # zipit up yo
    archive="$base.zip"
    zip -r "$archive" "$base"
elif [ -e lokinet.apk ] ; then
    # android af ngl
    archive="$base.apk"
    cp -av lokinet.apk "$archive"
elif [ -e build-docs ]; then
    archive="$base.tar.xz"
    cp -av build-docs/docs/mkdocs.yml build-docs/docs/markdown "$base"
    tar cJvf "$archive" "$base"
elif [ -e build-mac ]; then
    archive="$base.tar.xz"
    mv build-mac/Lokinet*/ "$base"
    tar cJvf "$archive" "$base"
else
    cp -av build/daemon/lokinet{,-cntrl} "$base"
    cp -av contrib/bootstrap/mainnet.signed "$base/bootstrap.signed"
    # tar dat shiz up yo
    archive="$base.tar.xz"
    tar cJvf "$archive" "$base"
fi

upload_to="oxen.rocks/${DRONE_REPO// /_}/${DRONE_BRANCH// /_}"

# sftp doesn't have any equivalent to mkdir -p, so we have to split the above up into a chain of
# -mkdir a/, -mkdir a/b/, -mkdir a/b/c/, ... commands.  The leading `-` allows the command to fail
# without error.
upload_dirs=(${upload_to//\// })
put_debug=
mkdirs=
dir_tmp=""
for p in "${upload_dirs[@]}"; do
    dir_tmp="$dir_tmp$p/"
    mkdirs="$mkdirs
-mkdir $dir_tmp"
done
if [ -e "$base-debug-symbols.tar.xz" ] ; then
    put_debug="put $base-debug-symbols.tar.xz $upload_to"
fi
sftp -i ssh_key -b - -o StrictHostKeyChecking=off drone@oxen.rocks <<SFTP
$mkdirs
put $archive $upload_to
$put_debug
SFTP

set +o xtrace

echo -e "\n\n\n\n\e[32;1mUploaded to https://${upload_to}/${archive}\e[0m\n\n\n"


================================================
FILE: contrib/ci/gdb-filter.py
================================================
def exit_handler (event):
    """
    write exit code of the program running in gdb to a file called exit.out.txt
    """
    code = 1
    if hasattr(event, "exit_code"):
        code = event.exit_code
    with open("exit.out.txt", 'w') as f:
        f.write("{}".format(code))

def gdb_execmany(*cmds):
    """
    run multiple gdb commands
    """
    for cmd in cmds:
        gdb.execute(cmd)

def crash_handler (event):
    """
    handle a crash from the program running in gdb
    """
    if isinstance(event, gdb.SignalEvent):
        log_file_name = "crash.out.txt"
        # poop out log file for stack trace of all threads
        gdb_execmany("set logging file {}".format(log_file_name), "set logging on", "set logging redirect on", "thread apply all bt full")
        # quit gdb
        gdb.execute("q")

# set up event handlers to catch shit
gdb.events.stop.connect(crash_handler)
gdb.events.exited.connect(exit_handler)

# run settings setup
gdb_execmany("set confirm off", "set pagination off", "set print thread-events off")
# run program and exit
gdb_execmany("r", "q")


================================================
FILE: contrib/cross/android.toolchain.cmake
================================================

set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION ${ANDROID_API}) # API level
set(CMAKE_ANDROID_ARCH_ABI ${ANDROID_ARCH_ABI})
set(CMAKE_ANDROID_NDK ${ANDROID_NDK})
set(CMAKE_ANDROID_STL_TYPE gnustl_static)

================================================
FILE: contrib/cross/cross.toolchain.cmake
================================================
set(CMAKE_SYSTEM_NAME ${CROSS_PLATFORM})
set(TOOLCHAIN_PREFIX ${CROSS_PREFIX})
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc${TOOLCHAIN_SUFFIX})
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++${TOOLCHAIN_SUFFIX})
set(ARCH_TRIPLET ${TOOLCHAIN_PREFIX})


================================================
FILE: contrib/cross/mingw32.cmake
================================================
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
set(WOW64_CROSS_COMPILE ON)
set(CROSS_TARGET i686-w64-mingw32)

set(TOOLCHAIN_PATHS
  /usr/${TOOLCHAIN_PREFIX}
  /usr/local/opt/mingw-w64/toolchain-i686
  /usr/local/opt/mingw-w64/toolchain-i686/i686-w64-mingw32
  /opt/mingw32
  /home/$ENV{USER}/mingw32
  /home/$ENV{USER}/mingw32/${TOOLCHAIN_PREFIX}
)

include("${CMAKE_CURRENT_LIST_DIR}/mingw_core.cmake")


================================================
FILE: contrib/cross/mingw64.cmake
================================================
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
set(WIN64_CROSS_COMPILE ON)
set(CROSS_TARGET x86_64-w64-mingw32)

set(TOOLCHAIN_PATHS
 /usr/${TOOLCHAIN_PREFIX}
 /usr/local/opt/mingw-w64/toolchain-x86_64
 /usr/local/opt/mingw-w64/toolchain-x86_64/x86_64-w64-mingw32
 /opt/mingw64
 /home/$ENV{USER}/mingw32
 /home/$ENV{USER}/mingw64
 /home/$ENV{USER}/mingw64/${TOOLCHAIN_PREFIX}
 /home/$ENV{USER}/mingw32/${TOOLCHAIN_PREFIX})

include("${CMAKE_CURRENT_LIST_DIR}/mingw_core.cmake")


================================================
FILE: contrib/cross/mingw_core.cmake
================================================
set(CMAKE_SYSTEM_VERSION 6.0)

# the minimum windows version, set to 6 rn because supporting older windows is hell
set(_winver 0x0600)
add_definitions(-D_WIN32_WINNT=${_winver})

# target environment on the build host system
# second one is for non-root installs
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_PATHS})

add_definitions("-DWINNT_CROSS_COMPILE")

# modify default behavior of FIND_XXX() commands
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# cross compilers to use
if($ENV{COMPILER} MATCHES "clang")
    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${TOOLCHAIN_SUFFIX})
    set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++${TOOLCHAIN_SUFFIX})
endif()

set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
set(ARCH_TRIPLET ${CROSS_TARGET})


================================================
FILE: contrib/cross.sh
================================================
#!/bin/bash
#
# helper script for me for when i cross compile
# t. jeff
#
set -e

die() {
    echo $@
    exit 1
}

platform=${PLATFORM:-Linux}
root="$(readlink -e $(dirname $0)/../)"
cd $root
mkdir -p build-cross

targets=()
cmake_extra=()

while [ "$#" -gt 0 ]; do
    if [ "$1" = "--" ]; then
        shift
        cmake_extra=("$@")
        break
    fi
    targets+=("$1")
    shift
done
test ${#targets[@]} = 0 && die no targets provided

archs="${targets[@]}"
echo "all: $archs" > build-cross/Makefile
for arch in $archs ; do
    mkdir -p $root/build-cross/build-$arch
    cd $root/build-cross/build-$arch
    cmake \
        -G 'Unix Makefiles' \
        -DCROSS_PLATFORM=$platform \
        -DCROSS_PREFIX=$arch \
        -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector \
        -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always \
        -DCMAKE_TOOLCHAIN_FILE=$root/contrib/cross/cross.toolchain.cmake \
        -DBUILD_STATIC_DEPS=ON \
        -DSTATIC_LINK=ON \
        -DBUILD_SHARED_LIBS=OFF \
        -DBUILD_TESTING=OFF \
        -DBUILD_LIBLOKINET=OFF \
        -DLOKINET_TESTS=OFF \
        -DLOKINET_NATIVE_BUILD=OFF \
        -DSTATIC_LINK=ON \
        -DWITH_SYSTEMD=OFF \
        -DFORCE_OXENMQ_SUBMODULE=ON \
        -DSUBMODULE_CHECK=OFF \
        -DWITH_LTO=OFF \
        -DLOKINET_BOOTSTRAP=OFF \
        -DCMAKE_BUILD_TYPE=RelWithDeb \
        "${cmake_extra[@]}" \
        $root
    cd $root/build-cross
    echo -ne "$arch:\n\t\$(MAKE) -C  build-$arch\n" >> $root/build-cross/Makefile

done
cd $root
make -j${JOBS:-$(nproc)} -C build-cross


================================================
FILE: contrib/format-version.sh
================================================

CLANG_FORMAT_DESIRED_VERSION=19

CLANG_FORMAT=$(command -v clang-format-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null)
if [ $? -ne 0 ]; then
    CLANG_FORMAT=$(command -v clang-format-mp-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null)
fi
if [ $? -ne 0 ]; then
    CLANG_FORMAT=$(command -v clang-format 2>/dev/null)
    if [ $? -ne 0 ]; then
        echo "Please install clang-format version $CLANG_FORMAT_DESIRED_VERSION and re-run this script."
        exit 1
    fi
    version=$(clang-format --version)
    if [[ ! $version == *"clang-format version $CLANG_FORMAT_DESIRED_VERSION"* ]]; then
        echo "Please install clang-format version $CLANG_FORMAT_DESIRED_VERSION and re-run this script."
        exit 1
    fi
fi


================================================
FILE: contrib/format.sh
================================================
#!/usr/bin/env bash

# set -x
set -e

. $(dirname $0)/format-version.sh

cd "$(dirname $0)/../"

sources=($(find jni daemon llarp include pybind | grep -E '\.([hc](pp)?|m(m)?)$' | grep -v '#'))

incl_pat='^(#include +)"(llarp|libntrup|oxen|oxenc|oxenmq|quic|CLI|cpr|nlohmann|ghc|fmt|spdlog|uvw?)([/.][^"]*)"'

if [ "$1" = "verify" ] ; then
    if [ $($CLANG_FORMAT --output-replacements-xml "${sources[@]}" | grep '</replacement>' | wc -l) -ne 0 ] ; then
        exit 2
    fi

    if grep --color -E "$incl_pat" "${sources[@]}"; then
        exit 5
    fi
else
    $CLANG_FORMAT -i "${sources[@]}" &> /dev/null

    perl -pi -e "s{$incl_pat}"'{$1<$2$3>}' "${sources[@]}" &> /dev/null
fi

# Some includes just shouldn't exist anywhere, but need to be fixed manually:
if grep --color -E '^#include ([<"]external/|<bits/|<.*/impl)' "${sources[@]}"; then
    echo "Format failed: bad includes detected that can't be auto-corrected"
    exit 5
fi

swift_format=$(command -v swiftformat 2>/dev/null)
if [ $? -eq 0 ]; then
    if [ "$1" = "verify" ] ; then
        for f in $(find daemon | grep -E '\.swift$' | grep -v '#') ; do
            if [ $($swift_format --quiet --dryrun < "$f" | diff "$f" - | wc -l) -ne 0 ] ; then
                exit 3
            fi
        done
    else
        $swift_format --quiet $(find daemon | grep -E '\.swift$' | grep -v '#')
    fi

fi

jsonnet_format=$(command -v jsonnetfmt 2>/dev/null)
if [ $? -eq 0 ]; then
    if [ "$1" = "verify" ]; then
        if ! $jsonnet_format --test .drone.jsonnet; then
            exit 4
        fi
    else
        $jsonnet_format --in-place .drone.jsonnet
    fi
fi


================================================
FILE: contrib/git-hook-pre-push.sh
================================================
#!/bin/bash
#
# pre-push hook for git
# this script is probably overkill for most contributors
#
# "i use this to prevent foot cannons caused by commiting broken code"
#
# ~ jeff (lokinet author and crazy person)
#
#
# to use this as a git hook do this in the root of the repo:
#
# cp contrib/git-hook-pre-push.sh .git/hooks/pre-push
#


set -e

cd "$(dirname $0)/../.."
echo "check format..."
./contrib/format.sh verify
echo "format is gucci af fam"

echo "remove old test build directory..."
rm -rf build-git-hook
mkdir build-git-hook
echo "configuring test build jizz..."
cmake -S . -B build-git-hook -DWITH_LTO=OFF -DLOKINET_HIVE=ON -G Ninja
echo "ensure this shit compiles..."
ninja -C build-git-hook all
echo "ensure unit tests aren't fucked..."
ninja -C build-git-hook check

echo "we gud UmU"
echo ""


================================================
FILE: contrib/hex-to-base32z.py
================================================
#!/usr/bin/python3

import sys

base32z_dict = 'ybndrfg8ejkmcpqxot1uwisza345h769'
base32z_map = {base32z_dict[i]: i for i in range(len(base32z_dict))}

def lokinet_snode_addr(pk_hex):
    """Returns the lokinet snode address from a hex ed25519 pubkey"""
    assert(len(pk_hex) == 64)
    bits = 0
    val = 0
    result = ''
    for x in pk_hex:
        bits += 4
        val = (val << 4) + int(x, 16)
        if bits >= 5:
            bits -= 5
            v = val >> bits
            val &= (1 << bits) - 1
            result += base32z_dict[v]
    result += base32z_dict[val << (5 - bits)]
    return result + ".snode"


def hex_from_snode(b32z):
    """undoes what the above does; b32z should have '.snode' already stripped off"""
    assert(len(b32z) == 52)
    val = 0
    bits = 0
    for x in b32z:
        val = (val << 5) | base32z_map[x]  # Arbitrary precision integers FTW

    # `val` is now a 260 bit value (52 * 5 bits per char); but we only use the first bit of the last
    # value (which is why lokinet addresses always end with y or o)
    assert(b32z[-1] in 'yo')
    val >>= 4

    return "{:64x}".format(val)


reverse = False
if len(sys.argv) >= 2 and sys.argv[1] == '-r':
    reverse = True
    del sys.argv[1]

if len(sys.argv) < 2 or (
        any(len(x) not in (52, 58) for x in sys.argv[1:])
        if reverse else
        any(len(x) != 64 for x in sys.argv[1:])
        ):
    print("Usage: {} PUBKEY [PUBKEY ...] -- converts ed25519 pubkeys to .snode addresses".format(sys.argv[0]))
    print("Usage: {} -r SNODE [SNODE ...] -- converts snode addresses to ed25519 pubkeys".format(sys.argv[0]))
    sys.exit(1)

if reverse:
    for key in sys.argv[1:]:
        print("{}.snode -> {}".format(key[0:52], hex_from_snode(key[0:52])))
else:
    for key in sys.argv[1:]:
        print("{} -> {}".format(key, lokinet_snode_addr(key)))


================================================
FILE: contrib/keygen.py
================================================
#!/usr/bin/env python3
#
# .loki secret key generator script
# makes keyfile contents
#
# usage: python3 keygen.py out.private
#        python3 keygen.py > /some/where/over/the/rainbow
#
from nacl.bindings import crypto_sign_keypair
import sys

out = sys.stdout

close_out = lambda : None
args = sys.argv[1:]

if args and args[0] != '-':
  out = open(args[0], 'wb')
  close_out = out.close

pk, sk = crypto_sign_keypair()
out.write(b'64:')
out.write(sk)
out.flush()
close_out()



================================================
FILE: contrib/liblokinet/CMakeLists.txt
================================================

cmake_minimum_required(VERSION 3.10)

project(udptest LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
add_executable(udptest udptest.cpp)
include_directories(../../include)
target_link_libraries(udptest PUBLIC lokinet)



================================================
FILE: contrib/liblokinet/readme.md
================================================
# liblokinet examples

building:

    $ mkdir -p build
    $ cd build
    $ cp /path/to/liblokinet.so .
    $ cmake .. -DCMAKE_EXE_LINKER_FLAGS='-L.'
    $ make

running:

    $ ./udptest /path/to/bootstrap.signed


================================================
FILE: contrib/liblokinet/udptest.cpp
================================================
#include <lokinet.h>

#include <signal.h>

#include <memory>
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>

bool _run{true};

using Lokinet_ptr = std::shared_ptr<lokinet_context>;

[[nodiscard]] auto
MakeLokinet(const std::vector<char>& bootstrap)
{
  auto ctx = std::shared_ptr<lokinet_context>(lokinet_context_new(), lokinet_context_free);
  if (auto err = lokinet_add_bootstrap_rc(bootstrap.data(), bootstrap.size(), ctx.get()))
    throw std::runtime_error{strerror(err)};
  if (lokinet_context_start(ctx.get()))
    throw std::runtime_error{"could not start context"};
  return ctx;
}

void
WaitForReady(const Lokinet_ptr& ctx)
{
  while (_run and lokinet_wait_for_ready(1000, ctx.get()))
  {
    std::cout << "waiting for context..." << std::endl;
  }
}

class Flow
{
  lokinet_udp_flowinfo const _info;
  lokinet_context* const _ctx;

 public:
  explicit Flow(const lokinet_udp_flowinfo* info, lokinet_context* ctx) : _info{*info}, _ctx{ctx}
  {}

  lokinet_context*
  Context() const
  {
    return _ctx;
  }

  std::string
  String() const
  {
    std::stringstream ss;
    ss << std::string{_info.remote_host} << ":" << std::to_string(_info.remote_port)
       << " on socket " << _info.socket_id;
    return ss.str();
  }
};

struct ConnectJob
{
  lokinet_udp_flowinfo remote;
  lokinet_context* ctx;
};

void
CreateOutboundFlow(void* user, void** flowdata, int* timeout)
{
  auto* job = static_cast<ConnectJob*>(user);
  Flow* flow = new Flow{&job->remote, job->ctx};
  *flowdata = flow;
  *timeout = 30;
  std::cout << "made outbound flow: " << flow->String() << std::endl;
  ;
}

int
ProcessNewInboundFlow(void* user, const lokinet_udp_flowinfo* remote, void** flowdata, int* timeout)
{
  auto* ctx = static_cast<lokinet_context*>(user);
  Flow* flow = new Flow{remote, ctx};
  std::cout << "new udp flow: " << flow->String() << std::endl;
  *flowdata = flow;
  *timeout = 30;

  return 0;
}

void
DeleteFlow(const lokinet_udp_flowinfo* remote, void* flowdata)
{
  auto* flow = static_cast<Flow*>(flowdata);
  std::cout << "udp flow from " << flow->String() << " timed out" << std::endl;
  delete flow;
}

void
HandleUDPPacket(const lokinet_udp_flowinfo* remote, const char* pkt, size_t len, void* flowdata)
{
  auto* flow = static_cast<Flow*>(flowdata);
  std::cout << "we got " << len << " bytes of udp from " << flow->String() << std::endl;
}

void
BounceUDPPacket(const lokinet_udp_flowinfo* remote, const char* pkt, size_t len, void* flowdata)
{
  auto* flow = static_cast<Flow*>(flowdata);
  std::cout << "bounce " << len << " bytes of udp from " << flow->String() << std::endl;
  if (auto err = lokinet_udp_flow_send(remote, pkt, len, flow->Context()))
  {
    std::cout << "bounce failed: " << strerror(err) << std::endl;
  }
}

Lokinet_ptr sender, recip;

void
signal_handler(int)
{
  _run = false;
}

int
main(int argc, char* argv[])
{
  if (argc == 1)
  {
    std::cout << "usage: " << argv[0] << " bootstrap.signed" << std::endl;
    return 1;
  }

  /*
  signal(SIGINT, signal_handler);
  signal(SIGTERM, signal_handler);
  */

  std::vector<char> bootstrap;

  // load bootstrap.signed
  {
    std::ifstream inf{argv[1], std::ifstream::ate | std::ifstream::binary};
    size_t len = inf.tellg();
    inf.seekg(0);
    bootstrap.resize(len);
    inf.read(bootstrap.data(), bootstrap.size());
  }

  if (auto* loglevel = getenv("LOKINET_LOG"))
    lokinet_log_level(loglevel);
  else
    lokinet_log_level("none");

  std::cout << "starting up" << std::endl;

  recip = MakeLokinet(bootstrap);
  WaitForReady(recip);

  lokinet_udp_bind_result recipBindResult{};

  const auto port = 10000;

  if (auto err = lokinet_udp_bind(
          port,
          ProcessNewInboundFlow,
          BounceUDPPacket,
          DeleteFlow,
          recip.get(),
          &recipBindResult,
          recip.get()))
  {
    std::cout << "failed to bind recip udp socket " << strerror(err) << std::endl;
    return 0;
  }

  std::cout << "bound recip udp" << std::endl;

  sender = MakeLokinet(bootstrap);
  WaitForReady(sender);

  std::string recipaddr{lokinet_address(recip.get())};

  std::cout << "recip ready at " << recipaddr << std::endl;

  lokinet_udp_bind_result senderBindResult{};

  if (auto err = lokinet_udp_bind(
          port,
          ProcessNewInboundFlow,
          HandleUDPPacket,
          DeleteFlow,
          sender.get(),
          &senderBindResult,
          sender.get()))
  {
    std::cout << "failed to bind sender udp socket " << strerror(err) << std::endl;
    return 0;
  }

  ConnectJob connect{};
  connect.remote.socket_id = senderBindResult.socket_id;
  connect.remote.remote_port = port;
  std::copy_n(recipaddr.c_str(), recipaddr.size(), connect.remote.remote_host);
  connect.ctx = sender.get();

  std::cout << "bound sender udp" << std::endl;

  do
  {
    std::cout << "try establish to " << connect.remote.remote_host << std::endl;
    if (auto err =
            lokinet_udp_establish(CreateOutboundFlow, &connect, &connect.remote, sender.get()))
    {
      std::cout << "failed to establish to recip: " << strerror(err) << std::endl;
      usleep(100000);
    }
    else
      break;
  } while (true);
  std::cout << "sender established" << std::endl;

  const std::string buf{"liblokinet"};

  const std::string senderAddr{lokinet_address(sender.get())};

  do
  {
    std::cout << senderAddr << " send to remote: " << buf << std::endl;
    if (auto err = lokinet_udp_flow_send(&connect.remote, buf.data(), buf.size(), sender.get()))
    {
      std::cout << "send failed: " << strerror(err) << std::endl;
    }
    usleep(100000);
  } while (_run);
  return 0;
}


================================================
FILE: contrib/liblokinet_jank_test.cpp
================================================
#include <lokinet.hpp>

#include <exception>
#include <filesystem>
#include <future>
#include <iostream>
#include <thread>

using namespace std::literals;

int main(int argc, char** argv)
{
    if (argc <= 1)
    {
        std::cerr << "USAGE: " << argv[0] << " {WHATEVER.loki | WHATEVER.snode}\n";
        return 1;
    }

    std::string target{argv[1]};

    lokinet::Lokinet loki{std::filesystem::path{"lokinet.ini"}};

    std::promise<void> prom;
    loki.on_connected([&] {
        std::cout << "\n\x1b[32;1mLokinet connected!\x1b[0m\n\n\x1b[33;1mINITIATING SESSION TO " << target
                  << "\x1b[0m\n\n"
                  << std::flush;
        loki.establish_udp(
            target,
            12345,
            [](auto udp_info) {
                std::cout << "\n\x1b[32;1mUDP bound to port " << udp_info.local_port << "\x1b[0m\n\n" << std::flush;
            },
            [&prom](std::string_view fail_msg) {
                try
                {
                    throw std::runtime_error{std::string{fail_msg}};
                }
                catch (...)
                {
                    prom.set_exception(std::current_exception());
                }
            });
    });
    try
    {
        prom.get_future().get();
    }
    catch (const std::exception& e)
    {
        std::cerr << "\n\n\x1b[31;1mError establishing session to " << target << ": " << e.what() << "\x1b[0m\n\n";
        return 1;
    }

    /*
    loki.map_tcp_remote_port(std::string{argv[1]}, 12345,
        [&](auto tunnel_info) {
          std::cout << "\n\nTCP bound to port " << tunnel_info.local_port << "\n\n";
        },
        [&](auto error_str) {
          std::cerr << "\nTCP Tunnel map error: " << error_str << "\n";
        });
    */
    std::cout << "\nPRESS ENTER TO EXIT\n";
    std::string ignored;
    std::getline(std::cin, ignored);
    std::cout << "\nEXITING\n";
}


================================================
FILE: contrib/lokinet-resolvconf
================================================
#!/bin/bash

# Script to invoke resolvconf (if installed) to add/remove lokinet into/from the resolvconf DNS
# server list.  This script does not add if any of these are true:
#
# - /sbin/resolvconf does not exist
# - the systemd-resolved service is active
# - a `no-resolvconf=1` item is present in the [dns] section of lokinet.ini
#
# It always attempts to remove if resolvconf is installed (so that commenting out while running,
# then stopping still removes the added entry).
#
# Usage: lokinet-resolvconf {add|remove} /etc/loki/lokinet.ini

set -e

action="$1"
conf="$2"

if [[ ! ("$action" == "add" || "$action" == "remove") || ! -f "$conf" ]]; then
    echo "Usage: $0 {add|remove} /path/to/lokinet.ini" >&2
    exit 1
fi

if ! [ -x /sbin/resolvconf ]; then
    exit 0
fi

if [ -x /bin/systemctl ] && /bin/systemctl --quiet is-active systemd-resolved.service; then
    exit 0
fi

if [ "$action" == "add" ]; then
    if ! [ -x /sbin/resolvconf ]; then exit 0; fi

    lokinet_ns=$(perl -e '
    $ns = "127.3.2.1"; # default if none found in .ini
    while (<>) {
        if ((/^\[dns\]/ ... /^\[/)) {
            if (/^bind\s*=\s*([\d.]+)(?::53)?\s*$/) {
                $ns=$1;
            } elsif (/^no-resolvconf\s*=\s*1\s*/) {
                exit;
            }
        }
    }
    print $ns' "$conf")

    if [ -n "$lokinet_ns" ]; then
        echo "nameserver $lokinet_ns" | /sbin/resolvconf -a lo.000lokinet
    fi
else
    /sbin/resolvconf -d lo.000lokinet
fi


================================================
FILE: contrib/mac-configure.sh
================================================
#!/bin/bash

set -e
set -x

if ! [ -f LICENSE ] || ! [ -d llarp ]; then
    echo "You need to run this as ./contrib/mac.sh from the top-level lokinet project directory" >&2
    exit 1
fi

mkdir -p build-mac
cd build-mac
cmake \
      -G Ninja \
      -DBUILD_STATIC_DEPS=ON \
      -DLOKINET_TESTS=OFF \
      -DLOKINET_BOOTSTRAP=OFF \
      -DLOKINET_NATIVE_BUILD=OFF \
      -DWITH_LTO=ON \
      -DCMAKE_BUILD_TYPE=Release \
      -DMACOS_SYSTEM_EXTENSION=ON \
      -DCODESIGN=ON \
      -DLOKINET_PACKAGE=ON \
      "$@" \
      ..

echo "cmake build configured in build-mac"


================================================
FILE: contrib/mac.sh
================================================
#!/bin/bash
#
# Build the shit on mac
#
# You will generally need to add: -DCODESIGN_APP=... to make this work, and (unless you are a
# lokinet team member) will need to pay Apple money for your own team ID and arse around with
# provisioning profiles.  See macos/README.txt.
#

set -e
set -x

if ! [ -f LICENSE ] || ! [ -d llarp ]; then
    echo "You need to run this as ./contrib/mac.sh from the top-level lokinet project directory" >&2
    exit 1
fi

./contrib/mac-configure.sh "$@"

cd build-mac
rm -rf Lokinet\ *
ninja -j${JOBS:-1} dmg
cd ..

echo -e "Build complete, your app is here:\n"
ls -lad $(pwd)/build-mac/Lokinet\ *
echo ""


================================================
FILE: contrib/macos/lokinet-extension.Info.plist.in
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>CFBundleDevelopmentRegion</key>
		<string>en</string>

		<key>CFBundleDisplayName</key>
		<string>Lokinet Network Extension</string>

		<key>CFBundleExecutable</key>
		<string>org.lokinet.network-extension</string>

		<key>CFBundleIdentifier</key>
		<string>org.lokinet.network-extension</string>

		<key>CFBundleInfoDictionaryVersion</key>
		<string>6.0</string>

		<key>CFBundlePackageType</key>
		<string>SYSX</string>
		
		<key>CFBundleName</key>
		<string>org.lokinet.network-extension</string>

		<key>CFBundleVersion</key>
		<string>@lokinet_VERSION@.@LOKINET_APPLE_BUILD@</string>

		<key>CFBundleShortVersionString</key>
		<string>@lokinet_VERSION@</string>

		<key>CFBundleSupportedPlatforms</key>
		<array>
			<string>MacOSX</string>
		</array>

		<key>ITSAppUsesNonExemptEncryption</key>
		<false/>

		<key>LSMinimumSystemVersion</key>
		<string>10.15</string>

        <key>NSHumanReadableCopyright</key>
        <string>Copyright © 2022 The Oxen Project, licensed under GPLv3-or-later</string>

		<key>NSSystemExtensionUsageDescription</key>
		<string>Provides Lokinet Network connectivity.</string>

		<key>NetworkExtension</key>
		<dict>
			<key>NEMachServiceName</key>
			<string>SUQ8J2PCT7.org.lokinet.network-extension</string>

			<key>NEProviderClasses</key>
			<dict>
				<key>com.apple.networkextension.packet-tunnel</key>
				<string>LLARPPacketTunnel</string>

				<key>com.apple.networkextension.dns-proxy</key>
				<string>LLARPDNSProxy</string>
			</dict>
		</dict>
	</dict>
</plist>


================================================
FILE: contrib/macos/lokinet-extension.plugin.entitlements.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.application-identifier</key>
		<string>SUQ8J2PCT7.org.lokinet.network-extension</string>

		<key>com.apple.developer.networking.networkextension</key>
		<array>
			<string>packet-tunnel-provider</string>
			<string>dns-proxy</string>
		</array>

		<key>com.apple.developer.team-identifier</key>
		<string>SUQ8J2PCT7</string>

		<key>com.apple.security.app-sandbox</key>
		<true/>

		<key>com.apple.security.network.client</key>
		<true/>

		<key>com.apple.security.network.server</key>
		<true/>

	</dict>
</plist>


================================================
FILE: contrib/macos/lokinet-extension.sysext.entitlements.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.application-identifier</key>
		<string>SUQ8J2PCT7.org.lokinet.network-extension</string>

		<key>com.apple.developer.networking.networkextension</key>
		<array>
			<string>packet-tunnel-provider-systemextension</string>
			<string>dns-proxy-systemextension</string>
		</array>

		<key>com.apple.developer.team-identifier</key>
		<string>SUQ8J2PCT7</string>

		<key>com.apple.security.app-sandbox</key>
		<true/>

        <key>com.apple.security.application-groups</key>
        <array>
            <string>SUQ8J2PCT7.org.lokinet</string>
        </array>

		<key>com.apple.security.network.client</key>
		<true/>

		<key>com.apple.security.network.server</key>
		<true/>

	</dict>
</plist>


================================================
FILE: contrib/macos/lokinet-newsyslog.conf
================================================
/var/log/lokinet.log   644  5  5M  $D0   J

================================================
FILE: contrib/macos/lokinet.Info.plist.in
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>CFBundleDevelopmentRegion</key>
		<string>en</string>

		<key>CFBundleExecutable</key>
		<string>Lokinet</string>

		<key>CFBundleIdentifier</key>
		<string>org.lokinet</string>

		<key>CFBundleInfoDictionaryVersion</key>
		<string>6.0</string>

		<key>CFBundleName</key>
		<string>Lokinet</string>

		<key>CFBundleIconFile</key>
		<string>icon.icns</string>

		<key>CFBundlePackageType</key>
		<string>APPL</string>

		<key>CFBundleShortVersionString</key>
		<string>@lokinet_VERSION@</string>

		<key>CFBundleVersion</key>
		<string>@lokinet_VERSION@.@LOKINET_APPLE_BUILD@</string>

		<key>LSMinimumSystemVersion</key>
		<string>10.15</string>

		<key>NSHumanReadableCopyright</key>
		<string>Copyright © 2022 The Oxen Project, licensed under GPLv3-or-later</string>

		<key>LSUIElement</key>
		<true/>

		<key>LSHasLocalizedDisplayName</key>
		<true/>

	  </dict>
</plist>


================================================
FILE: contrib/macos/lokinet.plugin.entitlements.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.application-identifier</key>
		<string>SUQ8J2PCT7.org.lokinet</string>

		<key>com.apple.developer.networking.networkextension</key>
		<array>
			<string>packet-tunnel-provider</string>
			<string>dns-proxy</string>
			<string>dns-settings</string>
		</array>

		<key>com.apple.developer.team-identifier</key>
		<string>SUQ8J2PCT7</string>

		<key>com.apple.security.app-sandbox</key>
		<true/>

		<key>com.apple.security.network.client</key>
		<true/>

		<key>com.apple.security.network.server</key>
		<true/>

	</dict>
</plist>


================================================
FILE: contrib/macos/lokinet.sysext.entitlements.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.application-identifier</key>
		<string>SUQ8J2PCT7.org.lokinet</string>

		<key>com.apple.developer.networking.networkextension</key>
		<array>
			<string>packet-tunnel-provider-systemextension</string>
			<string>dns-proxy-systemextension</string>
			<string>dns-settings</string>
		</array>

		<key>com.apple.developer.team-identifier</key>
		<string>SUQ8J2PCT7</string>

        <key>com.apple.developer.system-extension.install</key>
        <true/>

		<key>com.apple.security.app-sandbox</key>
		<true/>

        <key>com.apple.security.application-groups</key>
        <array>
            <string>SUQ8J2PCT7.org.lokinet</string>
        </array>

		<key>com.apple.security.network.client</key>
		<true/>

		<key>com.apple.security.network.server</key>
		<true/>

	</dict>
</plist>


================================================
FILE: contrib/macos/mk-icns.sh
================================================
#!/bin/bash

# Invoked from cmake as mk-icns.sh /path/to/icon.svg /path/to/output.icns
svg="$1"
out="$2"
outdir="${out/%.icns/.iconset}"

set -e

# Apple's PNG encoding/decoding is buggy and likes to inject yellow lines, particularly for the
# smaller images.  This is apparently a known issue since macOS 11 that apple just doesn't give a
# shit about fixing (https://en.wikipedia.org/wiki/Apple_Icon_Image_format#Known_issues).
#
# So moral of the story: we have to arse around and edit the png to put a tranparent pixel in the
# bottom-left corner but that pixel *must* be different from the preceeding color, otherwise Apple's
# garbage breaks exposing the dumpster fire that lies beneath and drops the blue channel from the
# last pixel (or run of pixels, if they are the same color (ignoring transparency).  So, just to be
# consistent, we make *all* 4 corners transparent yellow, because it seems unlikely for our logo to
# have full-on yellow in the corner, and the color itself is irrelevant because it is fully
# transparent.
#
# Why is there so much broken, buggy crap in the macOS core???

no_r_kelly() {
    size=$1
    last=$((size - 1))
    for x in 0 $last; do
        for y in 0 $last; do
            echo -n "color $x,$y point "
        done
    done
}



mkdir -p "${outdir}"
for size in 32 64 128 256 512 1024; do
    # Yay Apple thanks for this utter trash OS.
    last=$((size - 1))
    convert -background none -resize "${size}x${size}" "$svg" \
        -fill '#ff00' -draw "$(no_r_kelly $size)" \
        -strip "png32:${outdir}/icon_${size}x${size}.png"
done


# Outputs the imagemagick -draw command to color the corner-adjacent pixels as half-transparent
# white.  We use this for the 16x16 (the others pick up corner transparency from the svg).
semitransparent_off_corners() {
    size=$1
    for x in 1 $((size - 2)); do
        for y in 0 $((size - 1)); do
            echo -n "color $x,$y point "
        done
    done
    for x in 0 $((size -1)); do
        for y in 1 $((size - 2)); do
            echo -n "color $x,$y point "
        done
    done
}

# For 16x16 we crop the image to 5/8 of its regular size before resizing which effectively zooms in
# on it a bit because if we resize the full icon it ends up a fuzzy mess, while the crop and resize
# lets us retain some detail of the logo.  (We don't do this for the 16x16@2x because that is really
# 32x32 where it retains enough detail).
convert -background none -resize 512x512 "$svg" -gravity Center -extent 320x320 -resize 16x16 \
    -fill '#ff00' -draw "$(no_r_kelly 16)" \
    -fill '#fff8' -draw "$(semitransparent_off_corners 16)" \
    -strip "png32:$outdir/icon_16x16.png"

# Create all the "@2x" versions which are just the double-size versions
rm -f "${outdir}/icon_*@2x.png"
mv "${outdir}/icon_1024x1024.png" "${outdir}/icon_512x512@2x.png"
for size in 16 32 128 256; do
    double=$((size * 2))
    ln -f "${outdir}/icon_${double}x${double}.png" "${outdir}/icon_${size}x${size}@2x.png"
done

iconutil -c icns "${outdir}"


================================================
FILE: contrib/macos/notarize.py.in
================================================
#!/usr/bin/env python3

import sys
import plistlib
import subprocess
import time
import os
import os.path

def bold_red(x):
    return "\x1b[31;1m" + x + "\x1b[0m"

if not @notarize_py_is_sysext@:
    print(bold_red("\nUnable to notarize: this lokinet is not built as a system extension\n"), file=sys.stderr)
    sys.exit(1)

if not all(("@MACOS_NOTARIZE_USER@", "@MACOS_NOTARIZE_PASS@", "@MACOS_NOTARIZE_ASC@")):
    print(bold_red("\nUnable to notarize: one or more required notarization variable not set; see contrib/macos/README.txt\n") +
            "  Called with -DMACOS_NOTARIZE_USER=@MACOS_NOTARIZE_USER@\n"
            "              -DMACOS_NOTARIZE_PASS=@MACOS_NOTARIZE_PASS@\n"
            "              -DMACOS_NOTARIZE_ASC=@MACOS_NOTARIZE_ASC@\n",
            file=sys.stderr)
    sys.exit(1)

os.chdir("@PROJECT_BINARY_DIR@")
app = "@lokinet_app@"
zipfile = f"Lokinet.app.notarize.zip"
print(f"Creating {zipfile} from {app}")
if os.path.exists(zipfile):
    os.remove(zipfile)
subprocess.run(['ditto', '-v', '-c', '-k', '--sequesterRsrc', '--keepParent', app, zipfile])

userpass = ('--username', "@MACOS_NOTARIZE_USER@", '--password', "@MACOS_NOTARIZE_PASS@")
print("Submitting {} for notarization; this may take a minute...".format(zipfile))

started = time.time()
command = [
    'xcrun', 'altool',
    '--notarize-app',
    '--primary-bundle-id', 'org.lokinet.@PROJECT_VERSION@',
    *userpass,
    '--asc-provider', "@MACOS_NOTARIZE_ASC@",
    '--file', zipfile,
    '--output-format', 'xml'
    ]
print(command)
result = subprocess.run(command, stdout=subprocess.PIPE)

data = plistlib.loads(result.stdout)
if 'success-message' not in data or 'notarization-upload' not in data or 'RequestUUID' not in data['notarization-upload']:
    print("Something failed, leaving you with this nice XML to figure out:\n{}".format(data))
    sys.exit(1)

uuid = data['notarization-upload']['RequestUUID']
elapsed = time.time() - started
mins, secs = int(elapsed // 60), elapsed % 60
print("Notarization submitted with request uuid = {} in {:d}m{:05.2f}s".format(uuid, mins, secs))
print(data['success-message'])

print("Begin polling for notarization result")
started_waiting = time.time()
done = False
success = False
while not done:
    time.sleep(5)
    result = subprocess.run([
        'xcrun', 'altool',
        '--notarization-info', uuid,
        *userpass,
        '-
Download .txt
gitextract_c7sekzv8/

├── .clang-format
├── .clang-tidy
├── .dir-locals.el
├── .dockerignore
├── .drone.jsonnet
├── .gitattributes
├── .github/
│   ├── CONTRIBUTING.md
│   ├── ISSUE_TEMPLATE/
│   │   └── bug_report.md
│   └── workflows/
│       └── clean_issues.yml
├── .gitignore
├── .gitmodules
├── .swift-version
├── CMakeLists.txt
├── CONTRIBUTING.md
├── CONTRIBUTING_es.md
├── LICENSE
├── cmake/
│   ├── CMakeGraphVizOptions.cmake
│   ├── DownloadLibSodium.cmake
│   ├── FindJemalloc.cmake
│   ├── GenVersion.cmake
│   ├── MacroEnsureOutOfSourceBuild.cmake
│   ├── StaticBuild.cmake
│   ├── TargetArch.cmake
│   ├── Version.cmake
│   ├── add_import_library.cmake
│   ├── cmake_uninstall.cmake.in
│   ├── coverage.cmake
│   ├── cross_compile.cmake
│   ├── enable_lto.cmake
│   ├── gui-option.cmake
│   ├── gui.cmake
│   ├── installer.cmake
│   ├── libatomic.cmake
│   ├── macos.cmake
│   ├── ngtcp2_lib.cmake
│   ├── solaris.cmake
│   ├── target_link_libraries_system.cmake
│   ├── unix.cmake
│   ├── win32.cmake
│   └── win32_installer_deps.cmake
├── contrib/
│   ├── NetworkManager/
│   │   └── dnsmasq/
│   │       ├── README.md
│   │       └── lokinet.conf
│   ├── android-configure.sh
│   ├── android.sh
│   ├── apparmor/
│   │   └── usr.bin.lokinet
│   ├── apply-patches.sh
│   ├── bencode-dump.py
│   ├── bootstrap/
│   │   ├── mainnet.signed
│   │   ├── make-bootstrap-list.sh
│   │   ├── readme.txt
│   │   └── testnet.signed
│   ├── ci/
│   │   ├── docker/
│   │   │   ├── readme.md
│   │   │   └── rebuild-docker-images.py
│   │   ├── drone-check-static-libs.sh
│   │   ├── drone-debs-upload.sh
│   │   ├── drone-format-verify.sh
│   │   ├── drone-gdb.sh
│   │   ├── drone-run-router-hive.sh
│   │   ├── drone-static-upload.sh
│   │   └── gdb-filter.py
│   ├── cross/
│   │   ├── android.toolchain.cmake
│   │   ├── cross.toolchain.cmake
│   │   ├── mingw32.cmake
│   │   ├── mingw64.cmake
│   │   └── mingw_core.cmake
│   ├── cross.sh
│   ├── deb.oxen.io.gpg
│   ├── format-version.sh
│   ├── format.sh
│   ├── git-hook-pre-push.sh
│   ├── hex-to-base32z.py
│   ├── keygen.py
│   ├── liblokinet/
│   │   ├── CMakeLists.txt
│   │   ├── readme.md
│   │   └── udptest.cpp
│   ├── liblokinet_jank_test.cpp
│   ├── lokinet-resolvconf
│   ├── mac-configure.sh
│   ├── mac.sh
│   ├── macos/
│   │   ├── InfoPlist.strings
│   │   ├── installer.tiff
│   │   ├── lokinet-extension.Info.plist.in
│   │   ├── lokinet-extension.dev.provisionprofile
│   │   ├── lokinet-extension.plugin.entitlements.plist
│   │   ├── lokinet-extension.release.provisionprofile
│   │   ├── lokinet-extension.sysext.entitlements.plist
│   │   ├── lokinet-newsyslog.conf
│   │   ├── lokinet.Info.plist.in
│   │   ├── lokinet.dev.provisionprofile
│   │   ├── lokinet.plugin.entitlements.plist
│   │   ├── lokinet.release.provisionprofile
│   │   ├── lokinet.sysext.entitlements.plist
│   │   ├── mk-icns.sh
│   │   ├── notarize.py.in
│   │   ├── seticon.swift
│   │   └── sign.sh.in
│   ├── make-ico.sh
│   ├── omq-rpc.py
│   ├── patches/
│   │   ├── libzmq-mingw-unistd.patch
│   │   ├── libzmq-mingw-wepoll.patch
│   │   └── unbound-delete-crash-fix.patch
│   ├── py/
│   │   ├── .gitignore
│   │   ├── admin/
│   │   │   ├── .gitignore
│   │   │   ├── lokinetmon
│   │   │   └── requirements.txt
│   │   ├── ffi-example/
│   │   │   └── lokinet.py
│   │   ├── keygen/
│   │   │   ├── .gitignore
│   │   │   ├── keygen.py
│   │   │   └── readme.md
│   │   ├── lnproxy/
│   │   │   ├── lnproxy/
│   │   │   │   └── __main__.py
│   │   │   └── readme.md
│   │   └── quic_tester.py
│   ├── readme-installer.txt
│   ├── systemd-resolved/
│   │   ├── README.md
│   │   ├── lokinet.pkla
│   │   └── lokinet.rules
│   ├── tarball.sh
│   ├── windows-configure.sh
│   └── windows.sh
├── daemon/
│   ├── CMakeLists.txt
│   ├── lokinet-cntrl.cpp
│   ├── lokinet.cpp
│   ├── lokinet.swift
│   ├── utils.cpp
│   └── utils.hpp
├── docs/
│   ├── CMakeLists.txt
│   ├── Doxyfile.in
│   ├── LICENSE
│   ├── architecture.md
│   ├── config.json
│   ├── dns-overview.md
│   ├── doxygen.md
│   ├── exit-setup.md
│   ├── fix-markdown.sh
│   ├── ideal-ux.md
│   ├── index.md.in
│   ├── install.md
│   ├── liblokinet-dev-guide.md
│   ├── macos-signing.txt
│   ├── mkdocs.yml
│   ├── net-comparisons.md
│   ├── project-structure.md
│   ├── readme.md
│   ├── refactor_notes.md
│   ├── snapps-dev-guide.md
│   ├── spanish/
│   │   ├── LICENSE
│   │   ├── README
│   │   └── vision-general.txt
│   ├── tcp-over-quic.md
│   └── we-cannot-make-sandwiches.md
├── external/
│   └── CMakeLists.txt
├── include/
│   ├── llarp.hpp
│   ├── lokinet/
│   │   ├── addr.h
│   │   ├── context.h
│   │   ├── export.h
│   │   ├── misc.h
│   │   ├── srv.h
│   │   ├── stream.h
│   │   └── udp.h
│   ├── lokinet.h
│   └── lokinet.hpp
├── jni/
│   ├── CMakeLists.txt
│   ├── java/
│   │   └── src/
│   │       └── network/
│   │           └── loki/
│   │               └── lokinet/
│   │                   ├── LokinetConfig.java
│   │                   └── LokinetDaemon.java
│   ├── lokinet_config.cpp
│   ├── lokinet_daemon.cpp
│   ├── lokinet_jni_common.hpp
│   ├── network_loki_lokinet_LokinetConfig.h
│   ├── network_loki_lokinet_LokinetDaemon.h
│   ├── network_loki_lokinet_LokinetVPN.h
│   ├── network_loki_lokinet_LokinetVPN_VPNInfo.h
│   ├── network_loki_lokinet_Lokinet_JNI.h
│   └── readme.md
├── llarp/
│   ├── CMakeLists.txt
│   ├── address/
│   │   ├── address.cpp
│   │   ├── address.hpp
│   │   ├── ip_range.cpp
│   │   ├── ip_range.hpp
│   │   ├── map.hpp
│   │   ├── types.hpp
│   │   ├── utils.cpp
│   │   └── utils.hpp
│   ├── android/
│   │   ├── ifaddrs.c
│   │   └── ifaddrs.h
│   ├── app.xml
│   ├── apple/
│   │   ├── CMakeLists.txt
│   │   ├── DNSTrampoline.h
│   │   ├── DNSTrampoline.m
│   │   ├── PacketTunnelProvider.m
│   │   ├── context.hpp
│   │   ├── context_wrapper.cpp
│   │   ├── context_wrapper.h
│   │   ├── route_manager.cpp
│   │   ├── route_manager.hpp
│   │   ├── vpn_interface.cpp
│   │   ├── vpn_interface.hpp
│   │   ├── vpn_platform.cpp
│   │   └── vpn_platform.hpp
│   ├── auth/
│   │   ├── auth.cpp
│   │   ├── auth.hpp
│   │   ├── file.cpp
│   │   ├── file.hpp
│   │   ├── rpc.cpp
│   │   ├── rpc.hpp
│   │   ├── session.cpp
│   │   └── session.hpp
│   ├── config/
│   │   ├── config.cpp
│   │   ├── config.hpp
│   │   ├── definition.cpp
│   │   ├── definition.hpp
│   │   ├── ini.cpp
│   │   └── ini.hpp
│   ├── consensus/
│   │   ├── reachability_testing.cpp
│   │   └── reachability_testing.hpp
│   ├── constants/
│   │   ├── apple.hpp
│   │   ├── files.hpp
│   │   ├── link_layer.hpp
│   │   ├── net.hpp
│   │   ├── path.hpp
│   │   ├── platform.hpp
│   │   ├── proto.hpp
│   │   ├── version.cpp.in
│   │   └── version.hpp
│   ├── contact/
│   │   ├── client_contact.cpp
│   │   ├── client_contact.hpp
│   │   ├── client_intro.cpp
│   │   ├── client_intro.hpp
│   │   ├── contactdb.cpp
│   │   ├── contactdb.hpp
│   │   ├── relay_contact.cpp
│   │   ├── relay_contact.hpp
│   │   ├── router_id.cpp
│   │   ├── router_id.hpp
│   │   ├── sns.cpp
│   │   └── sns.hpp
│   ├── context.cpp
│   ├── crypto/
│   │   ├── constants.hpp
│   │   ├── crypto.cpp
│   │   ├── crypto.hpp
│   │   ├── key_manager.cpp
│   │   ├── key_manager.hpp
│   │   ├── keys.cpp
│   │   ├── keys.hpp
│   │   ├── types.cpp
│   │   └── types.hpp
│   ├── dns/
│   │   ├── dns.hpp
│   │   ├── message.cpp
│   │   ├── message.hpp
│   │   ├── name.cpp
│   │   ├── name.hpp
│   │   ├── nm_platform.cpp
│   │   ├── nm_platform.hpp
│   │   ├── platform.cpp
│   │   ├── platform.hpp
│   │   ├── question.cpp
│   │   ├── question.hpp
│   │   ├── rr.cpp
│   │   ├── rr.hpp
│   │   ├── sd_platform.cpp
│   │   ├── sd_platform.hpp
│   │   ├── serialize.cpp
│   │   ├── serialize.hpp
│   │   ├── server.cpp
│   │   ├── server.hpp
│   │   ├── srv_data.cpp
│   │   ├── srv_data.hpp
│   │   └── string.hpp
│   ├── ev/
│   │   ├── fd_poller.cpp
│   │   ├── fd_poller.hpp
│   │   ├── tcp.cpp
│   │   ├── tcp.hpp
│   │   ├── udp.cpp
│   │   └── udp.hpp
│   ├── handlers/
│   │   ├── session.cpp
│   │   ├── session.hpp
│   │   ├── tun.cpp
│   │   ├── tun.hpp
│   │   └── tun_base.hpp
│   ├── link/
│   │   ├── connection.cpp
│   │   ├── connection.hpp
│   │   ├── endpoint.cpp
│   │   ├── endpoint.hpp
│   │   ├── link_manager.cpp
│   │   └── link_manager.hpp
│   ├── linux/
│   │   ├── dbus.cpp
│   │   ├── dbus.hpp
│   │   └── sd_service_manager.cpp
│   ├── lokinet.cpp
│   ├── lokinet_shared.cpp
│   ├── messages/
│   │   ├── common.cpp
│   │   ├── common.hpp
│   │   ├── dht.cpp
│   │   ├── dht.hpp
│   │   ├── fetch.cpp
│   │   ├── fetch.hpp
│   │   ├── path.cpp
│   │   ├── path.hpp
│   │   ├── session.cpp
│   │   └── session.hpp
│   ├── net/
│   │   ├── id.hpp
│   │   ├── ip_headers.hpp
│   │   ├── ip_packet.cpp
│   │   ├── ip_packet.hpp
│   │   ├── net.h
│   │   ├── net_if.hpp
│   │   ├── platform.hpp
│   │   ├── policy.cpp
│   │   ├── policy.hpp
│   │   ├── posix.cpp
│   │   ├── utils.cpp
│   │   ├── utils.hpp
│   │   └── win32.cpp
│   ├── nodedb-bootstraps.cpp.in
│   ├── nodedb.cpp
│   ├── nodedb.hpp
│   ├── path/
│   │   ├── build_stats.cpp
│   │   ├── build_stats.hpp
│   │   ├── hopid.cpp
│   │   ├── hopid.hpp
│   │   ├── path.cpp
│   │   ├── path.hpp
│   │   ├── path_context.cpp
│   │   ├── path_context.hpp
│   │   ├── path_handler.cpp
│   │   ├── path_handler.hpp
│   │   ├── transit_hop.cpp
│   │   └── transit_hop.hpp
│   ├── profiling.cpp
│   ├── profiling.hpp
│   ├── router/
│   │   ├── route_poker.cpp
│   │   ├── route_poker.hpp
│   │   ├── router.cpp
│   │   └── router.hpp
│   ├── rpc/
│   │   ├── json_binary_proxy.cpp
│   │   ├── json_binary_proxy.hpp
│   │   ├── json_bt.hpp
│   │   ├── json_conversions.cpp
│   │   ├── json_conversions.hpp
│   │   ├── oxend_rpc.cpp
│   │   ├── oxend_rpc.hpp
│   │   ├── param_parser.hpp
│   │   ├── rpc_request.hpp
│   │   ├── rpc_request_decorators.hpp
│   │   ├── rpc_request_definitions.hpp
│   │   ├── rpc_request_parser.cpp
│   │   ├── rpc_request_parser.hpp
│   │   ├── rpc_server.cpp
│   │   └── rpc_server.hpp
│   ├── session/
│   │   ├── session.cpp
│   │   └── session.hpp
│   ├── simulation/
│   │   ├── sim_context.cpp
│   │   └── sim_context.hpp
│   ├── util/
│   │   ├── aligned.hpp
│   │   ├── bspan.hpp
│   │   ├── buffer.cpp
│   │   ├── buffer.hpp
│   │   ├── common.hpp
│   │   ├── compare_ptr.hpp
│   │   ├── decaying_hashset.hpp
│   │   ├── decaying_hashtable.hpp
│   │   ├── exceptions.hpp
│   │   ├── file.cpp
│   │   ├── file.hpp
│   │   ├── formattable.hpp
│   │   ├── logging/
│   │   │   ├── buffer.hpp
│   │   │   └── callback_sink.hpp
│   │   ├── logging.cpp
│   │   ├── logging.hpp
│   │   ├── lokinet_init.h
│   │   ├── mem.cpp
│   │   ├── mem.h
│   │   ├── mem.hpp
│   │   ├── nop_service_manager.cpp
│   │   ├── random.hpp
│   │   ├── service_manager.hpp
│   │   ├── str.cpp
│   │   ├── str.hpp
│   │   ├── thread/
│   │   │   ├── barrier.hpp
│   │   │   ├── queue.hpp
│   │   │   ├── queue_manager.cpp
│   │   │   ├── queue_manager.hpp
│   │   │   ├── threading.cpp
│   │   │   └── threading.hpp
│   │   ├── time.cpp
│   │   ├── time.hpp
│   │   ├── zstd.cpp
│   │   └── zstd.hpp
│   ├── vpn/
│   │   ├── android.hpp
│   │   ├── common.hpp
│   │   ├── egres_packet_router.cpp
│   │   ├── egres_packet_router.hpp
│   │   ├── linux.hpp
│   │   ├── packet_intercept.hpp
│   │   ├── packet_io.hpp
│   │   ├── packet_router.cpp
│   │   ├── packet_router.hpp
│   │   ├── platform.cpp
│   │   ├── platform.hpp
│   │   ├── win32.cpp
│   │   └── win32.hpp
│   └── win32/
│       ├── adapters.hpp
│       ├── dll.cpp
│       ├── dll.hpp
│       ├── exception.cpp
│       ├── exception.hpp
│       ├── exec.cpp
│       ├── exec.hpp
│       ├── guid.hpp
│       ├── handle.hpp
│       ├── service_manager.cpp
│       ├── service_manager.hpp
│       ├── version.rc.in
│       ├── win32_inet.c
│       ├── win32_intrnl.c
│       ├── windivert.cpp
│       ├── windivert.hpp
│       ├── wintun.cpp
│       └── wintun.hpp
├── pybind/
│   ├── CMakeLists.txt
│   ├── common.hpp
│   ├── llarp/
│   │   ├── config.cpp
│   │   ├── context.cpp
│   │   ├── crypto/
│   │   │   └── types.cpp
│   │   ├── dht/
│   │   │   └── dht_types.cpp
│   │   ├── handlers/
│   │   │   ├── pyhandler.cpp
│   │   │   └── pyhandler.hpp
│   │   ├── logger.cpp
│   │   ├── path/
│   │   │   ├── path_hop_config.cpp
│   │   │   └── path_types.cpp
│   │   ├── peerstats.cpp
│   │   ├── router.cpp
│   │   ├── router_contact.cpp
│   │   ├── router_id.cpp
│   │   ├── service/
│   │   │   └── address.cpp
│   │   └── tooling/
│   │       ├── router_event.cpp
│   │       └── router_hive.cpp
│   ├── module.cpp
│   └── readme.md
├── readme.md
├── readme_es.md
├── readme_fr.md
├── readme_ru.md
├── test/
│   ├── CMakeLists.txt
│   ├── check_main.cpp
│   ├── config/
│   │   ├── test_llarp_config_definition.cpp
│   │   ├── test_llarp_config_ini.cpp
│   │   ├── test_llarp_config_output.cpp
│   │   └── test_llarp_config_values.cpp
│   ├── crypto/
│   │   ├── test_llarp_crypto.cpp
│   │   ├── test_llarp_crypto_types.cpp
│   │   └── test_llarp_key_manager.cpp
│   ├── dns/
│   │   └── test_llarp_dns_dns.cpp
│   ├── hive/
│   │   ├── conftest.py
│   │   ├── hive.py
│   │   ├── test_path_builds.py
│   │   └── test_peer_stats.py
│   ├── mocks/
│   │   ├── mock_context.hpp
│   │   ├── mock_network.hpp
│   │   ├── mock_router.hpp
│   │   └── mock_vpn.hpp
│   ├── net/
│   │   ├── test_ip_address.cpp
│   │   ├── test_llarp_net.cpp
│   │   └── test_sock_addr.cpp
│   ├── nodedb/
│   │   └── test_nodedb.cpp
│   ├── path/
│   │   └── test_path.cpp
│   ├── peerstats/
│   │   ├── test_peer_db.cpp
│   │   └── test_peer_types.cpp
│   ├── readme.md
│   ├── router/
│   │   └── test_llarp_router_version.cpp
│   ├── routing/
│   │   ├── test_llarp_routing_obtainexitmessage.cpp
│   │   └── test_llarp_routing_transfer_traffic.cpp
│   ├── service/
│   │   ├── test_llarp_service_address.cpp
│   │   ├── test_llarp_service_identity.cpp
│   │   └── test_llarp_service_name.cpp
│   ├── test_llarp_encrypted_frame.cpp
│   ├── test_llarp_router_contact.cpp
│   ├── test_util.cpp
│   ├── test_util.hpp
│   ├── util/
│   │   ├── meta/
│   │   │   └── test_llarp_util_memfn.cpp
│   │   ├── test_llarp_util_aligned.cpp
│   │   ├── test_llarp_util_bencode.cpp
│   │   ├── test_llarp_util_bits.cpp
│   │   ├── test_llarp_util_decaying_hashset.cpp
│   │   ├── test_llarp_util_log_level.cpp
│   │   ├── test_llarp_util_str.cpp
│   │   └── thread/
│   │       ├── test_llarp_util_queue.cpp
│   │       └── test_llarp_util_queue_manager.cpp
│   └── win32/
│       └── test.rc
└── win32-setup/
    ├── .gitignore
    ├── Makefile
    ├── config_migration.bat
    ├── curl-win32.patch
    ├── extra_create_icons.nsis
    ├── extra_delete_icons.nsis
    ├── extra_install.nsis
    ├── extra_preinstall.nsis
    ├── extra_uninstall.nsis
    ├── libsodium-1.0.17-win32.patch
    ├── libsodium-1.0.18-win32.patch
    ├── lokinet-win32.iss
    ├── mbedtls-win32.patch
    ├── notes.txt
    └── regdb_helper.c
Download .txt
SYMBOL INDEX (2016 symbols across 301 files)

FILE: contrib/bencode-dump.py
  class HexPrinter (line 21) | class HexPrinter():
    method __init__ (line 22) | def __init__(self, data):
    method __repr__ (line 25) | def __repr__(self):
  function next_byte (line 29) | def next_byte():
  function parse_int (line 40) | def parse_int():
  function parse_string (line 50) | def parse_string(s):
  function parse_dict (line 69) | def parse_dict():
  function parse_list (line 86) | def parse_list():
  function parse_thing (line 95) | def parse_thing(t):

FILE: contrib/ci/docker/rebuild-docker-images.py
  function arches (line 37) | def arches(distro):
  function print_line (line 63) | def print_line(myline, value):
  function run_or_report (line 75) | def run_or_report(*args, myline):
  function build_tag (line 89) | def build_tag(tag_base, arch, contents):
  function base_distro_build (line 122) | def base_distro_build(distro, arch):
  function distro_build (line 135) | def distro_build(distro, arch):
  function android_builds (line 216) | def android_builds():
  function lint_build (line 254) | def lint_build():
  function nodejs_build (line 265) | def nodejs_build():
  function push_manifest (line 319) | def push_manifest(latest, tags):

FILE: contrib/ci/gdb-filter.py
  function exit_handler (line 1) | def exit_handler (event):
  function gdb_execmany (line 11) | def gdb_execmany(*cmds):
  function crash_handler (line 18) | def crash_handler (event):

FILE: contrib/hex-to-base32z.py
  function lokinet_snode_addr (line 8) | def lokinet_snode_addr(pk_hex):
  function hex_from_snode (line 26) | def hex_from_snode(b32z):

FILE: contrib/liblokinet/udptest.cpp
  function MakeLokinet (line 19) | [[nodiscard]] auto
  function WaitForReady (line 30) | void
  class Flow (line 39) | class Flow
    method Flow (line 45) | explicit Flow(const lokinet_udp_flowinfo* info, lokinet_context* ctx) ...
    method lokinet_context (line 48) | lokinet_context*
    method String (line 54) | std::string
  type ConnectJob (line 64) | struct ConnectJob
  function CreateOutboundFlow (line 70) | void
  function ProcessNewInboundFlow (line 81) | int
  function DeleteFlow (line 93) | void
  function HandleUDPPacket (line 101) | void
  function BounceUDPPacket (line 108) | void
  function signal_handler (line 121) | void
  function main (line 127) | int

FILE: contrib/liblokinet_jank_test.cpp
  function main (line 11) | int main(int argc, char** argv)

FILE: contrib/py/ffi-example/lokinet.py
  class LokiNET (line 12) | class LokiNET(threading.Thread):
    method load (line 17) | def load(self, lib, conf):
    method inform_fail (line 23) | def inform_fail(self):
    method inform_end (line 28) | def inform_end(self):
    method signal (line 34) | def signal(self, sig):
    method run (line 38) | def run(self):
    method close (line 46) | def close(self):
  function main (line 50) | def main():

FILE: contrib/py/keygen/keygen.py
  function base32z (line 11) | def base32z(data):
  function main (line 19) | def main():

FILE: contrib/py/lnproxy/lnproxy/__main__.py
  class ResultStruct (line 21) | class ResultStruct(ctypes.Structure):
    method __repr__ (line 30) | def __repr__(self):
  class LNContext (line 34) | class LNContext(ctypes.Structure):
  class Context (line 37) | class Context:
    method __init__ (line 42) | def __init__(self, debug=False):
    method free (line 59) | def free(self, ptr):
    method add_bootstrap (line 62) | def add_bootstrap(self, data):
    method wait_for_ready (line 67) | def wait_for_ready(self, ms):
    method ready (line 70) | def ready(self):
    method addr (line 73) | def addr(self):
    method expose (line 76) | def expose(self, port):
    method ln_call (line 79) | def ln_call(self, funcname, *args):
    method expose (line 85) | def expose(self, port):
    method start (line 90) | def start(self):
    method stop (line 93) | def stop(self):
    method hasAddr (line 96) | def hasAddr(self, addr):
    method putAddr (line 99) | def putAddr(self, addr, val):
    method getAddr (line 102) | def getAddr(self, addr):
    method delAddr (line 106) | def delAddr(self, addr):
    method __del__ (line 110) | def __del__(self):
    method set_netid (line 114) | def set_netid(self, netid):
  class Stream (line 117) | class Stream:
    method __init__ (line 119) | def __init__(self, ctx):
    method connect (line 123) | def connect(self, remote):
    method close (line 137) | def close(self):
  function read_and_forward_or_close (line 141) | def read_and_forward_or_close(readfd, writefd):
  class Handler (line 156) | class Handler(BaseHandler):
    method do_CONNECT (line 158) | def do_CONNECT(self):
    method connect (line 161) | def connect(self, host):

FILE: contrib/py/quic_tester.py
  function rpc (line 67) | def rpc(method, args, timeout=15000):
  function success_or_die (line 83) | def success_or_die(response):

FILE: daemon/lokinet-cntrl.cpp
  type cli_opts (line 29) | struct cli_opts
  type app_data (line 41) | struct app_data
  function exit_now (line 56) | static int exit_now(bool is_error, fmt::format_string<T...> format, T&&....
  function app_loop (line 76) | static void app_loop(cli_opts&& options, std::promise<void>&& p)
  function input_loop (line 205) | static void input_loop()
  function main (line 234) | int main(int argc, char* argv[])

FILE: daemon/lokinet.cpp
  type command_line_options (line 27) | struct command_line_options
  function handle_signal (line 63) | void handle_signal(int sig)
  function BOOL (line 79) | BOOL FAR PASCAL handle_signal_win32(DWORD fdwCtrlType)
  function startWinsock (line 86) | int startWinsock()
  function install_win32_daemon (line 100) | void install_win32_daemon()
  function VOID (line 154) | VOID insert_description()
  function uninstall_win32_daemon (line 205) | void uninstall_win32_daemon()
  function LONG (line 249) | LONG GenerateDump(EXCEPTION_POINTERS* pExceptionPointers)
  function VOID (line 272) | VOID FAR PASCAL SvcCtrlHandler(DWORD dwCtrl)
  function VOID (line 299) | VOID FAR PASCAL win32_daemon_entry(DWORD, LPTSTR* argv)
  function lokinet_main (line 322) | int lokinet_main(int argc, char** argv)
  function start_lokinet (line 499) | static void start_lokinet(std::optional<std::filesystem::path> confFile,...
  function main (line 540) | int main(int argc, char* argv[])

FILE: daemon/utils.cpp
  type llarp::controller (line 7) | namespace llarp::controller

FILE: daemon/utils.hpp
  type llarp::controller (line 11) | namespace llarp::controller
    type rpc_controller (line 15) | struct rpc_controller
    type lokinet_instance (line 17) | struct lokinet_instance
      method lokinet_instance (line 25) | lokinet_instance(omq::ConnectionID c) : ID{++next_id}, cid{std::move...
    type rpc_controller (line 31) | struct rpc_controller

FILE: include/llarp.hpp
  type oxen::quic (line 7) | namespace oxen::quic
    class Loop (line 9) | class Loop
  type llarp (line 12) | namespace llarp
    type vpn (line 14) | namespace vpn
      class Platform (line 16) | class Platform
    type Config (line 19) | struct Config
    class Router (line 20) | class Router
    type Context (line 28) | struct Context

FILE: include/lokinet.hpp
  type llarp (line 10) | namespace llarp
    type Context (line 12) | struct Context
    type Config (line 13) | struct Config
  type oxen::quic (line 16) | namespace oxen::quic
    class Loop (line 18) | class Loop
  type lokinet (line 21) | namespace lokinet
    type Network (line 23) | enum class Network
    type tunnel_info (line 30) | struct tunnel_info
    class Lokinet (line 56) | class Lokinet
      type path_ctor (line 60) | struct path_ctor
      method Lokinet (line 72) | explicit Lokinet(const FSPath& config, std::shared_ptr<oxen::quic::L...

FILE: include/lokinet/addr.h
  type lokinet_context (line 11) | struct lokinet_context

FILE: include/lokinet/context.h
  type lokinet_context (line 14) | struct lokinet_context
  type lokinet_context (line 17) | struct lokinet_context
  type lokinet_context (line 20) | struct lokinet_context
  type lokinet_context (line 25) | struct lokinet_context
  type lokinet_context (line 31) | struct lokinet_context
  type lokinet_context (line 36) | struct lokinet_context
  type lokinet_context (line 39) | struct lokinet_context
  type lokinet_context (line 44) | struct lokinet_context

FILE: include/lokinet/srv.h
  type lokinet_srv_record (line 11) | struct lokinet_srv_record
  type lokinet_srv_lookup_private (line 24) | struct lokinet_srv_lookup_private
  type lokinet_srv_lookup_result (line 27) | struct lokinet_srv_lookup_result
  type lokinet_srv_lookup_result (line 39) | struct lokinet_srv_lookup_result
  type lokinet_context (line 39) | struct lokinet_context
  type lokinet_srv_record (line 45) | struct lokinet_srv_record
  type lokinet_srv_lookup_result (line 51) | struct lokinet_srv_lookup_result
  type lokinet_srv_lookup_result (line 54) | struct lokinet_srv_lookup_result

FILE: include/lokinet/stream.h
  type lokinet_stream_result (line 11) | struct lokinet_stream_result
  type lokinet_stream_result (line 30) | struct lokinet_stream_result
  type lokinet_context (line 33) | struct lokinet_context
  type lokinet_context (line 45) | struct lokinet_context
  type lokinet_context (line 49) | struct lokinet_context
  type lokinet_context (line 51) | struct lokinet_context

FILE: include/lokinet/udp.h
  type lokinet_udp_flowinfo (line 11) | struct lokinet_udp_flowinfo
  type lokinet_udp_bind_result (line 22) | struct lokinet_udp_bind_result
  type lokinet_udp_flowinfo (line 30) | struct lokinet_udp_flowinfo
  type lokinet_udp_flowinfo (line 37) | struct lokinet_udp_flowinfo
  type lokinet_udp_flowinfo (line 44) | struct lokinet_udp_flowinfo
  type lokinet_udp_bind_result (line 66) | struct lokinet_udp_bind_result
  type lokinet_context (line 67) | struct lokinet_context
  type lokinet_udp_flowinfo (line 83) | struct lokinet_udp_flowinfo
  type lokinet_context (line 84) | struct lokinet_context
  type lokinet_udp_flowinfo (line 99) | struct lokinet_udp_flowinfo
  type lokinet_context (line 99) | struct lokinet_context
  type lokinet_context (line 107) | struct lokinet_context

FILE: jni/java/src/network/loki/lokinet/LokinetConfig.java
  class LokinetConfig (line 5) | public class LokinetConfig
    method Obtain (line 11) | private static native ByteBuffer Obtain(String dataDir);
    method Free (line 12) | private static native void Free(ByteBuffer buf);
    method Load (line 15) | public native boolean Load();
    method Save (line 17) | public native boolean Save();
    method AddDefaultValue (line 21) | public native void AddDefaultValue(String section, String key, String ...
    method LokinetConfig (line 25) | public LokinetConfig(String dataDir)
    method finalize (line 32) | public void finalize()

FILE: jni/java/src/network/loki/lokinet/LokinetDaemon.java
  class LokinetDaemon (line 12) | public class LokinetDaemon extends VpnService
    method Obtain (line 18) | private static native ByteBuffer Obtain();
    method Free (line 19) | private static native void Free(ByteBuffer buf);
    method Configure (line 20) | public native boolean Configure(LokinetConfig config);
    method Mainloop (line 21) | public native int Mainloop();
    method IsRunning (line 22) | public native boolean IsRunning();
    method Stop (line 23) | public native boolean Stop();
    method InjectVPNFD (line 24) | public native void InjectVPNFD();
    method GetUDPSocket (line 25) | public native int GetUDPSocket();
    method DetectFreeRange (line 27) | private static native String DetectFreeRange();
    method DumpStatus (line 29) | public native String DumpStatus();
    method onCreate (line 39) | @Override
    method onDestroy (line 45) | @Override
    method onStartCommand (line 61) | public int onStartCommand(Intent intent, int flags, int startID)

FILE: jni/lokinet_config.cpp
  function JNIEXPORT (line 9) | JNIEXPORT jobject JNICALL Java_network_loki_lokinet_LokinetConfig_Obtain...
  function JNIEXPORT (line 19) | JNIEXPORT void JNICALL Java_network_loki_lokinet_LokinetConfig_Free(JNIE...
  function JNIEXPORT (line 25) | JNIEXPORT jboolean JNICALL Java_network_loki_lokinet_LokinetConfig_Load(...
  function JNIEXPORT (line 37) | JNIEXPORT jboolean JNICALL Java_network_loki_lokinet_LokinetConfig_Save(...
  function JNIEXPORT (line 53) | JNIEXPORT void JNICALL Java_network_loki_lokinet_LokinetConfig_AddDefaul...

FILE: jni/lokinet_daemon.cpp
  function JNIEXPORT (line 10) | JNIEXPORT jobject JNICALL Java_network_loki_lokinet_LokinetDaemon_Obtain...
  function JNIEXPORT (line 18) | JNIEXPORT void JNICALL Java_network_loki_lokinet_LokinetDaemon_Free(JNIE...
  function JNIEXPORT (line 24) | JNIEXPORT jboolean JNICALL
  function JNIEXPORT (line 46) | JNIEXPORT jint JNICALL Java_network_loki_lokinet_LokinetDaemon_Mainloop(...
  function JNIEXPORT (line 55) | JNIEXPORT jboolean JNICALL Java_network_loki_lokinet_LokinetDaemon_IsRun...
  function JNIEXPORT (line 61) | JNIEXPORT jboolean JNICALL Java_network_loki_lokinet_LokinetDaemon_Stop(...
  function JNIEXPORT (line 73) | JNIEXPORT void JNICALL Java_network_loki_lokinet_LokinetDaemon_InjectVPN...
  function JNIEXPORT (line 79) | JNIEXPORT jint JNICALL Java_network_loki_lokinet_LokinetDaemon_GetUDPSoc...
  function JNIEXPORT (line 86) | JNIEXPORT jstring JNICALL Java_network_loki_lokinet_LokinetDaemon_Detect...
  function JNIEXPORT (line 96) | JNIEXPORT jstring JNICALL Java_network_loki_lokinet_LokinetDaemon_DumpSt...

FILE: jni/lokinet_jni_common.hpp
  function T (line 11) | static T VisitStringAsStringView(JNIEnv* env, jobject str, V visit)
  function T (line 33) | static T* FromBuffer(JNIEnv* env, jobject o)
  function T (line 42) | static T* FromObjectMember(JNIEnv* env, jobject self, const char* member...
  function T (line 52) | static T VisitObjectMemberStringAsStringView(JNIEnv* env, jobject self, ...
  function Int_t (line 62) | Int_t GetObjectMemberAsInt(JNIEnv* env, jobject self, const char* member...
  function T (line 71) | T* GetImpl(JNIEnv* env, jobject self)

FILE: llarp/address/address.cpp
  type llarp (line 9) | namespace llarp

FILE: llarp/address/address.hpp
  type llarp (line 9) | namespace llarp
    type NetworkAddress (line 12) | struct NetworkAddress
      method NetworkAddress (line 19) | NetworkAddress() = default;
      method NetworkAddress (line 28) | NetworkAddress(const RouterID& rid, bool is_client) : _pubkey{rid}, ...
      method empty (line 35) | bool empty() const { return _pubkey.is_zero(); }
      method client (line 37) | bool client() const { return _is_client; }
      method relay (line 39) | bool relay() const { return !_is_client; }
      method RouterID (line 41) | const RouterID& router_id() const { return _pubkey; }
      method short_name (line 44) | auto short_name() const { return _pubkey.short_string(); }
      method name (line 46) | std::string name() const { return _pubkey.to_string(); }
      method to_string (line 48) | std::string to_string() const { return name().append(_is_client ? TL...
  type std (line 54) | namespace std
    type hash<llarp::NetworkAddress> (line 57) | struct hash<llarp::NetworkAddress>

FILE: llarp/address/ip_range.cpp
  type llarp (line 11) | namespace llarp
    function parse_ip_net (line 16) | static std::conditional_t<is_ipv4, ipv4_net, ipv6_net> parse_ip_net(
    function ipv4_net (line 46) | ipv4_net parse_ipv4_net(std::string_view address, std::optional<uint8_...
    function ipv6_net (line 50) | ipv6_net parse_ipv6_net(std::string_view address, std::optional<uint8_...
    function ipv4_range (line 54) | ipv4_range parse_ipv4_range(std::string_view address, std::optional<ui...
    function ipv6_range (line 58) | ipv6_range parse_ipv6_range(std::string_view address, std::optional<ui...
    function encode (line 64) | std::string encode(const ipv4_range& r)
    function ipv4_range (line 72) | ipv4_range decode_ipv4_range(std::string_view encoded)
    function encode (line 86) | std::string encode(const ipv6_range& r)
    function ipv6_range (line 96) | ipv6_range decode_ipv6_range(std::string_view encoded)
    function decode_ip_range (line 108) | std::variant<ipv4_range, ipv6_range> decode_ip_range(std::string_view ...
    function ipv4_net (line 122) | ipv4_net to_ipv4_net(const quic::Address& addr, uint8_t mask)
    function ipv6_net (line 130) | ipv6_net to_ipv6_net(quic::Address addr, uint8_t mask)
    function find_ipv4_net (line 139) | static std::optional<ipv4_net> find_ipv4_net(
    function find_private_ipv4_net (line 155) | std::optional<ipv4_net> find_private_ipv4_net(const std::vector<ipv4_r...
    function find_private_ipv6_net (line 188) | std::optional<ipv6_net> find_private_ipv6_net(const std::vector<ipv6_r...

FILE: llarp/address/ip_range.hpp
  type llarp (line 7) | namespace llarp
    type IPRangeIterator (line 40) | struct IPRangeIterator
      method IPRangeIterator (line 50) | IPRangeIterator() = default;
      method IPRangeIterator (line 54) | explicit IPRangeIterator(const ip_net_t& net)
      method next_ip (line 59) | std::optional<ip_t> next_ip()
      method reset (line 70) | void reset() { _curr = _base; }
      method range_exhausted (line 72) | bool range_exhausted() const { return _curr == _last; }

FILE: llarp/address/map.hpp
  type llarp (line 8) | namespace llarp
    type address_map (line 11) | struct address_map
      method insert_or_assign (line 28) | bool insert_or_assign(const LocalAddrT& local, const NetworkAddress&...
      method get_remote (line 39) | std::optional<NetworkAddress> get_remote(const LocalAddrT& local) const
      method get_remote (line 48) | std::optional<NetworkAddress> get_remote(const std::string& name) const
      method get_local (line 58) | std::optional<LocalAddrT> get_local(const NetworkAddress& remote) const
      method get_local (line 68) | std::optional<LocalAddrT> get_local(const std::string& name) const
      method has_local (line 77) | bool has_local(const LocalAddrT& local) const
      method has_remote (line 84) | bool has_remote(const NetworkAddress& remote) const
      method unmap (line 91) | void unmap(const NetworkAddress& remote)
      method unmap (line 103) | void unmap(const LocalAddrT& local)
      method unmap (line 118) | void unmap(const std::string& name)

FILE: llarp/address/types.hpp
  type llarp (line 7) | namespace llarp
  type std::hash<llarp::ipv4> (line 22) | struct std::hash<llarp::ipv4>
  type std::hash<llarp::ipv6> (line 28) | struct std::hash<llarp::ipv6>

FILE: llarp/address/utils.cpp
  type llarp (line 10) | namespace llarp
    type detail (line 14) | namespace detail
      function parse_addr_string (line 16) | std::optional<std::string> parse_addr_string(std::string_view arg, s...
      function parse_addr (line 37) | std::pair<std::string, uint16_t> parse_addr(std::string_view addr, s...

FILE: llarp/address/utils.hpp
  type llarp (line 7) | namespace llarp
    type TLD (line 11) | namespace TLD
      function allowed (line 16) | inline constexpr bool allowed(std::string_view dot_tld) { return dot...
    type detail (line 19) | namespace detail

FILE: llarp/android/ifaddrs.c
  type NetlinkList (line 39) | typedef struct NetlinkList
  function netlink_socket (line 46) | static int netlink_socket(void)
  function netlink_send (line 66) | static int netlink_send(int p_socket, int p_request)
  function netlink_recv (line 89) | static int netlink_recv(int p_socket, void* p_buffer, size_t p_len)
  type nlmsghdr (line 123) | struct nlmsghdr
  type nlmsghdr (line 147) | struct nlmsghdr
  type nlmsghdr (line 148) | struct nlmsghdr
  type nlmsghdr (line 149) | struct nlmsghdr
  function NetlinkList (line 175) | static NetlinkList* newListItem(struct nlmsghdr* p_data, unsigned int p_...
  function freeResultList (line 189) | static void freeResultList(NetlinkList* p_list)
  function NetlinkList (line 201) | static NetlinkList* getResultList(int p_socket, int p_request)
  function maxSize (line 240) | static size_t maxSize(size_t a, size_t b) { return (a > b ? a : b); }
  function calcAddrLen (line 242) | static size_t calcAddrLen(sa_family_t p_family, int p_dataSize)
  function makeSockaddr (line 257) | static void makeSockaddr(sa_family_t p_family, struct sockaddr* p_dest, ...
  function addToEnd (line 278) | static void addToEnd(struct ifaddrs** p_resultList, struct ifaddrs* p_en...
  function interpretLink (line 295) | static int interpretLink(struct nlmsghdr* p_hdr, struct ifaddrs** p_resu...
  type ifaddrs (line 388) | struct ifaddrs
  type ifaddrs (line 388) | struct ifaddrs
  type ifaddrs (line 391) | struct ifaddrs
  type ifaddrs (line 394) | struct ifaddrs
  function interpretAddr (line 408) | static int interpretAddr(struct nlmsghdr* p_hdr, struct ifaddrs** p_resu...
  function interpretLinks (line 550) | static int interpretLinks(int p_socket, NetlinkList* p_netlinkList, stru...
  function interpretAddrs (line 583) | static int interpretAddrs(int p_socket, NetlinkList* p_netlinkList, stru...
  function getifaddrs (line 614) | int getifaddrs(struct ifaddrs** ifap)
  function freeifaddrs (line 656) | void freeifaddrs(struct ifaddrs* ifa)

FILE: llarp/android/ifaddrs.h
  type ifaddrs (line 28) | struct ifaddrs
  type ifaddrs (line 50) | struct ifaddrs
  type ifaddrs (line 51) | struct ifaddrs

FILE: llarp/apple/DNSTrampoline.h
  function interface (line 23) | interface LLARPDNSTrampoline : NSObject

FILE: llarp/apple/context.hpp
  type llarp::apple (line 8) | namespace llarp::apple
    type Context (line 10) | struct Context : public llarp::Context
      method make_vpn_platform (line 12) | std::shared_ptr<vpn::Platform> make_vpn_platform() override

FILE: llarp/apple/context_wrapper.cpp
  type instance_data (line 21) | struct instance_data
  function llarp_apple_start (line 116) | int llarp_apple_start(void* lokinet, void* callback_context)
  function uv_loop_t (line 161) | uv_loop_t* llarp_apple_get_uv_loop(void* lokinet)
  function llarp_apple_incoming (line 169) | int llarp_apple_incoming(void* lokinet, const llarp_incoming_packet* pac...
  function llarp_apple_shutdown (line 191) | void llarp_apple_shutdown(void* lokinet)

FILE: llarp/apple/context_wrapper.h
  type llarp_route_callbacks (line 32) | typedef struct llarp_route_callbacks
  type llarp_apple_config (line 61) | typedef struct llarp_apple_config
  type llarp_incoming_packet (line 143) | typedef struct llarp_incoming_packet

FILE: llarp/apple/route_manager.cpp
  type llarp::apple (line 8) | namespace llarp::apple

FILE: llarp/apple/route_manager.hpp
  type llarp::apple (line 8) | namespace llarp::apple
    class RouteManager (line 10) | class RouteManager final : public llarp::vpn::AbstractRouteManager
      method RouteManager (line 13) | RouteManager(llarp::Context& ctx, llarp_route_callbacks rcs, void* c...
      method add_route (line 19) | void add_route(quic::Address /*ip*/, quic::Address /*gateway*/) over...
      method delete_route (line 21) | void delete_route(quic::Address /*ip*/, quic::Address /*gateway*/) o...
      method get_non_interface_gateways (line 33) | std::vector<quic::Address> get_non_interface_gateways(vpn::NetworkIn...

FILE: llarp/apple/vpn_interface.cpp
  type llarp::apple (line 8) | namespace llarp::apple
    function IPPacket (line 36) | IPPacket VPNInterface::read_next_packet()

FILE: llarp/apple/vpn_interface.hpp
  type llarp::apple (line 9) | namespace llarp::apple
    type Context (line 11) | struct Context
    class VPNInterface (line 13) | class VPNInterface final : public vpn::NetworkInterface, public std::e...

FILE: llarp/apple/vpn_platform.cpp
  type llarp::apple (line 5) | namespace llarp::apple

FILE: llarp/apple/vpn_platform.hpp
  type llarp::apple (line 8) | namespace llarp::apple
    class VPNPlatform (line 10) | class VPNPlatform final : public vpn::Platform

FILE: llarp/auth/auth.cpp
  type llarp::auth (line 5) | namespace llarp::auth
    function parse_code (line 14) | std::optional<AuthCode> parse_code(std::string_view data)

FILE: llarp/auth/auth.hpp
  type llarp (line 14) | namespace llarp
    class Router (line 16) | class Router
  type llarp::auth (line 18) | namespace llarp::auth
    type AuthCode (line 21) | enum class AuthCode : uint64_t
    type AuthResult (line 36) | struct AuthResult
    type AuthInfo (line 43) | struct AuthInfo
    type AuthType (line 49) | enum class AuthType
    type AuthPolicy (line 61) | struct AuthPolicy
      method AuthPolicy (line 67) | AuthPolicy(Router& r) : _router{r} {}
      method Router (line 71) | const Router& router() const { return _router; }
      method Router (line 73) | Router& router() { return _router; }

FILE: llarp/auth/file.cpp
  type llarp::auth (line 6) | namespace llarp::auth
    function AuthResult (line 8) | AuthResult FileAuthPolicy::check_files(const AuthInfo& info) const

FILE: llarp/auth/file.hpp
  type llarp (line 12) | namespace llarp
    class Router (line 14) | class Router
  type llarp::auth (line 16) | namespace llarp::auth
    type AuthFileType (line 19) | enum class AuthFileType
    type FileAuthPolicy (line 25) | struct FileAuthPolicy final : public AuthPolicy
      method FileAuthPolicy (line 27) | FileAuthPolicy(Router& r, std::vector<std::filesystem::path> files, ...

FILE: llarp/auth/rpc.cpp
  type llarp::auth (line 7) | namespace llarp::auth

FILE: llarp/auth/rpc.hpp
  type oxenmq (line 9) | namespace oxenmq
    class OxenMQ (line 11) | class OxenMQ
    type ConnectionID (line 12) | struct ConnectionID
  type llarp::auth (line 15) | namespace llarp::auth
    type RPCAuthPolicy (line 17) | struct RPCAuthPolicy final : public AuthPolicy

FILE: llarp/auth/session.cpp
  type llarp::auth (line 6) | namespace llarp::auth

FILE: llarp/auth/session.hpp
  type llarp (line 5) | namespace llarp
    class Router (line 7) | class Router
  type llarp::auth (line 9) | namespace llarp::auth
    type SessionAuthPolicy (line 11) | struct SessionAuthPolicy final : public AuthPolicy
      method Ed25519SecretKey (line 27) | const Ed25519SecretKey& session_key() const { return _session_key; }
      method is_snode_service (line 29) | bool is_snode_service() const { return _is_snode_service; }
      method is_exit_service (line 31) | bool is_exit_service() const { return _is_exit_service; }

FILE: llarp/config/config.cpp
  function check_path_op (line 26) | static bool check_path_op(std::optional<std::filesystem::path>& path)
  function public_ip_loader (line 57) | static auto public_ip_loader(
  function public_port_loader (line 80) | static auto public_port_loader(
  function overrides_dir (line 1676) | static std::filesystem::path overrides_dir(const std::filesystem::path& ...
  function ensure_config (line 1789) | void ensure_config(std::filesystem::path dataDir, std::filesystem::path ...

FILE: llarp/config/config.hpp
  type llarp (line 28) | namespace llarp
    type ConfigGenParameters (line 42) | struct ConfigGenParameters
      method ConfigGenParameters (line 44) | ConfigGenParameters() = default;
      method ConfigGenParameters (line 47) | ConfigGenParameters(const ConfigGenParameters&) = delete;
      method ConfigGenParameters (line 48) | ConfigGenParameters(ConfigGenParameters&&) = delete;
    type RouterConfig (line 57) | struct RouterConfig
    type PathConfig (line 80) | struct PathConfig
      method inbound_hops (line 105) | int inbound_hops() const { return inbound_hops_.value_or(client_hops...
      method relay_hops (line 116) | int relay_hops() const { return relay_hops_.value_or(std::min(client...
    type ExitConfig (line 149) | struct ExitConfig
    type NetworkConfig (line 169) | struct NetworkConfig
    type DnsConfig (line 226) | struct DnsConfig
    type LinksConfig (line 249) | struct LinksConfig
    type ApiConfig (line 259) | struct ApiConfig
    type LokidConfig (line 267) | struct LokidConfig
    type BootstrapConfig (line 276) | struct BootstrapConfig
    type LoggingConfig (line 283) | struct LoggingConfig
    type Config (line 299) | struct Config
      method Config (line 315) | Config(Config&&) = default;
      method Config (line 316) | Config(const Config&) = default;
      method Config (line 317) | Config& operator=(Config&&) = default;
      method Config (line 318) | Config& operator=(const Config&) = default;
      method relay (line 353) | bool relay() const { return type == config::Type::Relay; }
      method embedded (line 354) | bool embedded() const { return type == config::Type::EmbeddedClient; }
      method client (line 355) | bool client() const { return !relay(); }

FILE: llarp/config/definition.cpp
  type llarp (line 10) | namespace llarp
    function parse_boolean (line 16) | std::optional<bool> parse_boolean(std::string_view input)
    function ConfigDefinition (line 33) | ConfigDefinition& ConfigDefinition::define_option(std::unique_ptr<Opti...
    function ConfigDefinition (line 73) | ConfigDefinition& ConfigDefinition::add_config_value(

FILE: llarp/config/definition.hpp
  type llarp (line 22) | namespace llarp
    type config (line 24) | namespace config
      type Type (line 26) | enum class Type
      function to_string (line 33) | inline constexpr std::string_view to_string(Type t)
      type flag (line 47) | namespace flag
        type opt (line 50) | struct opt
        type REQUIRED (line 53) | struct REQUIRED : opt
        type HIDDEN (line 55) | struct HIDDEN : opt
        type MULTIVALUE (line 57) | struct MULTIVALUE : opt
        type NOTEMBEDDED (line 59) | struct NOTEMBEDDED : opt
        type RELAYONLY (line 61) | struct RELAYONLY : NOTEMBEDDED
        type CLIENTONLY (line 63) | struct CLIENTONLY : opt
        type FULLCLIENTONLY (line 65) | struct FULLCLIENTONLY : CLIENTONLY, NOTEMBEDDED
        type DEPRECATED (line 67) | struct DEPRECATED : opt
      type Default (line 103) | struct Default
        method Default (line 106) | constexpr explicit Default(T val) : val{std::move(val)} {}
      type Comment (line 110) | struct Comment
        method Comment (line 113) | explicit Comment(std::initializer_list<std::string> comments) : co...
      function assignment_acceptor (line 121) | auto assignment_acceptor(T& ref)
      function bounded_assignment_acceptor (line 128) | auto bounded_assignment_acceptor(
      function lower_bounded_assignment_acceptor (line 138) | auto lower_bounded_assignment_acceptor(T& ref, std::type_identity_t<...
      function upper_bounded_assignment_acceptor (line 147) | auto upper_bounded_assignment_acceptor(T& ref, std::type_identity_t<...
      function bounded_assignment_acceptor (line 156) | auto bounded_assignment_acceptor(
    type OptionDefinitionBase (line 189) | struct OptionDefinitionBase
      method OptionDefinitionBase (line 192) | OptionDefinitionBase(std::string section_, std::string name_, const ...
    type OptionDefinition (line 260) | struct OptionDefinition : public OptionDefinitionBase
      method OptionDefinition (line 274) | OptionDefinition(std::string section_, std::string name_, Options&&....
      method extract_default (line 291) | void extract_default(U&& defaultValue_)
      method extract_acceptor (line 315) | void extract_acceptor(U&& acceptor_)
      method extract_comments (line 323) | void extract_comments(U&& comment)
      method get_value (line 333) | std::optional<T> get_value() const
      method get_number_found (line 347) | size_t get_number_found() const override { return parsed_values.size...
      method default_values_as_string (line 349) | std::vector<std::string> default_values_as_string() override
      method parse_value (line 370) | void parse_value(const std::string& input) override
      method T (line 380) | T from_string(const std::string& input)
      method values_as_string (line 438) | std::vector<std::string> values_as_string() override
      method try_accept (line 475) | void try_accept() const override
    type ConfigDefinition (line 543) | struct ConfigDefinition
      method ConfigDefinition (line 545) | explicit ConfigDefinition(config::Type type) : type{type} {}
      method ConfigDefinition (line 561) | ConfigDefinition& define_option(Params&&... args)
      method get_config_value (line 593) | std::optional<T> get_config_value(std::string_view section, std::str...
      method process (line 645) | void process()

FILE: llarp/config/ini.cpp
  type llarp (line 11) | namespace llarp
    function whitespace (line 41) | static bool whitespace(char ch) { return std::isspace(static_cast<unsi...

FILE: llarp/config/ini.hpp
  type llarp (line 10) | namespace llarp
    type ConfigParser (line 12) | struct ConfigParser
      method set_filename (line 45) | void set_filename(const std::filesystem::path& f) { _filename = f; }

FILE: llarp/consensus/reachability_testing.cpp
  type llarp::consensus (line 15) | namespace llarp::consensus

FILE: llarp/consensus/reachability_testing.hpp
  type llarp (line 12) | namespace llarp
    class Router (line 14) | class Router
  type oxen::quic (line 16) | namespace oxen::quic
    class Ticker (line 18) | class Ticker
  type llarp::consensus (line 21) | namespace llarp::consensus
    type detail (line 23) | namespace detail
      type nth_greater (line 30) | struct nth_greater
      type incoming_test_state (line 38) | struct incoming_test_state
    class reachability_testing (line 53) | class reachability_testing

FILE: llarp/constants/apple.hpp
  type llarp::apple (line 5) | namespace llarp::apple

FILE: llarp/constants/files.hpp
  type llarp (line 10) | namespace llarp
    function GetDefaultDataDir (line 17) | inline std::filesystem::path GetDefaultDataDir()
    function GetDefaultConfigPath (line 34) | inline std::filesystem::path GetDefaultConfigPath() { return GetDefaul...
    function GetDefaultBootstrap (line 36) | inline std::filesystem::path GetDefaultBootstrap() { return GetDefault...

FILE: llarp/constants/link_layer.hpp
  type llarp::constants (line 11) | namespace llarp::constants

FILE: llarp/constants/net.hpp
  type llarp::constants (line 3) | namespace llarp::constants

FILE: llarp/constants/path.hpp
  type llarp::path (line 8) | namespace llarp::path

FILE: llarp/constants/platform.hpp
  type llarp::platform (line 4) | namespace llarp::platform

FILE: llarp/constants/proto.hpp
  type llarp::constants (line 3) | namespace llarp::constants

FILE: llarp/constants/version.hpp
  type llarp (line 6) | namespace llarp

FILE: llarp/contact/client_contact.cpp
  type llarp (line 14) | namespace llarp
    function to_underlying (line 69) | constexpr std::underlying_type_t<Enum> to_underlying(Enum e) noexcept
    function EncryptedClientContact (line 114) | EncryptedClientContact ClientContact::encrypt_and_sign(const Ed25519Bl...

FILE: llarp/contact/client_contact.hpp
  type llarp (line 20) | namespace llarp
    type EncryptedClientContact (line 22) | struct EncryptedClientContact
      method EncryptedClientContact (line 119) | EncryptedClientContact() : nonce{SymmNonce::make_random()} {}
      method PubKey (line 140) | const PubKey& key() const { return blinded_pubkey; }
      method bt_payload (line 144) | std::string_view bt_payload() const { return _bt_payload; }
      method newer_than (line 148) | bool newer_than(const EncryptedClientContact& that) const { return s...
    type ClientContact (line 39) | struct ClientContact
      method ClientContact (line 43) | ClientContact() = default;
      method PubKey (line 70) | const PubKey& pubkey() const { return _pubkey; }
      method intros (line 73) | std::span<const ClientIntro> intros() const& { return _intros; }
      method protocol_flag (line 77) | protocol_flag protocols() const { return _protos; }
    type EncryptedClientContact (line 117) | struct EncryptedClientContact
      method EncryptedClientContact (line 119) | EncryptedClientContact() : nonce{SymmNonce::make_random()} {}
      method PubKey (line 140) | const PubKey& key() const { return blinded_pubkey; }
      method bt_payload (line 144) | std::string_view bt_payload() const { return _bt_payload; }
      method newer_than (line 148) | bool newer_than(const EncryptedClientContact& that) const { return s...

FILE: llarp/contact/client_intro.cpp
  type llarp (line 5) | namespace llarp

FILE: llarp/contact/client_intro.hpp
  type llarp (line 10) | namespace llarp
    type ClientIntro (line 12) | struct ClientIntro
      method ClientIntro (line 18) | ClientIntro() = default;
      method expires_in (line 22) | std::chrono::milliseconds expires_in(std::chrono::milliseconds now =...
      method is_expired (line 27) | bool is_expired(std::chrono::milliseconds now = llarp::time_now_ms()...

FILE: llarp/contact/contactdb.cpp
  type llarp (line 6) | namespace llarp
    function EncryptedClientContact (line 12) | const EncryptedClientContact* ContactDB::get_encrypted_cc(const PubKey...

FILE: llarp/contact/contactdb.hpp
  type oxen::quic (line 5) | namespace oxen::quic
    type Ticker (line 7) | struct Ticker
  type llarp (line 10) | namespace llarp
    class Router (line 12) | class Router
    class ContactDB (line 20) | class ContactDB

FILE: llarp/contact/relay_contact.cpp
  type llarp (line 17) | namespace llarp

FILE: llarp/contact/relay_contact.hpp
  type llarp (line 14) | namespace llarp
    class Router (line 16) | class Router
    type RelayContact (line 38) | struct RelayContact
      method view (line 64) | std::string_view view() const { return _payload; }
      method RouterID (line 71) | const RouterID& router_id() const { return _router_id; }
      method NetID (line 75) | NetID netid() const { return _netid; }
      method compare_tuple (line 97) | auto compare_tuple() const { return std::tie(_router_id, _addr, _add...
      method RelayContact (line 100) | RelayContact() = default;
      method newer_than (line 136) | bool newer_than(const RelayContact& other, std::chrono::seconds at_l...
  type std::hash<llarp::RelayContact> (line 158) | struct std::hash<llarp::RelayContact>

FILE: llarp/contact/router_id.cpp
  type llarp (line 10) | namespace llarp

FILE: llarp/contact/router_id.hpp
  type llarp (line 8) | namespace llarp
    type RouterID (line 12) | struct RouterID : public PubKey
      type AddressPrinter (line 27) | struct AddressPrinter
      method AddressPrinter (line 34) | AddressPrinter to_network_address(bool is_relay = true) const { retu...
  type std (line 40) | namespace std
    type hash<llarp::RouterID> (line 43) | struct hash<llarp::RouterID> : hash<llarp::PubKey>

FILE: llarp/contact/sns.cpp
  type llarp (line 7) | namespace llarp
    function EncryptedSNSRecord (line 11) | EncryptedSNSRecord EncryptedSNSRecord::deserialize(std::string_view bt...

FILE: llarp/contact/sns.hpp
  type llarp (line 8) | namespace llarp
    type NetworkAddress (line 10) | struct NetworkAddress
    type EncryptedSNSRecord (line 20) | struct EncryptedSNSRecord
      method EncryptedSNSRecord (line 32) | EncryptedSNSRecord() = default;
      method bt_payload (line 34) | std::string_view bt_payload() const { return _bt_payload; }
    function is_valid_sns (line 44) | inline bool is_valid_sns(std::string_view sns_name)

FILE: llarp/context.cpp
  type llarp (line 20) | namespace llarp

FILE: llarp/crypto/crypto.cpp
  type llarp::crypto (line 26) | namespace llarp::crypto
    function dh (line 34) | static bool dh(
    function maybe_decrypt_name (line 61) | std::optional<RouterID> maybe_decrypt_name(std::string_view ciphertext...
    function xchacha20 (line 100) | void xchacha20(std::span<std::byte> buf, const SharedSecret& secret, c...
    function xchacha20_poly1305_encrypt (line 106) | void xchacha20_poly1305_encrypt(std::span<std::byte> buf, const Shared...
    function xchacha20_poly1305_encrypt (line 120) | void xchacha20_poly1305_encrypt(std::string& buf, const SharedSecret& ...
    function xchacha20_poly1305_decrypt (line 126) | std::span<std::byte> xchacha20_poly1305_decrypt(
    function dh_client (line 147) | bool dh_client(SharedSecret& shared, const PubKey& pk, const Ed25519Se...
    function dh_client_gen (line 156) | std::tuple<SharedSecret, PubKey, SymmNonce> dh_client_gen(const PubKey...
    function dh_server (line 170) | bool dh_server(SharedSecret& shared, const PubKey& pk, const Ed25519Se...
    function shorthash (line 179) | void shorthash(std::span<std::byte, SHORTHASHSIZE> result, std::span<c...
    function shorthash (line 189) | AlignedBuffer<SHORTHASHSIZE> shorthash(std::span<const std::byte> buf)
    function verify (line 196) | bool verify(
    function derive_encrypt_outer_wrapping (line 207) | void derive_encrypt_outer_wrapping(
    function derive_decrypt_outer_wrapping (line 226) | void derive_decrypt_outer_wrapping(
    function blinding_scalar (line 247) | std::array<unsigned char, 32> blinding_scalar(std::span<const std::byt...
    function blind (line 269) | bool blind(PubKey& blinded, const PubKey& root, std::string_view blind...
    function Ed25519SecretKey (line 276) | Ed25519SecretKey generate_ed25519()
    function check_pubkey (line 285) | bool check_pubkey(const Ed25519SecretKey& keys)
    function check_passwd_hash (line 294) | bool check_passwd_hash(std::string pwhash, std::string challenge)
  type llarp (line 311) | namespace llarp
    function CSRNG (line 315) | static CSRNG _initialize_crypto()

FILE: llarp/crypto/crypto.hpp
  type llarp (line 10) | namespace llarp
  type llarp::crypto (line 15) | namespace llarp::crypto
    type blinding (line 103) | namespace blinding

FILE: llarp/crypto/key_manager.cpp
  type llarp (line 10) | namespace llarp

FILE: llarp/crypto/key_manager.hpp
  type llarp (line 6) | namespace llarp
    type Config (line 8) | struct Config
    type KeyManager (line 16) | struct KeyManager
      method KeyManager (line 21) | KeyManager() = default;
      method RouterID (line 30) | const RouterID& router_id() const { return public_key; }

FILE: llarp/crypto/keys.cpp
  type llarp (line 14) | namespace llarp
    function PubKey (line 29) | PubKey& PubKey::operator=(const uint8_t* ptr)

FILE: llarp/crypto/keys.hpp
  type llarp (line 7) | namespace llarp
    type PubKey (line 9) | struct PubKey : public AlignedBuffer<PUBKEYSIZE>
    type PubKey (line 21) | struct PubKey
    type Ed25519BlindedKey (line 22) | struct Ed25519BlindedKey
    type Ed25519SecretKey (line 27) | struct Ed25519SecretKey final : AlignedBuffer<SECKEYSIZE>
      method Ed25519SecretKey (line 32) | explicit Ed25519SecretKey(const AlignedBuffer<32>& seed)
      method pubkey_span (line 44) | std::span<const std::byte, 32> pubkey_span() const { return span().l...
      method PubKey (line 45) | PubKey to_pubkey() const { return PubKey{pubkey_span()}; }
    type Ed25519BlindedKey (line 55) | struct Ed25519BlindedKey final
  type std (line 77) | namespace std
    type hash<llarp::PubKey> (line 80) | struct hash<llarp::PubKey> : public hash<llarp::AlignedBuffer<PUBKEYSI...

FILE: llarp/crypto/types.cpp
  type llarp (line 7) | namespace llarp
    function SymmNonce (line 11) | SymmNonce SymmNonce::make_random()

FILE: llarp/crypto/types.hpp
  type llarp (line 9) | namespace llarp
    type SharedSecret (line 11) | struct SharedSecret final : AlignedBuffer<SHAREDKEYSIZE>
    type Signature (line 14) | struct Signature final : AlignedBuffer<SIGSIZE>
    type SymmNonce (line 17) | struct SymmNonce final : AlignedBuffer<NONCESIZE>
      method SymmNonce (line 21) | SymmNonce operator^(const SymmNonce& other) const

FILE: llarp/dns/dns.hpp
  type llarp::dns (line 7) | namespace llarp::dns

FILE: llarp/dns/message.cpp
  type llarp::dns (line 15) | namespace llarp::dns
    function reply_flags (line 165) | static constexpr uint16_t reply_flags(uint16_t setbits) { return setbi...
    function maybe_parse_dns_msg (line 388) | std::optional<Message> maybe_parse_dns_msg(std::span<const std::byte> b)

FILE: llarp/dns/message.hpp
  type llarp (line 9) | namespace llarp
    type IPPacket (line 11) | struct IPPacket
    type dns (line 13) | namespace dns
      type SRVData (line 15) | struct SRVData
      type MessageHeader (line 17) | struct MessageHeader : public Serialize
        method MessageHeader (line 22) | MessageHeader() = default;
      type Message (line 44) | struct Message : public Serialize

FILE: llarp/dns/name.cpp
  type llarp::dns (line 7) | namespace llarp::dns
    function DecodeName (line 9) | std::optional<std::string> DecodeName(llarp_buffer_t* buf, bool trimTr...
    function EncodeNameTo (line 36) | bool EncodeNameTo(llarp_buffer_t* buf, std::string_view name)
    function DecodePTR (line 63) | std::optional<std::variant<ipv4, ipv6>> DecodePTR(std::string_view name)
    function NameIsReserved (line 129) | bool NameIsReserved(std::string_view name)

FILE: llarp/dns/name.hpp
  type llarp::dns (line 9) | namespace llarp::dns

FILE: llarp/dns/nm_platform.cpp
  type llarp::dns::nm (line 11) | namespace llarp::dns::nm

FILE: llarp/dns/nm_platform.hpp
  type llarp::dns (line 9) | namespace llarp::dns
    type nm (line 11) | namespace nm
      class Platform (line 14) | class Platform : public I_Platform

FILE: llarp/dns/platform.cpp
  type llarp::dns (line 3) | namespace llarp::dns

FILE: llarp/dns/platform.hpp
  type llarp::dns (line 14) | namespace llarp::dns
    class I_Platform (line 17) | class I_Platform
    class Null_Platform (line 35) | class Null_Platform : public I_Platform
      method set_resolver (line 39) | void set_resolver(unsigned int, quic::Address, bool) override {}
    class Multi_Platform (line 43) | class Multi_Platform : public I_Platform

FILE: llarp/dns/question.cpp
  type llarp::dns (line 10) | namespace llarp::dns

FILE: llarp/dns/question.hpp
  type llarp::dns (line 5) | namespace llarp::dns
    type Question (line 10) | struct Question : public Serialize
      method Question (line 12) | Question() = default;

FILE: llarp/dns/rr.cpp
  type llarp::dns (line 8) | namespace llarp::dns

FILE: llarp/dns/rr.hpp
  type llarp::dns (line 7) | namespace llarp::dns
    type ResourceRecord (line 14) | struct ResourceRecord : public Serialize
      method ResourceRecord (line 16) | ResourceRecord() = default;

FILE: llarp/dns/sd_platform.cpp
  type llarp::dns::sd (line 11) | namespace llarp::dns::sd

FILE: llarp/dns/sd_platform.hpp
  type llarp::dns (line 8) | namespace llarp::dns
    type sd (line 10) | namespace sd
      class Platform (line 13) | class Platform : public I_Platform

FILE: llarp/dns/serialize.cpp
  type llarp::dns (line 3) | namespace llarp::dns
    function EncodeRData (line 7) | bool EncodeRData(llarp_buffer_t* buf, const std::vector<uint8_t>& v)
    function DecodeRData (line 21) | bool DecodeRData(llarp_buffer_t* buf, std::vector<uint8_t>& v)

FILE: llarp/dns/serialize.hpp
  type llarp::dns (line 9) | namespace llarp::dns
    type Serialize (line 12) | struct Serialize

FILE: llarp/dns/server.cpp
  type llarp::dns (line 19) | namespace llarp::dns
    class UDPReader (line 31) | class UDPReader : public PacketSource, public std::enable_shared_from_...
      method UDPReader (line 38) | explicit UDPReader(Server& dns, quic::Loop& loop, quic::Address bind...
      method bound_on (line 65) | std::optional<quic::Address> bound_on() const override { return _udp...
      method would_loop (line 67) | bool would_loop(const quic::Address& to, const quic::Address& /*from...
      method send_udp (line 72) | void send_udp(const quic::Address& to, const quic::Address&, std::sp...
    type libunbound (line 87) | namespace libunbound
      class Resolver (line 89) | class Resolver
        type ub_result_deleter (line 132) | struct ub_result_deleter
        method callback (line 139) | static void callback(void* data, int err, ub_result* _result)
        method add_upstream_resolver (line 170) | void add_upstream_resolver(const quic::Address& dns)
        method configure_apple_trampoline (line 180) | bool configure_apple_trampoline(const quic::Address& dns)
        method configure_upstream (line 224) | void configure_upstream(const llarp::DnsConfig& conf)
        method set_opt (line 293) | void set_opt(const std::string& key, const std::string& val)
        method Resolver (line 303) | explicit Resolver(quic::Loop& loop, llarp::DnsConfig conf) : _loop...
        method resolver_name (line 310) | std::string_view resolver_name() const override { return "unbound"; }
        method get_local_addr (line 312) | std::optional<quic::Address> get_local_addr() const override { ret...
        method remove_pending (line 314) | void remove_pending(const std::shared_ptr<Query>& query) { _pendin...
        method up (line 316) | void up(const llarp::DnsConfig& conf)
        method down (line 370) | void down() override
        method rank (line 401) | int rank() const override { return 10; }
        method reset_resolver (line 403) | void reset_resolver(std::optional<std::vector<quic::Address>> repl...
        method call (line 412) | void call(Callable&& f)
        method maybe_hook_dns (line 417) | bool maybe_hook_dns(
      class Query (line 91) | class Query : public QueryJob_Base, public std::enable_shared_from_t...
        method Query (line 98) | explicit Query(
      class Resolver (line 117) | class Resolver final : public Resolver_Base, public std::enable_shar...
        type ub_result_deleter (line 132) | struct ub_result_deleter
        method callback (line 139) | static void callback(void* data, int err, ub_result* _result)
        method add_upstream_resolver (line 170) | void add_upstream_resolver(const quic::Address& dns)
        method configure_apple_trampoline (line 180) | bool configure_apple_trampoline(const quic::Address& dns)
        method configure_upstream (line 224) | void configure_upstream(const llarp::DnsConfig& conf)
        method set_opt (line 293) | void set_opt(const std::string& key, const std::string& val)
        method Resolver (line 303) | explicit Resolver(quic::Loop& loop, llarp::DnsConfig conf) : _loop...
        method resolver_name (line 310) | std::string_view resolver_name() const override { return "unbound"; }
        method get_local_addr (line 312) | std::optional<quic::Address> get_local_addr() const override { ret...
        method remove_pending (line 314) | void remove_pending(const std::shared_ptr<Query>& query) { _pendin...
        method up (line 316) | void up(const llarp::DnsConfig& conf)
        method down (line 370) | void down() override
        method rank (line 401) | int rank() const override { return 10; }
        method reset_resolver (line 403) | void reset_resolver(std::optional<std::vector<quic::Address>> repl...
        method call (line 412) | void call(Callable&& f)
        method maybe_hook_dns (line 417) | bool maybe_hook_dns(

FILE: llarp/dns/server.hpp
  type llarp::dns (line 16) | namespace llarp::dns
    class QueryJob_Base (line 19) | class QueryJob_Base
      method QueryJob_Base (line 29) | explicit QueryJob_Base(Message query) : _query{std::move(query)} {}
      method Message (line 33) | Message& underlying() { return _query; }
      method Message (line 35) | const Message& underlying() const { return _query; }
    class PacketSource (line 44) | class PacketSource
    class QueryJob (line 64) | class QueryJob : public QueryJob_Base, std::enable_shared_from_this<Qu...
      method QueryJob (line 71) | explicit QueryJob(
      method send_reply (line 79) | void send_reply(std::vector<std::byte> buf) override { src->send_udp...
    class Resolver_Base (line 84) | class Resolver_Base
      method get_local_addr (line 101) | virtual std::optional<quic::Address> get_local_addr() const { return...
      method reset_resolver (line 108) | virtual void reset_resolver(std::optional<std::vector<quic::Address>...
      method down (line 111) | virtual void down() {}
    class Server (line 123) | class Server

FILE: llarp/dns/srv_data.cpp
  type llarp::dns (line 10) | namespace llarp::dns

FILE: llarp/dns/srv_data.hpp
  type llarp::dns (line 10) | namespace llarp::dns
    type SRVData (line 25) | struct SRVData
      method SRVData (line 27) | SRVData() = default;
  type std (line 90) | namespace std
    type hash<llarp::dns::SRVData> (line 93) | struct hash<llarp::dns::SRVData>

FILE: llarp/dns/string.hpp
  type llarp_buffer_t (line 5) | struct llarp_buffer_t
  type llarp::dns (line 7) | namespace llarp::dns

FILE: llarp/ev/fd_poller.cpp
  type llarp::ev (line 7) | namespace llarp::ev

FILE: llarp/ev/fd_poller.hpp
  type llarp::ev (line 4) | namespace llarp::ev
    class FDPoller (line 11) | class FDPoller
      method FDPoller (line 15) | FDPoller() = delete;
      method FDPoller (line 16) | FDPoller(const FDPoller&) = delete;
      method FDPoller (line 17) | FDPoller(FDPoller&&) = delete;
      method FDPoller (line 18) | FDPoller& operator=(const FDPoller&) = delete;
      method FDPoller (line 19) | FDPoller& operator=(FDPoller&&) = delete;

FILE: llarp/ev/tcp.cpp
  type llarp (line 6) | namespace llarp
    function check_rv (line 17) | static int check_rv(int rv)
    function tcp_read_cb (line 29) | static void tcp_read_cb(bufferevent *bev, void *user_arg)
    function tcp_write_cb (line 47) | static void tcp_write_cb([[maybe_unused]] bufferevent *bev, void *user...
    function tcp_event_cb (line 59) | static void tcp_event_cb(bufferevent *bev, short what, void *user_arg)
    function tcp_listen_cb (line 95) | static void tcp_listen_cb(
    function tcp_err_cb (line 114) | static void tcp_err_cb(struct evconnlistener * /* e */, void *user_arg)
    type sockaddr (line 230) | struct sockaddr
    type evconnlistener (line 253) | struct evconnlistener

FILE: llarp/ev/tcp.hpp
  type llarp (line 17) | namespace llarp
    class QUICTunnel (line 21) | class QUICTunnel
    type TCPConnection (line 23) | struct TCPConnection
      method TCPConnection (line 27) | TCPConnection() = delete;
      method TCPConnection (line 30) | TCPConnection(const TCPConnection& s) = delete;
      method TCPConnection (line 31) | TCPConnection& operator=(const TCPConnection& s) = delete;
      method TCPConnection (line 32) | TCPConnection(TCPConnection&& s) = delete;
      method TCPConnection (line 33) | TCPConnection& operator=(TCPConnection&& s) = delete;
    class TCPHandle (line 56) | class TCPHandle
      method TCPHandle (line 82) | TCPHandle() = delete;
      method port (line 96) | uint16_t port() const { return _bound.port(); }

FILE: llarp/ev/udp.cpp
  type llarp (line 3) | namespace llarp
    function io_result (line 22) | io_result UDPHandle::_send_impl(const quic::Path& path, std::byte* buf...
    function io_result (line 101) | io_result UDPHandle::send(const quic::Address& dest, std::span<const s...

FILE: llarp/ev/udp.hpp
  type llarp (line 11) | namespace llarp
    class UDPHandle (line 17) | class UDPHandle
      method UDPHandle (line 20) | UDPHandle() = delete;
      method bind (line 38) | quic::Address bind() { return _local; }

FILE: llarp/handlers/session.cpp
  type llarp::handlers (line 26) | namespace llarp::handlers
    function session_tag (line 1126) | session_tag SessionEndpoint::next_tag()

FILE: llarp/handlers/session.hpp
  type llarp (line 16) | namespace llarp
    type rpc (line 18) | namespace rpc
      class RPCServer (line 20) | class RPCServer
    type handlers (line 23) | namespace handlers
      class SessionEndpoint (line 27) | class SessionEndpoint final : public path::PathHandler
        method srv_records (line 117) | std::unordered_set<dns::SRVData> srv_records() const { return _srv...
        method S (line 120) | S* get_session(const session_tag& tag) const
        method S (line 129) | S* get_session(const NetworkAddress& remote) const

FILE: llarp/handlers/tun.cpp
  type llarp::handlers (line 21) | namespace llarp::handlers
    class DnsInterceptor (line 42) | class DnsInterceptor : public dns::PacketSource
      method DnsInterceptor (line 49) | explicit DnsInterceptor(ip_pkt_hook reply, quic::Address our_ip, lla...
      method send_udp (line 55) | void send_udp(
      method bound_on (line 68) | std::optional<quic::Address> bound_on() const override { return std:...
      method would_loop (line 70) | bool would_loop(const quic::Address& to, const quic::Address& from) ...
    class TunDNS (line 92) | class TunDNS : public dns::Server
      method TunDNS (line 103) | explicit TunDNS(TunEndpoint* ep, const llarp::DnsConfig& conf)
      method make_packet_source_on (line 113) | std::shared_ptr<dns::PacketSource> make_packet_source_on(
    function is_random_snode (line 328) | static bool is_random_snode(const dns::Message& msg) { return msg.ques...
    function is_localhost_loki (line 330) | static bool is_localhost_loki(const dns::Message& msg) { return msg.qu...
    function try_making (line 342) | static std::optional<T> try_making(Args&&... args)
    function ipv4 (line 845) | const ipv4& TunEndpoint::get_ipv4() const { return _local_net.ip; }
    function ipv6 (line 846) | const ipv6* TunEndpoint::get_ipv6() const { return _local_ipv6_net ? &...
    function ipv4_net (line 848) | const ipv4_net& TunEndpoint::get_ipv4_network() const { return _local_...
    function get_next_local_ipvX (line 891) | static std::optional<typename RangeIterator::ip_t> get_next_local_ipvX(

FILE: llarp/handlers/tun.hpp
  type llarp::traffic_type (line 13) | namespace llarp::traffic_type
    function is_valid (line 20) | inline constexpr bool is_valid(uint8_t t) { return t >= UDP && t <= TU...
  type llarp::handlers (line 23) | namespace llarp::handlers
    class TunEndpoint (line 28) | class TunEndpoint : public TunEPBase, public dns::Resolver_Base, publi...
      method name (line 75) | std::string_view name() const { return TUN; }
      method rank (line 77) | int rank() const override { return 0; }
      method resolver_name (line 79) | std::string_view resolver_name() const override { return LOKI_RESOLV...
      method get_exit_policy (line 146) | std::optional<net::ExitPolicy> get_exit_policy() const { return _exi...
      method Router (line 155) | const Router& router() const { return _router; }
      method Router (line 157) | Router& router() { return _router; }

FILE: llarp/handlers/tun_base.hpp
  type llarp::handlers (line 7) | namespace llarp::handlers
    class TunEPBase (line 12) | class TunEPBase

FILE: llarp/link/connection.cpp
  type llarp::link (line 5) | namespace llarp::link

FILE: llarp/link/connection.hpp
  type llarp (line 7) | namespace llarp
  type llarp::link (line 15) | namespace llarp::link
    type Connection (line 17) | struct Connection
      method is_inbound (line 25) | bool is_inbound() const { return conn->is_inbound(); }

FILE: llarp/link/endpoint.cpp
  type llarp::link (line 14) | namespace llarp::link
    function make_static_secret (line 55) | static std::vector<uint8_t> make_static_secret(
    function special_connect_impl (line 874) | std::pair<std::shared_ptr<quic::Connection>, std::shared_ptr<quic::BTR...

FILE: llarp/link/endpoint.hpp
  type llarp (line 18) | namespace llarp
    class Router (line 20) | class Router
  type llarp::link (line 23) | namespace llarp::link
    class Manager (line 25) | class Manager
    type relay_conn (line 42) | struct relay_conn
      method relay_conn (line 47) | explicit relay_conn(bool inbound_wins) : inbound_wins{inbound_wins} {}
    class Endpoint (line 74) | class Endpoint
      method send_command (line 223) | bool send_command(
      method send_datagram (line 247) | bool send_datagram(const std::variant<RouterID, quic::ConnectionID>&...

FILE: llarp/link/link_manager.cpp
  type llarp::link (line 41) | namespace llarp::link
    function extract_path_message_metadata (line 955) | static std::optional<std::tuple<HopID, SymmNonce, std::byte>> extract_...

FILE: llarp/link/link_manager.hpp
  type llarp (line 28) | namespace llarp
    class Router (line 30) | class Router
  type llarp::link (line 32) | namespace llarp::link
    class Manager (line 64) | class Manager

FILE: llarp/linux/dbus.cpp
  type llarp::linux (line 4) | namespace llarp::linux

FILE: llarp/linux/dbus.hpp
  type llarp::linux (line 11) | namespace llarp::linux
    class system_bus_exception (line 14) | class system_bus_exception : public std::runtime_error
    class dbus_call_exception (line 21) | class dbus_call_exception : public std::runtime_error
    class DBUS (line 27) | class DBUS
      type sd_bus_deleter (line 29) | struct sd_bus_deleter

FILE: llarp/linux/sd_service_manager.cpp
  type llarp::sys (line 10) | namespace llarp::sys
    class SD_Manager (line 12) | class SD_Manager : public I_SystemLayerManager
      method we_changed_our_state (line 18) | void we_changed_our_state(ServiceState st) override
      method report_changed_state (line 24) | void report_changed_state() override
      method report_periodic_stats (line 38) | void report_periodic_stats() override
      method system_changed_our_state (line 47) | void system_changed_our_state(ServiceState) override

FILE: llarp/lokinet.cpp
  type lokinet (line 24) | namespace lokinet
    function make_embedded_context (line 26) | static auto make_embedded_context() { return std::make_unique<llarp::C...
    function tunnel_info (line 123) | tunnel_info Lokinet::establish_udp_blocking(std::string_view remote, u...

FILE: llarp/lokinet_shared.cpp
  type Context (line 26) | struct Context : public llarp::Context
    method makeNodeDB (line 30) | std::shared_ptr<llarp::NodeDB> makeNodeDB() override { return std::mak...
  type UDPFlow (line 33) | struct UDPFlow
    method TimedOut (line 43) | void TimedOut(lokinet_udp_flow_timeout_func timeout) { timeout(&m_Flow...
    method MarkActive (line 47) | void MarkActive() { m_ExpiresAt = Clock_t::now() + m_FlowTimeout; }
    method IsExpired (line 50) | bool IsExpired() const { return Clock_t::now() >= m_ExpiresAt; }
    method HandlePacket (line 52) | void HandlePacket(const llarp::net::IPPacket& pkt)
  type UDPHandler (line 62) | struct UDPHandler
    method UDPHandler (line 77) | explicit UDPHandler(
    method KillAllFlows (line 94) | void KillAllFlows()
    method AddFlow (line 104) | void AddFlow(
    method ExpireOldFlows (line 121) | void ExpireOldFlows()
    method HandlePacketFrom (line 136) | void HandlePacketFrom(AddressVariant_t from, llarp::net::IPPacket pkt)
  type lokinet_context (line 170) | struct lokinet_context
    method next_socket_id (line 187) | int next_socket_id()
    method make_udp_handler (line 201) | [[nodiscard]] std::optional<int> make_udp_handler(
    method remove_udp_handler (line 245) | void remove_udp_handler(int socket_id)
    method acquire (line 268) | [[nodiscard]] auto acquire() { return std::unique_lock{m_access}; }
    method endpoint (line 270) | [[nodiscard]] auto endpoint(std::string name = "default") const
    method inbound_stream (line 278) | void inbound_stream(int id) { streams[id] = true; }
    method outbound_stream (line 280) | void outbound_stream(int id) { streams[id] = false; }
  function stream_error (line 285) | void stream_error(lokinet_stream_result* result, int err)
  function stream_okay (line 291) | void stream_okay(lokinet_stream_result* result, std::string host, int po...
  function split_host_port (line 299) | std::pair<std::string, int> split_host_port(std::string data, std::strin...
  function accept_port (line 317) | int accept_port(const char* remote, uint16_t port, void* ptr)
  function SRVFromData (line 327) | std::optional<lokinet_srv_record> SRVFromData(const llarp::dns::SRVData&...
  type lokinet_srv_lookup_private (line 337) | struct lokinet_srv_lookup_private
    method LookupSRV (line 341) | int LookupSRV(std::string host, std::string service, lokinet_context* ...
    method IterateAll (line 374) | void IterateAll(std::function<void(lokinet_srv_record*)> visit)
  function lokinet_set_netid (line 385) | void EXPORT lokinet_set_netid(const char* netid)
  function lokinet_log_level (line 398) | int EXPORT lokinet_log_level(const char* level)
  type lokinet_context (line 414) | struct lokinet_context
    method next_socket_id (line 187) | int next_socket_id()
    method make_udp_handler (line 201) | [[nodiscard]] std::optional<int> make_udp_handler(
    method remove_udp_handler (line 245) | void remove_udp_handler(int socket_id)
    method acquire (line 268) | [[nodiscard]] auto acquire() { return std::unique_lock{m_access}; }
    method endpoint (line 270) | [[nodiscard]] auto endpoint(std::string name = "default") const
    method inbound_stream (line 278) | void inbound_stream(int id) { streams[id] = true; }
    method outbound_stream (line 280) | void outbound_stream(int id) { streams[id] = false; }
  function lokinet_add_bootstrap_rc (line 425) | int EXPORT lokinet_add_bootstrap_rc(const char* data, size_t datalen, st...
  type lokinet_context (line 461) | struct lokinet_context
    method next_socket_id (line 187) | int next_socket_id()
    method make_udp_handler (line 201) | [[nodiscard]] std::optional<int> make_udp_handler(
    method remove_udp_handler (line 245) | void remove_udp_handler(int socket_id)
    method acquire (line 268) | [[nodiscard]] auto acquire() { return std::unique_lock{m_access}; }
    method endpoint (line 270) | [[nodiscard]] auto endpoint(std::string name = "default") const
    method inbound_stream (line 278) | void inbound_stream(int id) { streams[id] = true; }
    method outbound_stream (line 280) | void outbound_stream(int id) { streams[id] = false; }
  function lokinet_context_free (line 463) | void EXPORT lokinet_context_free(struct lokinet_context* ctx)
  function lokinet_context_start (line 469) | int EXPORT lokinet_context_start(struct lokinet_context* ctx)
  function lokinet_status (line 503) | int EXPORT lokinet_status(struct lokinet_context* ctx)
  function lokinet_wait_for_ready (line 515) | int EXPORT lokinet_wait_for_ready(int ms, struct lokinet_context* ctx)
  function lokinet_context_stop (line 535) | void EXPORT lokinet_context_stop(struct lokinet_context* ctx)
  function lokinet_outbound_stream (line 553) | void EXPORT lokinet_outbound_stream(
  function lokinet_inbound_stream (line 664) | int EXPORT lokinet_inbound_stream(uint16_t port, struct lokinet_context*...
  function lokinet_inbound_stream_filter (line 670) | int EXPORT
  function lokinet_close_stream (line 732) | void EXPORT lokinet_close_stream(int stream_id, struct lokinet_context* ...
  function lokinet_srv_lookup (line 764) | int EXPORT
  function lokinet_for_each_srv_record (line 776) | void EXPORT
  function lokinet_srv_lookup_done (line 789) | void EXPORT lokinet_srv_lookup_done(struct lokinet_srv_lookup_result* re...
  function lokinet_udp_bind (line 797) | int EXPORT lokinet_udp_bind(
  function lokinet_udp_close (line 822) | void EXPORT lokinet_udp_close(int socket_id, struct lokinet_context* ctx)
  function lokinet_udp_flow_send (line 830) | int EXPORT lokinet_udp_flow_send(
  function lokinet_udp_establish (line 876) | int EXPORT lokinet_udp_establish(
  function lokinet_set_syncing_logger (line 950) | void EXPORT lokinet_set_syncing_logger(lokinet_logger_func func, lokinet...
  function lokinet_set_logger (line 956) | void EXPORT lokinet_set_logger(lokinet_logger_func func, void* user)

FILE: llarp/messages/common.cpp
  type llarp::messages (line 3) | namespace llarp::messages
    function serialize_status_response (line 6) | std::string serialize_status_response(std::string_view value)

FILE: llarp/messages/common.hpp
  type llarp::messages (line 11) | namespace llarp::messages
  type llarp (line 21) | namespace llarp
    function to_bytes (line 27) | inline std::vector<std::byte> to_bytes(const oxenc::bt_dict_producer& ...

FILE: llarp/messages/dht.cpp
  type llarp (line 3) | namespace llarp
    type PublishClientContact (line 7) | namespace PublishClientContact
      function serialize (line 29) | std::vector<std::byte> serialize(const EncryptedClientContact& ecc, ...
      function deserialize (line 39) | std::pair<EncryptedClientContact, std::optional<int>> deserialize(ox...
    type FindClientContact (line 52) | namespace FindClientContact
      function serialize (line 63) | std::vector<std::byte> serialize(const PubKey& location)
      function PubKey (line 72) | PubKey deserialize(oxenc::bt_dict_consumer&& btdc)
      function serialize_response (line 94) | std::vector<std::byte> serialize_response(const EncryptedClientConta...
      function EncryptedClientContact (line 103) | EncryptedClientContact deserialize_response(oxenc::bt_dict_consumer&...
    type ResolveSNS (line 120) | namespace ResolveSNS
      function serialize (line 129) | std::vector<std::byte> serialize(std::span<const std::byte, SHORTHAS...
      function deserialize (line 138) | std::string deserialize(oxenc::bt_dict_consumer&& btdc)
      function serialize_response (line 156) | std::vector<std::byte> serialize_response(const EncryptedSNSRecord& ...
      function EncryptedSNSRecord (line 165) | EncryptedSNSRecord deserialize_response(oxenc::bt_dict_consumer&& btdc)

FILE: llarp/messages/dht.hpp
  type llarp (line 8) | namespace llarp
    type PublishClientContact (line 10) | namespace PublishClientContact
    type FindClientContact (line 21) | namespace FindClientContact
    type ResolveSNS (line 47) | namespace ResolveSNS

FILE: llarp/messages/fetch.cpp
  type llarp (line 5) | namespace llarp
    type FetchRC (line 7) | namespace FetchRC
      function serialize (line 11) | std::vector<std::byte> serialize(std::span<const RouterID> explicit_...
      function deserialize_response (line 24) | std::vector<RelayContact> deserialize_response(NetID netid, oxenc::b...
    type FetchRID (line 35) | namespace FetchRID
      function serialize (line 37) | std::vector<std::byte> serialize(const RouterID& source)

FILE: llarp/messages/fetch.hpp
  type llarp (line 7) | namespace llarp
    type FetchRC (line 9) | namespace FetchRC
    type FetchRID (line 19) | namespace FetchRID

FILE: llarp/messages/path.cpp
  type llarp (line 12) | namespace llarp
    type PATH (line 20) | namespace PATH
      type BUILD (line 22) | namespace BUILD
      type CONTROL (line 32) | namespace CONTROL
        function serialize (line 38) | std::vector<std::byte> serialize(std::string_view endpoint, std::s...
        function deserialize (line 46) | std::pair<std::string, std::string> deserialize(oxenc::bt_dict_con...

FILE: llarp/messages/path.hpp
  type llarp::PATH (line 8) | namespace llarp::PATH
    type BUILD (line 10) | namespace BUILD
    type CONTROL (line 20) | namespace CONTROL

FILE: llarp/messages/session.cpp
  type llarp (line 9) | namespace llarp
    type InitiateSession (line 13) | namespace InitiateSession
      function serialize (line 19) | std::vector<std::byte> serialize(
      function serialize_encrypt (line 46) | std::pair<std::vector<std::byte>, SharedSecret> serialize_encrypt(
      function Parameters (line 75) | Parameters decrypt_deserialize(oxenc::bt_dict_consumer&& outer_btdc,...
      function serialize_response (line 106) | std::string serialize_response(session_tag& t)
      function session_tag (line 113) | session_tag deserialize_response(oxenc::bt_dict_consumer&& btdc)
    type CloseSession (line 127) | namespace CloseSession
      function serialize (line 129) | std::string serialize(session_tag& t)
      function session_tag (line 136) | session_tag deserialize(oxenc::bt_dict_consumer&& btdc)
    type SetSessionTag (line 151) | namespace SetSessionTag
      function serialize (line 153) | std::string serialize()
    type SessionPathSwitch (line 161) | namespace SessionPathSwitch
      function serialize (line 166) | std::string serialize(session_tag t, HopID local_pivot_txid, HopID r...
      function deserialize (line 177) | std::tuple<session_tag, HopID, HopID> deserialize(oxenc::bt_dict_con...

FILE: llarp/messages/session.hpp
  type llarp (line 8) | namespace llarp

FILE: llarp/net/id.hpp
  type llarp (line 6) | namespace llarp
    type NetID (line 9) | enum class NetID
    function to_string (line 15) | inline std::string to_string(NetID n)
    function NetID (line 28) | inline NetID netid_from_string(std::string_view s)
  type fmt (line 39) | namespace fmt
    type formatter<llarp::NetID, char> (line 42) | struct formatter<llarp::NetID, char> : formatter<std::string>
      method format (line 45) | auto format(llarp::NetID n, FormatContext& ctx) const

FILE: llarp/net/ip_headers.hpp
  type llarp (line 7) | namespace llarp
    type ip_header (line 9) | struct ip_header
    type ipv6_header (line 31) | struct ipv6_header
      method tclass (line 52) | constexpr uint8_t tclass() const { return (tclass_hi << 4) | tclass_...
      method tclass (line 55) | constexpr void tclass(uint8_t tcl)
      method flowlabel (line 62) | constexpr uint32_t flowlabel() const { return (flow_hi << 16) | oxen...
      method flowlabel (line 65) | constexpr void flowlabel(uint32_t label)
    type TCPFLAG (line 77) | enum class TCPFLAG : uint8_t
    type tcp_header (line 87) | struct tcp_header
    type udp_header (line 107) | struct udp_header

FILE: llarp/net/ip_packet.cpp
  type llarp (line 14) | namespace llarp
    type tcp_header (line 23) | struct tcp_header
    type udp_header (line 24) | struct udp_header

FILE: llarp/net/ip_packet.hpp
  type llarp (line 14) | namespace llarp
    type IPPacket (line 19) | struct IPPacket
      method IPPacket (line 40) | IPPacket() : IPPacket{size_t{0}} {}
      method ip_header (line 51) | ip_header& header() { return *reinterpret_cast<ip_header*>(data()); }
      method ip_header (line 52) | const ip_header& header() const { return *reinterpret_cast<const ip_...
      method ipv6_header (line 54) | ipv6_header& v6_header() { return *reinterpret_cast<ipv6_header*>(da...
      method ipv6_header (line 55) | const ipv6_header& v6_header() const { return *reinterpret_cast<cons...
      method header_size (line 57) | size_t header_size() const
      method payload_size (line 61) | size_t payload_size() const
      method is_ipv4 (line 67) | bool is_ipv4() const { return _buf.size() >= sizeof(ip_header) && he...
      method is_ipv6 (line 68) | bool is_ipv6() const { return _buf.size() >= sizeof(ipv6_header) && ...
      method is_ip (line 69) | bool is_ip() const { return is_ipv4() || is_ipv6(); }
      method protocol (line 71) | net::IPProtocol protocol() const
      method _s_d_port (line 79) | std::optional<uint16_t> _s_d_port(int offset) const
      method source_port (line 89) | std::optional<uint16_t> source_port() const { return _s_d_port(0); }
      method dest_port (line 90) | std::optional<uint16_t> dest_port() const { return _s_d_port(2); }
      method source_ipv4 (line 92) | std::optional<ipv4> source_ipv4() const
      method dest_ipv4 (line 98) | std::optional<ipv4> dest_ipv4() const
      method source_ipv6 (line 105) | std::optional<ipv6> source_ipv6() const
      method dest_ipv6 (line 111) | std::optional<ipv6> dest_ipv6() const
      method size (line 134) | size_t size() const { return _buf.size(); }
      method span (line 136) | std::span<std::byte> span() { return _buf; }
      method span (line 137) | std::span<const std::byte> span() const { return _buf; }
      method u8span (line 139) | std::span<uint8_t> u8span() { return {reinterpret_cast<uint8_t*>(dat...
      method u8span (line 140) | std::span<const uint8_t> u8span() const { return {reinterpret_cast<c...
      method empty (line 142) | bool empty() const { return _buf.empty(); }
      type info_printer (line 145) | struct info_printer
      method info_printer (line 152) | info_printer info_line() const { return {*this}; }
    type IPPacket (line 34) | struct IPPacket
      method IPPacket (line 40) | IPPacket() : IPPacket{size_t{0}} {}
      method ip_header (line 51) | ip_header& header() { return *reinterpret_cast<ip_header*>(data()); }
      method ip_header (line 52) | const ip_header& header() const { return *reinterpret_cast<const ip_...
      method ipv6_header (line 54) | ipv6_header& v6_header() { return *reinterpret_cast<ipv6_header*>(da...
      method ipv6_header (line 55) | const ipv6_header& v6_header() const { return *reinterpret_cast<cons...
      method header_size (line 57) | size_t header_size() const
      method payload_size (line 61) | size_t payload_size() const
      method is_ipv4 (line 67) | bool is_ipv4() const { return _buf.size() >= sizeof(ip_header) && he...
      method is_ipv6 (line 68) | bool is_ipv6() const { return _buf.size() >= sizeof(ipv6_header) && ...
      method is_ip (line 69) | bool is_ip() const { return is_ipv4() || is_ipv6(); }
      method protocol (line 71) | net::IPProtocol protocol() const
      method _s_d_port (line 79) | std::optional<uint16_t> _s_d_port(int offset) const
      method source_port (line 89) | std::optional<uint16_t> source_port() const { return _s_d_port(0); }
      method dest_port (line 90) | std::optional<uint16_t> dest_port() const { return _s_d_port(2); }
      method source_ipv4 (line 92) | std::optional<ipv4> source_ipv4() const
      method dest_ipv4 (line 98) | std::optional<ipv4> dest_ipv4() const
      method source_ipv6 (line 105) | std::optional<ipv6> source_ipv6() const
      method dest_ipv6 (line 111) | std::optional<ipv6> dest_ipv6() const
      method size (line 134) | size_t size() const { return _buf.size(); }
      method span (line 136) | std::span<std::byte> span() { return _buf; }
      method span (line 137) | std::span<const std::byte> span() const { return _buf; }
      method u8span (line 139) | std::span<uint8_t> u8span() { return {reinterpret_cast<uint8_t*>(dat...
      method u8span (line 140) | std::span<const uint8_t> u8span() const { return {reinterpret_cast<c...
      method empty (line 142) | bool empty() const { return _buf.empty(); }
      type info_printer (line 145) | struct info_printer
      method info_printer (line 152) | info_printer info_line() const { return {*this}; }

FILE: llarp/net/net.h
  type in_port_t (line 19) | typedef unsigned short in_port_t;
  type in_addr_t (line 20) | typedef unsigned int in_addr_t;
  type sockaddr (line 33) | struct sockaddr

FILE: llarp/net/platform.hpp
  type llarp::net (line 11) | namespace llarp::net
    class Platform (line 15) | class Platform
      method Platform (line 18) | Platform() = default;
      method Platform (line 20) | Platform(const Platform&) = delete;
      method Platform (line 21) | Platform(Platform&&) = delete;
      method find_free_ipv6_net (line 35) | virtual std::optional<ipv6_net> find_free_ipv6_net(uint8_t /*mask*/ ...

FILE: llarp/net/policy.cpp
  type llarp (line 15) | namespace llarp
    function to_string (line 17) | std::string to_string(protocol_flag p)
    type net (line 26) | namespace net
      function ip_proto_str (line 31) | static std::string ip_proto_str(IPProtocol proto)
      function ProtocolInfo (line 69) | ProtocolInfo ProtocolInfo::from_config(std::string_view config_input)

FILE: llarp/net/policy.hpp
  type llarp (line 9) | namespace llarp
    type IPPacket (line 11) | struct IPPacket
    type protocol_flag (line 13) | enum class protocol_flag : uint8_t
    function protocol_flag (line 21) | inline constexpr protocol_flag operator&(protocol_flag a, protocol_fla...
    function protocol_flag (line 25) | inline constexpr protocol_flag& operator&=(protocol_flag& a, protocol_...
    function protocol_flag (line 30) | inline constexpr protocol_flag operator|(protocol_flag a, protocol_fla...
    function protocol_flag (line 34) | inline constexpr protocol_flag& operator|=(protocol_flag& a, protocol_...
    function has_flag (line 40) | inline constexpr bool has_flag(protocol_flag flags, protocol_flag cont...
    type net (line 59) | namespace net
      type IPProtocol (line 61) | enum class IPProtocol : uint8_t
      function ip_protocol_name (line 76) | inline constexpr std::string_view ip_protocol_name(IPProtocol p)
      type ProtocolInfo (line 107) | struct ProtocolInfo
        method ProtocolInfo (line 115) | ProtocolInfo() = default;
      type ExitPolicy (line 132) | struct ExitPolicy
        method empty (line 141) | bool empty() const { return ranges.empty() and protocols.empty(); }
  type fmt (line 157) | namespace fmt
    type formatter<llarp::net::IPProtocol, char> (line 160) | struct formatter<llarp::net::IPProtocol, char> : formatter<std::string...
      method format (line 163) | auto format(llarp::net::IPProtocol p, FormatContext& ctx) const

FILE: llarp/net/posix.cpp
  type llarp::net (line 18) | namespace llarp::net
    type ifaddrs_deleter (line 24) | struct ifaddrs_deleter
    function ifaddrs_ptr (line 29) | ifaddrs_ptr getifaddrs()
    class Platform_Impl (line 37) | class Platform_Impl : public Platform
      method for_each_interface (line 42) | void for_each_interface(Visitor&& visit) const
      method get_best_public_address (line 59) | std::optional<quic::Address> get_best_public_address(bool ipv4, uint...
      method find_free_ipv4_net (line 82) | std::optional<ipv4_net> find_free_ipv4_net(uint8_t mask) const override
      method find_free_ipv6_net (line 101) | std::optional<ipv6_net> find_free_ipv6_net(uint8_t mask) const override
      method get_interface_index (line 120) | std::optional<int> get_interface_index(ipv4 ip) const override
      method get_interface_index (line 139) | std::optional<int> get_interface_index(ipv6 ip) const override
      method find_free_tun (line 159) | std::string find_free_tun([[maybe_unused]] std::string_view suggest)...
      method get_interface_ipv4 (line 187) | std::optional<ipv4> get_interface_ipv4(std::string_view ifname) cons...
      method get_interface_ipv6 (line 203) | std::optional<ipv6> get_interface_ipv6(std::string_view ifname) cons...
      method has_interface_address (line 219) | bool has_interface_address(ipv4 ip) const override
      method has_interface_address (line 228) | bool has_interface_address(ipv6 ip) const override
    function Platform (line 241) | const Platform* Platform::Default_ptr() { return &g_plat; }

FILE: llarp/net/utils.cpp
  type llarp (line 5) | namespace llarp
    type utils (line 9) | namespace utils
      function add_u32 (line 11) | static constexpr uint32_t add_u32(uint32_t x) { return uint32_t{x & ...
      function add_u32 (line 13) | static uint32_t add_u32(ipv4 x) { return add_u32(oxenc::host_to_big(...
      function sub_u32 (line 15) | static constexpr uint32_t sub_u32(uint32_t x) { return add_u32(~x); }
      function sub_u32 (line 17) | static uint32_t sub_u32(ipv4 x) { return sub_u32(oxenc::host_to_big(...
      function ip_checksum (line 19) | uint16_t ip_checksum(const uint8_t *buf, size_t sz)
      function ipv4_checksum_diff (line 43) | uint16_t ipv4_checksum_diff(uint16_t old_sum, uint32_t old_src, uint...
      function ipv4_tcp_checksum_diff (line 53) | uint16_t ipv4_tcp_checksum_diff(
      function ipv4_udp_checksum_diff (line 60) | uint16_t ipv4_udp_checksum_diff(
    function csum_add (line 70) | uint16_t csum_add(uint16_t csum, uint16_t rhs)
    function csum_sub (line 77) | uint16_t csum_sub(uint16_t csum, uint16_t rhs) { return csum_add(csum,...
    function from_32_to_16 (line 79) | uint16_t from_32_to_16(uint32_t x)
    function from_64_to_32 (line 88) | uint32_t from_64_to_32(uint64_t x)
    function fold_csum (line 97) | uint16_t fold_csum(uint32_t csum)
    function ipv6_checksum_magic (line 105) | uint16_t ipv6_checksum_magic(
    function tcp_checksum_ipv6 (line 140) | uint32_t tcp_checksum_ipv6(const struct in6_addr *saddr, const struct ...
    function udp_checksum_ipv6 (line 145) | uint32_t udp_checksum_ipv6(const struct in6_addr *saddr, const struct ...

FILE: llarp/net/utils.hpp
  type llarp (line 5) | namespace llarp
    type utils (line 11) | namespace utils
    type in6_addr (line 33) | struct in6_addr
    type in6_addr (line 33) | struct in6_addr
    type in6_addr (line 35) | struct in6_addr
    type in6_addr (line 35) | struct in6_addr

FILE: llarp/net/win32.cpp
  type llarp::net (line 16) | namespace llarp::net
    class Platform_Impl (line 20) | class Platform_Impl : public Platform
      method adapter_has_ip (line 23) | bool adapter_has_ip(adapter_t* a, ipaddr_t ip) const
      method adapter_has_fam (line 37) | bool adapter_has_fam(adapter_t* a, int af) const
      method get_interface_index (line 49) | std::optional<int> get_interface_index(ip ip) const override
      method get_interface_addr (line 79) | std::optional<quic::Address> get_interface_addr(std::string_view nam...
      method all_interfaces (line 96) | std::optional<quic::Address> all_interfaces(quic::Address fallback) ...
      method find_free_tun (line 103) | std::string find_free_tun() const override { return "lokitun0"; }
      method get_best_public_address (line 105) | std::optional<quic::Address> get_best_public_address(bool, uint16_t)...
      method find_free_range (line 111) | std::optional<IPRange> find_free_range(bool ipv6_enabled) const over...
      method has_interface_address (line 133) | bool has_interface_address(ip ip) const override { return get_interf...
    function Platform (line 138) | const Platform* Platform::Default_ptr() { return &g_plat; }

FILE: llarp/nodedb.cpp
  type llarp (line 25) | namespace llarp
    function sample_rcs (line 32) | static std::vector<const RelayContact*> sample_rcs(
    function RelayContact (line 91) | const RelayContact* NodeDB::get_random_rc(const std::function<bool(con...
    type bs_data (line 139) | struct bs_data
      method try_next (line 150) | void try_next()
    function RelayContact (line 936) | const RelayContact* NodeDB::get_rc(const RouterID& pk) const
    function xor_condense (line 1054) | inline uint64_t xor_condense(const AlignedBuffer<32>& x)
    type PublishLocationMetric (line 1065) | struct PublishLocationMetric
      method PublishLocationMetric (line 1067) | PublishLocationMetric(const PubKey& blinded_pk) : pk_xor{xor_condens...

FILE: llarp/nodedb.hpp
  type oxen::quic (line 14) | namespace oxen::quic
    type message (line 16) | struct message
    type Ticker (line 17) | struct Ticker
    class Wakeable (line 18) | class Wakeable
  type llarp (line 21) | namespace llarp
    class Router (line 23) | class Router
    class NodeDB (line 75) | class NodeDB
      method num_bootstraps (line 176) | int num_bootstraps() const { return static_cast<int>(_bootstraps.siz...
      method has_bootstraps (line 178) | bool has_bootstraps() const { return !_bootstraps.empty(); }
      method has_rc (line 206) | bool has_rc(const RouterID& pk) const { return get_rc(pk); }

FILE: llarp/path/build_stats.cpp
  type llarp::path (line 8) | namespace llarp::path

FILE: llarp/path/build_stats.hpp
  type llarp::path (line 6) | namespace llarp::path
    type BuildStats (line 12) | struct BuildStats

FILE: llarp/path/hopid.cpp
  type llarp (line 5) | namespace llarp
    function HopID (line 7) | HopID HopID::make_random()

FILE: llarp/path/hopid.hpp
  type llarp (line 5) | namespace llarp
    type HopID (line 10) | struct HopID final : public AlignedBuffer<HOPID_SIZE>
  type std::hash<llarp::HopID> (line 20) | struct std::hash<llarp::HopID> : hash<llarp::AlignedBuffer<llarp::HopID:...

FILE: llarp/path/path.cpp
  type llarp::path (line 20) | namespace llarp::path
    function ClientIntro (line 59) | ClientIntro Path::make_intro() const
    function path_hop_stringifier (line 306) | path_hop_stringifier Path::hop_string() const { return {hops}; }

FILE: llarp/path/path.hpp
  type oxen::quic (line 18) | namespace oxen::quic
    type message (line 20) | struct message
  type llarp (line 23) | namespace llarp
    class Router (line 25) | class Router
    type Profiling (line 26) | struct Profiling
    type service (line 28) | namespace service
      type EncryptedIntroSet (line 30) | struct EncryptedIntroSet
  type llarp::path (line 34) | namespace llarp::path
    class PathHandler (line 36) | class PathHandler
    type path_hop_stringifier (line 40) | struct path_hop_stringifier
    type path_control_response (line 48) | struct path_control_response
      method ok (line 54) | bool ok() { return !timed_out && !error; }
    class Path (line 57) | class Path final : public std::enable_shared_from_this<Path>
      method LastRemoteActivityAt (line 82) | std::chrono::milliseconds LastRemoteActivityAt() const { return last...
      method num_hops (line 86) | size_t num_hops() const { return hops.size(); }
      method expires_in (line 90) | std::chrono::milliseconds expires_in(std::chrono::milliseconds now =...
      method is_expired (line 95) | bool is_expired(std::chrono::milliseconds now = llarp::time_now_ms()...
      method is_active (line 154) | bool is_active(std::chrono::milliseconds now = llarp::time_now_ms())...
      method TransitHop (line 159) | const TransitHop& edge() const { return hops.front(); }
      method TransitHop (line 160) | const TransitHop& terminus() const { return hops.back(); }
      method RouterID (line 171) | RouterID terminal_rid() const { return terminus().router_id; }
      method HopID (line 176) | HopID terminal_hopid() const { return terminus().txid; }
      method is_established (line 181) | bool is_established() const { return _is_established; }
      method set_built (line 186) | bool set_built()
      method is_built (line 194) | bool is_built() const { return _is_built; }
      type ping_stats_printer (line 203) | struct ping_stats_printer
      method ping_stats_printer (line 211) | ping_stats_printer printable_ping_stats() { return ping_stats_printe...
  type std::hash<llarp::path::Path> (line 240) | struct std::hash<llarp::path::Path>

FILE: llarp/path/path_context.cpp
  type llarp::path (line 7) | namespace llarp::path
    function TransitHop (line 94) | TransitHop* PathContext::get_transit_hop(const HopID& path_id) const
    function Path (line 111) | Path* PathContext::get_path(const HopID& hop_id) const

FILE: llarp/path/path_context.hpp
  type llarp (line 14) | namespace llarp
    class Router (line 16) | class Router
  type llarp::path (line 19) | namespace llarp::path
    class PathContext (line 23) | class PathContext

FILE: llarp/path/path_handler.cpp
  type llarp::path (line 25) | namespace llarp::path
    function Path (line 51) | Path* PathHandler::get_random_active_path() const
    function Path (line 101) | Path* PathHandler::get_path_by_edge(const HopID& edge_hop_id)
    function Path (line 108) | Path* PathHandler::get_path_by_terminus(const HopID& terminal_hop_id)
    function RelayContact (line 148) | const RelayContact* PathHandler::select_first_hop(std::function<bool(c...

FILE: llarp/path/path_handler.hpp
  type oxen::quic (line 17) | namespace oxen::quic
    type Ticker (line 19) | struct Ticker
  type llarp (line 22) | namespace llarp
    class Router (line 24) | class Router
    type path (line 25) | namespace path
      class PathHandler (line 34) | class PathHandler : public std::enable_shared_from_this<PathHandler>
        method on_path_build_failure (line 84) | virtual void on_path_build_failure(int64_t /*build_id*/, Path* /*p...
        method on_path_build_success (line 93) | virtual void on_path_build_success(int64_t /*build_id*/, Path& /*p...
        method update_paths (line 146) | virtual void update_paths(std::chrono::milliseconds /*now*/) {}
        method paths (line 170) | auto paths() const
        method active_paths (line 178) | auto active_paths(std::chrono::milliseconds now = llarp::time_now_...

FILE: llarp/path/transit_hop.cpp
  type llarp::path (line 18) | namespace llarp::path
    function short_string (line 42) | static std::string short_string(const std::variant<RouterID, quic::Con...

FILE: llarp/path/transit_hop.hpp
  type llarp (line 12) | namespace llarp
    class Router (line 14) | class Router
  type llarp::path (line 17) | namespace llarp::path
    class TransitHopError (line 19) | class TransitHopError : public std::runtime_error
      method TransitHopError (line 26) | inline static TransitHopError INVALID_DATA() { return "INVALID DATA"...
      method TransitHopError (line 27) | inline static TransitHopError DH_PUBKEY() { return "INVALID DH PUBKE...
      method TransitHopError (line 28) | inline static TransitHopError INVALID_PAYLOAD() { return "INVALID TR...
      method TransitHopError (line 29) | inline static TransitHopError INVALID_HOP_ID() { return "INVALID TRA...
      method TransitHopError (line 30) | inline static TransitHopError HOP_ID_UNAVAILABLE() { return "TRANSIT...
      method TransitHopError (line 31) | inline static TransitHopError INVALID_LIFETIME() { return "INVALID P...
    type TransitHop (line 37) | struct TransitHop
      method TransitHop (line 62) | TransitHop() = default;
      method same_transit (line 89) | bool same_transit(const TransitHop& other) const
      method is_expired (line 95) | bool is_expired(std::chrono::milliseconds now = llarp::time_now_ms()...

FILE: llarp/profiling.cpp
  type llarp (line 16) | namespace llarp
    function checkIsGood (line 106) | static constexpr bool checkIsGood(uint64_t fails, uint64_t success, ui...

FILE: llarp/profiling.hpp
  type oxenc (line 10) | namespace oxenc
    class bt_dict_consumer (line 12) | class bt_dict_consumer
    class bt_dict_producer (line 13) | class bt_dict_producer
  type oxen::quic (line 16) | namespace oxen::quic
    type Ticker (line 18) | struct Ticker
  type llarp (line 21) | namespace llarp
    class Router (line 23) | class Router
    type path (line 25) | namespace path
      class Path (line 27) | class Path
    type RouterProfile (line 30) | struct RouterProfile
      method RouterProfile (line 43) | RouterProfile() = default;
    type Profiling (line 65) | struct Profiling
      method Profiling (line 71) | Profiling() = default;

FILE: llarp/router/route_poker.cpp
  type llarp (line 7) | namespace llarp

FILE: llarp/router/route_poker.hpp
  type llarp (line 8) | namespace llarp
    class Router (line 10) | class Router
    class RoutePoker (line 15) | class RoutePoker
      method RoutePoker (line 19) | RoutePoker(const RoutePoker&) = delete;
      method RoutePoker (line 20) | RoutePoker(RoutePoker&&) = delete;
      method RoutePoker (line 21) | RoutePoker& operator=(const RoutePoker&) = delete;
      method RoutePoker (line 22) | RoutePoker& operator=(RoutePoker&&) = delete;
      method delete_route (line 28) | void delete_route(const IP& ip)
      method enabled (line 49) | bool enabled() const { return _enabled; }
      method delete_route (line 93) | auto delete_route(It it)

FILE: llarp/router/router.cpp
  type llarp (line 45) | namespace llarp

FILE: llarp/router/router.hpp
  type oxenmq (line 25) | namespace oxenmq
    class OxenMQ (line 27) | class OxenMQ
  type llarp (line 30) | namespace llarp
    type link (line 33) | namespace link
      type Connection (line 35) | struct Connection
      class Endpoint (line 36) | class Endpoint
      class Manager (line 37) | class Manager
    type rpc (line 40) | namespace rpc
      class RPCServer (line 42) | class RPCServer
      class OxendRPC (line 43) | class OxendRPC
    type consensus (line 46) | namespace consensus
      class reachability_testing (line 48) | class reachability_testing
    class ContactDB (line 83) | class ContactDB
    class NodeDB (line 84) | class NodeDB
    class Router (line 86) | class Router
      method Config (line 231) | const Config& config() const { return _config; }
      method ContactDB (line 233) | ContactDB& contact_db()
      method ContactDB (line 238) | const ContactDB& contact_db() const
      method NodeDB (line 244) | NodeDB& node_db()
      method NodeDB (line 249) | const NodeDB& node_db() const
      method NetID (line 255) | NetID netid() const { return _config.router.net_id; }
      method embedded (line 257) | bool embedded() const { return _config.embedded(); }
      method Ed25519SecretKey (line 264) | const Ed25519SecretKey& secret_key() const { return key_manager.secr...
      method RouterID (line 265) | const RouterID& id() const { return key_manager.router_id(); }
      method Profiling (line 267) | Profiling& router_profiling() { return _router_profiling; }
      method set_router_close_cb (line 297) | void set_router_close_cb(std::function<void(void)> hook) { _router_c...
      method looks_alive (line 299) | bool looks_alive() const { return llarp::time_now_ms() - _last_tick ...
      method is_running (line 329) | bool is_running() const { return _is_running; }
      method is_stopping (line 331) | bool is_stopping() const { return _is_stopping; }

FILE: llarp/rpc/json_binary_proxy.cpp
  type llarp::rpc (line 8) | namespace llarp::rpc
    function load_binary_parameter_impl (line 11) | void load_binary_parameter_impl(std::string_view bytes, size_t raw_siz...

FILE: llarp/rpc/json_binary_proxy.hpp
  type llarp::rpc (line 8) | namespace llarp::rpc
    function load_binary_parameter (line 38) | void load_binary_parameter(std::string_view bytes, bool allow_raw, T& ...
    class json_binary_proxy (line 45) | class json_binary_proxy
      type fmt (line 49) | enum class fmt
      method json_binary_proxy (line 55) | explicit json_binary_proxy(nlohmann::json& elem, fmt format) : e{ele...
      method json_binary_proxy (line 56) | json_binary_proxy() = delete;
      method json_binary_proxy (line 58) | json_binary_proxy(const json_binary_proxy&) = default;
      method json_binary_proxy (line 59) | json_binary_proxy(json_binary_proxy&&) = default;
      method json_binary_proxy (line 68) | json_binary_proxy operator[](T&& key)
      method json_binary_proxy (line 74) | json_binary_proxy front() { return json_binary_proxy{e.front(), form...
      method json_binary_proxy (line 75) | json_binary_proxy back() { return json_binary_proxy{e.back(), format...
      method json_binary_proxy (line 114) | json_binary_proxy emplace_back(Args&&... args)
      method push_back (line 122) | void push_back(T&& val)

FILE: llarp/rpc/json_bt.hpp
  type llarp::rpc (line 8) | namespace llarp::rpc
    function json_to_bt (line 11) | inline oxenc::bt_value json_to_bt(json&& j)

FILE: llarp/rpc/json_conversions.cpp
  type llarp (line 5) | namespace llarp
    function to_json (line 9) | void to_json(nlohmann::json& j, const ipv4_net& ipr) { j = ipr.to_stri...
    function from_json (line 11) | void from_json(const nlohmann::json& j, ipv4_net& ipr)

FILE: llarp/rpc/json_conversions.hpp
  type llarp (line 10) | namespace llarp
  type nlohmann (line 16) | namespace nlohmann
    type adl_serializer<T, std::enable_if_t<llarp::rpc::json_is_binary<T>>> (line 22) | struct adl_serializer<T, std::enable_if_t<llarp::rpc::json_is_binary<T>>>
      method to_json (line 26) | static void to_json(json&, const T&)
      method from_json (line 30) | static void from_json(const json& j, T& val)

FILE: llarp/rpc/oxend_rpc.cpp
  type llarp::rpc (line 13) | namespace llarp::rpc
    function Ed25519SecretKey (line 233) | Ed25519SecretKey OxendRPC::obtain_identity_key()

FILE: llarp/rpc/oxend_rpc.hpp
  type oxen::quic (line 11) | namespace oxen::quic
    type Ticker (line 13) | struct Ticker
  type llarp (line 15) | namespace llarp
    class Router (line 17) | class Router
  type llarp::rpc (line 20) | namespace llarp::rpc
    class OxendRPC (line 26) | class OxendRPC
      method block_height (line 39) | uint64_t block_height() const { return _block_height; }
      method request (line 61) | void request(std::string_view cmd, HandlerFunc_t func, const Args_t&...
      method request (line 67) | void request(std::string_view cmd, HandlerFunc_t func)

FILE: llarp/rpc/param_parser.hpp
  type llarp::rpc (line 15) | namespace llarp::rpc
    function check_ascending_names (line 22) | void check_ascending_names(std::string_view name1, std::string_view na...
    type required (line 38) | struct required
      method required (line 41) | required(T& ref) : value{ref} {}
    type ignore_empty_string (line 65) | struct ignore_empty_string
      method ignore_empty_string (line 68) | ignore_empty_string(T& ref) : value{ref} {}
      method should_ignore (line 70) | bool should_ignore(oxenc::bt_dict_consumer& d)
      method should_ignore (line 81) | bool should_ignore(json_range& it_range)
    function skip_until (line 97) | inline bool skip_until(oxenc::bt_dict_consumer& d, std::string_view na...
    function skip_until (line 99) | inline bool skip_until(json_range& it_range, std::string_view name)
    function load_value (line 140) | void load_value(BTConsumer& c, T& target)
    function load_value (line 174) | void load_value(json_range& range_itr, T& target)
    function load_tuple_values (line 244) | void load_tuple_values(oxenc::bt_list_consumer& c, TupleLike& val, std...
    function load_curr_value (line 253) | void load_curr_value(In& in, T& val)
    function get_next_value (line 279) | void get_next_value(In& in, [[maybe_unused]] std::string_view name, T&...
    function get_values (line 294) | void get_values(Input& in, std::string_view name, T&& val, More&&... m...

FILE: llarp/rpc/rpc_request.hpp
  type llarp::rpc (line 18) | namespace llarp::rpc
    function make_invoke (line 23) | auto make_invoke()

FILE: llarp/rpc/rpc_request_decorators.hpp
  type tools (line 15) | namespace tools
    type type_list (line 19) | struct type_list
  type llarp::rpc (line 23) | namespace llarp::rpc
    type RPCRequest (line 26) | struct RPCRequest
      method is_bt (line 34) | bool is_bt() const { return bt; }
      method set_bt (line 37) | void set_bt()
      method send_response (line 46) | void send_response()
      method send_response (line 51) | void send_response(nlohmann::json _response)
      method move (line 102) | oxenmq::Message::DeferredSend move()
    type NoArgs (line 114) | struct NoArgs : virtual RPCRequest
    type Immediate (line 118) | struct Immediate : virtual RPCRequest

FILE: llarp/rpc/rpc_request_definitions.hpp
  type llarp::rpc (line 17) | namespace llarp::rpc
    type Halt (line 24) | struct Halt : NoArgs, Immediate
    type Version (line 38) | struct Version : NoArgs, Immediate
    type Status (line 51) | struct Status : NoArgs
    type GetStatus (line 70) | struct GetStatus : NoArgs
    type QuicConnect (line 90) | struct QuicConnect : RPCRequest
      type request_parameters (line 94) | struct request_parameters
    type QuicListener (line 119) | struct QuicListener : RPCRequest
      type request_parameters (line 123) | struct request_parameters
    type LookupSnode (line 143) | struct LookupSnode : RPCRequest
      type request_parameters (line 147) | struct request_parameters
    type MapExit (line 163) | struct MapExit : RPCRequest
      type request_parameters (line 167) | struct request_parameters
    type ListExits (line 182) | struct ListExits : NoArgs
    type UnmapExit (line 195) | struct UnmapExit : RPCRequest
      type request_parameters (line 199) | struct request_parameters
    type SwapExits (line 213) | struct SwapExits : RPCRequest
      type request_parameters (line 217) | struct request_parameters
    type DNSQuery (line 235) | struct DNSQuery : Immediate
      type request_parameters (line 239) | struct request_parameters
    type Config (line 258) | struct Config : Immediate
      type request_parameters (line 262) | struct request_parameters
    type FindCC (line 278) | struct FindCC : RPCRequest
      type request_parameters (line 282) | struct request_parameters
    type SessionInit (line 296) | struct SessionInit : RPCRequest
      type request_parameters (line 300) | struct request_parameters
    type SessionClose (line 314) | struct SessionClose : RPCRequest
      type request_paramters (line 318) | struct request_paramters

FILE: llarp/rpc/rpc_request_parser.cpp
  type llarp::rpc (line 5) | namespace llarp::rpc
    function parse_request (line 9) | void parse_request(QuicConnect& quicconnect, rpc_input input)
    function parse_request (line 25) | void parse_request(QuicListener& quiclistener, rpc_input input)
    function parse_request (line 41) | void parse_request(FindCC& findcc, rpc_input input) { get_values(input...
    function parse_request (line 43) | void parse_request(SessionInit& sessioninit, rpc_input input) { get_va...
    function parse_request (line 45) | void parse_request(SessionClose& sessionclose, rpc_input input)
    function parse_request (line 50) | void parse_request(LookupSnode& lookupsnode, rpc_input input)
    function parse_request (line 55) | void parse_request(MapExit& mapexit, rpc_input input)
    function parse_request (line 67) | void parse_request(UnmapExit& unmapexit, rpc_input input)
    function parse_request (line 72) | void parse_request(SwapExits& swapexits, rpc_input input)
    function parse_request (line 78) | void parse_request(DNSQuery& dnsquery, rpc_input input)
    function parse_request (line 91) | void parse_request(Config& config, rpc_input input)

FILE: llarp/rpc/rpc_request_parser.hpp
  type llarp::rpc (line 10) | namespace llarp::rpc
    function parse_request (line 14) | inline void parse_request(NoArgs&, rpc_input) {}

FILE: llarp/rpc/rpc_server.cpp
  type llarp::rpc (line 22) | namespace llarp::rpc
    function log_print_rpc (line 28) | static void log_print_rpc(T& req)
    class DummyPacketSource (line 34) | class DummyPacketSource final : public dns::PacketSource
      method DummyPacketSource (line 39) | explicit DummyPacketSource(std::function<void(std::optional<dns::Mes...
      method would_loop (line 41) | bool would_loop(const quic::Address&, const quic::Address&) const ov...
      method send_udp (line 44) | void send_udp(const quic::Address&, const quic::Address&, std::span<...
      method bound_on (line 50) | std::optional<quic::Address> bound_on() const override { return std:...
    function check_path (line 53) | bool check_path(std::string path)
    function register_rpc_command (line 68) | void register_rpc_command(std::unordered_map<std::string, rpc_callback...
    function register_rpc_requests (line 93) | std::unordered_map<std::string, rpc_callback> register_rpc_requests(to...
    function try_netaddr (line 293) | static std::optional<NetworkAddress> try_netaddr(std::string_view x)

FILE: llarp/rpc/rpc_server.hpp
  type llarp (line 17) | namespace llarp
    class Router (line 19) | class Router
    type rpc (line 21) | namespace rpc
      class RPCServer (line 24) | class RPCServer
      type rpc_callback (line 27) | struct rpc_callback
      type rpc_error (line 52) | struct rpc_error : std::runtime_error
        method rpc_error (line 56) | rpc_error(std::string message) : std::runtime_error{"RPC error: " ...
      function SetJSONResponse (line 62) | void SetJSONResponse(Result_t result, json& j)
      function SetJSONError (line 67) | inline void SetJSONError(std::string_view msg, json& j) { j["error"]...
      class RPCServer (line 69) | class RPCServer
      class EndpointHandler (line 102) | class EndpointHandler
        method EndpointHandler (line 108) | EndpointHandler(RPCServer& _server, oxenmq::Message::DeferredSend ...

FILE: llarp/session/session.cpp
  type llarp::session (line 37) | namespace llarp::session
    type TCPTunnel (line 42) | struct TCPTunnel
      method reset (line 66) | void reset()
      method TCPTunnel (line 75) | TCPTunnel(Session& _session) : session(_session)
      method open_connection (line 183) | void open_connection()
      method map_tcp_remote_port (line 215) | uint16_t map_tcp_remote_port(uint16_t dest_port)
    function check_dead (line 929) | bool check_dead(std::shared_ptr<T>& path_like, Session& s)
    function send_path_data_impl (line 941) | static void send_path_data_impl(
    function send_path_control_impl (line 959) | static void send_path_control_impl(

FILE: llarp/session/session.hpp
  type llarp (line 20) | namespace llarp
    type link (line 28) | namespace link
      class TunnelManager (line 30) | class TunnelManager
    type handlers (line 33) | namespace handlers
      class SessionEndpoint (line 35) | class SessionEndpoint
    type session (line 45) | namespace session
      type TCPTunnel (line 49) | struct TCPTunnel
      class Session (line 56) | class Session
        method canary (line 128) | std::weak_ptr<bool> canary() { return _destructor_canary; }
        method Session (line 141) | Session(Session&&) = delete;
        method Session (line 142) | Session(const Session&) = delete;
        method Session (line 143) | Session& operator=(Session&&) = delete;
        method Session (line 144) | Session& operator=(const Session&) = delete;
        method NetworkAddress (line 157) | const NetworkAddress& remote() const { return _remote; }
        method queue_data_message (line 196) | virtual void queue_data_message(std::span<const std::byte> /*data*...
        method session_tag (line 213) | session_tag inbound_tag() const { return _inbound_tag; }
        method session_tag (line 214) | session_tag outbound_tag() const { return _outbound_tag; }
        method is_closed (line 218) | bool is_closed() const { return _is_closed; }
        method tick (line 235) | virtual void tick([[maybe_unused]] std::chrono::milliseconds now) {}
      class OutboundSession (line 238) | class OutboundSession : public path::PathHandler, public Session
        type on_established_sorter (line 282) | struct on_established_sorter
      class OutboundRelaySession (line 320) | class OutboundRelaySession final : public OutboundSession
      class OutboundClientSession (line 341) | class OutboundClientSession final : public OutboundSession
        method RouterID (line 390) | const RouterID& remote_endpoint() const { return _remote.router_id...
      class InboundSession (line 393) | class InboundSession : public Session
      class InboundClientSession (line 407) | class InboundClientSession final : public InboundSession
      class InboundRelaySession (line 424) | class InboundRelaySession final : public InboundSession

FILE: llarp/simulation/sim_context.cpp
  type llarp (line 5) | namespace llarp
    type simulate (line 7) | namespace simulate
      function Node_ptr (line 13) | Node_ptr Simulation::AddNode(const std::string& name)

FILE: llarp/simulation/sim_context.hpp
  type llarp (line 5) | namespace llarp
    type Context (line 8) | struct Context
    type simulate (line 11) | namespace simulate
      type Simulation (line 13) | struct Simulation : public std::enable_shared_from_this<Simulation>

FILE: llarp/util/aligned.hpp
  type llarp (line 13) | namespace llarp
    type AlignedBuffer (line 17) | struct alignas(8) AlignedBuffer
      method AlignedBuffer (line 23) | AlignedBuffer() { zero(); }
      method AlignedBuffer (line 25) | explicit AlignedBuffer(std::span<const uint8_t, SIZE> buf) { *this =...
      method AlignedBuffer (line 26) | explicit AlignedBuffer(std::span<const std::byte, SIZE> buf) { *this...
      method AlignedBuffer (line 28) | AlignedBuffer& operator=(std::span<const uint8_t, SIZE> buf)
      method AlignedBuffer (line 33) | AlignedBuffer& operator=(std::span<const std::byte, SIZE> buf)
      method assign (line 39) | void assign(std::span<const uint8_t, SIZE> buf) { std::memcpy(_data....
      method assign (line 40) | void assign(std::span<const std::byte, SIZE> buf) { std::memcpy(_dat...
      method copy_to (line 43) | void copy_to(std::span<std::byte, SIZE> buf) const { std::memcpy(buf...
      method copy_to (line 44) | void copy_to(std::span<uint8_t, SIZE> buf) const { std::memcpy(buf.d...
      method AlignedBuffer (line 58) | AlignedBuffer operator^(const AlignedBuffer& other) const
      method AlignedBuffer (line 65) | AlignedBuffer& operator^=(const AlignedBuffer& other)
      method size (line 87) | static constexpr size_t size() { return sz; }
      method Fill (line 89) | void Fill(uint8_t f) { _data.fill(f); }
      method span (line 99) | std::span<std::byte, SIZE> span()
      method span (line 103) | std::span<const std::byte, SIZE> span() const
      method first (line 115) | std::span<std::byte> first(size_t n) { return span().first(n); }
      method first (line 118) | std::span<std::byte, N> first()
      method last (line 122) | std::span<std::byte> last(size_t n) { return span().last(n); }
      method last (line 125) | std::span<std::byte, N> last()
      method is_zero (line 130) | bool is_zero() const
      method zero (line 141) | void zero() { _data.fill(0); }
      method begin (line 143) | typename std::array<uint8_t, SIZE>::iterator begin() { return _data....
      method end (line 145) | typename std::array<uint8_t, SIZE>::iterator end() { return _data.en...
      method begin (line 147) | typename std::array<uint8_t, SIZE>::const_iterator begin() const { r...
      method end (line 149) | typename std::array<uint8_t, SIZE>::const_iterator end() const { ret...
      method from_base32z (line 151) | bool from_base32z(std::string_view b32z)
      method bt_encode (line 159) | std::string bt_encode() const { return oxenc::bt_serialize(_data); }
      method bt_decode (line 161) | bool bt_decode(std::string buf)
      method to_view (line 167) | std::string_view to_view() const { return {reinterpret_cast<const ch...
      method ToHex (line 169) | std::string ToHex() const { return oxenc::to_hex(begin(), end()); }
      method FromHex (line 171) | bool FromHex(std::string_view str)
      method to_string (line 179) | std::string to_string() const { return ToHex(); }
      type short_log_printer (line 184) | struct short_log_printer
        method to_string (line 187) | std::string to_string() const { return oxenc::to_base32z(buf.begin...
      method short_log_printer (line 191) | short_log_printer short_string() const { return {*this}; }
        method to_string (line 187) | std::string to_string() const { return oxenc::to_base32z(buf.begin...
      method T (line 195) | static T filled(uint8_t f)
    type AlignedHasher (line 210) | struct AlignedHasher
  type std (line 233) | namespace std
    type hash<llarp::AlignedBuffer<sz>> (line 236) | struct hash<llarp::AlignedBuffer<sz>> : llarp::AlignedHasher

FILE: llarp/util/bspan.hpp
  type llarp (line 10) | namespace llarp
    function as_bspan (line 17) | std::span<std::byte, Extent> as_bspan(std::span<uint8_t, Extent> s)
    function as_bspan (line 22) | std::span<const std::byte, Extent> as_bspan(std::span<const uint8_t, E...
    function as_uspan (line 28) | std::span<std::uint8_t, Extent> as_uspan(std::span<std::byte, Extent> s)
    function as_uspan (line 33) | std::span<const std::uint8_t, Extent> as_uspan(std::span<const std::by...
    function as_bspan (line 39) | inline std::span<const std::byte> as_bspan(std::string_view s)
    function as_bspan (line 45) | inline std::span<std::byte> as_bspan(std::string& s) { return {reinter...
    type detail (line 47) | namespace detail
      function split_span (line 49) | inline constexpr std::span<std::byte> split_span(std::byte*& data, s...
      function split_span (line 56) | constexpr std::span<std::byte, Len> split_span(std::byte*& data)
    function split_span (line 71) | constexpr std::array<std::span<std::byte>, sizeof...(Lengths) + 1> spl...
    function split_span_tail (line 82) | constexpr std::array<std::span<std::byte>, sizeof...(Lengths) + 1> spl...
    function split_span (line 94) | constexpr std::tuple<std::span<std::byte, Lengths>..., std::span<std::...
    function split_span_tail (line 105) | constexpr std::tuple<std::span<std::byte>, std::span<std::byte, Length...

FILE: llarp/util/buffer.cpp
  function put (line 11) | bool put(llarp_buffer_t& buf, UInt i)
  function read (line 21) | bool read(llarp_buffer_t& buf, UInt& i)

FILE: llarp/util/buffer.hpp
  type llarp_buffer_t (line 20) | struct /* [[deprecated("this type is stupid, use something else")]] */ l...
    method llarp_buffer_t (line 31) | llarp_buffer_t() = default;
    method llarp_buffer_t (line 33) | llarp_buffer_t(uint8_t* b, uint8_t* c, size_t s) : base(b), cur(c), sz...
    method llarp_buffer_t (line 41) | llarp_buffer_t(Byte* buf, size_t sz) : base{reinterpret_cast<uint8_t*>...
    method llarp_buffer_t (line 46) | llarp_buffer_t(std::vector<Byte>& b) : llarp_buffer_t{b.data(), b.size()}
    method llarp_buffer_t (line 50) | llarp_buffer_t(std::array<Byte, N>& b) : llarp_buffer_t{b.data(), b.si...
    method llarp_buffer_t (line 55) | llarp_buffer_t(const Byte* buf, size_t sz) : llarp_buffer_t{const_cast...
    method llarp_buffer_t (line 59) | llarp_buffer_t(const std::vector<Byte>& b) : llarp_buffer_t{const_cast...
    method llarp_buffer_t (line 63) | llarp_buffer_t(const std::array<Byte, N>& b) : llarp_buffer_t{const_ca...
    method llarp_buffer_t (line 69) | explicit llarp_buffer_t(T&& t) : llarp_buffer_t{t.data(), t.size()}
    method to_string (line 72) | std::string to_string() const { return {reinterpret_cast<const char*>(...
    method size_left (line 79) | size_t size_left() const
    method llarp_buffer_t (line 105) | llarp_buffer_t(const llarp_buffer_t&) = default;
    method llarp_buffer_t (line 106) | llarp_buffer_t(llarp_buffer_t&&) = default;

FILE: llarp/util/compare_ptr.hpp
  type llarp (line 5) | namespace llarp
    type ComparePtr (line 9) | struct ComparePtr
    type CompareWeakPtr (line 22) | struct CompareWeakPtr

FILE: llarp/util/decaying_hashset.hpp
  type llarp::util (line 7) | namespace llarp::util
    type DecayingHashSet (line 10) | struct DecayingHashSet
      method DecayingHashSet (line 12) | DecayingHashSet(std::chrono::milliseconds cacheInterval = 1s) : m_Ca...
      method Size (line 14) | size_t Size() const { return m_Values.size(); }
      method Contains (line 17) | bool Contains(const Val_t& v) const { return m_Values.count(v) != 0; }
      method Insert (line 21) | bool Insert(const Val_t& v, std::chrono::milliseconds now = 0s)
      method Upsert (line 29) | void Upsert(const Val_t& v) { m_Values[v] = llarp::time_now_ms(); }
      method Decay (line 32) | void Decay(std::chrono::milliseconds now = 0s)
      method DecayInterval (line 39) | std::chrono::milliseconds DecayInterval() const { return m_CacheInte...
      method Empty (line 41) | bool Empty() const { return m_Values.empty(); }
      method DecayInterval (line 43) | void DecayInterval(std::chrono::milliseconds interval) { m_CacheInte...
      method Remove (line 45) | void Remove(const Val_t& val) { m_Values.erase(val); }
      method EraseIf (line 49) | void EraseIf(Predicate_t pred)

FILE: llarp/util/decaying_hashtable.hpp
  type llarp::util (line 8) | namespace llarp::util
    type DecayingHashTable (line 11) | struct DecayingHashTable
      method DecayingHashTable (line 13) | DecayingHashTable(std::chrono::milliseconds cacheInterval = 1h) : m_...
      method Decay (line 15) | void Decay(std::chrono::milliseconds now)
      method Has (line 21) | bool Has(const Key_t& k) const { return m_Values.find(k) != m_Values...
      method Put (line 25) | bool Put(Key_t key, Value_t value, std::chrono::milliseconds now = 0s)
      method Get (line 33) | std::optional<Value_t> Get(Key_t k) const
      method Remove (line 42) | void Remove(const Key_t& key) { m_Values.erase(key); }
      method EraseIf (line 46) | void EraseIf(Predicate_t pred)

FILE: llarp/util/exceptions.hpp
  type llarp::util (line 3) | namespace llarp::util
    class bind_socket_error (line 5) | class bind_socket_error : public std::runtime_error

FILE: llarp/util/file.cpp
  type llarp::util (line 19) | namespace llarp::util
    function file_to_string (line 23) | std::string file_to_string(const std::filesystem::path& filename, size...
    function buffer_to_file (line 43) | void buffer_to_file(const std::filesystem::path& filename, std::string...
    function errno_error (line 51) | static std::error_code errno_error()
    function error_code_t (line 58) | error_code_t EnsurePrivateFile(const std::filesystem::path& pathname)

FILE: llarp/util/file.hpp
  type llarp::util (line 15) | namespace llarp::util
    type FileHash (line 29) | struct FileHash
    function OpenFileStream (line 47) | std::optional<T> OpenFileStream(const std::filesystem::path& pathname,...

FILE: llarp/util/formattable.hpp
  type llarp (line 9) | namespace llarp
  type fmt (line 16) | namespace fmt
    type is_range<T, char> (line 21) | struct is_range<T, char>
    type formatter<std::optional<T>, Char, std::enable_if_t<is_formattable<T, Char>::value>> (line 35) | struct formatter<std::optional<T>, Char, std::enable_if_t<is_formattab...
      method FMT_CONSTEXPR (line 44) | FMT_CONSTEXPR static auto maybe_set_debug_format(U& u, bool set) -> ...
      method FMT_CONSTEXPR (line 50) | FMT_CONSTEXPR static void maybe_set_debug_format(U&, ...)
      method parse (line 55) | FMT_CONSTEXPR auto parse(ParseContext& ctx)
      method format (line 62) | auto format(const std::optional<T>& opt, FormatContext& ctx) const -...
  type fmt (line 32) | namespace fmt
    type is_range<T, char> (line 21) | struct is_range<T, char>
    type formatter<std::optional<T>, Char, std::enable_if_t<is_formattable<T, Char>::value>> (line 35) | struct formatter<std::optional<T>, Char, std::enable_if_t<is_formattab...
      method FMT_CONSTEXPR (line 44) | FMT_CONSTEXPR static auto maybe_set_debug_format(U& u, bool set) -> ...
      method FMT_CONSTEXPR (line 50) | FMT_CONSTEXPR static void maybe_set_debug_format(U&, ...)
      method parse (line 55) | FMT_CONSTEXPR auto parse(ParseContext& ctx)
      method format (line 62) | auto format(const std::optional<T>& opt, FormatContext& ctx) const -...

FILE: llarp/util/logging.cpp
  type llarp (line 6) | namespace llarp

FILE: llarp/util/logging.hpp
  type llarp (line 9) | namespace llarp

FILE: llarp/util/logging/buffer.hpp
  type llarp (line 5) | namespace llarp

FILE: llarp/util/logging/callback_sink.hpp
  type llarp::logging (line 7) | namespace llarp::logging
    class CallbackSink (line 11) | class CallbackSink : public spdlog::sinks::base_sink<Mutex>
      method CallbackSink (line 19) | explicit CallbackSink(lokinet_logger_func log, lokinet_logger_sync s...
      method sink_it_ (line 24) | void sink_it_(const spdlog::details::log_msg& msg) override
      method flush_ (line 33) | void flush_() override

FILE: llarp/util/mem.cpp
  type llarp (line 6) | namespace llarp
    function Zero (line 8) | void Zero(void* ptr, size_t sz)
  function llarp_mem_slab (line 19) | void llarp_mem_slab(struct llarp_alloc* /*mem*/, uint32_t* /*buf*/, size...
  function llarp_eq (line 25) | bool llarp_eq(const void* a, const void* b, size_t sz)

FILE: llarp/util/mem.hpp
  type llarp (line 10) | namespace llarp
    function dumphex (line 15) | void dumphex(const uint8_t* t)
    function DumpBufferHex (line 27) | void DumpBufferHex(const T& buff)
    function DumpBuffer (line 55) | void DumpBuffer(const T& buff)

FILE: llarp/util/nop_service_manager.cpp
  type llarp::sys (line 3) | namespace llarp::sys

FILE: llarp/util/random.hpp
  type llarp (line 8) | namespace llarp
    type CSRNG (line 11) | struct CSRNG
      method min (line 15) | static constexpr uint64_t min() { return std::numeric_limits<uint64_...
      method max (line 17) | static constexpr uint64_t max() { return std::numeric_limits<uint64_...
    function random_fill (line 29) | inline void random_fill(std::span<std::byte> s) { randombytes_buf(s.da...

FILE: llarp/util/service_manager.hpp
  type llarp (line 3) | namespace llarp
    type Context (line 5) | struct Context
  type llarp::sys (line 8) | namespace llarp::sys
    type ServiceState (line 12) | enum class ServiceState
    class I_SystemLayerManager (line 24) | class I_SystemLayerManager
      method disable (line 37) | inline void disable() { m_disable = true; }
      method give_context (line 40) | inline void give_context(llarp::Context* ctx) { m_Context = ctx; }
      method starting (line 51) | void starting()
      method ready (line 58) | void ready()
      method stopping (line 65) | void stopping()
      method stopped (line 72) | void stopped()
      method failed (line 79) | void failed()
    class NOP_SystemLayerHandler (line 89) | class NOP_SystemLayerHandler : public I_SystemLayerManager
      method we_changed_our_state (line 92) | void we_changed_our_state(ServiceState) override {}

FILE: llarp/util/str.cpp
  type llarp (line 14) | namespace llarp
    function TrimWhitespace (line 18) | std::string_view TrimWhitespace(std::string_view str)
    function split (line 35) | std::vector<std::string_view> split(std::string_view str, const std::s...
    function split_any (line 61) | std::vector<std::string_view> split_any(std::string_view str, const st...
    function lowercase_ascii_string (line 84) | std::string lowercase_ascii_string(std::string src)
    function to_wide (line 92) | std::wstring to_wide(std::string data)

FILE: llarp/util/str.hpp
  type llarp (line 13) | namespace llarp
    function starts_with (line 16) | inline constexpr bool starts_with(std::string_view str, std::string_vi...
    function ends_with (line 22) | inline constexpr bool ends_with(std::string_view str, std::string_view...
    function strip_prefix (line 28) | inline constexpr std::string_view strip_prefix(std::string_view str, s...
    function join (line 61) | std::string join(std::string_view delimiter, It begin, It end)
    function join (line 68) | std::string join(std::string_view delimiter, const Container& c)
    function parse_int (line 77) | bool parse_int(const std::string_view str, T& value, int base = 10)

FILE: llarp/util/thread/barrier.hpp
  type llarp (line 5) | namespace llarp
    type util (line 7) | namespace util
      class Barrier (line 11) | class Barrier
        method Barrier (line 18) | Barrier(unsigned threads) : pending{threads} {}
        method Block (line 23) | bool Block()

FILE: llarp/util/thread/queue.hpp
  type llarp::thread (line 10) | namespace llarp::thread
    class QueuePushGuard (line 13) | class QueuePushGuard
      method QueuePushGuard (line 109) | QueuePushGuard(Queue<Type>& queue, uint32_t generation, uint32_t index)
    class QueuePopGuard (line 15) | class QueuePopGuard
      method QueuePopGuard (line 130) | QueuePopGuard(Queue<Type>& queue, uint32_t generation, uint32_t index)
    class Queue (line 18) | class Queue
      method Queue (line 46) | Queue(const Queue&) = delete;
      method Queue (line 47) | Queue& operator=(const Queue&) = delete;
    class QueuePushGuard (line 101) | class QueuePushGuard
      method QueuePushGuard (line 109) | QueuePushGuard(Queue<Type>& queue, uint32_t generation, uint32_t index)
    class QueuePopGuard (line 122) | class QueuePopGuard
      method QueuePopGuard (line 130) | QueuePopGuard(Queue<Type>& queue, uint32_t generation, uint32_t index)
    function QueueReturn (line 162) | QueueReturn Queue<Type>::tryPushBack(const Type& value)
    function QueueReturn (line 201) | QueueReturn Queue<Type>::tryPushBack(Type&& value)
    function QueueReturn (line 270) | QueueReturn Queue<Type>::pushBack(const Type& value)
    function QueueReturn (line 306) | QueueReturn Queue<Type>::pushBack(Type&& value)
    function Type (line 342) | Type Queue<Type>::popFront()

FILE: llarp/util/thread/queue_manager.cpp
  type llarp::thread (line 5) | namespace llarp::thread
    function to_underlying (line 10) | constexpr auto to_underlying(E e) noexcept
    function to_underlying (line 16) | constexpr uint32_t to_underlying(E e) noexcept
    function isDisabledFlagSet (line 35) | bool isDisabledFlagSet(uint32_t encodedIndex) { return (encodedIndex &...
    function discardDisabledFlag (line 37) | uint32_t discardDisabledFlag(uint32_t encodedIndex) { return (encodedI...
    function encodeElement (line 39) | uint32_t encodeElement(uint32_t generation, ElementState state)
    function decodeGenerationFromElementState (line 44) | uint32_t decodeGenerationFromElementState(uint32_t state) { return sta...
    function ElementState (line 46) | ElementState decodeStateFromElementState(uint32_t state) { return Elem...
    function QueueReturn (line 126) | QueueReturn QueueManager::reservePushIndex(uint32_t& generation, uint3...
    function QueueReturn (line 231) | QueueReturn QueueManager::reservePopIndex(uint32_t& generation, uint32...

FILE: llarp/util/thread/queue_manager.hpp
  type llarp::thread (line 11) | namespace llarp::thread
    type ElementState (line 15) | enum class ElementState : uint32_t
    type QueueReturn (line 23) | enum class QueueReturn
    function to_string (line 31) | constexpr std::string_view to_string(QueueReturn val)
    class QueueManager (line 47) | class QueueManager

FILE: llarp/util/thread/threading.cpp
  type llarp::util (line 19) | namespace llarp::util
    function SetThreadName (line 23) | void SetThreadName(const std::string& name)

FILE: llarp/util/thread/threading.hpp
  type llarp::util (line 19) | namespace llarp::util
    type NullMutex (line 30) | struct NullMutex
      method lock (line 37) | void lock() const
      method lock (line 53) | void lock() const {}
      method unlock (line 56) | void unlock() const {}
    type NullLock (line 60) | struct NullLock
      method NullLock (line 62) | NullLock(NullMutex& mtx) { mtx.lock(); }
    class Semaphore (line 76) | class Semaphore
      method Semaphore (line 84) | Semaphore(size_t count) : m_count(count) {}
      method notify (line 86) | void notify()
      method wait (line 95) | void wait()
      method waitFor (line 102) | bool waitFor(std::chrono::microseconds timeout)
    function pid_t (line 115) | inline pid_t GetPid()
    type ContentionKiller (line 125) | struct ContentionKiller
      method TryAccess (line 128) | void TryAccess(F visit) const

FILE: llarp/util/time.cpp
  type llarp (line 7) | namespace llarp
    function time_since_epoch (line 12) | static std::chrono::milliseconds time_since_epoch(std::chrono::time_po...
    function get_time (line 22) | std::chrono::steady_clock::time_point get_time() { return std::chrono:...
    function get_timestamp (line 24) | std::chrono::nanoseconds get_timestamp() { return std::chrono::steady_...
    function to_milliseconds (line 26) | uint64_t to_milliseconds(std::chrono::milliseconds ms) { return ms.cou...
    function uptime (line 29) | std::chrono::milliseconds uptime()
    function time_now_ms (line 35) | std::chrono::milliseconds time_now_ms()
    function to_json (line 40) | nlohmann::json to_json(const std::chrono::milliseconds& t) { return to...
    function extract_h_m_s_ms (line 42) | static auto extract_h_m_s_ms(const std::chrono::milliseconds& dur)
    function short_time_from_now (line 51) | std::string short_time_from_now(

FILE: llarp/util/time.hpp
  type llarp (line 11) | namespace llarp
    function timeval (line 33) | inline timeval loop_time_to_timeval(loop_time t)
    function get_timestamp (line 43) | auto get_timestamp()
    type uniform_duration_distribution (line 58) | struct uniform_duration_distribution
      method uniform_duration_distribution (line 69) | constexpr uniform_duration_distribution(Time a, Time b) : underlying...
      method Time (line 72) | Time operator()(Generator& g)

FILE: llarp/util/zstd.cpp
  type llarp::zstd (line 10) | namespace llarp::zstd
    function ZSTD_CCtx (line 13) | static ZSTD_CCtx* cctx(void* c) { return static_cast<ZSTD_CCtx*>(c); }
    function ZSTD_DCtx (line 14) | static ZSTD_DCtx* dctx(void* d) { return static_cast<ZSTD_DCtx*>(d); }
    function compress_piecewise (line 46) | static std::vector<std::byte> compress_piecewise(

FILE: llarp/util/zstd.hpp
  type llarp::zstd (line 7) | namespace llarp::zstd
    class compressor (line 12) | class compressor
      method compressor (line 22) | compressor(compressor&&) = delete;
      method compressor (line 23) | compressor(const compressor&) = delete;
      method compressor (line 24) | compressor& operator=(const compressor&) = delete;
      method compressor (line 25) | compressor& operator=(compressor&&) = delete;
    class decompressor (line 47) | class decompressor
      method decompressor (line 55) | decompressor(decompressor&&) = delete;
      method decompressor (line 56) | decompressor(const decompressor&) = delete;
      method decompressor (line 57) | decompressor& operator=(const decompressor&) = delete;
      method decompressor (line 58) | decompressor& operator=(decompressor&&) = delete;

FILE: llarp/vpn/android.hpp
  type llarp::vpn (line 12) | namespace llarp::vpn
    class AndroidInterface (line 14) | class AndroidInterface : public NetworkInterface
      method AndroidInterface (line 19) | AndroidInterface(InterfaceInfo info, int fd) : NetworkInterface{std:...
      method PollFD (line 31) | int PollFD() const override { return m_fd; }
      method IPPacket (line 33) | IPPacket read_next_packet() override
      method write_packet (line 42) | bool write_packet(IPPacket pkt) override
    class AndroidRouteManager (line 51) | class AndroidRouteManager : public AbstractRouteManager
      method get_non_interface_gateways (line 65) | std::vector<quic::Address> get_non_interface_gateways(NetworkInterfa...
    class AndroidPlatform (line 71) | class AndroidPlatform : public Platform
      method AndroidPlatform (line 77) | AndroidPlatform(llarp::Context* ctx) : fd{ctx->androidFD} {}
      method obtain_interface (line 79) | std::shared_ptr<NetworkInterface> obtain_interface(InterfaceInfo inf...
      method AbstractRouteManager (line 83) | AbstractRouteManager& RouteManager() override { return _route_manage...

FILE: llarp/vpn/common.hpp
  type llarp::vpn (line 13) | namespace llarp::vpn
    class permission_error (line 15) | class permission_error : public std::runtime_error
    type IOCTL (line 21) | struct IOCTL
      method IOCTL (line 25) | explicit IOCTL(int af) : _fd{::socket(af, SOCK_DGRAM, IPPROTO_IP)}
      method ioctl (line 34) | void ioctl(Command cmd, Args&&... args)

FILE: llarp/vpn/egres_packet_router.cpp
  type llarp::vpn (line 3) | namespace llarp::vpn
    type EgresUDPPacketHandler (line 5) | struct EgresUDPPacketHandler : public EgresLayer4Handler
      method EgresUDPPacketHandler (line 10) | explicit EgresUDPPacketHandler(EgresPacketHandlerFunc baseHandler) :...
      method AddSubHandler (line 12) | void AddSubHandler(uint16_t localport, EgresPacketHandlerFunc handle...
      method RemoveSubHandler (line 17) | void RemoveSubHandler(uint16_t localport) override { _ports.erase(lo...
      method HandleIPPacketFrom (line 19) | void HandleIPPacketFrom(NetworkAddress from, IPPacket pkt) override
    type EgresGenericLayer4Handler (line 38) | struct EgresGenericLayer4Handler : public EgresLayer4Handler
      method EgresGenericLayer4Handler (line 42) | explicit EgresGenericLayer4Handler(EgresPacketHandlerFunc baseHandle...
      method HandleIPPacketFrom (line 44) | void HandleIPPacketFrom(NetworkAddress from, IPPacket pkt) override

FILE: llarp/vpn/egres_packet_router.hpp
  type llarp::vpn (line 9) | namespace llarp::vpn
    type EgresLayer4Handler (line 13) | struct EgresLayer4Handler
    class EgresPacketRouter (line 23) | class EgresPacketRouter

FILE: llarp/vpn/linux.hpp
  type llarp::vpn (line 23) | namespace llarp::vpn
    type in6_ifreq (line 29) | struct in6_ifreq
    type call_on_destroy (line 36) | struct call_on_destroy
      method disarm (line 44) | void disarm() { f = nullptr; }
    function nl_submit (line 50) | std::optional<std::string> nl_submit(int nlfd, const NLRequestT& req)
    class LinuxInterface (line 69) | class LinuxInterface : public NetworkInterface
      method LinuxInterface (line 74) | LinuxInterface(InterfaceInfo info) : NetworkInterface{std::move(info...
      method PollFD (line 194) | int PollFD() const override { return _fd; }
      method IPPacket (line 196) | IPPacket read_next_packet() override
      method write_packet (line 216) | bool write_packet(IPPacket pkt) override
    class LinuxRouteManager (line 226) | class LinuxRouteManager : public AbstractRouteManager
      type GatewayMode (line 230) | enum class GatewayMode
      type NLRequest (line 236) | struct NLRequest
        method AddData (line 242) | void AddData(int type, const void* data, int alen)
      method make_blackhole (line 264) | void make_blackhole(int cmd, int flags, int af)
      method NLRequest (line 289) | NLRequest init_route_cmd(int cmd, int flags)
        method AddData (line 242) | void AddData(int type, const void* data, int alen)
      method route_cmd (line 310) | void route_cmd(int cmd, int flags, const ipv4_range& dst, const ipv4...
      method route_cmd (line 334) | void route_cmd(int cmd, int flags, const ipv6_range& dst, const ipv6...
      method route_all_via_interface (line 359) | void route_all_via_interface(NetworkInterface& vpn, int cmd, int flags)
      method route_range_via_interface (line 376) | void route_range_via_interface(int cmd, int flags, NetworkInterface&...
      method route_range_via_interface (line 385) | void route_range_via_interface(int cmd, int flags, NetworkInterface&...
      method route_via_gateway (line 395) | void route_via_gateway(int cmd, int flags, ipv4_range range, ipv4 ga...
      method route_via_gateway (line 399) | void route_via_gateway(int cmd, int flags, ipv4 dest, ipv4 gateway)
      method route_via_gateway (line 403) | void route_via_gateway(int cmd, int flags, ipv6_range range, ipv6 ga...
      method route_via_gateway (line 407) | void route_via_gateway(int cmd, int flags, ipv6 dest, ipv6 gateway)
      method LinuxRouteManager (line 413) | LinuxRouteManager() : fd{socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)}
      method add_route (line 421) | void add_route(ipv4 ip, ipv4 gateway) override
      method add_route (line 425) | void add_route(ipv6 ip, ipv6 gateway) override
      method delete_route (line 430) | void delete_route(ipv4 ip, ipv4 gateway) override { route_via_gatewa...
      method delete_route (line 431) | void delete_route(ipv6 ip, ipv6 gateway) override { route_via_gatewa...
      method add_default_route_via_interface (line 433) | void add_default_route_via_interface(NetworkInterface& vpn) override
      method delete_default_route_via_interface (line 438) | void delete_default_route_via_interface(NetworkInterface& vpn) override
      method add_route_via_interface (line 443) | void add_route_via_interface(NetworkInterface& vpn, ipv4_range range...
      method add_route_via_interface (line 447) | void add_route_via_interface(NetworkInterface& vpn, ipv6_range range...
      method delete_route_via_interface (line 452) | void delete_route_via_interface(NetworkInterface& vpn, ipv4_range ra...
      method delete_route_via_interface (line 457) | void delete_route_via_interface(NetworkInterface& vpn, ipv6_range ra...
      method get_non_interface_gateways (line 462) | std::vector<quic::Address> get_non_interface_gateways(NetworkInterfa...
      method add_blackhole (line 486) | void add_blackhole() override
      method delete_blackhole (line 492) | void delete_blackhole() override
    class LinuxPlatform (line 499) | class LinuxPlatform : public Platform
      method obtain_interface (line 504) | std::shared_ptr<NetworkInterface> obtain_interface(InterfaceInfo inf...
      method AbstractRouteManager (line 509) | AbstractRouteManager& RouteManager() override { return _routeManager; }

FILE: llarp/vpn/packet_intercept.hpp
  type llarp::vpn (line 6) | namespace llarp::vpn
    class I_PacketInterceptor (line 11) | class I_PacketInterceptor

FILE: llarp/vpn/packet_io.hpp
  type llarp::vpn (line 7) | namespace llarp::vpn
    class PacketIO (line 9) | class PacketIO

FILE: llarp/vpn/packet_router.cpp
  type llarp::vpn (line 5) | namespace llarp::vpn
    type UDPPacketHandler (line 9) | struct UDPPacketHandler : public Layer4Handler
      method UDPPacketHandler (line 14) | explicit UDPPacketHandler(ip_pkt_hook baseHandler) : _base_handler{s...
      method add_sub_handler (line 16) | void add_sub_handler(uint16_t localport, ip_pkt_hook handler) override
      method handle_ip_packet (line 22) | void handle_ip_packet(IPPacket pkt) override
    type GenericLayer4Handler (line 41) | struct GenericLayer4Handler : public Layer4Handler
      method GenericLayer4Handler (line 45) | explicit GenericLayer4Handler(ip_pkt_hook baseHandler) : _base_handl...
      method handle_ip_packet (line 47) | void handle_ip_packet(IPPacket pkt) override

FILE: llarp/vpn/packet_router.hpp
  type llarp::vpn (line 8) | namespace llarp::vpn
    type Layer4Handler (line 10) | struct Layer4Handler
    class PacketRouter (line 12) | class PacketRouter
    type Layer4Handler (line 35) | struct Layer4Handler

FILE: llarp/vpn/platform.cpp
  type llarp::vpn (line 15) | namespace llarp::vpn
    function MakeNativePlatform (line 19) | std::shared_ptr<Platform> MakeNativePlatform(llarp::Context* ctx)

FILE: llarp/vpn/platform.hpp
  type llarp (line 13) | namespace llarp
    type Context (line 15) | struct Context
    class Router (line 16) | class Router
  type llarp::vpn (line 19) | namespace llarp::vpn
    type InterfaceInfo (line 21) | struct InterfaceInfo
    class NetworkInterface (line 29) | class NetworkInterface : public PacketIO
      method NetworkInterface (line 35) | NetworkInterface() = default;
      method NetworkInterface (line 36) | NetworkInterface(InterfaceInfo info) : _info{std::move(info)} {}
      method NetworkInterface (line 37) | NetworkInterface(const NetworkInterface&) = delete;
      method NetworkInterface (line 38) | NetworkInterface(NetworkInterface&&) = delete;
      method InterfaceInfo (line 40) | const InterfaceInfo& interface_info() const { return _info; }
    class AbstractRouteManager (line 46) | class AbstractRouteManager
      method AbstractRouteManager (line 49) | AbstractRouteManager() = default;
      method AbstractRouteManager (line 50) | AbstractRouteManager(const AbstractRouteManager&) = delete;
      method AbstractRouteManager (line 51) | AbstractRouteManager(AbstractRouteManager&&) = delete;
      method add_blackhole (line 75) | virtual void add_blackhole() {}
      method delete_blackhole (line 77) | virtual void delete_blackhole() {}
    class Platform (line 82) | class Platform
      method Platform (line 90) | Platform() = default;
      method Platform (line 91) | Platform(const Platform&) = delete;
      method Platform (line 92) | Platform(Platform&&) = delete;
      method create_interface (line 96) | std::shared_ptr<NetworkInterface> create_interface(InterfaceInfo inf...
      method create_packet_io (line 113) | virtual std::shared_ptr<PacketIO> create_packet_io(

FILE: llarp/vpn/win32.cpp
  type llarp::win32 (line 9) | namespace llarp::win32
    function ip_to_string (line 14) | std::string ip_to_string(T ip)

FILE: llarp/vpn/win32.hpp
  type llarp::win32 (line 15) | namespace llarp::win32
    class VPNPlatform (line 18) | class VPNPlatform : public Platform, public AbstractRouteManager
      method VPNPlatform (line 32) | VPNPlatform(const VPNPlatform&) = delete;
      method VPNPlatform (line 33) | VPNPlatform(VPNPlatform&&) = delete;
      method VPNPlatform (line 35) | VPNPlatform(llarp::Context* ctx) : Platform{}, _ctx{ctx} {}
      method AbstractRouteManager (line 58) | AbstractRouteManager& RouteManager() override { return *this; }

FILE: llarp/win32/adapters.hpp
  type llarp::win32 (line 8) | namespace llarp::win32
    function iter_adapters (line 14) | void iter_adapters(Visitor&& visit, int af = AF_UNSPEC)

FILE: llarp/win32/dll.cpp
  type llarp::win32 (line 6) | namespace llarp::win32
    type detail (line 13) | namespace detail
      function HMODULE (line 15) | HMODULE

FILE: llarp/win32/dll.hpp
  type llarp::win32 (line 8) | namespace llarp::win32
    type detail (line 10) | namespace detail
      function load_funcs (line 16) | void load_funcs(HMODULE handle, const std::string& name, Func*& f, M...
    function load_dll_functions (line 30) | void load_dll_functions(const std::string& dll, const std::string& fna...

FILE: llarp/win32/exception.cpp
  type llarp::win32 (line 9) | namespace llarp::win32
    function error_to_string (line 16) | std::string error_to_string(DWORD err)

FILE: llarp/win32/exception.hpp
  type llarp::win32 (line 7) | namespace llarp::win32
    class error (line 11) | class error : public std::runtime_error

FILE: llarp/win32/exec.cpp
  type llarp::win32 (line 9) | namespace llarp::win32
    function SystemExeDir (line 16) | std::string SystemExeDir()
    function Exec (line 28) | void Exec(std::string exe, std::string args) { OneShotExec{exe, args}; }

FILE: llarp/win32/exec.hpp
  type llarp::win32 (line 9) | namespace llarp::win32
    class OneShotExec (line 13) | class OneShotExec
    class DeferExec (line 30) | class DeferExec
      method DeferExec (line 37) | explicit DeferExec(std::string exe, std::string args, std::chrono::m...

FILE: llarp/win32/guid.hpp
  type llarp::win32 (line 7) | namespace llarp::win32
    function GUID (line 12) | inline GUID MakeDeterministicGUID(Data data)

FILE: llarp/win32/handle.hpp
  type llarp::win32 (line 5) | namespace llarp::win32
    function ensure_handle_is_valid (line 7) | inline void ensure_handle_is_valid(HANDLE h)

FILE: llarp/win32/service_manager.cpp
  type llarp::sys (line 11) | namespace llarp::sys
    function to_win32_state (line 18) | std::optional<DWORD> to_win32_state(ServiceState st)

FILE: llarp/win32/service_manager.hpp
  type llarp::sys (line 10) | namespace llarp::sys
    class SVC_Manager (line 13) | class SVC_Manager : public I_SystemLayerManager

FILE: llarp/win32/win32_inet.c
  type sockaddr_storage (line 24) | struct sockaddr_storage
  type sockaddr_in (line 25) | struct sockaddr_in
  type sockaddr_in (line 25) | struct sockaddr_in
  type sockaddr_in6 (line 26) | struct sockaddr_in6
  type sockaddr_in6 (line 26) | struct sockaddr_in6
  type sockaddr_in (line 32) | struct sockaddr_in
  type in_addr (line 34) | struct in_addr
  type sockaddr_in6 (line 38) | struct sockaddr_in6
  type in6_addr (line 40) | struct in6_addr
  function inet_pton (line 55) | int inet_pton(int af, const char* src, void* dst)

FILE: llarp/win32/win32_intrnl.c
  type THREADNAME_INFO (line 10) | typedef struct _THREADNAME_INFO
  function SetThreadName (line 18) | void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)
  function HRESULT (line 78) | HRESULT
  function PASCAL (line 151) | PASCAL win32_signal_handler(EXCEPTION_POINTERS *e)

FILE: llarp/win32/windivert.cpp
  function windivert_addr_to_string (line 23) | std::string windivert_addr_to_string(const WINDIVERT_ADDRESS& addr)
  type llarp::win32 (line 105) | namespace llarp::win32
    type wd (line 109) | namespace wd
      function Initialize (line 122) | void Initialize()
      type Packet (line 143) | struct Packet
      class IO (line 149) | class IO : public llarp::vpn::PacketIO
        method IO (line 161) | IO(const std::string& filter_spec, std::function<void(void)> wake)
        method recv_packet (line 174) | std::optional<Packet> recv_packet() const
        method send_packet (line 202) | void send_packet(Packet w_pkt) const
        method PollFD (line 220) | virtual int PollFD() const { return -1; }
        method write_packet (line 222) | bool write_packet(net::IPPacket) override { return false; }
        method read_next_packet (line 224) | net::IPPacket read_next_packet() override
        method Start (line 237) | void Start() override
        method Stop (line 264) | void Stop() override
    type WinDivert (line 275) | namespace WinDivert
      function format_ip (line 277) | std::string format_ip(uint32_t ip)
      function make_interceptor (line 284) | std::shared_ptr<llarp::vpn::PacketIO> make_interceptor(

FILE: llarp/win32/windivert.hpp
  type llarp::win32::WinDivert (line 9) | namespace llarp::win32::WinDivert

FILE: llarp/win32/wintun.cpp
  type llarp::win32 (line 22) | namespace llarp::win32
    function WintunInitialize (line 44) | void WintunInitialize()
    type PacketWrapper (line 72) | struct PacketWrapper
      method copy (line 78) | net::IPPacket copy() const
    function make_adapter (line 89) | [[nodiscard]] auto make_adapter(std::string adapter_name, std::string ...
    class WintunAdapter (line 117) | class WintunAdapter
      method GetAdapterLUID (line 121) | [[nodiscard]] auto GetAdapterLUID() const
      method WintunAdapter (line 129) | explicit WintunAdapter(std::string name)
      method Up (line 137) | void Up(const vpn::InterfaceInfo& info) const
      method Down (line 162) | void Down() const { close_adapter(_handle); }
      method session (line 165) | [[nodiscard]] std::pair<WINTUN_SESSION_HANDLE, HANDLE> session() const
    class WintunSession (line 183) | class WintunSession
      method WintunSession (line 191) | WintunSession() : _impl{nullptr}, _handle{nullptr} {}
      method Start (line 193) | void Start(const std::shared_ptr<WintunAdapter>& adapter)
      method Stop (line 204) | void Stop()
      method WaitFor (line 210) | void WaitFor(std::chrono::milliseconds dur) { WaitForSingleObject(_h...
      method ReadPacket (line 214) | [[nodiscard]] std::pair<std::unique_ptr<PacketWrapper>, bool> ReadPa...
      method WritePacket (line 232) | std::pair<bool, bool> WritePacket(net::IPPacket pkt) const
    class WintunInterface (line 250) | class WintunInterface : public vpn::NetworkInterface
      method WintunInterface (line 263) | WintunInterface(vpn::InterfaceInfo info, Router* router)
      method Start (line 272) | void Start() override
      method Stop (line 315) | void Stop() override
      method read_next_packet (line 330) | net::IPPacket read_next_packet() override
      method WritePacket (line 338) | bool WritePacket(net::IPPacket pkt) override
      method PollFD (line 343) | int PollFD() const override { return -1; }
      method MaybeWakeUpperLayers (line 345) | void MaybeWakeUpperLayers() const override { _router->TriggerPump(); }
    type wintun (line 349) | namespace wintun
      function make_interface (line 351) | std::shared_ptr<vpn::NetworkInterface> make_interface(const llarp::v...

FILE: llarp/win32/wintun.hpp
  type llarp (line 5) | namespace llarp
    class Router (line 7) | class Router
  type llarp::vpn (line 10) | namespace llarp::vpn
    type InterfaceInfo (line 12) | struct InterfaceInfo
    class NetworkInterface (line 13) | class NetworkInterface
  type llarp::win32::wintun (line 16) | namespace llarp::win32::wintun

FILE: pybind/common.hpp
  type llarp (line 12) | namespace llarp
    type dht (line 34) | namespace dht
    type path (line 39) | namespace path
    type handlers (line 44) | namespace handlers
    type service (line 49) | namespace service
  type tooling (line 56) | namespace tooling

FILE: pybind/llarp/config.cpp
  type llarp (line 6) | namespace llarp
    function in_addr_set (line 8) | void in_addr_set(in_addr* addr, const char* str) { inet_aton(str, addr...
    function Config_Init (line 10) | void Config_Init(py::module& mod)

FILE: pybind/llarp/context.cpp
  type llarp (line 9) | namespace llarp
    function Context_Init (line 11) | void Context_Init(py::module& mod)
  type tooling (line 41) | namespace tooling
    function HiveContext_Init (line 43) | void HiveContext_Init(py::module& mod)

FILE: pybind/llarp/crypto/types.cpp
  type llarp (line 5) | namespace llarp
    function CryptoTypes_Init (line 7) | void CryptoTypes_Init(py::module& mod)

FILE: pybind/llarp/dht/dht_types.cpp
  type llarp (line 6) | namespace llarp
    type dht (line 8) | namespace dht
      function DHTTypes_Init (line 10) | void DHTTypes_Init(py::module& mod)

FILE: pybind/llarp/handlers/pyhandler.cpp
  type llarp (line 2) | namespace llarp
    type handlers (line 4) | namespace handlers
      function PyHandler_Init (line 6) | void PyHandler_Init(py::module& mod)

FILE: pybind/llarp/handlers/pyhandler.hpp
  type llarp (line 9) | namespace llarp
    type handlers (line 11) | namespace handlers
      type PythonEndpoint (line 15) | struct PythonEndpoint final : public llarp::service::Endpoint,
        method PythonEndpoint (line 18) | PythonEndpoint(std::string name, Context_ptr routerContext)
        method HandleInboundPacket (line 24) | bool HandleInboundPacket(
        method GetSelf (line 50) | std::shared_ptr<path::PathSet> GetSelf() override { return shared_...
        method GetWeak (line 52) | std::weak_ptr<path::PathSet> GetWeak() override { return weak_from...
        method SupportsV6 (line 54) | bool SupportsV6() const override { return false; }
        method ObtainIPForAddr (line 56) | llarp::huint128_t ObtainIPForAddr(std::variant<service::Address, R...
        method ObtainAddrForIP (line 58) | std::optional<std::variant<service::Address, RouterID>> ObtainAddr...
        method GetIfName (line 63) | std::string GetIfName() const override { return ""; }
        method SendPacket (line 69) | void SendPacket(service::Address remote, std::vector<byte_t> pkt, ...
        method GetOurAddress (line 78) | std::string GetOurAddress() const { return m_Identity.pub.Addr().T...

FILE: pybind/llarp/logger.cpp
  type llarp (line 7) | namespace llarp
    type PyLogger (line 9) | struct PyLogger
    function Logger_Init (line 14) | void Logger_Init(py::module& mod)

FILE: pybind/llarp/path/path_hop_config.cpp
  type llarp (line 5) | namespace llarp
    type path (line 7) | namespace path
      function PathHopConfig_Init (line 9) | void PathHopConfig_Init(py::module& mod)

FILE: pybind/llarp/path/path_types.cpp
  type llarp (line 6) | namespace llarp
    function PathTypes_Init (line 8) | void PathTypes_Init(py::module& mod)

FILE: pybind/llarp/peerstats.cpp
  type llarp (line 8) | namespace llarp
    function PeerDb_Init (line 10) | void PeerDb_Init(py::module& mod)
    function PeerStats_Init (line 16) | void PeerStats_Init(py::module& mod)

FILE: pybind/llarp/router.cpp
  type llarp (line 6) | namespace llarp
    function Router_Init (line 8) | void Router_Init(py::module& mod)
  type tooling (line 18) | namespace tooling
    function HiveRouter_Init (line 20) | void HiveRouter_Init(py::module& mod)

FILE: pybind/llarp/router_contact.cpp
  type llarp (line 7) | namespace llarp
    function RelayContact_Init (line 9) | void RelayContact_Init(py::module& mod)

FILE: pybind/llarp/router_id.cpp
  type llarp (line 5) | namespace llarp
    function RouterID_Init (line 7) | void RouterID_Init(py::module& mod)

FILE: pybind/llarp/service/address.cpp
  type llarp (line 5) | namespace llarp
    type service (line 7) | namespace service
      function Address_Init (line 9) | void Address_Init(py::module& mod)

FILE: pybind/llarp/tooling/router_event.cpp
  type tooling (line 12) | namespace tooling
    function RouterEvent_Init (line 14) | void RouterEvent_Init(py::module& mod)

FILE: pybind/llarp/tooling/router_hive.cpp
  type tooling (line 9) | namespace tooling
    function RouterHive_Init (line 11) | void RouterHive_Init(py::module& mod)

FILE: pybind/module.cpp
  function PYBIND11_MODULE (line 5) | PYBIND11_MODULE(pyllarp, m)

FILE: test/check_main.cpp
  function startWinsock (line 9) | int
  function main (line 24) | int

FILE: test/config/test_llarp_config_values.cpp
  type UnitTestConfigGenParameters (line 8) | struct UnitTestConfigGenParameters : public llarp::ConfigGenParameters
    method UnitTestConfigGenParameters (line 11) | UnitTestConfigGenParameters(const mocks::Network* plat)
  type UnitTestConfig (line 22) | struct UnitTestConfig : public llarp::Config
    method UnitTestConfig (line 26) | explicit UnitTestConfig(const mocks::Network* plat) : llarp::Config{st...
    method MakeGenParams (line 29) | std::unique_ptr<llarp::ConfigGenParameters>
  function make_config_for_test (line 36) | std::shared_ptr<UnitTestConfig>
  function make_config (line 47) | std::shared_ptr<UnitTestConfig>
  function run_config_test (line 58) | void

FILE: test/crypto/test_llarp_crypto_types.cpp
  type ToStringData (line 18) | struct ToStringData
  type TestCryptoTypesSecret (line 64) | struct TestCryptoTypesSecret
    method TestCryptoTypesSecret (line 69) | TestCryptoTypesSecret() : filename(llarp::test::randFilename()), p(fil...
  function BOOL (line 256) | BOOL

FILE: test/crypto/test_llarp_key_manager.cpp
  type KeyManagerTest (line 16) | struct KeyManagerTest
    method KeyManagerTest (line 24) | KeyManagerTest()
    method generateRcFile (line 32) | bool

FILE: test/hive/conftest.py
  function HiveTenRTenC (line 6) | def HiveTenRTenC():
  function HiveThirtyRTenC (line 15) | def HiveThirtyRTenC():
  function HiveArbitrary (line 24) | def HiveArbitrary():
  function HiveForPeerStats (line 37) | def HiveForPeerStats():

FILE: test/hive/hive.py
  class RouterHive (line 15) | class RouterHive(object):
    method __init__ (line 17) | def __init__(self, n_relays=10, n_clients=10, netid="hive", shutup=True):
    method RemoveTmpDir (line 42) | def RemoveTmpDir(self):
    method AddRelay (line 52) | def AddRelay(self, index):
    method AddClient (line 86) | def AddClient(self, index):
    method InitFirstRC (line 115) | def InitFirstRC(self):
    method Start (line 125) | def Start(self):
    method Stop (line 149) | def Stop(self):
    method CollectNextEvent (line 152) | def CollectNextEvent(self):
    method CollectAllEvents (line 155) | def CollectAllEvents(self):
    method PopEvent (line 158) | def PopEvent(self):
    method DistanceSortedRCs (line 164) | def DistanceSortedRCs(self, dht_key):
  function main (line 175) | def main(n_relays=10, n_clients=10, print_each_event=True, verbose=False):

FILE: test/hive/test_path_builds.py
  function test_path_builds (line 3) | def test_path_builds(HiveArbitrary):

FILE: test/hive/test_peer_stats.py
  function test_peer_stats (line 4) | def test_peer_stats(HiveForPeerStats):
  function tally_rc_received_for_peer (line 76) | def tally_rc_received_for_peer(hive, routerId):

FILE: test/mocks/mock_context.hpp
  type mocks (line 8) | namespace mocks
    class MockContext (line 10) | class MockContext : public llarp::Context
      method MockContext (line 15) | MockContext(const Network& net) : llarp::Context{}, _net{net}
      method makeRouter (line 20) | std::shared_ptr<llarp::Router>
      method makeVPNPlatform (line 27) | std::shared_ptr<llarp::vpn::Platform>
      method makeNodeDB (line 33) | std::shared_ptr<llarp::NodeDB>

FILE: test/mocks/mock_network.hpp
  type mocks (line 8) | namespace mocks
    class Network (line 10) | class Network
      method Network (line 49) | Network(
      method run (line 63) | void
      method Opts (line 73) | llarp::RuntimeOptions
      method make_udp (line 79) | std::shared_ptr<llarp::UDPHandle>
      method GetBestNetIF (line 85) | std::optional<std::string>
      method FindFreeTun (line 94) | std::optional<std::string>
      method GetInterfaceAddr (line 100) | std::optional<llarp::SockAddr>
      method HasInterfaceAddress (line 109) | bool
      method AllInterfaces (line 119) | std::optional<llarp::SockAddr>
      method GetInterfaceIndex (line 125) | std::optional<int>
      method FindFreeRange (line 131) | std::optional<llarp::IPRange>
      method LoopbackInterfaceName (line 166) | std::string
      method AllNetworkInterfaces (line 175) | std::vector<llarp::net::InterfaceInfo>
    class MockUDPHandle (line 12) | class MockUDPHandle : public llarp::UDPHandle
      method MockUDPHandle (line 18) | MockUDPHandle(Network* net, llarp::UDPHandle::ReceiveFunc recv)
      method LocalAddr (line 22) | std::optional<llarp::SockAddr>
      method send (line 31) | bool
    class Network (line 41) | class Network : public llarp::net::Platform, public llarp::uv::Loop
      method Network (line 49) | Network(
      method run (line 63) | void
      method Opts (line 73) | llarp::RuntimeOptions
      method make_udp (line 79) | std::shared_ptr<llarp::UDPHandle>
      method GetBestNetIF (line 85) | std::optional<std::string>
      method FindFreeTun (line 94) | std::optional<std::string>
      method GetInterfaceAddr (line 100) | std::optional<llarp::SockAddr>
      method HasInterfaceAddress (line 109) | bool
      method AllInterfaces (line 119) | std::optional<llarp::SockAddr>
      method GetInterfaceIndex (line 125) | std::optional<int>
      method FindFreeRange (line 131) | std::optional<llarp::IPRange>
      method LoopbackInterfaceName (line 166) | std::string
      method AllNetworkInterfaces (line 175) | std::vector<llarp::net::InterfaceInfo>

FILE: test/mocks/mock_router.hpp
  type mocks (line 6) | namespace mocks
    class MockRouter (line 8) | class MockRouter : public llarp::Router
      method MockRouter (line 13) | explicit MockRouter(const Network& net, std::shared_ptr<llarp::vpn::...

FILE: test/mocks/mock_vpn.hpp
  type mocks (line 5) | namespace mocks
    class MockInterface (line 7) | class MockInterface : public llarp::vpn::NetworkInterface
      method MockInterface (line 12) | MockInterface(llarp::vpn::InterfaceInfo info) : llarp::vpn::NetworkI...
      method PollFD (line 23) | int
      method ReadNextPacket (line 29) | llarp::net::IPPacket
      method WritePacket (line 35) | bool WritePacket(llarp::net::IPPacket) override
    class MockVPN (line 41) | class MockVPN : public llarp::vpn::Platform, public llarp::vpn::IRoute...
      method MockVPN (line 46) | MockVPN(const Network& net) : llarp::vpn::Platform{}, llarp::vpn::IR...
      method obtain_interface (line 49) | virtual std::shared_ptr<llarp::vpn::NetworkInterface>
      method GetGatewaysNotOnInterface (line 75) | std::vector<llarp::net::ipaddr_t> GetGatewaysNotOnInterface(llarp::v...

FILE: test/net/test_llarp_net.cpp
  function IsBogon (line 12) | bool IsBogon(T ip)

FILE: test/path/test_path.cpp
  function RC_t (line 9) | static RC_t
  function Path_ptr (line 17) | static Path_ptr

FILE: test/routing/test_llarp_routing_obtainexitmessage.cpp
  function fill (line 12) | void

FILE: test/test_llarp_encrypted_frame.cpp
  class FrameTest (line 15) | class FrameTest
    method FrameTest (line 18) | FrameTest() : test::LlarpTest<>{}

FILE: test/test_llarp_router_contact.cpp
  type llarp (line 8) | namespace llarp

FILE: test/test_util.cpp
  type llarp (line 5) | namespace llarp
    type test (line 7) | namespace test
      function randFilename (line 9) | std::string

FILE: test/test_util.hpp
  type llarp (line 9) | namespace llarp
    type test (line 11) | namespace test
      function Buf (line 17) | Buf
      type FileGuard (line 25) | struct FileGuard
        method FileGuard (line 29) | FileGuard(const fs::path &_p) : p(_p)
      function randbytes_impl (line 42) | inline void
      function keygen_val (line 49) | inline void
      function keygen (line 56) | inline void
      type CombinationIterator (line 63) | struct CombinationIterator
        method createCombo (line 71) | void
        method CombinationIterator (line 84) | CombinationIterator(const std::vector< T > &values)
        method next (line 91) | bool
        method includesElement (line 104) | bool

FILE: test/util/meta/test_llarp_util_memfn.cpp
  type Foo (line 7) | struct Foo
    method empty (line 9) | bool
    method constEmpty (line 15) | bool
    method arg (line 21) | int
    method constArg (line 27) | int

FILE: test/util/test_llarp_util_bencode.cpp
  type TestReadData (line 14) | struct TestReadData
  type TestWriteData (line 111) | struct TestWriteData
  type ValueData (line 218) | struct ValueData
  type ListTestData (line 226) | struct ListTestData
  type DictTestData (line 268) | struct DictTestData
  type ReadData (line 314) | struct ReadData

FILE: test/util/test_llarp_util_log_level.cpp
  type TestParseLog (line 8) | struct TestParseLog

FILE: test/util/thread/test_llarp_util_queue.cpp
  class Element (line 19) | class Element
    method Element (line 26) | Element(double d, bool _stop = false) : data(d), shouldStop(_stop)
    method val (line 29) | double
    method stop (line 35) | bool
  class Args (line 50) | class Args
    method Args (line 69) | Args(size_t _iterations, size_t size = 20 * 1000)
    method signal (line 73) | bool
  function popFrontTester (line 80) | void
  function pushBackTester (line 99) | void
  function abaThread (line 117) | void
  type Exception (line 128) | struct Exception : public std::exception
  type ExceptionTester (line 131) | struct ExceptionTester
    method test (line 135) | void
    method ExceptionTester (line 144) | ExceptionTester()
    method ExceptionTester (line 147) | ExceptionTester(const ExceptionTester&)
    method ExceptionTester (line 152) | ExceptionTester&
  function sleepNWait (line 162) | void
  function exceptionProducer (line 169) | void
  type MoveTester (line 190) | struct MoveTester
    method MoveTester (line 196) | explicit MoveTester(size_t& counter, size_t val) : moved(false), moveC...
    method MoveTester (line 199) | explicit MoveTester(const MoveTester& rhs) = delete;
    method MoveTester (line 201) | MoveTester&
    method MoveTester (line 204) | MoveTester(MoveTester&& rhs) : moved(false), moveCounter(rhs.moveCount...
    method MoveTester (line 210) | MoveTester&

FILE: test/util/thread/test_llarp_util_queue_manager.cpp
  function generation (line 9) | void
  class IntQueue (line 44) | class IntQueue
    method IntQueue (line 52) | IntQueue(const IntQueue&) = delete;
    method IntQueue (line 54) | explicit IntQueue(size_t capacity) : manager(capacity), data(capacity, 0)
    method tryPushBack (line 57) | bool
    method tryPopFront (line 75) | std::optional<int>
    method size (line 93) | size_t
    method capacity (line 99) | size_t
  type QueueData (line 108) | struct QueueData
  type QueueIntrospection (line 136) | struct QueueIntrospection
    method QueueIntrospection (line 142) | QueueIntrospection(const QueueManager& manager)
    method pushIndex (line 146) | uint32_t
    method pushGeneration (line 152) | uint32_t
    method popIndex (line 158) | uint32_t
    method popGeneration (line 164) | uint32_t
    method elementGen (line 170) | uint32_t
    method ElementState (line 176) | ElementState
    method maxGen (line 182) | uint32_t
    method maxCombinedIndex (line 188) | uint32_t
    method capacity (line 194) | uint32_t
  function adjustGeneration (line 201) | void
  function dirtyGenerate (line 217) | void
  type CombinedIndexData (line 415) | struct CombinedIndexData
  type CircularDifferenceData (line 596) | struct CircularDifferenceData
  type AbortData (line 711) | struct AbortData
  type ReserveData (line 899) | struct ReserveData

FILE: win32-setup/regdb_helper.c
  function BOOL (line 37) | BOOL
Condensed preview — 503 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,162K chars).
[
  {
    "path": ".clang-format",
    "chars": 2358,
    "preview": "BasedOnStyle: Google\n\n# alignment\nAlignAfterOpenBracket: AlwaysBreak\nAlignConsecutiveAssignments: 'false'\nAlignConsecuti"
  },
  {
    "path": ".clang-tidy",
    "chars": 220,
    "preview": "HeaderFilterRegex: 'llarp/.*'\nChecks: \n'readability-else-after-return,\nclang-analyzer-core-*,modernize-*,\n-modernize-use"
  },
  {
    "path": ".dir-locals.el",
    "chars": 151,
    "preview": "((c++-mode\n  (eval add-hook 'before-save-hook #'clang-format-buffer nil t))\n (c-mode\n  (eval add-hook 'before-save-hook "
  },
  {
    "path": ".dockerignore",
    "chars": 36,
    "preview": "build/\n.vscode/\nlokinet\nlokinet.exe\n"
  },
  {
    "path": ".drone.jsonnet",
    "chars": 20196,
    "preview": "local default_deps_base = std.set([\n  'g++',\n  'libcli11-dev',\n  'libcurl4-openssl-dev',\n  'libevent-dev',\n  'libfmt-dev"
  },
  {
    "path": ".gitattributes",
    "chars": 170,
    "preview": "external/date/test export-ignore\nexternal/nlohmann/doc export-ignore\nexternal/nlohmann/test export-ignore\nexternal/nlohm"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "chars": 74,
    "preview": "\n* RUN `make format && make lint -j8` BEFORE COMMITING ALWAYS.\n\n* no tabs\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 523,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: bug\nassignees: ''\n\n---\n\n**Describe the "
  },
  {
    "path": ".github/workflows/clean_issues.yml",
    "chars": 724,
    "preview": "name: Close incomplete issues\non:\n  schedule:\n    - cron: \"30 1 * * *\"\n\njobs:\n  close-issues:\n    runs-on: ubuntu-latest"
  },
  {
    "path": ".gitignore",
    "chars": 688,
    "preview": "*~\n*\\#*\n\n*.a\n*.o\n*.so\n\n/build*/\n**/__pycache__/**\n\nllarpd\n*.test\n*.bin\n\n*.ninja\ncmake_install.cmake\nCMakeFiles\nCMakeCach"
  },
  {
    "path": ".gitmodules",
    "chars": 804,
    "preview": "[submodule \"external/nlohmann\"]\n\tpath = external/nlohmann\n\turl = https://github.com/nlohmann/json.git\n[submodule \"test/C"
  },
  {
    "path": ".swift-version",
    "chars": 6,
    "preview": "5.4.2\n"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 12611,
    "preview": "cmake_minimum_required(VERSION 3.13...3.24)  # 3.13 is buster's version\n\n# Cmake 3.24+ breaks extraction timestamps by d"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 643,
    "preview": "[Español](CONTRIBUTING_es.md)\n# Do\n\n* Act like a responsible adult.\n\n* RUN `./contrib/format.sh` BEFORE COMMITING ALWAYS"
  },
  {
    "path": "CONTRIBUTING_es.md",
    "chars": 798,
    "preview": "[Ingles](CONTRIBUTING.md)\n# Lo que debe\n\n* Actuar como un adulto responsable.\n\n* CORRER `make format` SIEMPRE ANTES DEL "
  },
  {
    "path": "LICENSE",
    "chars": 35148,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "cmake/CMakeGraphVizOptions.cmake",
    "chars": 204,
    "preview": "set(GRAPHVIZ_GRAPH_NAME \"graph.dot\" CACHE STRING \"\")\nset(GRAPHVIZ_GENERATE_PER_TARGET FALSE CACHE BOOL \"\")\nset(GRAPHVIZ_"
  },
  {
    "path": "cmake/DownloadLibSodium.cmake",
    "chars": 1987,
    "preview": "set(LIBSODIUM_PREFIX ${CMAKE_BINARY_DIR}/libsodium)\nset(LIBSODIUM_URL https://github.com/jedisct1/libsodium/releases/dow"
  },
  {
    "path": "cmake/FindJemalloc.cmake",
    "chars": 1810,
    "preview": "#\n# Find the JEMALLOC client includes and library\n# \n\n# This module defines\n# JEMALLOC_INCLUDE_DIR, where to find jemall"
  },
  {
    "path": "cmake/GenVersion.cmake",
    "chars": 3054,
    "preview": "# Copyright (c) 2014-2019, The Monero Project\n# Copyright (c)      2019, The Loki Project\n# \n# All rights reserved.\n# \n#"
  },
  {
    "path": "cmake/MacroEnsureOutOfSourceBuild.cmake",
    "chars": 1974,
    "preview": "# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)\n# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)\n\n# Copyright (c)"
  },
  {
    "path": "cmake/StaticBuild.cmake",
    "chars": 13170,
    "preview": "# cmake bits to do a full static build, downloading and building all dependencies.\n\n# Most of these are CACHE STRINGs so"
  },
  {
    "path": "cmake/TargetArch.cmake",
    "chars": 5550,
    "preview": "# Based on the Qt 5 processor detection code, so should be very accurate\n# https://qt.gitorious.org/qt/qtbase/blobs/mast"
  },
  {
    "path": "cmake/Version.cmake",
    "chars": 2361,
    "preview": "# We do this via a custom command that re-invokes a cmake script because we need the DEPENDS on .git/index so that we wi"
  },
  {
    "path": "cmake/add_import_library.cmake",
    "chars": 180,
    "preview": "function(add_import_library libname)\n  add_library(libname SHARED IMPORTED)\n  if(NOT TARGET libname)\n    message(FATAL \""
  },
  {
    "path": "cmake/cmake_uninstall.cmake.in",
    "chars": 852,
    "preview": "if(NOT EXISTS \"@CMAKE_BINARY_DIR@/install_manifest.txt\")\n  message(FATAL_ERROR \"Cannot find install manifest: @CMAKE_BIN"
  },
  {
    "path": "cmake/coverage.cmake",
    "chars": 287,
    "preview": "if (LOKINET_COVERAGE)\n  if (CMAKE_CXX_COMPILER_ID MATCHES \"Clang\")\n    add_compile_options( -fprofile-instr-generate -fc"
  },
  {
    "path": "cmake/cross_compile.cmake",
    "chars": 607,
    "preview": "# dynamic linking does this all the time\nif (CMAKE_CXX_COMPILER_ID MATCHES \"Clang\")\n  option(NO_LIBGCC \"use libunwind+co"
  },
  {
    "path": "cmake/enable_lto.cmake",
    "chars": 618,
    "preview": "# -flto\ninclude(CheckIPOSupported)\noption(WITH_LTO \"enable lto on compile time\" ON)\nif(WITH_LTO)\n  if(WIN32)\n    message"
  },
  {
    "path": "cmake/gui-option.cmake",
    "chars": 495,
    "preview": "set(default_build_gui OFF)\nif(LOKINET_DAEMON AND (APPLE OR WIN32))\n  set(default_build_gui ON)\nendif()\n\nif(WIN32)\n  set("
  },
  {
    "path": "cmake/gui.cmake",
    "chars": 3120,
    "preview": "\nif(WIN32 AND GUI_EXE)\n  message(STATUS \"using pre-built lokinet gui executable: ${GUI_EXE}\")\n  execute_process(COMMAND "
  },
  {
    "path": "cmake/installer.cmake",
    "chars": 1864,
    "preview": "set(CPACK_PACKAGE_VENDOR \"lokinet.org\")\nset(CPACK_PACKAGE_HOMEPAGE_URL \"https://lokinet.org/\")\nset(CPACK_RESOURCE_FILE_R"
  },
  {
    "path": "cmake/libatomic.cmake",
    "chars": 1647,
    "preview": "function(check_working_cxx_atomics64 varname)\n  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})\n  if (EMBEDDED_CFG"
  },
  {
    "path": "cmake/macos.cmake",
    "chars": 8227,
    "preview": "if((NOT APPLE) OR NOT LOKINET_DAEMON)\n  return()\nendif()\n\n\noption(MACOS_SYSTEM_EXTENSION\n  \"Build the network extension "
  },
  {
    "path": "cmake/ngtcp2_lib.cmake",
    "chars": 2315,
    "preview": "# ngtcp2's top-level CMakeLists.txt loads a bunch of crap we don't want (examples, a conflicting\n# 'check' target, etc.)"
  },
  {
    "path": "cmake/solaris.cmake",
    "chars": 198,
    "preview": "if(${CMAKE_SYSTEM_NAME} MATCHES \"SunOS\")\n  set(SOLARIS ON)\n  set(CMAKE_CXX_STANDARD_LIBRARIES \"${CMAKE_CXX_STANDARD_LIBR"
  },
  {
    "path": "cmake/target_link_libraries_system.cmake",
    "chars": 385,
    "preview": "# This adds a dependency as a \"system\" dep - e.g -isystem\nfunction(target_link_libraries_system target)\n  set(libs ${ARG"
  },
  {
    "path": "cmake/unix.cmake",
    "chars": 416,
    "preview": "if(NOT ANDROID)\n  if(NOT UNIX)\n    return()\n  endif()\nendif()\n\ninclude(CheckCXXSourceCompiles)\ninclude(CheckLibraryExist"
  },
  {
    "path": "cmake/win32.cmake",
    "chars": 2387,
    "preview": "if(NOT WIN32)\n  return()\nendif()\nif (NOT STATIC_LINK)\n  message(FATAL_ERROR \"windows requires static builds (thanks balm"
  },
  {
    "path": "cmake/win32_installer_deps.cmake",
    "chars": 2529,
    "preview": "install(DIRECTORY ${CMAKE_BINARY_DIR}/gui DESTINATION share COMPONENT gui)\n\nif(WITH_WINDOWS_32)\n  install(FILES ${CMAKE_"
  },
  {
    "path": "contrib/NetworkManager/dnsmasq/README.md",
    "chars": 368,
    "preview": "Place in `/etc/NetworkManager/dnsmasq.d/lokinet.conf`.\n\nTo make use of this, first install dnsmasq.\n\nThen enable Network"
  },
  {
    "path": "contrib/NetworkManager/dnsmasq/lokinet.conf",
    "chars": 29,
    "preview": "server=/loki/snode/127.3.2.1\n"
  },
  {
    "path": "contrib/android-configure.sh",
    "chars": 2034,
    "preview": "#!/bin/bash\nset -e\n\ndefault_abis=\"armeabi-v7a arm64-v8a x86_64\"\nbuild_abis=${ABIS:-$default_abis}\n\ntest x$NDK = x && tes"
  },
  {
    "path": "contrib/android.sh",
    "chars": 173,
    "preview": "#!/bin/bash\nset -e\nset +x\n\nroot=\"$(readlink -f $(dirname $0)/../)\"\ncd \"$root\"\n./contrib/android-configure.sh . build-and"
  },
  {
    "path": "contrib/apparmor/usr.bin.lokinet",
    "chars": 634,
    "preview": "# Last Modified: Fri 05 Feb 2021 08:13:58 PM UTC\n#include <tunables/global>\n\nprofile lokinet /usr/bin/lokinet {\n  #inclu"
  },
  {
    "path": "contrib/apply-patches.sh",
    "chars": 66,
    "preview": "#!/usr/bin/env bash\nfor f in \"$@\" ; do\n    patch -p1 -i \"$f\"\ndone\n"
  },
  {
    "path": "contrib/bencode-dump.py",
    "chars": 2780,
    "preview": "#!/usr/bin/python3\n\nimport sys\nimport pprint\n\nif len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == '-'):\n    "
  },
  {
    "path": "contrib/bootstrap/make-bootstrap-list.sh",
    "chars": 81,
    "preview": "#!/usr/bin/env bash\necho -n 'l'\nfor arg in $@ ; do cat \"$arg\" ; done\necho -n 'e'\n"
  },
  {
    "path": "contrib/bootstrap/readme.txt",
    "chars": 99,
    "preview": "usage:\n\n./make-bootstrap-list.sh $(find $HOME/.lokinet/netdb | grep \\\\.signed$) > bootstrap.signed\n"
  },
  {
    "path": "contrib/ci/docker/readme.md",
    "chars": 351,
    "preview": "## drone-ci docker jizz\n\nTo rebuild all ci images and push them to the oxen registry server do:\n\n    $ docker login regi"
  },
  {
    "path": "contrib/ci/docker/rebuild-docker-images.py",
    "chars": 11416,
    "preview": "#!/usr/bin/env python3\n\nimport subprocess\nimport tempfile\nimport optparse\nimport sys\nfrom concurrent.futures import Thre"
  },
  {
    "path": "contrib/ci/drone-check-static-libs.sh",
    "chars": 1163,
    "preview": "#!/usr/bin/env bash\n\n# Script used with Drone CI to check that a statically build lokinet only links against the expecte"
  },
  {
    "path": "contrib/ci/drone-debs-upload.sh",
    "chars": 1478,
    "preview": "#!/bin/bash\n\n# Script used with Drone CI to upload debs from the deb building pipelines (because specifying all\n# this i"
  },
  {
    "path": "contrib/ci/drone-format-verify.sh",
    "chars": 416,
    "preview": "#!/usr/bin/env bash\ntest \"x$IGNORE\" != \"x\" && exit 0\n\n. $(dirname $0)/../format-version.sh\n\nrepo=$(readlink -e $(dirname"
  },
  {
    "path": "contrib/ci/drone-gdb.sh",
    "chars": 184,
    "preview": "#!/usr/bin/env bash\nrm -f crash.out.txt exit.out.txt\ngdb -q -x $(readlink -e $(dirname $0))/gdb-filter.py --args $@\ntest"
  },
  {
    "path": "contrib/ci/drone-run-router-hive.sh",
    "chars": 242,
    "preview": "#!/usr/bin/env bash\nexport PYTHONPATH=pybind\nrm -f crash.out.txt exit.out.txt\ngdb -q -x $(readlink -e $(dirname $0))/gdb"
  },
  {
    "path": "contrib/ci/drone-static-upload.sh",
    "chars": 2788,
    "preview": "#!/usr/bin/env bash\n\n# Script used with Drone CI to upload build artifacts (because specifying all this in\n# .drone.json"
  },
  {
    "path": "contrib/ci/gdb-filter.py",
    "chars": 1087,
    "preview": "def exit_handler (event):\n    \"\"\"\n    write exit code of the program running in gdb to a file called exit.out.txt\n    \"\""
  },
  {
    "path": "contrib/cross/android.toolchain.cmake",
    "chars": 212,
    "preview": "\nset(CMAKE_SYSTEM_NAME Android)\nset(CMAKE_SYSTEM_VERSION ${ANDROID_API}) # API level\nset(CMAKE_ANDROID_ARCH_ABI ${ANDROI"
  },
  {
    "path": "contrib/cross/cross.toolchain.cmake",
    "chars": 435,
    "preview": "set(CMAKE_SYSTEM_NAME ${CROSS_PLATFORM})\nset(TOOLCHAIN_PREFIX ${CROSS_PREFIX})\nset(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN"
  },
  {
    "path": "contrib/cross/mingw32.cmake",
    "chars": 428,
    "preview": "set(CMAKE_SYSTEM_NAME Windows)\nset(TOOLCHAIN_PREFIX i686-w64-mingw32)\nset(WOW64_CROSS_COMPILE ON)\nset(CROSS_TARGET i686-"
  },
  {
    "path": "contrib/cross/mingw64.cmake",
    "chars": 503,
    "preview": "set(CMAKE_SYSTEM_NAME Windows)\nset(TOOLCHAIN_PREFIX x86_64-w64-mingw32)\nset(WIN64_CROSS_COMPILE ON)\nset(CROSS_TARGET x86"
  },
  {
    "path": "contrib/cross/mingw_core.cmake",
    "chars": 1011,
    "preview": "set(CMAKE_SYSTEM_VERSION 6.0)\n\n# the minimum windows version, set to 6 rn because supporting older windows is hell\nset(_"
  },
  {
    "path": "contrib/cross.sh",
    "chars": 1561,
    "preview": "#!/bin/bash\n#\n# helper script for me for when i cross compile\n# t. jeff\n#\nset -e\n\ndie() {\n    echo $@\n    exit 1\n}\n\nplat"
  },
  {
    "path": "contrib/format-version.sh",
    "chars": 717,
    "preview": "\nCLANG_FORMAT_DESIRED_VERSION=19\n\nCLANG_FORMAT=$(command -v clang-format-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null)\nif ["
  },
  {
    "path": "contrib/format.sh",
    "chars": 1633,
    "preview": "#!/usr/bin/env bash\n\n# set -x\nset -e\n\n. $(dirname $0)/format-version.sh\n\ncd \"$(dirname $0)/../\"\n\nsources=($(find jni dae"
  },
  {
    "path": "contrib/git-hook-pre-push.sh",
    "chars": 809,
    "preview": "#!/bin/bash\n#\n# pre-push hook for git\n# this script is probably overkill for most contributors\n#\n# \"i use this to preven"
  },
  {
    "path": "contrib/hex-to-base32z.py",
    "chars": 1858,
    "preview": "#!/usr/bin/python3\n\nimport sys\n\nbase32z_dict = 'ybndrfg8ejkmcpqxot1uwisza345h769'\nbase32z_map = {base32z_dict[i]: i for "
  },
  {
    "path": "contrib/keygen.py",
    "chars": 479,
    "preview": "#!/usr/bin/env python3\n#\n# .loki secret key generator script\n# makes keyfile contents\n#\n# usage: python3 keygen.py out.p"
  },
  {
    "path": "contrib/liblokinet/CMakeLists.txt",
    "chars": 216,
    "preview": "\ncmake_minimum_required(VERSION 3.10)\n\nproject(udptest LANGUAGES CXX)\n\nset(CMAKE_CXX_STANDARD 17)\nadd_executable(udptest"
  },
  {
    "path": "contrib/liblokinet/readme.md",
    "chars": 214,
    "preview": "# liblokinet examples\n\nbuilding:\n\n    $ mkdir -p build\n    $ cd build\n    $ cp /path/to/liblokinet.so .\n    $ cmake .. -"
  },
  {
    "path": "contrib/liblokinet/udptest.cpp",
    "chars": 5734,
    "preview": "#include <lokinet.h>\n\n#include <signal.h>\n\n#include <memory>\n#include <stdexcept>\n#include <iostream>\n#include <fstream>"
  },
  {
    "path": "contrib/liblokinet_jank_test.cpp",
    "chars": 1905,
    "preview": "#include <lokinet.hpp>\n\n#include <exception>\n#include <filesystem>\n#include <future>\n#include <iostream>\n#include <threa"
  },
  {
    "path": "contrib/lokinet-resolvconf",
    "chars": 1475,
    "preview": "#!/bin/bash\n\n# Script to invoke resolvconf (if installed) to add/remove lokinet into/from the resolvconf DNS\n# server li"
  },
  {
    "path": "contrib/mac-configure.sh",
    "chars": 581,
    "preview": "#!/bin/bash\n\nset -e\nset -x\n\nif ! [ -f LICENSE ] || ! [ -d llarp ]; then\n    echo \"You need to run this as ./contrib/mac."
  },
  {
    "path": "contrib/mac.sh",
    "chars": 638,
    "preview": "#!/bin/bash\n#\n# Build the shit on mac\n#\n# You will generally need to add: -DCODESIGN_APP=... to make this work, and (unl"
  },
  {
    "path": "contrib/macos/lokinet-extension.Info.plist.in",
    "chars": 1691,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "contrib/macos/lokinet-extension.plugin.entitlements.plist",
    "chars": 704,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "contrib/macos/lokinet-extension.sysext.entitlements.plist",
    "chars": 879,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "contrib/macos/lokinet-newsyslog.conf",
    "chars": 42,
    "preview": "/var/log/lokinet.log   644  5  5M  $D0   J"
  },
  {
    "path": "contrib/macos/lokinet.Info.plist.in",
    "chars": 1055,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "contrib/macos/lokinet.plugin.entitlements.plist",
    "chars": 719,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "contrib/macos/lokinet.sysext.entitlements.plist",
    "chars": 975,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "contrib/macos/mk-icns.sh",
    "chars": 3024,
    "preview": "#!/bin/bash\n\n# Invoked from cmake as mk-icns.sh /path/to/icon.svg /path/to/output.icns\nsvg=\"$1\"\nout=\"$2\"\noutdir=\"${out/%"
  },
  {
    "path": "contrib/macos/notarize.py.in",
    "chars": 3936,
    "preview": "#!/usr/bin/env python3\n\nimport sys\nimport plistlib\nimport subprocess\nimport time\nimport os\nimport os.path\n\ndef bold_red("
  },
  {
    "path": "contrib/macos/seticon.swift",
    "chars": 629,
    "preview": "import Foundation\nimport AppKit\n\n// Apple deprecated their command line tools to set images on things and replaced them "
  },
  {
    "path": "contrib/macos/sign.sh.in",
    "chars": 2194,
    "preview": "#!/usr/bin/env bash\n\nset -e\n\nif [ \"@CODESIGN@\" != \"ON\" ]; then\n  echo \"Cannot codesign: this build was not configured wi"
  },
  {
    "path": "contrib/make-ico.sh",
    "chars": 975,
    "preview": "#!/bin/bash\n\n# Invoked from cmake as make-ico.sh /path/to/icon.svg /path/to/output.ico\nsvg=\"$1\"\nout=\"$2\"\noutdir=\"$out.d\""
  },
  {
    "path": "contrib/omq-rpc.py",
    "chars": 3806,
    "preview": "#!/usr/bin/env python3\n\nimport nacl.bindings as sodium\nfrom nacl.public import PrivateKey\nfrom nacl.signing import Signi"
  },
  {
    "path": "contrib/patches/libzmq-mingw-unistd.patch",
    "chars": 348,
    "preview": "diff --git a/tests/testutil.hpp b/tests/testutil.hpp\nindex c6f5e4de78..09b9fa77e5 100644\n--- a/tests/testutil.hpp\n+++ b/"
  },
  {
    "path": "contrib/patches/libzmq-mingw-wepoll.patch",
    "chars": 361,
    "preview": "diff --git a/external/wepoll/wepoll.c b/external/wepoll/wepoll.c\n--- a/external/wepoll/wepoll.c\n+++ b/external/wepoll/we"
  },
  {
    "path": "contrib/patches/unbound-delete-crash-fix.patch",
    "chars": 1334,
    "preview": "commit 56d816014d5e8a7eb055169c7e13a303dad5e50f\nAuthor: Jason Rhinelander <jason@imaginary.ca>\nDate:   Mon Oct 31 22:07:"
  },
  {
    "path": "contrib/py/.gitignore",
    "chars": 29,
    "preview": "*.egg-info\nv\n__pycache__\ndist"
  },
  {
    "path": "contrib/py/admin/.gitignore",
    "chars": 2,
    "preview": "v/"
  },
  {
    "path": "contrib/py/admin/lokinetmon",
    "chars": 20354,
    "preview": "#!/usr/bin/env python3\n\nimport curses\nimport json\nimport sys\nimport time\nimport platform\nimport os\nimport re\nfrom argpar"
  },
  {
    "path": "contrib/py/admin/requirements.txt",
    "chars": 8,
    "preview": "requests"
  },
  {
    "path": "contrib/py/ffi-example/lokinet.py",
    "chars": 1490,
    "preview": "#!/usr/bin/env python3\n\n\nfrom ctypes import *\nimport signal\nimport time\nimport threading\nimport os\n\nlib_file = os.path.j"
  },
  {
    "path": "contrib/py/keygen/.gitignore",
    "chars": 9,
    "preview": "*.private"
  },
  {
    "path": "contrib/py/keygen/keygen.py",
    "chars": 936,
    "preview": "#!/usr/bin/env python3\n\"\"\"\nkeygen tool for lokinet\n\"\"\"\n\nfrom argparse import ArgumentParser as AP\nfrom base64 import b32"
  },
  {
    "path": "contrib/py/keygen/readme.md",
    "chars": 177,
    "preview": "# lokinet key generator\n\nrequires:\n\n* python3.7 or higher\n* pynacl\n\nusage:\n\n```bash\n./keygen.py --keyfile somekeyfile.pr"
  },
  {
    "path": "contrib/py/lnproxy/lnproxy/__main__.py",
    "chars": 7806,
    "preview": "#!/usr/bin/env python3\n\nfrom http.server import ThreadingHTTPServer as Server\nfrom http.server import BaseHTTPRequestHan"
  },
  {
    "path": "contrib/py/lnproxy/readme.md",
    "chars": 239,
    "preview": "# LN Proxy\n\nembedded lokinet that provides an http tunnel proxy (using http connect)\n\nif `python3-requests` is installed"
  },
  {
    "path": "contrib/py/quic_tester.py",
    "chars": 3421,
    "preview": "#!/usr/bin/env python3\n\nimport nacl.bindings as sodium\nfrom nacl.public import PrivateKey\nfrom nacl.signing import Signi"
  },
  {
    "path": "contrib/readme-installer.txt",
    "chars": 297,
    "preview": "Lokinet is the reference implementation of LLARP (low latency anonymous routing protocol), a layer 3 onion routing proto"
  },
  {
    "path": "contrib/systemd-resolved/README.md",
    "chars": 929,
    "preview": "Lokinet now talks to systemd directly via sdbus to set up DNS, but in order for this to work the\nuser running lokinet (a"
  },
  {
    "path": "contrib/systemd-resolved/lokinet.pkla",
    "chars": 163,
    "preview": "[Allow lokinet to set DNS settings]\nIdentity=unix-user:_lokinet\nAction=org.freedesktop.resolve1.set-dns-servers;org.free"
  },
  {
    "path": "contrib/systemd-resolved/lokinet.rules",
    "chars": 299,
    "preview": "/* Allow lokinet to set DNS settings */\npolkit.addRule(function(action, subject) {\n    if ((action.id == \"org.freedeskto"
  },
  {
    "path": "contrib/tarball.sh",
    "chars": 533,
    "preview": "#!/usr/bin/env bash\n#\n# create signed release tarball with submodules bundled\n# usage: ./contrib/tarball.sh [keyid]\n#\nre"
  },
  {
    "path": "contrib/windows-configure.sh",
    "chars": 1119,
    "preview": "#!/bin/bash\nset -e\nset -x\n\n# Usage: windows-configure.sh [rootdir [builddir]] -DWHATEVER=BLAH ...\n\nif [ $# -ge 1 ] && [["
  },
  {
    "path": "contrib/windows.sh",
    "chars": 287,
    "preview": "#!/bin/bash\n#\n# helper script for me for when i cross compile for windows\n# t. jeff\n#\n\nset -e\nset +x\nroot=\"$(readlink -f"
  },
  {
    "path": "daemon/CMakeLists.txt",
    "chars": 2710,
    "preview": "set(exetargets lokinet)\n\nadd_library(lokinet_daemon STATIC utils.cpp)\ntarget_link_libraries(lokinet_daemon PUBLIC liblok"
  },
  {
    "path": "daemon/lokinet-cntrl.cpp",
    "chars": 9146,
    "preview": "#include \"utils.hpp\"\n\n#include <CLI/CLI.hpp>\n#include <nlohmann/json.hpp>\n#include <oxenmq/oxenmq.h>\n\nusing namespace ll"
  },
  {
    "path": "daemon/lokinet.cpp",
    "chars": 19740,
    "preview": "#include <llarp.hpp>\n#include <llarp/config/config.hpp>  // for ensure_config\n#include <llarp/constants/platform.hpp>\n#i"
  },
  {
    "path": "daemon/lokinet.swift",
    "chars": 10675,
    "preview": "import AppKit\nimport Foundation\nimport NetworkExtension\nimport SystemExtensions\n\nlet app = NSApplication.shared\n\nlet STA"
  },
  {
    "path": "daemon/utils.cpp",
    "chars": 7464,
    "preview": "#include \"utils.hpp\"\n\n#include <llarp/util/formattable.hpp>\n\n#include <nlohmann/json.hpp>\n\nnamespace llarp::controller\n{"
  },
  {
    "path": "daemon/utils.hpp",
    "chars": 1605,
    "preview": "#pragma once\n\n#include <llarp.hpp>\n#include <llarp/util/logging.hpp>\n#include <llarp/util/logging/buffer.hpp>\n\n#include "
  },
  {
    "path": "docs/CMakeLists.txt",
    "chars": 2823,
    "preview": "find_program(DOXYGEN doxygen)\nif (NOT DOXYGEN)\n    message(STATUS \"Documentation generation disabled (doxygen not found)"
  },
  {
    "path": "docs/Doxyfile.in",
    "chars": 949,
    "preview": "PROJECT_NAME           = \"Lokinet\"\nPROJECT_NUMBER         = v@lokinet_VERSION@\nPROJECT_BRIEF          = \"Anonymous, dece"
  },
  {
    "path": "docs/LICENSE",
    "chars": 488,
    "preview": "Low Latency Anonymous Routing Protocol Specification\nWritten in 2017 by Jeff Becker <jeff@i2p.rocks>\n\nTo the extent poss"
  },
  {
    "path": "docs/architecture.md",
    "chars": 2192,
    "preview": "# High-Level Architecture\n\n## Path Building\n\n<p align=\"center\">\n    <img src=\"/docs/lokinet_pathbuild_no_steps.png\">\n</p"
  },
  {
    "path": "docs/config.json",
    "chars": 223,
    "preview": "{\n    \"baseUrl\": \"\",\n    \"indexInFolders\": false,\n    \"linkSuffix\": \".md\",\n    \"mainPageInRoot\": false,\n    \"mainPageNam"
  },
  {
    "path": "docs/dns-overview.md",
    "chars": 1893,
    "preview": "# DNS in Lokinet\n\nLokinet uses dns are its primary interface for resolving, mapping and querying resources inside of lok"
  },
  {
    "path": "docs/doxygen.md",
    "chars": 510,
    "preview": "\n# Doxygen\n\nbuilding doxygen docs requires the following:\n\n* cmake\n* doxygen\n* sphinx-build\n* sphinx readthedocs theme\n*"
  },
  {
    "path": "docs/exit-setup.md",
    "chars": 449,
    "preview": "\nto configure lokinet to be an exit add into `lokinet.ini`:\n\n    [router]\n    min-connections=8\n    max-connections=16\n\n"
  },
  {
    "path": "docs/fix-markdown.sh",
    "chars": 97,
    "preview": "#!/bin/bash\n# apply markdown file content quarks\n\n\n# rewrite br tags\nsed -i 's|<br>|<br/>|g' $@ \n"
  },
  {
    "path": "docs/ideal-ux.md",
    "chars": 2717,
    "preview": "# What does Lokinet actually do?\n\nLokinet is an onion routed authenticated unicast IP network. It exposes an IP tunnel t"
  },
  {
    "path": "docs/index.md.in",
    "chars": 124,
    "preview": "# Lokinet @lokinet_VERSION@ (git rev: @GIT_VERSION@)\n\nsummary goes here\n\n## Overview\n\n[code internals](index_namespaces."
  },
  {
    "path": "docs/install.md",
    "chars": 5550,
    "preview": "# Installing\n\nIf you are simply looking to install Lokinet and don't want to compile it yourself we provide several opti"
  },
  {
    "path": "docs/liblokinet-dev-guide.md",
    "chars": 374,
    "preview": "# Embedding Lokinet into an existing application\n\nWhen all else fails and you want to deploy lokinet inside your app wit"
  },
  {
    "path": "docs/macos-signing.txt",
    "chars": 7048,
    "preview": "If you are reading this to try to build Lokinet for yourself for an Apple operating system and\nsimultaneously care about"
  },
  {
    "path": "docs/mkdocs.yml",
    "chars": 82,
    "preview": "site_name: Lokinet\ntheme:\n  name: 'readthedocs'\ndocs_dir: markdown\nsite_dir: html\n"
  },
  {
    "path": "docs/net-comparisons.md",
    "chars": 2975,
    "preview": "# How is lokinet different than ...\n\n## Tor Browser\n\nTor browser is a hardened Firefox Web Browser meant exclusively to "
  },
  {
    "path": "docs/project-structure.md",
    "chars": 4538,
    "preview": "# Lokinet Project Structure \n\nthis codebase is a bit large. this is a high level map of the current code structure.\n\n## "
  },
  {
    "path": "docs/readme.md",
    "chars": 716,
    "preview": "# Lokinet Docs\n\nThis is where Lokinet documentation lives.\n\n## Contents:\n\n### Local Environment Set-Up\n  - [Installing L"
  },
  {
    "path": "docs/refactor_notes.md",
    "chars": 6170,
    "preview": "# High Level Iterative Approach\n\nthe desired outcome of this refactor will be splitting the existing code up into a stac"
  },
  {
    "path": "docs/snapps-dev-guide.md",
    "chars": 324,
    "preview": "# (SN)Apps Development Guide\n\n\n## Our approach\n\n`// TODO: this`\n\n## Differences From Other approaches\n\n`// TODO: this`\n\n"
  },
  {
    "path": "docs/spanish/LICENSE",
    "chars": 612,
    "preview": "Especificaciones del Protocolo de Enrutado Anónimo de Baja Latencia - Low Latency Anonymous Routing Protocol\nEscrito en "
  },
  {
    "path": "docs/spanish/README",
    "chars": 244,
    "preview": "Carpeta de las Especificaciones del Protocolo\n\nTodo los documentos de esta carpeta están licenciados como CC0 y son del "
  },
  {
    "path": "docs/spanish/vision-general.txt",
    "chars": 5617,
    "preview": "LLARP - Low Latency Anon Routing Protocol -  Protocolo de Enrutado Anónimo de Baja Latencia\n\n\tResumen TL;DR: un router o"
  },
  {
    "path": "docs/tcp-over-quic.md",
    "chars": 13393,
    "preview": "# \"liblokinet\" TCP-over-QUIC\n\nIn order for lokinet to work in an embedded version (which I will call \"liblokinet\" in thi"
  },
  {
    "path": "docs/we-cannot-make-sandwiches.md",
    "chars": 1211,
    "preview": "# What Lokinet can't do \n\nLokinet does a few things very well, but obviously can't do everything.\n\n## Anonymize OS/Appli"
  },
  {
    "path": "external/CMakeLists.txt",
    "chars": 4923,
    "preview": "option(SUBMODULE_CHECK \"Enables checking that vendored library submodules are up to date\" ON)\nif(SUBMODULE_CHECK)\n  find"
  },
  {
    "path": "include/llarp.hpp",
    "chars": 1887,
    "preview": "#pragma once\n\n#include <future>\n#include <memory>\n#include <mutex>\n\nnamespace oxen::quic\n{\n    class Loop;\n}\n\nnamespace "
  },
  {
    "path": "include/lokinet/addr.h",
    "chars": 291,
    "preview": "#pragma once\n#include \"context.h\"\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n    /// get a free()-able null terminated str"
  },
  {
    "path": "include/lokinet/context.h",
    "chars": 1428,
    "preview": "#pragma once\n\n#include \"export.h\"\n\n#include <stdbool.h>\n#include <stdint.h>\n#include <unistd.h>\n\n#ifdef __cplusplus\nexte"
  },
  {
    "path": "include/lokinet/export.h",
    "chars": 79,
    "preview": "#pragma once\n\n#ifdef _WIN32\n#define EXPORT __cdecl\n#else\n#define EXPORT\n#endif\n"
  },
  {
    "path": "include/lokinet/misc.h",
    "chars": 1448,
    "preview": "#pragma once\n#include \"export.h\"\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n    /// change our network id globally across a"
  },
  {
    "path": "include/lokinet/srv.h",
    "chars": 1846,
    "preview": "#pragma once\n\n#include \"context.h\"\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n    // a single srv record\n    struct lokine"
  },
  {
    "path": "include/lokinet/stream.h",
    "chars": 1840,
    "preview": "#pragma once\n\n#include \"context.h\"\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n    /// the result of a lokinet stream mappi"
  },
  {
    "path": "include/lokinet/udp.h",
    "chars": 3785,
    "preview": "#pragma once\n\n#include \"context.h\"\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n    /// information about a udp flow\n    str"
  },
  {
    "path": "include/lokinet.h",
    "chars": 173,
    "preview": "#pragma once\n\n#include \"lokinet/addr.h\"\n#include \"lokinet/context.h\"\n#include \"lokinet/misc.h\"\n#include \"lokinet/srv.h\"\n"
  },
  {
    "path": "include/lokinet.hpp",
    "chars": 6061,
    "preview": "#pragma once\n\n#include <cstdint>\n#include <filesystem>\n#include <functional>\n#include <memory>\n#include <thread>\n#includ"
  },
  {
    "path": "jni/CMakeLists.txt",
    "chars": 141,
    "preview": "add_library(lokinet-android\n    SHARED\n    lokinet_config.cpp\n    lokinet_daemon.cpp)\ntarget_link_libraries(lokinet-andr"
  },
  {
    "path": "jni/java/src/network/loki/lokinet/LokinetConfig.java",
    "chars": 838,
    "preview": "package network.loki.lokinet;\n\nimport java.nio.ByteBuffer;\n\npublic class LokinetConfig\n{\n  static {\n    System.loadLibra"
  },
  {
    "path": "jni/java/src/network/loki/lokinet/LokinetDaemon.java",
    "chars": 3710,
    "preview": "package network.loki.lokinet;\n\nimport java.lang.Thread;\nimport java.nio.ByteBuffer;\nimport java.io.File;\n\nimport android"
  },
  {
    "path": "jni/lokinet_config.cpp",
    "chars": 2142,
    "preview": "#include \"lokinet_jni_common.hpp\"\n#include \"network_loki_lokinet_LokinetConfig.h\"\n\n#include <llarp.hpp>\n#include <llarp/"
  },
  {
    "path": "jni/lokinet_daemon.cpp",
    "chars": 3780,
    "preview": "#include \"lokinet_jni_common.hpp\"\n#include \"network_loki_lokinet_LokinetDaemon.h\"\n\n#include <llarp.hpp>\n#include <llarp/"
  },
  {
    "path": "jni/lokinet_jni_common.hpp",
    "chars": 2411,
    "preview": "#pragma once\n\n#include <jni.h>\n\n#include <functional>\n#include <string_view>\n\n/// visit string as native bytes\n/// jvm u"
  },
  {
    "path": "jni/network_loki_lokinet_LokinetConfig.h",
    "chars": 1532,
    "preview": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class network_loki_lokinet_LokinetC"
  },
  {
    "path": "jni/network_loki_lokinet_LokinetDaemon.h",
    "chars": 2603,
    "preview": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class network_loki_lokinet_LokinetD"
  },
  {
    "path": "jni/network_loki_lokinet_LokinetVPN.h",
    "chars": 1883,
    "preview": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class network_loki_lokinet_LokinetV"
  },
  {
    "path": "jni/network_loki_lokinet_LokinetVPN_VPNInfo.h",
    "chars": 325,
    "preview": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class network_loki_lokinet_LokinetV"
  },
  {
    "path": "jni/network_loki_lokinet_Lokinet_JNI.h",
    "chars": 1590,
    "preview": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class network_loki_lokinet_Lokinet_"
  },
  {
    "path": "jni/readme.md",
    "chars": 50,
    "preview": "jni binding for lokinet vpn using android vpn api\n"
  },
  {
    "path": "llarp/CMakeLists.txt",
    "chars": 9268,
    "preview": "include(Version)\n\n# Add an internal lokinet static library target, enables LTO (if enabled) on the target,\n# and links i"
  },
  {
    "path": "llarp/address/address.cpp",
    "chars": 1152,
    "preview": "#include \"address.hpp\"\n\n#include <llarp/util/formattable.hpp>\n\n#include <oxenc/base32z.h>\n\n#include <stdexcept>\n\nnamespa"
  },
  {
    "path": "llarp/address/address.hpp",
    "chars": 2115,
    "preview": "#pragma once\n\n#include \"utils.hpp\"\n\n#include <llarp/contact/router_id.hpp>\n#include <llarp/contact/sns.hpp>\n#include <ll"
  },
  {
    "path": "llarp/address/ip_range.cpp",
    "chars": 9402,
    "preview": "#include \"ip_range.hpp\"\n\n#include <llarp/util/logging.hpp>\n#include <llarp/util/str.hpp>\n\n#include <algorithm>\n#include "
  },
  {
    "path": "llarp/address/ip_range.hpp",
    "chars": 4029,
    "preview": "#pragma once\n\n#include \"types.hpp\"\n\n#include <oxen/quic/address.hpp>\n\nnamespace llarp\n{\n    // Takes an address with an "
  },
  {
    "path": "llarp/address/map.hpp",
    "chars": 4488,
    "preview": "#pragma once\n\n#include \"address.hpp\"\n\n#include <llarp/util/formattable.hpp>\n#include <llarp/util/thread/threading.hpp>\n\n"
  },
  {
    "path": "llarp/address/types.hpp",
    "chars": 900,
    "preview": "#pragma once\n\n#include <llarp/util/formattable.hpp>\n\n#include <oxen/quic/ip.hpp>\n\nnamespace llarp\n{\n    namespace quic ="
  },
  {
    "path": "llarp/address/utils.cpp",
    "chars": 2719,
    "preview": "#include \"utils.hpp\"\n\n#include <llarp/crypto/constants.hpp>\n#include <llarp/util/formattable.hpp>\n#include <llarp/util/l"
  },
  {
    "path": "llarp/address/utils.hpp",
    "chars": 685,
    "preview": "#pragma once\n\n#include <cstdint>\n#include <optional>\n#include <string_view>\n\nnamespace llarp\n{\n    using namespace std::"
  },
  {
    "path": "llarp/android/ifaddrs.c",
    "chars": 19498,
    "preview": "/*\nCopyright (c) 2013, Kenneth MacKay\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or w"
  },
  {
    "path": "llarp/android/ifaddrs.h",
    "chars": 1835,
    "preview": "/*\n * Copyright (c) 1995, 1999\n *\tBerkeley Software Design, Inc.  All rights reserved.\n *\n * Redistribution and use in s"
  },
  {
    "path": "llarp/app.xml",
    "chars": 1536,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersi"
  },
  {
    "path": "llarp/apple/CMakeLists.txt",
    "chars": 2306,
    "preview": "\n# 3.13+ so that we can add link libraries to parent targets\ncmake_minimum_required(VERSION 3.13)\n\nif (LOKINET_DAEMON AN"
  },
  {
    "path": "llarp/apple/DNSTrampoline.h",
    "chars": 2369,
    "preview": "#pragma once\n#include <NetworkExtension/NetworkExtension.h>\n#include <uv.h>\n\nextern NSString* error_domain;\n\n/**\n * \"Tra"
  },
  {
    "path": "llarp/apple/DNSTrampoline.m",
    "chars": 5216,
    "preview": "#include \"DNSTrampoline.h\"\n\n#include <uv.h>\n\nNSString* error_domain = @\"org.lokinet\";\n\n// Receiving an incoming packet, "
  },
  {
    "path": "llarp/apple/PacketTunnelProvider.m",
    "chars": 15394,
    "preview": "#include \"context_wrapper.h\"\n#include \"DNSTrampoline.h\"\n\n#include <Foundation/Foundation.h>\n#include <NetworkExtension/N"
  },
  {
    "path": "llarp/apple/context.hpp",
    "chars": 880,
    "preview": "#pragma once\n\n#include \"route_manager.hpp\"\n#include \"vpn_platform.hpp\"\n\n#include <llarp.hpp>\n\nnamespace llarp::apple\n{\n "
  },
  {
    "path": "llarp/apple/context_wrapper.cpp",
    "chars": 6783,
    "preview": "#include \"context_wrapper.h\"\n\n#include \"context.hpp\"\n#include \"vpn_interface.hpp\"\n\n#include <llarp/config/config.hpp>\n#i"
  },
  {
    "path": "llarp/apple/context_wrapper.h",
    "chars": 7726,
    "preview": "#pragma once\n\n// C-linkage wrappers for interacting with a lokinet context, so that we can call them from Swift\n// code "
  },
  {
    "path": "llarp/apple/route_manager.cpp",
    "chars": 2950,
    "preview": "#include \"route_manager.hpp\"\n\n#include <llarp.hpp>\n#include <llarp/handlers/tun.hpp>\n\n#include <memory>\n\nnamespace llarp"
  },
  {
    "path": "llarp/apple/route_manager.hpp",
    "chars": 1936,
    "preview": "#pragma once\n\n#include \"context_wrapper.h\"\n\n#include <llarp/router/router.hpp>\n#include <llarp/vpn/platform.hpp>\n\nnamesp"
  },
  {
    "path": "llarp/apple/vpn_interface.cpp",
    "chars": 1333,
    "preview": "\n#include \"vpn_interface.hpp\"\n\n#include \"context.hpp\"\n\n#include <llarp/router/router.hpp>\n\nnamespace llarp::apple\n{\n    "
  },
  {
    "path": "llarp/apple/vpn_interface.hpp",
    "chars": 1458,
    "preview": "#pragma once\n\n#include <llarp.hpp>\n#include <llarp/util/thread/queue.hpp>\n#include <llarp/vpn/platform.hpp>\n\n#include <m"
  },
  {
    "path": "llarp/apple/vpn_platform.cpp",
    "chars": 770,
    "preview": "#include \"vpn_platform.hpp\"\n\n#include \"context.hpp\"\n\nnamespace llarp::apple\n{\n    VPNPlatform::VPNPlatform(\n        Cont"
  },
  {
    "path": "llarp/apple/vpn_platform.hpp",
    "chars": 899,
    "preview": "#pragma once\n\n#include \"route_manager.hpp\"\n#include \"vpn_interface.hpp\"\n\n#include <llarp/vpn/platform.hpp>\n\nnamespace ll"
  },
  {
    "path": "llarp/auth/auth.cpp",
    "chars": 817,
    "preview": "#include \"auth.hpp\"\n\n#include <oxenmq/oxenmq.h>\n\nnamespace llarp::auth\n{\n    static const std::unordered_map<std::string"
  },
  {
    "path": "llarp/auth/auth.hpp",
    "chars": 1638,
    "preview": "#pragma once\n\n#include <llarp/address/address.hpp>\n#include <llarp/contact/router_id.hpp>\n#include <llarp/crypto/types.h"
  },
  {
    "path": "llarp/auth/file.cpp",
    "chars": 1387,
    "preview": "#include \"auth.hpp\"\n\n#include <llarp/router/router.hpp>\n#include <llarp/util/str.hpp>\n\nnamespace llarp::auth\n{\n    AuthR"
  },
  {
    "path": "llarp/auth/file.hpp",
    "chars": 1058,
    "preview": "#pragma once\n\n#include \"auth.hpp\"\n\n#include <filesystem>\n#include <functional>\n#include <optional>\n#include <string>\n#in"
  },
  {
    "path": "llarp/auth/rpc.cpp",
    "chars": 1338,
    "preview": "#include \"rpc.hpp\"\n\n#include <llarp/router/router.hpp>\n\n#include <oxenmq/oxenmq.h>\n\nnamespace llarp::auth\n{\n    static a"
  },
  {
    "path": "llarp/auth/rpc.hpp",
    "chars": 824,
    "preview": "#pragma once\n\n#include \"auth.hpp\"\n\n#include <memory>\n#include <string>\n#include <unordered_set>\n\nnamespace oxenmq\n{\n    "
  },
  {
    "path": "llarp/auth/session.cpp",
    "chars": 1513,
    "preview": "#include \"session.hpp\"\n\n#include <llarp/crypto/key_manager.hpp>\n#include <llarp/router/router.hpp>\n\nnamespace llarp::aut"
  },
  {
    "path": "llarp/auth/session.hpp",
    "chars": 806,
    "preview": "#pragma once\n\n#include \"auth.hpp\"\n\nnamespace llarp\n{\n    class Router;\n}\nnamespace llarp::auth\n{\n    struct SessionAuthP"
  },
  {
    "path": "llarp/config/config.cpp",
    "chars": 75824,
    "preview": "#include \"config.hpp\"\n\n#include \"definition.hpp\"\n#include \"ini.hpp\"\n\n#include <llarp/constants/path.hpp>\n#include <llarp"
  },
  {
    "path": "llarp/config/config.hpp",
    "chars": 13851,
    "preview": "#pragma once\n\n#include \"definition.hpp\"\n#include \"ini.hpp\"\n\n#include <llarp/address/address.hpp>\n#include <llarp/address"
  },
  {
    "path": "llarp/config/definition.cpp",
    "chars": 11635,
    "preview": "#include \"definition.hpp\"\n\n#include <llarp/util/formattable.hpp>\n#include <llarp/util/logging.hpp>\n\n#include <cassert>\n#"
  }
]

// ... and 303 more files (download for full content)

About this extraction

This page contains the full source code of the oxen-io/loki-network GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 503 files (2.0 MB), approximately 537.1k tokens, and a symbol index with 2016 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!