Skip to content

Commit 7c3993c

Browse files
committed
Move config & keygen to a dedicated binary
This moves the config generation from the main session-router binary into a dedicated session-router-config binary, which can now: - `-c` generate a full client config - `-r` generate a router config - `-e` generate an embedded config - `-H` generate a hidden service config (= client config, but with DNS disabled, more inbound paths, and a persistent key) - `-k` generates a keypair file - `-s` show the pubkey from a keypair file along with some other flags that let you tweak the generated file. Along the way this reworks several related things: - config "overrides" that could be set via RPC are now gone. They seemed like a privelege escalation (because a user could make permanent changes overriding the settings in the admin-protected config file). Also they were quite broken because if you tried to actually "override" a setting it just errored with an error about specifying a value more than once, bricking lokinet; and for multi-options it could only append but not replace. (These issues could be fixed, but don't seem worth it given the first issue). - removed a bunch of related override saving code. - Untangled a weird relationship between Config/ConfigDefinitions/Parser. - Drop `ConfigGenParameters` which was really just two values, one of which was wrong (the data-dir, as it referred to the default rather than actual) and the other of which was already in the ConfigDefinitions. - Made all paths the config (e.g. unbound hosts, key file) properly resolve relative to the config file dir. Previously they were all wrong in different ways: some relative to cwd, some relative to data-dir, some relative to the *default* data_dir fallback if you don't specify a datadir. - Make the config file a required argument when launching session-router, and never auto-vivify it. - Make the keyfile no longer auto-vivify: if a keyfile is specified that doesn't exist it is now an error. - Remove many deprecated config options as we no longer are aiming to be a seamless upgrade from Lokinet. - Rename "Deprecated" in the config to "Obsolete" to better reflect what it does (i.e. warn and ignore). - Remove "undeclared" ini handlers. They were gross, and the last use of it (for unbound options) is now gone.
1 parent 7d5e77c commit 7c3993c

21 files changed

+463
-949
lines changed

src/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ endforeach()
190190
configure_file("nodedb-bootstraps.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/nodedb-bootstraps.cpp" @ONLY)
191191
target_sources(session-router-nodedb PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/nodedb-bootstraps.cpp")
192192

193-
# session-router-config is for all configuration types and parsers
194-
session_router_add_library(session-router-config
193+
# session-router-conf is for all configuration types and parsers
194+
session_router_add_library(session-router-conf
195195
config/config.cpp
196196
config/definition.cpp
197197
config/ini.cpp
@@ -209,26 +209,26 @@ session_router_add_library(session-router-path
209209

210210
if(SROUTER_DEBUG_PATH_SEED)
211211
target_compile_definitions(session-router-nodedb PRIVATE SROUTER_DEBUG_PATH_SEED)
212-
target_compile_definitions(session-router-config PRIVATE SROUTER_DEBUG_PATH_SEED)
212+
target_compile_definitions(session-router-conf PRIVATE SROUTER_DEBUG_PATH_SEED)
213213
target_compile_definitions(session-router-path PRIVATE SROUTER_DEBUG_PATH_SEED)
214214
endif()
215215

216216
# Link libraries to their internals
217217
target_link_libraries(session-router-nodedb PUBLIC session-router-addressing session-router-cryptography)
218218
target_link_libraries(session-router-contact PUBLIC session-router-dns)
219219
if(SROUTER_FULL)
220-
target_link_libraries(session-router-rpc PUBLIC session-router-contact session-router-config)
220+
target_link_libraries(session-router-rpc PUBLIC session-router-contact session-router-conf)
221221
endif()
222222
target_link_libraries(session-router-addressing PUBLIC session-router-utils session-router-cryptography session-router-contact session-router-ip)
223-
target_link_libraries(session-router-config PUBLIC session-router-cryptography session-router-addressing)
223+
target_link_libraries(session-router-conf PUBLIC session-router-cryptography session-router-addressing)
224224
if(SROUTER_FULL)
225225
target_link_libraries(session-router-platform PUBLIC session-router-cryptography session-router-ip)
226-
target_link_libraries(session-router-config PUBLIC session-router-exit-auth)
226+
target_link_libraries(session-router-conf PUBLIC session-router-exit-auth)
227227
endif()
228228
target_link_libraries(session-router-dns
229229
PUBLIC
230230
session-router-cryptography
231-
session-router-config
231+
session-router-conf
232232
)
233233
if(SROUTER_FULL)
234234
target_link_libraries(session-router-dns PUBLIC session-router-platform)
@@ -241,7 +241,7 @@ target_link_libraries(session-router-path
241241

242242
target_link_libraries(session-router-core-utils
243243
PUBLIC
244-
session-router-config
244+
session-router-conf
245245
session-router-dns
246246
)
247247

0 commit comments

Comments
 (0)