Rename crates.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-04-22 01:41:02 +00:00
parent 0024354345
commit 9b658d86b2
316 changed files with 1590 additions and 1593 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "conduwuit"
default-run = "conduwuit"
name = "tuwunel"
default-run = "tuwunel"
authors.workspace = true
categories.workspace = true
description.workspace = true
@@ -15,23 +15,23 @@ version.workspace = true
metadata.crane.workspace = true
[package.metadata.deb]
name = "conduwuit"
maintainer = "strawberry <strawberry@puppygock.gay>"
copyright = "2024, strawberry <strawberry@puppygock.gay>"
name = "tuwunel"
maintainer = "Jason Volk <jason@zemos.net>"
copyright = "2025, Tuwunel Contributors"
license-file = ["../../LICENSE", "3"]
depends = "$auto, ca-certificates"
extended-description = """\
a cool hard fork of Conduit, a Matrix homeserver written in Rust"""
High performance Matrix homeserver written in Rust"""
section = "net"
priority = "optional"
conf-files = ["/etc/conduwuit/conduwuit.toml"]
conf-files = ["/etc/tuwunel/tuwunel.toml"]
maintainer-scripts = "../../debian/"
systemd-units = { unit-name = "conduwuit", start = false }
systemd-units = { unit-name = "tuwunel", start = false }
assets = [
["../../debian/README.md", "usr/share/doc/conduwuit/README.Debian", "644"],
["../../README.md", "usr/share/doc/conduwuit/", "644"],
["../../target/release/conduwuit", "usr/sbin/conduwuit", "755"],
["../../conduwuit-example.toml", "etc/conduwuit/conduwuit.toml", "640"],
["../../debian/README.md", "usr/share/doc/tuwunel/README.Debian", "644"],
["../../README.md", "usr/share/doc/tuwunel/", "644"],
["../../target/release/tuwunel", "usr/sbin/tuwunel", "755"],
["../../tuwunel-example.toml", "etc/tuwunel/tuwunel.toml", "640"],
]
[features]
@@ -50,51 +50,51 @@ default = [
]
blurhashing = [
"conduwuit-service/blurhashing",
"tuwunel-service/blurhashing",
]
brotli_compression = [
"conduwuit-api/brotli_compression",
"conduwuit-core/brotli_compression",
"conduwuit-router/brotli_compression",
"conduwuit-service/brotli_compression",
"tuwunel-api/brotli_compression",
"tuwunel-core/brotli_compression",
"tuwunel-router/brotli_compression",
"tuwunel-service/brotli_compression",
]
console = [
"conduwuit-service/console",
"tuwunel-service/console",
]
direct_tls = [
"conduwuit-router/direct_tls"
"tuwunel-router/direct_tls"
]
element_hacks = [
"conduwuit-api/element_hacks",
"conduwuit-service/element_hacks",
"tuwunel-api/element_hacks",
"tuwunel-service/element_hacks",
]
gzip_compression = [
"conduwuit-api/gzip_compression",
"conduwuit-core/gzip_compression",
"conduwuit-router/gzip_compression",
"conduwuit-service/gzip_compression",
"tuwunel-api/gzip_compression",
"tuwunel-core/gzip_compression",
"tuwunel-router/gzip_compression",
"tuwunel-service/gzip_compression",
]
hardened_malloc = [
"conduwuit-core/hardened_malloc",
"tuwunel-core/hardened_malloc",
]
io_uring = [
"conduwuit-database/io_uring",
"tuwunel-database/io_uring",
]
jemalloc = [
"conduwuit-core/jemalloc",
"conduwuit-database/jemalloc",
"tuwunel-core/jemalloc",
"tuwunel-database/jemalloc",
]
jemalloc_prof = [
"conduwuit-core/jemalloc_prof",
"tuwunel-core/jemalloc_prof",
]
jemalloc_stats = [
"conduwuit-core/jemalloc_stats",
"tuwunel-core/jemalloc_stats",
]
jemalloc_conf = [
"conduwuit-core/jemalloc_conf",
"tuwunel-core/jemalloc_conf",
]
media_thumbnail = [
"conduwuit-service/media_thumbnail",
"tuwunel-service/media_thumbnail",
]
perf_measurements = [
"dep:opentelemetry",
@@ -102,8 +102,8 @@ perf_measurements = [
"dep:tracing-opentelemetry",
"dep:opentelemetry_sdk",
"dep:opentelemetry-jaeger",
"conduwuit-core/perf_measurements",
"conduwuit-core/sentry_telemetry",
"tuwunel-core/perf_measurements",
"tuwunel-core/sentry_telemetry",
]
# increases performance, reduces build times, and reduces binary size by not compiling or
# genreating code for log level filters that users will generally not use (debug and trace)
@@ -112,22 +112,22 @@ release_max_log_level = [
"tracing/release_max_level_info",
"log/max_level_trace",
"log/release_max_level_info",
"conduwuit-admin/release_max_log_level",
"conduwuit-api/release_max_log_level",
"conduwuit-core/release_max_log_level",
"conduwuit-database/release_max_log_level",
"conduwuit-router/release_max_log_level",
"conduwuit-service/release_max_log_level",
"tuwunel-admin/release_max_log_level",
"tuwunel-api/release_max_log_level",
"tuwunel-core/release_max_log_level",
"tuwunel-database/release_max_log_level",
"tuwunel-router/release_max_log_level",
"tuwunel-service/release_max_log_level",
]
sentry_telemetry = [
"dep:sentry",
"dep:sentry-tracing",
"dep:sentry-tower",
"conduwuit-core/sentry_telemetry",
"conduwuit-router/sentry_telemetry",
"tuwunel-core/sentry_telemetry",
"tuwunel-router/sentry_telemetry",
]
systemd = [
"conduwuit-router/systemd",
"tuwunel-router/systemd",
]
# enable the tokio_console server ncompatible with release_max_log_level
tokio_console = [
@@ -135,26 +135,27 @@ tokio_console = [
"tokio/tracing",
]
url_preview = [
"conduwuit-service/url_preview",
"tuwunel-service/url_preview",
]
zstd_compression = [
"conduwuit-api/zstd_compression",
"conduwuit-core/zstd_compression",
"conduwuit-database/zstd_compression",
"conduwuit-router/zstd_compression",
"conduwuit-service/zstd_compression",
"tuwunel-api/zstd_compression",
"tuwunel-core/zstd_compression",
"tuwunel-database/zstd_compression",
"tuwunel-router/zstd_compression",
"tuwunel-service/zstd_compression",
]
conduwuit_mods = [
"conduwuit-core/conduwuit_mods",
tuwunel_mods = [
"tuwunel-core/tuwunel_mods",
]
[dependencies]
conduwuit-admin.workspace = true
conduwuit-api.workspace = true
conduwuit-core.workspace = true
conduwuit-database.workspace = true
conduwuit-router.workspace = true
conduwuit-service.workspace = true
tuwunel-admin.workspace = true
tuwunel-api.workspace = true
tuwunel-core.workspace = true
tuwunel-database.workspace = true
tuwunel-macros.workspace = true
tuwunel-router.workspace = true
tuwunel-service.workspace = true
clap.workspace = true
console-subscriber.optional = true
@@ -191,5 +192,5 @@ hardened_malloc-rs.optional = true
workspace = true
[[bin]]
name = "conduwuit"
name = "tuwunel"
path = "main.rs"

View File

@@ -3,7 +3,7 @@
use std::path::PathBuf;
use clap::{ArgAction, Parser};
use conduwuit_core::{
use tuwunel_core::{
Err, Result,
config::{Figment, FigmentValue},
err, toml,
@@ -15,8 +15,8 @@ use conduwuit_core::{
#[clap(
about,
long_about = None,
name = "conduwuit",
version = conduwuit_core::version(),
name = "tuwunel",
version = tuwunel_core::version(),
)]
pub(crate) struct Args {
#[arg(short, long)]
@@ -74,18 +74,18 @@ pub(crate) struct Args {
/// with the exception of the last bucket, try increasing this value to e.g.
/// 50 or 100. Inversely, decrease to 10 etc if the histogram lacks
/// resolution.
#[arg(long, hide(true), env = "CONDUWUIT_RUNTIME_HISTOGRAM_INTERVAL", default_value = "25")]
#[arg(long, hide(true), env = "TUWUNEL_RUNTIME_HISTOGRAM_INTERVAL", default_value = "25")]
pub(crate) worker_histogram_interval: u64,
/// Set the histogram bucket count (tokio_unstable). Default is 20.
#[arg(long, hide(true), env = "CONDUWUIT_RUNTIME_HISTOGRAM_BUCKETS", default_value = "20")]
#[arg(long, hide(true), env = "TUWUNEL_RUNTIME_HISTOGRAM_BUCKETS", default_value = "20")]
pub(crate) worker_histogram_buckets: usize,
/// Toggles worker affinity feature.
#[arg(
long,
hide(true),
env = "CONDUWUIT_RUNTIME_WORKER_AFFINITY",
env = "TUWUNEL_RUNTIME_WORKER_AFFINITY",
action = ArgAction::Set,
num_args = 0..=1,
require_equals(false),
@@ -99,7 +99,7 @@ pub(crate) struct Args {
#[arg(
long,
hide(true),
env = "CONDUWUIT_RUNTIME_GC_ON_PARK",
env = "TUWUNEL_RUNTIME_GC_ON_PARK",
action = ArgAction::Set,
num_args = 0..=1,
require_equals(false),
@@ -115,7 +115,7 @@ pub(crate) struct Args {
#[arg(
long,
hide(true),
env = "CONDUWUIT_RUNTIME_GC_MUZZY",
env = "TUWUNEL_RUNTIME_GC_MUZZY",
action = ArgAction::Set,
num_args = 0..=1,
require_equals(false),

View File

@@ -1,13 +1,13 @@
use std::sync::Arc;
use conduwuit_core::{
use tracing_subscriber::{EnvFilter, Layer, Registry, fmt, layer::SubscriberExt, reload};
use tuwunel_core::{
Result,
config::Config,
debug_warn, err,
log::{ConsoleFormat, ConsoleWriter, LogLevelReloadHandles, capture, fmt_span},
result::UnwrapOrErr,
};
use tracing_subscriber::{EnvFilter, Layer, Registry, fmt, layer::SubscriberExt, reload};
#[cfg(feature = "perf_measurements")]
pub(crate) type TracingFlameGuard =
@@ -77,7 +77,7 @@ pub(crate) fn init(
);
let tracer = opentelemetry_jaeger::new_agent_pipeline()
.with_auto_split_batch(true)
.with_service_name("conduwuit")
.with_service_name("tuwunel")
.install_batch(opentelemetry_sdk::runtime::Tokio)
.expect("jaeger agent pipeline");
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);

View File

@@ -11,8 +11,9 @@ mod signal;
use std::sync::{Arc, atomic::Ordering};
use conduwuit_core::{Error, Result, debug_info, error, rustc_flags_capture};
use server::Server;
use tuwunel_core::{Error, Result, debug_info, error, rustc_flags_capture};
use crate::server::Server;
rustc_flags_capture! {}
@@ -36,14 +37,14 @@ fn main() -> Result {
/// Operate the server normally in release-mode static builds. This will start,
/// run and stop the server within the asynchronous runtime.
#[cfg(any(not(conduwuit_mods), not(feature = "conduwuit_mods")))]
#[cfg(any(not(tuwunel_mods), not(feature = "tuwunel_mods")))]
#[tracing::instrument(
name = "main",
parent = None,
skip_all
)]
async fn async_main(server: &Arc<Server>) -> Result<(), Error> {
extern crate conduwuit_router as router;
extern crate tuwunel_router as router;
match router::start(&server.server).await {
| Ok(services) => server.services.lock().await.insert(services),
@@ -88,7 +89,7 @@ async fn async_main(server: &Arc<Server>) -> Result<(), Error> {
/// Operate the server in developer-mode dynamic builds. This will start, run,
/// and hot-reload portions of the server as-needed before returning for an
/// actual shutdown. This is not available in release-mode or static builds.
#[cfg(all(conduwuit_mods, feature = "conduwuit_mods"))]
#[cfg(all(tuwunel_mods, feature = "tuwunel_mods"))]
async fn async_main(server: &Arc<Server>) -> Result<(), Error> {
let mut starts = true;
let mut reloads = true;

View File

@@ -1,7 +1,7 @@
#![cfg(all(conduwuit_mods, feature = "conduwuit_mods"))]
#![cfg(all(tuwunel_mods, feature = "tuwunel_mods"))]
#[unsafe(no_link)]
extern crate conduwuit_service;
extern crate tuwunel_service;
use std::{
future::Future,
@@ -9,13 +9,13 @@ use std::{
sync::{Arc, atomic::Ordering},
};
use conduwuit_core::{Error, Result, debug, error, mods};
use conduwuit_service::Services;
use tuwunel_core::{Error, Result, debug, error, mods};
use tuwunel_service::Services;
use crate::Server;
type StartFuncResult = Pin<Box<dyn Future<Output = Result<Arc<Services>>> + Send>>;
type StartFuncProto = fn(&Arc<conduwuit_core::Server>) -> StartFuncResult;
type StartFuncProto = fn(&Arc<tuwunel_core::Server>) -> StartFuncResult;
type RunFuncResult = Pin<Box<dyn Future<Output = Result<()>> + Send>>;
type RunFuncProto = fn(&Arc<Services>) -> RunFuncResult;
@@ -23,19 +23,19 @@ type RunFuncProto = fn(&Arc<Services>) -> RunFuncResult;
type StopFuncResult = Pin<Box<dyn Future<Output = Result<()>> + Send>>;
type StopFuncProto = fn(Arc<Services>) -> StopFuncResult;
const RESTART_THRESH: &str = "conduwuit_service";
const RESTART_THRESH: &str = "tuwunel_service";
const MODULE_NAMES: &[&str] = &[
//"conduwuit_core",
"conduwuit_database",
"conduwuit_service",
"conduwuit_api",
"conduwuit_admin",
"conduwuit_router",
//"tuwunel_core",
"tuwunel_database",
"tuwunel_service",
"tuwunel_api",
"tuwunel_admin",
"tuwunel_router",
];
#[cfg(panic_trap)]
conduwuit_core::mod_init! {{
conduwuit_core::debug::set_panic_trap();
tuwunel_core::mod_init! {{
tuwunel_core::debug::set_panic_trap();
}}
pub(crate) async fn run(server: &Arc<Server>, starts: bool) -> Result<(bool, bool), Error> {

View File

@@ -2,7 +2,7 @@
use std::{env, os::unix::process::CommandExt, process::Command};
use conduwuit_core::{debug, info, utils};
use tuwunel_core::{debug, info, utils};
#[cold]
pub(super) fn restart() -> ! {

View File

@@ -8,17 +8,17 @@ use std::{
time::Duration,
};
use tokio::runtime::Builder;
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
use conduwuit_core::result::LogDebugErr;
use conduwuit_core::{
use tuwunel_core::result::LogDebugErr;
use tuwunel_core::{
Result, debug, is_true,
utils::sys::compute::{nth_core_available, set_affinity},
};
use tokio::runtime::Builder;
use crate::{clap::Args, server::Server};
const WORKER_NAME: &str = "conduwuit:worker";
const WORKER_NAME: &str = "tuwunel:worker";
const WORKER_MIN: usize = 2;
const WORKER_KEEPALIVE: u64 = 36;
const MAX_BLOCKING_THREADS: usize = 1024;
@@ -87,8 +87,8 @@ fn enable_histogram(builder: &mut Builder, args: &Args) {
#[cfg(tokio_unstable)]
#[tracing::instrument(name = "stop", level = "info", skip_all)]
pub(super) fn shutdown(server: &Arc<Server>, runtime: tokio::runtime::Runtime) {
use conduwuit_core::event;
use tracing::Level;
use tuwunel_core::event;
// The final metrics output is promoted to INFO when tokio_unstable is active in
// a release/bench mode and DEBUG is likely optimized out
@@ -161,7 +161,7 @@ fn set_worker_affinity() {
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
fn set_worker_mallctl(id: usize) {
use conduwuit_core::alloc::je::{
use tuwunel_core::alloc::je::{
is_affine_arena,
this_thread::{set_arena, set_muzzy_decay},
};
@@ -175,7 +175,7 @@ fn set_worker_mallctl(id: usize) {
.expect("GC_MUZZY initialized by runtime::new()");
let muzzy_auto_disable =
conduwuit_core::utils::available_parallelism() >= DISABLE_MUZZY_THRESHOLD;
tuwunel_core::utils::available_parallelism() >= DISABLE_MUZZY_THRESHOLD;
if matches!(muzzy_option, Some(false) | None if muzzy_auto_disable) {
set_muzzy_decay(-1).log_debug_err().ok();
}
@@ -228,7 +228,7 @@ fn thread_park() {
fn gc_on_park() {
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
conduwuit_core::alloc::je::this_thread::decay()
tuwunel_core::alloc::je::this_thread::decay()
.log_debug_err()
.ok();
}

View File

@@ -5,7 +5,6 @@ use std::{
sync::{Arc, OnceLock},
};
use conduwuit_core::{config::Config, debug, trace};
use sentry::{
Breadcrumb, ClientOptions, Level,
types::{
@@ -13,6 +12,7 @@ use sentry::{
protocol::v7::{Context, Event},
},
};
use tuwunel_core::{config::Config, debug, trace};
static SEND_PANIC: OnceLock<bool> = OnceLock::new();
static SEND_ERROR: OnceLock<bool> = OnceLock::new();
@@ -43,7 +43,7 @@ fn options(config: &Config) -> ClientOptions {
traces_sample_rate: config.sentry_traces_sample_rate,
debug: cfg!(debug_assertions),
release: sentry::release_name!(),
user_agent: conduwuit_core::version::user_agent().into(),
user_agent: tuwunel_core::version::user_agent().into(),
attach_stacktrace: config.sentry_attach_stacktrace,
before_send: Some(Arc::new(before_send)),
before_breadcrumb: Some(Arc::new(before_breadcrumb)),

View File

@@ -1,31 +1,31 @@
use std::{path::PathBuf, sync::Arc};
use conduwuit_core::{
use tokio::{runtime, sync::Mutex};
use tuwunel_core::{
Error, Result,
config::Config,
info,
log::Log,
utils::{stream, sys},
};
use tokio::{runtime, sync::Mutex};
use crate::{clap::Args, logging::TracingFlameGuard};
/// Server runtime state; complete
pub(crate) struct Server {
/// Server runtime state; public portion
pub(crate) server: Arc<conduwuit_core::Server>,
pub(crate) server: Arc<tuwunel_core::Server>,
pub(crate) services: Mutex<Option<Arc<conduwuit_service::Services>>>,
pub(crate) services: Mutex<Option<Arc<tuwunel_service::Services>>>,
_tracing_flame_guard: TracingFlameGuard,
#[cfg(feature = "sentry_telemetry")]
_sentry_guard: Option<::sentry::ClientInitGuard>,
#[cfg(all(conduwuit_mods, feature = "conduwuit_mods"))]
#[cfg(all(tuwunel_mods, feature = "tuwunel_mods"))]
// Module instances; TODO: move to mods::loaded mgmt vector
pub(crate) mods: tokio::sync::RwLock<Vec<conduwuit_core::mods::Module>>,
pub(crate) mods: tokio::sync::RwLock<Vec<tuwunel_core::mods::Module>>,
}
impl Server {
@@ -66,11 +66,11 @@ impl Server {
database_path = ?config.database_path,
log_levels = %config.log,
"{}",
conduwuit_core::version(),
tuwunel_core::version(),
);
Ok(Arc::new(Self {
server: Arc::new(conduwuit_core::Server::new(config, runtime.cloned(), Log {
server: Arc::new(tuwunel_core::Server::new(config, runtime.cloned(), Log {
reload: tracing_reload_handle,
capture,
})),
@@ -82,7 +82,7 @@ impl Server {
#[cfg(feature = "sentry_telemetry")]
_sentry_guard: sentry_guard,
#[cfg(all(conduwuit_mods, feature = "conduwuit_mods"))]
#[cfg(all(tuwunel_mods, feature = "tuwunel_mods"))]
mods: tokio::sync::RwLock::new(Vec::new()),
}))
}

View File

@@ -1,7 +1,7 @@
use std::sync::Arc;
use conduwuit_core::{debug_error, trace, warn};
use tokio::signal;
use tuwunel_core::{debug_error, trace, warn};
use super::server::Server;
@@ -12,7 +12,7 @@ pub(super) async fn signal(server: Arc<Server>) {
use unix::SignalKind;
const CONSOLE: bool = cfg!(feature = "console");
const RELOADING: bool = cfg!(all(conduwuit_mods, feature = "conduwuit_mods", not(CONSOLE)));
const RELOADING: bool = cfg!(all(tuwunel_mods, feature = "tuwunel_mods", not(CONSOLE)));
let mut quit = unix::signal(SignalKind::quit()).expect("SIGQUIT handler");
let mut term = unix::signal(SignalKind::terminate()).expect("SIGTERM handler");