Split into core + full libraries#48
Open
jagerman wants to merge 4 commits into
Open
Conversation
jagerman
force-pushed
the
core-full-lib-split
branch
from
July 16, 2026 00:35
6570ed0 to
65a8517
Compare
…ntry point Move the service_manager global into the core library with a no-op default and make it settable, so core can reference it unconditionally; the native (systemd/win32) implementation installs itself. Introduce srouter::full::initialize() -- the single entry point a full application calls early in main() to install the full library's overrides (native service manager, stricter config validators, ...) over the core defaults -- and drop the SROUTER_EMBEDDED_ONLY guards around service_manager now that it is always present. Validate the [oxend]:rpc config value through an optional hook installed by the full library instead of constructing an oxenmq::address directly, so the core config library no longer depends on oxenmq. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Router drives the oxend client and reachability tester through core-side interfaces (rpc::IOxendClient, consensus::IReachability) and holds the oxenmq instance and rpc server via forward-declared handles, all constructed by an injected RpcBackendHooks seam that the full library installs in srouter::full::initialize(). The concrete implementations (which need oxenmq) live in the full library; Router still owns and drives them, but its construction of them moves behind the hooks and it no longer names the concrete types. With this the core library no longer references any oxenmq or rpc code. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…BEDDED_ONLY Give the TUN endpoint a core interface (handlers::ITunnel) and route the net::Platform and vpn::Platform singletons through settable seams installed by the full library. Relocate TUN/DNS construction into the full backend hooks so the concrete platform/dns implementations -- and libunbound -- leave the core library, and dispatch the remaining tun/oxend call sites in session and link_manager through the interfaces. With the last full-only references gone from core, delete SROUTER_EMBEDDED_ONLY entirely. The core/full distinction is now purely whether the full backend is installed at runtime, so the core translation units compile identically regardless of SROUTER_FULL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Build two aggregate libraries from the internal component libraries: libsessionrouter-core (alias session-router::core, libsessionrouter-core.so) is the embedded API plus the core components and has no oxenmq/libunbound dependency; libsessionrouter (alias session-router::full, libsessionrouter.so) adds the full-only components and links libsessionrouter-core. Embedded consumers build with -DSROUTER_FULL=OFF and link the core library; the daemon links the full one. To keep the core graph dependency-clean in a full build: split the dns library into a core srv_data stub (session-router-dns-data) and the full parser (session-router-dns); relocate the full-only concrete implementations out of the core component libraries; cut the now-spurious core->full dependency edges; and split session-router-base into base and base-full (oxenmq/unbound). The aggregate shared libraries whole-archive their components (srouter_link_whole(), using $<LINK_LIBRARY:WHOLE_ARCHIVE> on CMake >= 3.24 with a GNU --whole-archive fallback) so each .so is self-complete. Declare sessiondep::libzstd on session-router-utils (which contains util/zstd.cpp, the only user of the zstd C API) rather than on session-router-addressing (which uses no zstd symbols). The old placement relied on link ordering that happened to work before the split; once the aggregate link line is reordered by the whole-archive layering, the utils archive can precede libzstd on the link command and the zstd.cpp references (ZSTD_createCCtx, ...) fail to resolve in static builds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jagerman
force-pushed
the
core-full-lib-split
branch
from
July 16, 2026 01:24
65a8517 to
9a18f5e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR restructures session-router so it builds as two layered libraries instead of one. The primary purpose is to solve a dependency ugliness:
-DSROUTER_FULL=OFFwould build a library suitable for embedded usage, with some codepaths disabled at compilation time, and omitting various things like libunbound and liboxen-mq (which are only needed for full clients and relays).-DSROUTER_FULL=ON(the default) would build a library that included everything, including libunbound-dev. While this library was perfectly usable for both embedded and full, it meant that you always had to bring along libunbound and liboxenmq (and transitives) as package dependencies, which is a little bit annoying if you only care about embedded mode.Thus this PR splits the library into two, and removes all the compile-time differences in the build:
This required some internal abstraction and mild reworking of the code to be able to cleanly sever the two components, but now builds and works successfully.