From 9b658d86b2f49d01ba8d2f5ae7f263a104e8f282 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 22 Apr 2025 01:41:02 +0000 Subject: [PATCH] Rename crates. Signed-off-by: Jason Volk --- Cargo.lock | 477 +++++++++--------- Cargo.toml | 47 +- clippy.toml | 12 +- src/admin/Cargo.toml | 78 +-- src/admin/admin.rs | 4 +- src/admin/appservice/commands.rs | 2 +- src/admin/appservice/mod.rs | 2 +- src/admin/check/commands.rs | 4 +- src/admin/check/mod.rs | 2 +- src/admin/context.rs | 4 +- src/admin/debug/commands.rs | 22 +- src/admin/debug/mod.rs | 10 +- src/admin/debug/tester.rs | 2 +- src/admin/federation/commands.rs | 2 +- src/admin/federation/mod.rs | 2 +- src/admin/media/commands.rs | 6 +- src/admin/media/mod.rs | 2 +- src/admin/mod.rs | 16 +- src/admin/processor.rs | 27 +- src/admin/query/account_data.rs | 2 +- src/admin/query/appservice.rs | 2 +- src/admin/query/globals.rs | 2 +- src/admin/query/mod.rs | 2 +- src/admin/query/presence.rs | 2 +- src/admin/query/pusher.rs | 2 +- src/admin/query/raw.rs | 12 +- src/admin/query/resolver.rs | 6 +- src/admin/query/room_alias.rs | 2 +- src/admin/query/room_state_cache.rs | 2 +- src/admin/query/room_timeline.rs | 2 +- src/admin/query/sending.rs | 4 +- src/admin/query/short.rs | 2 +- src/admin/query/users.rs | 2 +- src/admin/room/alias.rs | 2 +- src/admin/room/commands.rs | 2 +- src/admin/room/directory.rs | 2 +- src/admin/room/info.rs | 2 +- src/admin/room/mod.rs | 2 +- src/admin/room/moderation.rs | 8 +- src/admin/server/commands.rs | 10 +- src/admin/server/mod.rs | 4 +- src/admin/user/commands.rs | 18 +- src/admin/user/mod.rs | 2 +- src/admin/utils.rs | 4 +- src/api/Cargo.toml | 42 +- src/api/client/account.rs | 16 +- src/api/client/account_data.rs | 4 +- src/api/client/alias.rs | 4 +- src/api/client/appservice.rs | 2 +- src/api/client/backup.rs | 2 +- src/api/client/capabilities.rs | 2 +- src/api/client/context.rs | 14 +- src/api/client/device.rs | 2 +- src/api/client/directory.rs | 20 +- src/api/client/filter.rs | 2 +- src/api/client/keys.rs | 4 +- src/api/client/media.rs | 16 +- src/api/client/media_legacy.rs | 10 +- src/api/client/membership.rs | 50 +- src/api/client/message.rs | 26 +- src/api/client/mod.rs | 2 +- src/api/client/openid.rs | 2 +- src/api/client/presence.rs | 2 +- src/api/client/profile.rs | 14 +- src/api/client/push.rs | 4 +- src/api/client/read_marker.rs | 2 +- src/api/client/redact.rs | 2 +- src/api/client/relations.rs | 12 +- src/api/client/report.rs | 6 +- src/api/client/room/aliases.rs | 2 +- src/api/client/room/create.rs | 12 +- src/api/client/room/event.rs | 2 +- src/api/client/room/initial_sync.rs | 6 +- src/api/client/room/summary.rs | 10 +- src/api/client/room/upgrade.rs | 8 +- src/api/client/search.rs | 14 +- src/api/client/send.rs | 2 +- src/api/client/session.rs | 10 +- src/api/client/space.rs | 12 +- src/api/client/state.rs | 12 +- src/api/client/sync/mod.rs | 12 +- src/api/client/sync/v3.rs | 49 +- src/api/client/sync/v4.rs | 28 +- src/api/client/sync/v5.rs | 30 +- src/api/client/tag.rs | 2 +- src/api/client/thirdparty.rs | 2 +- src/api/client/threads.rs | 6 +- src/api/client/to_device.rs | 4 +- src/api/client/typing.rs | 2 +- src/api/client/unstable.rs | 2 +- src/api/client/unversioned.rs | 18 +- src/api/client/user_directory.rs | 12 +- src/api/client/voip.rs | 2 +- src/api/client/well_known.rs | 4 +- src/api/mod.rs | 7 +- src/api/router.rs | 8 +- src/api/router/args.rs | 6 +- src/api/router/auth.rs | 6 +- src/api/router/handler.rs | 2 +- src/api/router/request.rs | 4 +- src/api/router/response.rs | 2 +- src/api/router/state.rs | 2 +- src/api/server/backfill.rs | 6 +- src/api/server/event.rs | 2 +- src/api/server/event_auth.rs | 2 +- src/api/server/get_missing_events.rs | 2 +- src/api/server/hierarchy.rs | 10 +- src/api/server/invite.rs | 6 +- src/api/server/key.rs | 2 +- src/api/server/make_join.rs | 8 +- src/api/server/make_knock.rs | 2 +- src/api/server/make_leave.rs | 2 +- src/api/server/media.rs | 4 +- src/api/server/openid.rs | 2 +- src/api/server/publicrooms.rs | 2 +- src/api/server/query.rs | 2 +- src/api/server/send.rs | 32 +- src/api/server/send_join.rs | 14 +- src/api/server/send_knock.rs | 10 +- src/api/server/send_leave.rs | 4 +- src/api/server/state.rs | 2 +- src/api/server/state_ids.rs | 2 +- src/api/server/user.rs | 2 +- src/api/server/utils.rs | 4 +- src/api/server/version.rs | 6 +- src/api/server/well_known.rs | 2 +- src/core/Cargo.toml | 6 +- src/core/config/check.rs | 35 +- src/core/config/mod.rs | 178 +++---- src/core/debug.rs | 4 +- src/core/error/mod.rs | 2 +- src/core/info/cargo.rs | 2 +- src/core/info/mod.rs | 2 +- src/core/info/version.rs | 11 +- src/core/mod.rs | 4 +- src/core/mods/mod.rs | 2 +- src/core/server.rs | 2 +- src/core/utils/debug.rs | 2 +- src/core/utils/mod.rs | 2 +- src/core/utils/string.rs | 2 +- src/database/Cargo.toml | 16 +- src/database/benches.rs | 8 +- src/database/de.rs | 8 +- src/database/deserialized.rs | 2 +- src/database/engine.rs | 2 +- src/database/engine/backup.rs | 4 +- src/database/engine/cf_opts.rs | 2 +- src/database/engine/context.rs | 2 +- src/database/engine/db_opts.rs | 2 +- src/database/engine/descriptor.rs | 2 +- src/database/engine/files.rs | 2 +- src/database/engine/logger.rs | 2 +- src/database/engine/memory_usage.rs | 2 +- src/database/engine/open.rs | 2 +- src/database/engine/repair.rs | 2 +- src/database/handle.rs | 2 +- src/database/keyval.rs | 2 +- src/database/map.rs | 2 +- src/database/map/clear.rs | 4 +- src/database/map/compact.rs | 2 +- src/database/map/contains.rs | 6 +- src/database/map/count.rs | 2 +- src/database/map/get.rs | 2 +- src/database/map/get_batch.rs | 6 +- src/database/map/insert.rs | 2 +- src/database/map/keys.rs | 2 +- src/database/map/keys_from.rs | 2 +- src/database/map/keys_prefix.rs | 2 +- src/database/map/qry.rs | 2 +- src/database/map/qry_batch.rs | 6 +- src/database/map/remove.rs | 2 +- src/database/map/rev_keys.rs | 2 +- src/database/map/rev_keys_from.rs | 2 +- src/database/map/rev_keys_prefix.rs | 2 +- src/database/map/rev_stream.rs | 2 +- src/database/map/rev_stream_from.rs | 2 +- src/database/map/rev_stream_prefix.rs | 2 +- src/database/map/stream.rs | 2 +- src/database/map/stream_from.rs | 2 +- src/database/map/stream_prefix.rs | 2 +- src/database/maps.rs | 2 +- src/database/mod.rs | 9 +- src/database/pool.rs | 14 +- src/database/pool/configure.rs | 2 +- src/database/ser.rs | 2 +- src/database/stream.rs | 2 +- src/database/stream/items.rs | 2 +- src/database/stream/items_rev.rs | 2 +- src/database/stream/keys.rs | 2 +- src/database/stream/keys_rev.rs | 2 +- src/database/tests.rs | 14 +- src/database/util.rs | 10 +- src/macros/Cargo.toml | 4 +- src/macros/admin.rs | 2 +- src/macros/cargo.rs | 6 +- src/macros/rustc.rs | 10 +- src/main/Cargo.toml | 119 ++--- src/main/clap.rs | 16 +- src/main/logging.rs | 6 +- src/main/main.rs | 11 +- src/main/mods.rs | 28 +- src/main/restart.rs | 2 +- src/main/runtime.rs | 16 +- src/main/sentry.rs | 4 +- src/main/server.rs | 18 +- src/main/signal.rs | 4 +- src/router/Cargo.toml | 82 +-- src/router/layers.rs | 14 +- src/router/mod.rs | 12 +- src/router/request.rs | 6 +- src/router/router.rs | 10 +- src/router/run.rs | 12 +- src/router/serve/mod.rs | 8 +- src/router/serve/plain.rs | 2 +- src/router/serve/tls.rs | 5 +- src/router/serve/unix.rs | 6 +- src/service/Cargo.toml | 36 +- src/service/account_data/mod.rs | 10 +- src/service/admin/console.rs | 4 +- src/service/admin/create.rs | 2 +- src/service/admin/execute.rs | 2 +- src/service/admin/grant.rs | 4 +- src/service/admin/mod.rs | 6 +- src/service/appservice/mod.rs | 4 +- src/service/appservice/namespace_regex.rs | 2 +- src/service/appservice/registration_info.rs | 2 +- src/service/client/mod.rs | 8 +- src/service/config/mod.rs | 2 +- src/service/emergency/mod.rs | 2 +- src/service/federation/execute.rs | 8 +- src/service/federation/mod.rs | 2 +- src/service/globals/data.rs | 4 +- src/service/globals/mod.rs | 2 +- src/service/key_backups/mod.rs | 10 +- src/service/manager.rs | 4 +- src/service/media/blurhash.rs | 8 +- src/service/media/data.rs | 10 +- src/service/media/migrations.rs | 4 +- src/service/media/mod.rs | 10 +- src/service/media/preview.rs | 5 +- src/service/media/remote.rs | 8 +- src/service/media/thumbnail.rs | 2 +- src/service/migrations.rs | 22 +- src/service/mod.rs | 9 +- src/service/presence/data.rs | 8 +- src/service/presence/mod.rs | 8 +- src/service/presence/presence.rs | 2 +- src/service/pusher/mod.rs | 12 +- src/service/resolver/actual.rs | 2 +- src/service/resolver/cache.rs | 10 +- src/service/resolver/dns.rs | 2 +- src/service/resolver/fed.rs | 2 +- src/service/resolver/mod.rs | 2 +- src/service/resolver/well_known.rs | 2 +- src/service/rooms/alias/mod.rs | 10 +- src/service/rooms/alias/remote.rs | 2 +- src/service/rooms/auth_chain/data.rs | 4 +- src/service/rooms/auth_chain/mod.rs | 6 +- src/service/rooms/directory/mod.rs | 4 +- src/service/rooms/event_handler/acl_check.rs | 2 +- .../fetch_and_handle_outliers.rs | 8 +- src/service/rooms/event_handler/fetch_prev.rs | 8 +- .../rooms/event_handler/fetch_state.rs | 2 +- .../event_handler/handle_incoming_pdu.rs | 8 +- .../rooms/event_handler/handle_outlier_pdu.rs | 6 +- .../rooms/event_handler/handle_prev_pdu.rs | 4 +- src/service/rooms/event_handler/mod.rs | 2 +- .../rooms/event_handler/parse_incoming_pdu.rs | 2 +- .../rooms/event_handler/resolve_state.rs | 6 +- .../rooms/event_handler/state_at_incoming.rs | 6 +- .../event_handler/upgrade_outlier_pdu.rs | 6 +- src/service/rooms/lazy_loading/mod.rs | 8 +- src/service/rooms/metadata/mod.rs | 4 +- src/service/rooms/outlier/mod.rs | 4 +- src/service/rooms/pdu_metadata/data.rs | 8 +- src/service/rooms/pdu_metadata/mod.rs | 2 +- src/service/rooms/read_receipt/data.rs | 10 +- src/service/rooms/read_receipt/mod.rs | 12 +- src/service/rooms/search/mod.rs | 10 +- src/service/rooms/short/mod.rs | 6 +- src/service/rooms/spaces/mod.rs | 18 +- src/service/rooms/spaces/pagination_token.rs | 2 +- src/service/rooms/state/mod.rs | 22 +- src/service/rooms/state_accessor/mod.rs | 4 +- .../rooms/state_accessor/room_state.rs | 8 +- .../rooms/state_accessor/server_can.rs | 2 +- src/service/rooms/state_accessor/state.rs | 20 +- src/service/rooms/state_accessor/user_can.rs | 2 +- src/service/rooms/state_cache/mod.rs | 16 +- src/service/rooms/state_compressor/mod.rs | 10 +- src/service/rooms/threads/mod.rs | 16 +- src/service/rooms/timeline/data.rs | 8 +- src/service/rooms/timeline/mod.rs | 26 +- src/service/rooms/typing/mod.rs | 8 +- src/service/rooms/user/mod.rs | 4 +- src/service/sending/appservice.rs | 2 +- src/service/sending/data.rs | 8 +- src/service/sending/dest.rs | 2 +- src/service/sending/mod.rs | 12 +- src/service/sending/sender.rs | 22 +- src/service/server_keys/acquire.rs | 6 +- src/service/server_keys/get.rs | 2 +- src/service/server_keys/keypair.rs | 4 +- src/service/server_keys/mod.rs | 10 +- src/service/server_keys/request.rs | 2 +- src/service/server_keys/sign.rs | 2 +- src/service/server_keys/verify.rs | 2 +- src/service/service.rs | 6 +- src/service/services.rs | 4 +- src/service/sync/mod.rs | 4 +- src/service/sync/watch.rs | 2 +- src/service/transaction_ids/mod.rs | 4 +- src/service/uiaa/mod.rs | 10 +- src/service/users/mod.rs | 10 +- tests/cargo_smoke.sh | 6 +- ...uwuit-example.toml => tuwunel-example.toml | 150 +++--- 316 files changed, 1590 insertions(+), 1593 deletions(-) rename conduwuit-example.toml => tuwunel-example.toml (91%) diff --git a/Cargo.lock b/Cargo.lock index 2619dbf9..2c972c79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -723,244 +723,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "conduwuit" -version = "1.0.0" -dependencies = [ - "clap", - "conduwuit_admin", - "conduwuit_api", - "conduwuit_core", - "conduwuit_database", - "conduwuit_router", - "conduwuit_service", - "console-subscriber", - "const-str", - "hardened_malloc-rs", - "log", - "opentelemetry", - "opentelemetry-jaeger", - "opentelemetry_sdk", - "sentry", - "sentry-tower", - "sentry-tracing", - "tokio", - "tokio-metrics", - "tracing", - "tracing-flame", - "tracing-opentelemetry", - "tracing-subscriber", -] - -[[package]] -name = "conduwuit_admin" -version = "1.0.0" -dependencies = [ - "clap", - "conduwuit_api", - "conduwuit_core", - "conduwuit_database", - "conduwuit_macros", - "conduwuit_service", - "const-str", - "futures", - "log", - "ruma", - "serde_json", - "serde_yaml", - "tokio", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "conduwuit_api" -version = "1.0.0" -dependencies = [ - "async-trait", - "axum", - "axum-client-ip", - "axum-extra", - "base64 0.22.1", - "bytes", - "conduwuit_core", - "conduwuit_service", - "const-str", - "futures", - "hmac", - "http", - "http-body-util", - "hyper", - "ipaddress", - "itertools 0.14.0", - "log", - "rand 0.8.5", - "reqwest", - "ruma", - "serde", - "serde_html_form", - "serde_json", - "sha1", - "tokio", - "tracing", -] - -[[package]] -name = "conduwuit_core" -version = "1.0.0" -dependencies = [ - "argon2", - "arrayvec", - "axum", - "axum-extra", - "bytes", - "bytesize", - "cargo_toml", - "checked_ops", - "chrono", - "clap", - "conduwuit_macros", - "const-str", - "core_affinity", - "ctor", - "cyborgtime", - "either", - "figment", - "futures", - "hardened_malloc-rs", - "http", - "http-body-util", - "ipaddress", - "itertools 0.14.0", - "libc", - "libloading", - "log", - "maplit", - "nix", - "num-traits", - "rand 0.8.5", - "regex", - "reqwest", - "ring", - "ruma", - "sanitize-filename", - "serde", - "serde_json", - "serde_regex", - "serde_yaml", - "smallstr", - "smallvec", - "thiserror 2.0.12", - "tikv-jemalloc-ctl", - "tikv-jemalloc-sys", - "tikv-jemallocator", - "tokio", - "tokio-metrics", - "toml", - "tracing", - "tracing-core", - "tracing-subscriber", - "url", -] - -[[package]] -name = "conduwuit_database" -version = "1.0.0" -dependencies = [ - "async-channel", - "conduwuit_core", - "const-str", - "futures", - "log", - "minicbor", - "minicbor-serde", - "rust-rocksdb", - "serde", - "serde_json", - "tokio", - "tracing", -] - -[[package]] -name = "conduwuit_macros" -version = "1.0.0" -dependencies = [ - "itertools 0.14.0", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "conduwuit_router" -version = "1.0.0" -dependencies = [ - "axum", - "axum-client-ip", - "axum-server", - "axum-server-dual-protocol", - "bytes", - "conduwuit_admin", - "conduwuit_api", - "conduwuit_core", - "conduwuit_service", - "const-str", - "futures", - "http", - "http-body-util", - "hyper", - "hyper-util", - "log", - "ruma", - "rustls", - "sd-notify", - "sentry", - "sentry-tower", - "sentry-tracing", - "serde_json", - "tokio", - "tower 0.5.2", - "tower-http", - "tracing", -] - -[[package]] -name = "conduwuit_service" -version = "1.0.0" -dependencies = [ - "async-trait", - "base64 0.22.1", - "blurhash", - "bytes", - "conduwuit_core", - "conduwuit_database", - "const-str", - "either", - "futures", - "hickory-resolver 0.25.1", - "http", - "image", - "ipaddress", - "itertools 0.14.0", - "log", - "loole", - "lru-cache", - "rand 0.8.5", - "regex", - "reqwest", - "ruma", - "rustyline-async", - "serde", - "serde_json", - "serde_yaml", - "sha2", - "termimad", - "tokio", - "tracing", - "url", - "webpage", -] - [[package]] name = "console-api" version = "0.8.1" @@ -5066,6 +4828,245 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tuwunel" +version = "1.0.0" +dependencies = [ + "clap", + "console-subscriber", + "const-str", + "hardened_malloc-rs", + "log", + "opentelemetry", + "opentelemetry-jaeger", + "opentelemetry_sdk", + "sentry", + "sentry-tower", + "sentry-tracing", + "tokio", + "tokio-metrics", + "tracing", + "tracing-flame", + "tracing-opentelemetry", + "tracing-subscriber", + "tuwunel_admin", + "tuwunel_api", + "tuwunel_core", + "tuwunel_database", + "tuwunel_macros", + "tuwunel_router", + "tuwunel_service", +] + +[[package]] +name = "tuwunel_admin" +version = "1.0.0" +dependencies = [ + "clap", + "const-str", + "futures", + "log", + "ruma", + "serde_json", + "serde_yaml", + "tokio", + "tracing", + "tracing-subscriber", + "tuwunel_api", + "tuwunel_core", + "tuwunel_database", + "tuwunel_macros", + "tuwunel_service", +] + +[[package]] +name = "tuwunel_api" +version = "1.0.0" +dependencies = [ + "async-trait", + "axum", + "axum-client-ip", + "axum-extra", + "base64 0.22.1", + "bytes", + "const-str", + "futures", + "hmac", + "http", + "http-body-util", + "hyper", + "ipaddress", + "itertools 0.14.0", + "log", + "rand 0.8.5", + "reqwest", + "ruma", + "serde", + "serde_html_form", + "serde_json", + "sha1", + "tokio", + "tracing", + "tuwunel_core", + "tuwunel_service", +] + +[[package]] +name = "tuwunel_core" +version = "1.0.0" +dependencies = [ + "argon2", + "arrayvec", + "axum", + "axum-extra", + "bytes", + "bytesize", + "cargo_toml", + "checked_ops", + "chrono", + "clap", + "const-str", + "core_affinity", + "ctor", + "cyborgtime", + "either", + "figment", + "futures", + "hardened_malloc-rs", + "http", + "http-body-util", + "ipaddress", + "itertools 0.14.0", + "libc", + "libloading", + "log", + "maplit", + "nix", + "num-traits", + "rand 0.8.5", + "regex", + "reqwest", + "ring", + "ruma", + "sanitize-filename", + "serde", + "serde_json", + "serde_regex", + "serde_yaml", + "smallstr", + "smallvec", + "thiserror 2.0.12", + "tikv-jemalloc-ctl", + "tikv-jemalloc-sys", + "tikv-jemallocator", + "tokio", + "tokio-metrics", + "toml", + "tracing", + "tracing-core", + "tracing-subscriber", + "tuwunel_macros", + "url", +] + +[[package]] +name = "tuwunel_database" +version = "1.0.0" +dependencies = [ + "async-channel", + "const-str", + "futures", + "log", + "minicbor", + "minicbor-serde", + "rust-rocksdb", + "serde", + "serde_json", + "tokio", + "tracing", + "tuwunel_core", +] + +[[package]] +name = "tuwunel_macros" +version = "1.0.0" +dependencies = [ + "itertools 0.14.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tuwunel_router" +version = "1.0.0" +dependencies = [ + "axum", + "axum-client-ip", + "axum-server", + "axum-server-dual-protocol", + "bytes", + "const-str", + "futures", + "http", + "http-body-util", + "hyper", + "hyper-util", + "log", + "ruma", + "rustls", + "sd-notify", + "sentry", + "sentry-tower", + "sentry-tracing", + "serde_json", + "tokio", + "tower 0.5.2", + "tower-http", + "tracing", + "tuwunel_admin", + "tuwunel_api", + "tuwunel_core", + "tuwunel_service", +] + +[[package]] +name = "tuwunel_service" +version = "1.0.0" +dependencies = [ + "async-trait", + "base64 0.22.1", + "blurhash", + "bytes", + "const-str", + "either", + "futures", + "hickory-resolver 0.25.1", + "http", + "image", + "ipaddress", + "itertools 0.14.0", + "log", + "loole", + "lru-cache", + "rand 0.8.5", + "regex", + "reqwest", + "ruma", + "rustyline-async", + "serde", + "serde_json", + "serde_yaml", + "sha2", + "termimad", + "tokio", + "tracing", + "tuwunel_core", + "tuwunel_database", + "url", + "webpage", +] + [[package]] name = "typenum" version = "1.18.0" diff --git a/Cargo.toml b/Cargo.toml index 154a7437..ea192512 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -435,6 +435,9 @@ default-features = false features = [ "extra-traits", "full", + "parsing", + "proc-macro", + "printing", ] [workspace.dependencies.termimad] @@ -604,38 +607,38 @@ rev = "200e958941d522a70c5877e3d846f55b5586c68d" # Our crates # -[workspace.dependencies.conduwuit-router] -package = "conduwuit_router" +[workspace.dependencies.tuwunel-router] +package = "tuwunel_router" path = "src/router" default-features = false -[workspace.dependencies.conduwuit-admin] -package = "conduwuit_admin" +[workspace.dependencies.tuwunel-admin] +package = "tuwunel_admin" path = "src/admin" default-features = false -[workspace.dependencies.conduwuit-api] -package = "conduwuit_api" +[workspace.dependencies.tuwunel-api] +package = "tuwunel_api" path = "src/api" default-features = false -[workspace.dependencies.conduwuit-service] -package = "conduwuit_service" +[workspace.dependencies.tuwunel-service] +package = "tuwunel_service" path = "src/service" default-features = false -[workspace.dependencies.conduwuit-database] -package = "conduwuit_database" +[workspace.dependencies.tuwunel-database] +package = "tuwunel_database" path = "src/database" default-features = false -[workspace.dependencies.conduwuit-core] -package = "conduwuit_core" +[workspace.dependencies.tuwunel-core] +package = "tuwunel_core" path = "src/core" default-features = false -[workspace.dependencies.conduwuit-macros] -package = "conduwuit_macros" +[workspace.dependencies.tuwunel-macros] +package = "tuwunel_macros" path = "src/macros" default-features = false @@ -694,7 +697,7 @@ codegen-units = 32 # '-Clink-arg=-Wl,--no-gc-sections', #] -[profile.release-max-perf.package.conduwuit_macros] +[profile.release-max-perf.package.tuwunel_macros] inherits = "release-max-perf.build-override" #rustflags = [ # '-Crelocation-model=pic', @@ -728,7 +731,7 @@ panic = "unwind" debug-assertions = true incremental = true #rustflags = [ -# '--cfg', 'conduwuit_mods', +# '--cfg', 'tuwunel_mods', # '-Ztime-passes', # '-Zmir-opt-level=0', # '-Zvalidate-mir=false', @@ -745,11 +748,11 @@ incremental = true # '-Clink-arg=-Wl,-z,lazy', #] -[profile.dev.package.conduwuit_core] +[profile.dev.package.tuwunel_core] inherits = "dev" incremental = false #rustflags = [ -# '--cfg', 'conduwuit_mods', +# '--cfg', 'tuwunel_mods', # '-Ztime-passes', # '-Zmir-opt-level=0', # '-Ztls-model=initial-exec', @@ -766,10 +769,10 @@ incremental = false # '-Clink-arg=-Wl,-z,nodelete', #] -[profile.dev.package.conduwuit] +[profile.dev.package.tuwunel] inherits = "dev" #rustflags = [ -# '--cfg', 'conduwuit_mods', +# '--cfg', 'tuwunel_mods', # '-Ztime-passes', # '-Zmir-opt-level=0', # '-Zvalidate-mir=false', @@ -791,7 +794,7 @@ incremental = false codegen-units = 1 opt-level = 'z' #rustflags = [ -# '--cfg', 'conduwuit_mods', +# '--cfg', 'tuwunel_mods', # '-Ztls-model=global-dynamic', # '-Cprefer-dynamic=true', # '-Zstaticlib-prefer-dynamic=true', @@ -992,5 +995,5 @@ suspicious = { level = "warn", priority = -1 } ## some sadness let_underscore_future = { level = "allow", priority = 1 } -# rust doesnt understand conduwuit's custom log macros +# rust doesnt understand tuwunel's custom log macros literal_string_with_formatting_args = { level = "allow", priority = 1 } diff --git a/clippy.toml b/clippy.toml index 863759aa..7fb323b4 100644 --- a/clippy.toml +++ b/clippy.toml @@ -8,13 +8,13 @@ type-complexity-threshold = 250 # reduce me to ~200 large-error-threshold = 256 # TODO reduce me ALARA disallowed-macros = [ - { path = "log::error", reason = "use conduwuit_core::error" }, - { path = "log::warn", reason = "use conduwuit_core::warn" }, - { path = "log::info", reason = "use conduwuit_core::info" }, - { path = "log::debug", reason = "use conduwuit_core::debug" }, - { path = "log::trace", reason = "use conduwuit_core::trace" }, + { path = "log::error", reason = "use tuwunel_core::error" }, + { path = "log::warn", reason = "use tuwunel_core::warn" }, + { path = "log::info", reason = "use tuwunel_core::info" }, + { path = "log::debug", reason = "use tuwunel_core::debug" }, + { path = "log::trace", reason = "use tuwunel_core::trace" }, ] disallowed-methods = [ - { path = "tokio::spawn", reason = "use and pass conduuwit_core::server::Server::runtime() to spawn from" }, + { path = "tokio::spawn", reason = "use and pass tuwunel_core::server::Server::runtime() to spawn from" }, ] diff --git a/src/admin/Cargo.toml b/src/admin/Cargo.toml index 7896ef97..686f2960 100644 --- a/src/admin/Cargo.toml +++ b/src/admin/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "conduwuit_admin" +name = "tuwunel_admin" categories.workspace = true description.workspace = true edition.workspace = true @@ -18,68 +18,68 @@ crate-type = [ [features] brotli_compression = [ - "conduwuit-api/brotli_compression", - "conduwuit-core/brotli_compression", - "conduwuit-service/brotli_compression", + "tuwunel-api/brotli_compression", + "tuwunel-core/brotli_compression", + "tuwunel-service/brotli_compression", ] gzip_compression = [ - "conduwuit-api/gzip_compression", - "conduwuit-core/gzip_compression", - "conduwuit-service/gzip_compression", + "tuwunel-api/gzip_compression", + "tuwunel-core/gzip_compression", + "tuwunel-service/gzip_compression", ] io_uring = [ - "conduwuit-api/io_uring", - "conduwuit-database/io_uring", - "conduwuit-service/io_uring", + "tuwunel-api/io_uring", + "tuwunel-database/io_uring", + "tuwunel-service/io_uring", ] jemalloc = [ - "conduwuit-api/jemalloc", - "conduwuit-core/jemalloc", - "conduwuit-database/jemalloc", - "conduwuit-service/jemalloc", + "tuwunel-api/jemalloc", + "tuwunel-core/jemalloc", + "tuwunel-database/jemalloc", + "tuwunel-service/jemalloc", ] jemalloc_conf = [ - "conduwuit-api/jemalloc_conf", - "conduwuit-core/jemalloc_conf", - "conduwuit-database/jemalloc_conf", - "conduwuit-service/jemalloc_conf", + "tuwunel-api/jemalloc_conf", + "tuwunel-core/jemalloc_conf", + "tuwunel-database/jemalloc_conf", + "tuwunel-service/jemalloc_conf", ] jemalloc_prof = [ - "conduwuit-api/jemalloc_prof", - "conduwuit-core/jemalloc_prof", - "conduwuit-database/jemalloc_prof", - "conduwuit-service/jemalloc_prof", + "tuwunel-api/jemalloc_prof", + "tuwunel-core/jemalloc_prof", + "tuwunel-database/jemalloc_prof", + "tuwunel-service/jemalloc_prof", ] jemalloc_stats = [ - "conduwuit-api/jemalloc_stats", - "conduwuit-core/jemalloc_stats", - "conduwuit-database/jemalloc_stats", - "conduwuit-service/jemalloc_stats", + "tuwunel-api/jemalloc_stats", + "tuwunel-core/jemalloc_stats", + "tuwunel-database/jemalloc_stats", + "tuwunel-service/jemalloc_stats", ] release_max_log_level = [ - "conduwuit-api/release_max_log_level", - "conduwuit-core/release_max_log_level", - "conduwuit-database/release_max_log_level", - "conduwuit-service/release_max_log_level", + "tuwunel-api/release_max_log_level", + "tuwunel-core/release_max_log_level", + "tuwunel-database/release_max_log_level", + "tuwunel-service/release_max_log_level", "tracing/max_level_trace", "tracing/release_max_level_info", "log/max_level_trace", "log/release_max_level_info", ] zstd_compression = [ - "conduwuit-api/zstd_compression", - "conduwuit-core/zstd_compression", - "conduwuit-database/zstd_compression", - "conduwuit-service/zstd_compression", + "tuwunel-api/zstd_compression", + "tuwunel-core/zstd_compression", + "tuwunel-database/zstd_compression", + "tuwunel-service/zstd_compression", ] [dependencies] clap.workspace = true -conduwuit-api.workspace = true -conduwuit-core.workspace = true -conduwuit-database.workspace = true -conduwuit-macros.workspace = true -conduwuit-service.workspace = true +tuwunel-api.workspace = true +tuwunel-core.workspace = true +tuwunel-database.workspace = true +tuwunel-macros.workspace = true +tuwunel-service.workspace = true const-str.workspace = true futures.workspace = true log.workspace = true diff --git a/src/admin/admin.rs b/src/admin/admin.rs index 0d636c72..1eaa83a3 100644 --- a/src/admin/admin.rs +++ b/src/admin/admin.rs @@ -1,5 +1,5 @@ use clap::Parser; -use conduwuit::Result; +use tuwunel_core::Result; use crate::{ appservice, appservice::AppserviceCommand, check, check::CheckCommand, context::Context, @@ -9,7 +9,7 @@ use crate::{ }; #[derive(Debug, Parser)] -#[command(name = "conduwuit", version = conduwuit::version())] +#[command(name = "tuwunel", version = tuwunel_core::version())] pub(super) enum AdminCommand { #[command(subcommand)] /// - Commands for managing appservices diff --git a/src/admin/appservice/commands.rs b/src/admin/appservice/commands.rs index 3575e067..1ed8362c 100644 --- a/src/admin/appservice/commands.rs +++ b/src/admin/appservice/commands.rs @@ -1,5 +1,5 @@ -use conduwuit::{Err, Result, checked}; use futures::{FutureExt, StreamExt, TryFutureExt}; +use tuwunel_core::{Err, Result, checked}; use crate::admin_command; diff --git a/src/admin/appservice/mod.rs b/src/admin/appservice/mod.rs index 2e0694aa..3fc21711 100644 --- a/src/admin/appservice/mod.rs +++ b/src/admin/appservice/mod.rs @@ -1,7 +1,7 @@ mod commands; use clap::Subcommand; -use conduwuit::Result; +use tuwunel_core::Result; use crate::admin_command_dispatch; diff --git a/src/admin/check/commands.rs b/src/admin/check/commands.rs index 1ffc3ae5..d111c7cc 100644 --- a/src/admin/check/commands.rs +++ b/src/admin/check/commands.rs @@ -1,6 +1,6 @@ -use conduwuit::Result; -use conduwuit_macros::implement; use futures::StreamExt; +use tuwunel_core::Result; +use tuwunel_macros::implement; use crate::Context; diff --git a/src/admin/check/mod.rs b/src/admin/check/mod.rs index 30b335c4..408e6ba2 100644 --- a/src/admin/check/mod.rs +++ b/src/admin/check/mod.rs @@ -1,7 +1,7 @@ mod commands; use clap::Subcommand; -use conduwuit::Result; +use tuwunel_core::Result; use crate::admin_command_dispatch; diff --git a/src/admin/context.rs b/src/admin/context.rs index 270537be..b141e1eb 100644 --- a/src/admin/context.rs +++ b/src/admin/context.rs @@ -1,13 +1,13 @@ use std::{fmt, time::SystemTime}; -use conduwuit::Result; -use conduwuit_service::Services; use futures::{ Future, FutureExt, TryFutureExt, io::{AsyncWriteExt, BufWriter}, lock::Mutex, }; use ruma::EventId; +use tuwunel_core::Result; +use tuwunel_service::Services; pub(crate) struct Context<'a> { pub(crate) services: &'a Services, diff --git a/src/admin/debug/commands.rs b/src/admin/debug/commands.rs index d0debc2a..53baa4b3 100644 --- a/src/admin/debug/commands.rs +++ b/src/admin/debug/commands.rs @@ -5,7 +5,14 @@ use std::{ time::{Instant, SystemTime}, }; -use conduwuit::{ +use futures::{FutureExt, StreamExt, TryStreamExt}; +use ruma::{ + CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId, + OwnedRoomOrAliasId, OwnedServerName, RoomId, RoomVersionId, + api::federation::event::get_room_state, +}; +use tracing_subscriber::EnvFilter; +use tuwunel_core::{ Err, Result, debug_error, err, info, matrix::pdu::{PduEvent, PduId, RawPduId}, trace, utils, @@ -15,17 +22,10 @@ use conduwuit::{ }, warn, }; -use futures::{FutureExt, StreamExt, TryStreamExt}; -use ruma::{ - CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId, - OwnedRoomOrAliasId, OwnedServerName, RoomId, RoomVersionId, - api::federation::event::get_room_state, -}; -use service::rooms::{ +use tuwunel_service::rooms::{ short::{ShortEventId, ShortRoomId}, state_compressor::HashSetCompressStateEvent, }; -use tracing_subscriber::EnvFilter; use crate::admin_command; @@ -764,7 +764,7 @@ pub(super) async fn memory_stats(&self, opts: Option) -> Result { }) .collect(); - let stats = conduwuit::alloc::memory_stats(&opts).unwrap_or_default(); + let stats = tuwunel_core::alloc::memory_stats(&opts).unwrap_or_default(); self.write_str("```\n").await?; self.write_str(&stats).await?; @@ -902,7 +902,7 @@ pub(super) async fn database_files(&self, map: Option, level: Option Result { - conduwuit::alloc::trim(None)?; + tuwunel_core::alloc::trim(None)?; writeln!(self, "done").await } diff --git a/src/admin/debug/mod.rs b/src/admin/debug/mod.rs index 9b86f18c..b4c75705 100644 --- a/src/admin/debug/mod.rs +++ b/src/admin/debug/mod.rs @@ -2,9 +2,9 @@ mod commands; pub(crate) mod tester; use clap::Subcommand; -use conduwuit::Result; use ruma::{OwnedEventId, OwnedRoomId, OwnedRoomOrAliasId, OwnedServerName}; -use service::rooms::short::{ShortEventId, ShortRoomId}; +use tuwunel_core::Result; +use tuwunel_service::rooms::short::{ShortEventId, ShortRoomId}; use self::tester::TesterCommand; use crate::admin_command_dispatch; @@ -32,13 +32,13 @@ pub(super) enum DebugCommand { /// the command. ParsePdu, - /// - Retrieve and print a PDU by EventID from the conduwuit database + /// - Retrieve and print a PDU by EventID from the tuwunel database GetPdu { /// An event ID (a $ followed by the base64 reference hash) event_id: OwnedEventId, }, - /// - Retrieve and print a PDU by PduId from the conduwuit database + /// - Retrieve and print a PDU by PduId from the tuwunel database GetShortPdu { /// Shortroomid integer shortroomid: ShortRoomId, @@ -179,7 +179,7 @@ pub(super) enum DebugCommand { server_name: OwnedServerName, }, - /// - Runs a server name through conduwuit's true destination resolution + /// - Runs a server name through tuwunel's true destination resolution /// process /// /// Useful for debugging well-known issues diff --git a/src/admin/debug/tester.rs b/src/admin/debug/tester.rs index 0a2b1516..ffc9fc7b 100644 --- a/src/admin/debug/tester.rs +++ b/src/admin/debug/tester.rs @@ -1,4 +1,4 @@ -use conduwuit::{Err, Result}; +use tuwunel_core::{Err, Result}; use crate::{admin_command, admin_command_dispatch}; diff --git a/src/admin/federation/commands.rs b/src/admin/federation/commands.rs index 545dcbca..edaac410 100644 --- a/src/admin/federation/commands.rs +++ b/src/admin/federation/commands.rs @@ -1,8 +1,8 @@ use std::fmt::Write; -use conduwuit::{Err, Result}; use futures::StreamExt; use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId}; +use tuwunel_core::{Err, Result}; use crate::{admin_command, get_room_info}; diff --git a/src/admin/federation/mod.rs b/src/admin/federation/mod.rs index 2c539adc..412202ef 100644 --- a/src/admin/federation/mod.rs +++ b/src/admin/federation/mod.rs @@ -1,8 +1,8 @@ mod commands; use clap::Subcommand; -use conduwuit::Result; use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId}; +use tuwunel_core::Result; use crate::admin_command_dispatch; diff --git a/src/admin/media/commands.rs b/src/admin/media/commands.rs index 7aed28db..3177136b 100644 --- a/src/admin/media/commands.rs +++ b/src/admin/media/commands.rs @@ -1,11 +1,11 @@ use std::time::Duration; -use conduwuit::{ +use ruma::{Mxc, OwnedEventId, OwnedMxcUri, OwnedServerName}; +use tuwunel_core::{ Err, Result, debug, debug_info, debug_warn, error, info, trace, utils::time::parse_timepoint_ago, warn, }; -use conduwuit_service::media::Dim; -use ruma::{Mxc, OwnedEventId, OwnedMxcUri, OwnedServerName}; +use tuwunel_service::media::Dim; use crate::{admin_command, utils::parse_local_user_id}; diff --git a/src/admin/media/mod.rs b/src/admin/media/mod.rs index d1e6cd3a..06c9a091 100644 --- a/src/admin/media/mod.rs +++ b/src/admin/media/mod.rs @@ -2,8 +2,8 @@ mod commands; use clap::Subcommand; -use conduwuit::Result; use ruma::{OwnedEventId, OwnedMxcUri, OwnedServerName}; +use tuwunel_core::Result; use crate::admin_command_dispatch; diff --git a/src/admin/mod.rs b/src/admin/mod.rs index 1f777fa9..2792a35d 100644 --- a/src/admin/mod.rs +++ b/src/admin/mod.rs @@ -19,22 +19,18 @@ pub(crate) mod room; pub(crate) mod server; pub(crate) mod user; -extern crate conduwuit_api as api; -extern crate conduwuit_core as conduwuit; -extern crate conduwuit_service as service; - -pub(crate) use conduwuit_macros::{admin_command, admin_command_dispatch}; +pub(crate) use tuwunel_macros::{admin_command, admin_command_dispatch}; pub(crate) use crate::{context::Context, utils::get_room_info}; pub(crate) const PAGE_SIZE: usize = 100; -conduwuit::mod_ctor! {} -conduwuit::mod_dtor! {} -conduwuit::rustc_flags_capture! {} +tuwunel_core::mod_ctor! {} +tuwunel_core::mod_dtor! {} +tuwunel_core::rustc_flags_capture! {} /// Install the admin command processor -pub async fn init(admin_service: &service::admin::Service) { +pub async fn init(admin_service: &tuwunel_service::admin::Service) { _ = admin_service .complete .write() @@ -48,7 +44,7 @@ pub async fn init(admin_service: &service::admin::Service) { } /// Uninstall the admin command handler -pub async fn fini(admin_service: &service::admin::Service) { +pub async fn fini(admin_service: &tuwunel_service::admin::Service) { _ = admin_service.handle.write().await.take(); _ = admin_service .complete diff --git a/src/admin/processor.rs b/src/admin/processor.rs index 8282a846..f94a8113 100644 --- a/src/admin/processor.rs +++ b/src/admin/processor.rs @@ -7,7 +7,17 @@ use std::{ }; use clap::{CommandFactory, Parser}; -use conduwuit::{ +use futures::{AsyncWriteExt, future::FutureExt, io::BufWriter}; +use ruma::{ + EventId, + events::{ + relation::InReplyTo, + room::message::{Relation::Reply, RoomMessageEventContent}, + }, +}; +use tracing::Level; +use tracing_subscriber::{EnvFilter, filter::LevelFilter}; +use tuwunel_core::{ Error, Result, debug, error, log::{ capture, @@ -18,20 +28,10 @@ use conduwuit::{ utils::string::{collect_stream, common_prefix}, warn, }; -use futures::{AsyncWriteExt, future::FutureExt, io::BufWriter}; -use ruma::{ - EventId, - events::{ - relation::InReplyTo, - room::message::{Relation::Reply, RoomMessageEventContent}, - }, -}; -use service::{ +use tuwunel_service::{ Services, admin::{CommandInput, CommandOutput, ProcessorFuture, ProcessorResult}, }; -use tracing::Level; -use tracing_subscriber::{EnvFilter, filter::LevelFilter}; use crate::{admin, admin::AdminCommand, context::Context}; @@ -94,7 +94,8 @@ async fn process_command(services: Arc, input: &CommandInput) -> Proce #[allow(clippy::result_large_err)] fn handle_panic(error: &Error, command: &CommandInput) -> ProcessorResult { let link = - "Please submit a [bug report](https://github.com/girlbossceo/conduwuit/issues/new). 🥺"; + "Please submit a [bug report](https://github.com/matrix-construct/tuwunel/issues/new). \ + 🥺"; let msg = format!("Panic occurred while processing command:\n```\n{error:#?}\n```\n{link}"); let content = RoomMessageEventContent::notice_markdown(msg); error!("Panic while processing command: {error:?}"); diff --git a/src/admin/query/account_data.rs b/src/admin/query/account_data.rs index 228d2120..61065686 100644 --- a/src/admin/query/account_data.rs +++ b/src/admin/query/account_data.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::Result; use futures::StreamExt; use ruma::{OwnedRoomId, OwnedUserId}; +use tuwunel_core::Result; use crate::{admin_command, admin_command_dispatch}; diff --git a/src/admin/query/appservice.rs b/src/admin/query/appservice.rs index 28bf6451..ad28796f 100644 --- a/src/admin/query/appservice.rs +++ b/src/admin/query/appservice.rs @@ -1,6 +1,6 @@ use clap::Subcommand; -use conduwuit::Result; use futures::TryStreamExt; +use tuwunel_core::Result; use crate::Context; diff --git a/src/admin/query/globals.rs b/src/admin/query/globals.rs index d6dd1455..34717ff3 100644 --- a/src/admin/query/globals.rs +++ b/src/admin/query/globals.rs @@ -1,6 +1,6 @@ use clap::Subcommand; -use conduwuit::Result; use ruma::OwnedServerName; +use tuwunel_core::Result; use crate::Context; diff --git a/src/admin/query/mod.rs b/src/admin/query/mod.rs index da27eb1d..2cf95c10 100644 --- a/src/admin/query/mod.rs +++ b/src/admin/query/mod.rs @@ -13,7 +13,7 @@ mod short; mod users; use clap::Subcommand; -use conduwuit::Result; +use tuwunel_core::Result; use self::{ account_data::AccountDataCommand, appservice::AppserviceCommand, globals::GlobalsCommand, diff --git a/src/admin/query/presence.rs b/src/admin/query/presence.rs index 5b7ead4b..d21795d7 100644 --- a/src/admin/query/presence.rs +++ b/src/admin/query/presence.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::Result; use futures::StreamExt; use ruma::OwnedUserId; +use tuwunel_core::Result; use crate::Context; diff --git a/src/admin/query/pusher.rs b/src/admin/query/pusher.rs index 0d0e6cc9..ce33639a 100644 --- a/src/admin/query/pusher.rs +++ b/src/admin/query/pusher.rs @@ -1,6 +1,6 @@ use clap::Subcommand; -use conduwuit::Result; use ruma::OwnedUserId; +use tuwunel_core::Result; use crate::Context; diff --git a/src/admin/query/raw.rs b/src/admin/query/raw.rs index 0e248c65..2bccd54f 100644 --- a/src/admin/query/raw.rs +++ b/src/admin/query/raw.rs @@ -1,17 +1,17 @@ use std::{borrow::Cow, collections::BTreeMap, ops::Deref, sync::Arc}; use clap::Subcommand; -use conduwuit::{ +use futures::{FutureExt, Stream, StreamExt, TryStreamExt}; +use tokio::time::Instant; +use tuwunel_core::{ Err, Result, apply, at, is_zero, utils::{ stream::{IterStream, ReadyExt, TryIgnore, TryParallelExt}, string::EMPTY, }, }; -use conduwuit_database::Map; -use conduwuit_service::Services; -use futures::{FutureExt, Stream, StreamExt, TryStreamExt}; -use tokio::time::Instant; +use tuwunel_database::Map; +use tuwunel_service::Services; use crate::{admin_command, admin_command_dispatch}; @@ -170,7 +170,7 @@ pub(super) async fn compact( parallelism: Option, exhaustive: bool, ) -> Result { - use conduwuit_database::compact::Options; + use tuwunel_database::compact::Options; let default_all_maps: Option<_> = map.is_none().then(|| { self.services diff --git a/src/admin/query/resolver.rs b/src/admin/query/resolver.rs index 4a39a40e..e02465f4 100644 --- a/src/admin/query/resolver.rs +++ b/src/admin/query/resolver.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::{Result, utils::time}; use futures::StreamExt; use ruma::OwnedServerName; +use tuwunel_core::{Result, utils::time}; use crate::{admin_command, admin_command_dispatch}; @@ -22,7 +22,7 @@ pub(crate) enum ResolverCommand { #[admin_command] async fn destinations_cache(&self, server_name: Option) -> Result { - use service::resolver::cache::CachedDest; + use tuwunel_service::resolver::cache::CachedDest; writeln!(self, "| Server Name | Destination | Hostname | Expires |").await?; writeln!(self, "| ----------- | ----------- | -------- | ------- |").await?; @@ -46,7 +46,7 @@ async fn destinations_cache(&self, server_name: Option) -> Resu #[admin_command] async fn overrides_cache(&self, server_name: Option) -> Result { - use service::resolver::cache::CachedOverride; + use tuwunel_service::resolver::cache::CachedOverride; writeln!(self, "| Server Name | IP | Port | Expires | Overriding |").await?; writeln!(self, "| ----------- | --- | ----:| ------- | ---------- |").await?; diff --git a/src/admin/query/room_alias.rs b/src/admin/query/room_alias.rs index b646beec..57f779df 100644 --- a/src/admin/query/room_alias.rs +++ b/src/admin/query/room_alias.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::Result; use futures::StreamExt; use ruma::{OwnedRoomAliasId, OwnedRoomId}; +use tuwunel_core::Result; use crate::Context; diff --git a/src/admin/query/room_state_cache.rs b/src/admin/query/room_state_cache.rs index c64cd173..ff192d04 100644 --- a/src/admin/query/room_state_cache.rs +++ b/src/admin/query/room_state_cache.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::Result; use futures::StreamExt; use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId}; +use tuwunel_core::Result; use crate::Context; diff --git a/src/admin/query/room_timeline.rs b/src/admin/query/room_timeline.rs index 0fd22ca7..e55abe02 100644 --- a/src/admin/query/room_timeline.rs +++ b/src/admin/query/room_timeline.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::{PduCount, Result, utils::stream::TryTools}; use futures::TryStreamExt; use ruma::OwnedRoomOrAliasId; +use tuwunel_core::{PduCount, Result, utils::stream::TryTools}; use crate::{admin_command, admin_command_dispatch}; diff --git a/src/admin/query/sending.rs b/src/admin/query/sending.rs index 8b1676bc..65dbb55c 100644 --- a/src/admin/query/sending.rs +++ b/src/admin/query/sending.rs @@ -1,8 +1,8 @@ use clap::Subcommand; -use conduwuit::{Err, Result}; use futures::StreamExt; use ruma::{OwnedServerName, OwnedUserId}; -use service::sending::Destination; +use tuwunel_core::{Err, Result}; +use tuwunel_service::sending::Destination; use crate::Context; diff --git a/src/admin/query/short.rs b/src/admin/query/short.rs index aa7c8666..21b3f796 100644 --- a/src/admin/query/short.rs +++ b/src/admin/query/short.rs @@ -1,6 +1,6 @@ use clap::Subcommand; -use conduwuit::Result; use ruma::{OwnedEventId, OwnedRoomOrAliasId}; +use tuwunel_core::Result; use crate::{admin_command, admin_command_dispatch}; diff --git a/src/admin/query/users.rs b/src/admin/query/users.rs index 0f34d13f..df545c1a 100644 --- a/src/admin/query/users.rs +++ b/src/admin/query/users.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::Result; use futures::stream::StreamExt; use ruma::{OwnedDeviceId, OwnedRoomId, OwnedUserId}; +use tuwunel_core::Result; use crate::{admin_command, admin_command_dispatch}; diff --git a/src/admin/room/alias.rs b/src/admin/room/alias.rs index 6b37ffe4..f94ae325 100644 --- a/src/admin/room/alias.rs +++ b/src/admin/room/alias.rs @@ -1,9 +1,9 @@ use std::fmt::Write; use clap::Subcommand; -use conduwuit::{Err, Result}; use futures::StreamExt; use ruma::{OwnedRoomAliasId, OwnedRoomId}; +use tuwunel_core::{Err, Result}; use crate::Context; diff --git a/src/admin/room/commands.rs b/src/admin/room/commands.rs index 81f36f15..c5572c67 100644 --- a/src/admin/room/commands.rs +++ b/src/admin/room/commands.rs @@ -1,6 +1,6 @@ -use conduwuit::{Err, Result}; use futures::StreamExt; use ruma::OwnedRoomId; +use tuwunel_core::{Err, Result}; use crate::{PAGE_SIZE, admin_command, get_room_info}; diff --git a/src/admin/room/directory.rs b/src/admin/room/directory.rs index a6be9a15..f10619b8 100644 --- a/src/admin/room/directory.rs +++ b/src/admin/room/directory.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::{Err, Result}; use futures::StreamExt; use ruma::OwnedRoomId; +use tuwunel_core::{Err, Result}; use crate::{Context, PAGE_SIZE, get_room_info}; diff --git a/src/admin/room/info.rs b/src/admin/room/info.rs index 1278e820..4af51889 100644 --- a/src/admin/room/info.rs +++ b/src/admin/room/info.rs @@ -1,7 +1,7 @@ use clap::Subcommand; -use conduwuit::{Err, Result, utils::ReadyExt}; use futures::StreamExt; use ruma::OwnedRoomId; +use tuwunel_core::{Err, Result, utils::ReadyExt}; use crate::{admin_command, admin_command_dispatch}; diff --git a/src/admin/room/mod.rs b/src/admin/room/mod.rs index 26d2c2d8..357c5741 100644 --- a/src/admin/room/mod.rs +++ b/src/admin/room/mod.rs @@ -5,8 +5,8 @@ mod info; mod moderation; use clap::Subcommand; -use conduwuit::Result; use ruma::OwnedRoomId; +use tuwunel_core::Result; use self::{ alias::RoomAliasCommand, directory::RoomDirectoryCommand, info::RoomInfoCommand, diff --git a/src/admin/room/moderation.rs b/src/admin/room/moderation.rs index ee429fc6..62fd6347 100644 --- a/src/admin/room/moderation.rs +++ b/src/admin/room/moderation.rs @@ -1,12 +1,12 @@ -use api::client::leave_room; use clap::Subcommand; -use conduwuit::{ +use futures::StreamExt; +use ruma::{OwnedRoomId, OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId}; +use tuwunel_api::client::leave_room; +use tuwunel_core::{ Err, Result, debug, utils::{IterStream, ReadyExt}, warn, }; -use futures::StreamExt; -use ruma::{OwnedRoomId, OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId}; use crate::{admin_command, admin_command_dispatch, get_room_info}; diff --git a/src/admin/server/commands.rs b/src/admin/server/commands.rs index 6027a9eb..f07731d7 100644 --- a/src/admin/server/commands.rs +++ b/src/admin/server/commands.rs @@ -1,11 +1,11 @@ use std::{fmt::Write, path::PathBuf, sync::Arc}; -use conduwuit::{ +use futures::TryStreamExt; +use tuwunel_core::{ Err, Result, info, utils::{stream::IterStream, time}, warn, }; -use futures::TryStreamExt; use crate::admin_command; @@ -68,8 +68,8 @@ pub(super) async fn list_features(&self, available: bool, enabled: bool, comma: pub(super) async fn memory_usage(&self) -> Result { let services_usage = self.services.memory_usage().await?; let database_usage = self.services.db.db.memory_usage()?; - let allocator_usage = - conduwuit::alloc::memory_usage().map_or(String::new(), |s| format!("\nAllocator:\n{s}")); + let allocator_usage = tuwunel_core::alloc::memory_usage() + .map_or(String::new(), |s| format!("\nAllocator:\n{s}")); self.write_str(&format!( "Services:\n{services_usage}\nDatabase:\n{database_usage}{allocator_usage}", @@ -131,7 +131,7 @@ pub(super) async fn reload_mods(&self) -> Result { #[admin_command] #[cfg(unix)] pub(super) async fn restart(&self, force: bool) -> Result { - use conduwuit::utils::sys::current_exe_deleted; + use tuwunel_core::utils::sys::current_exe_deleted; if !force && current_exe_deleted() { return Err!( diff --git a/src/admin/server/mod.rs b/src/admin/server/mod.rs index 60615365..ac6cdeaf 100644 --- a/src/admin/server/mod.rs +++ b/src/admin/server/mod.rs @@ -3,7 +3,7 @@ mod commands; use std::path::PathBuf; use clap::Subcommand; -use conduwuit::Result; +use tuwunel_core::Result; use crate::admin_command_dispatch; @@ -36,7 +36,7 @@ pub(super) enum ServerCommand { /// - Print database memory usage statistics MemoryUsage, - /// - Clears all of Conduwuit's caches + /// - Clears all of Tuwunel's caches ClearCaches, /// - Performs an online backup of the database (only available for RocksDB diff --git a/src/admin/user/commands.rs b/src/admin/user/commands.rs index e5e481e5..3baaa103 100644 --- a/src/admin/user/commands.rs +++ b/src/admin/user/commands.rs @@ -1,13 +1,5 @@ use std::{collections::BTreeMap, fmt::Write as _}; -use api::client::{full_user_deactivate, join_room_by_id_helper, leave_room}; -use conduwuit::{ - Err, Result, debug, debug_warn, error, info, is_equal_to, - matrix::pdu::PduBuilder, - utils::{self, ReadyExt}, - warn, -}; -use conduwuit_api::client::{leave_all_rooms, update_avatar_url, update_displayname}; use futures::StreamExt; use ruma::{ OwnedEventId, OwnedRoomId, OwnedRoomOrAliasId, OwnedUserId, UserId, @@ -20,6 +12,16 @@ use ruma::{ tag::{TagEvent, TagEventContent, TagInfo}, }, }; +use tuwunel_api::client::{ + full_user_deactivate, join_room_by_id_helper, leave_all_rooms, leave_room, update_avatar_url, + update_displayname, +}; +use tuwunel_core::{ + Err, Result, debug, debug_warn, error, info, is_equal_to, + matrix::pdu::PduBuilder, + utils::{self, ReadyExt}, + warn, +}; use crate::{ admin_command, get_room_info, diff --git a/src/admin/user/mod.rs b/src/admin/user/mod.rs index e789376a..c8459652 100644 --- a/src/admin/user/mod.rs +++ b/src/admin/user/mod.rs @@ -1,8 +1,8 @@ mod commands; use clap::Subcommand; -use conduwuit::Result; use ruma::{OwnedEventId, OwnedRoomId, OwnedRoomOrAliasId}; +use tuwunel_core::Result; use crate::admin_command_dispatch; diff --git a/src/admin/utils.rs b/src/admin/utils.rs index ea9696b2..c45b629a 100644 --- a/src/admin/utils.rs +++ b/src/admin/utils.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] -use conduwuit_core::{Err, Result, err}; use ruma::{OwnedRoomId, OwnedUserId, RoomId, UserId}; -use service::Services; +use tuwunel_core::{Err, Result, err}; +use tuwunel_service::Services; pub(crate) fn escape_html(s: &str) -> String { s.replace('&', "&") diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml index 15ada812..fb723b46 100644 --- a/src/api/Cargo.toml +++ b/src/api/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "conduwuit_api" +name = "tuwunel_api" categories.workspace = true description.workspace = true edition.workspace = true @@ -18,48 +18,48 @@ crate-type = [ [features] brotli_compression = [ - "conduwuit-core/brotli_compression", - "conduwuit-service/brotli_compression", + "tuwunel-core/brotli_compression", + "tuwunel-service/brotli_compression", "reqwest/brotli", ] element_hacks = [ - "conduwuit-service/element_hacks", + "tuwunel-service/element_hacks", ] gzip_compression = [ - "conduwuit-core/gzip_compression", - "conduwuit-service/gzip_compression", + "tuwunel-core/gzip_compression", + "tuwunel-service/gzip_compression", "reqwest/gzip", ] io_uring = [ - "conduwuit-service/io_uring", + "tuwunel-service/io_uring", ] jemalloc = [ - "conduwuit-core/jemalloc", - "conduwuit-service/jemalloc", + "tuwunel-core/jemalloc", + "tuwunel-service/jemalloc", ] jemalloc_conf = [ - "conduwuit-core/jemalloc_conf", - "conduwuit-service/jemalloc_conf", + "tuwunel-core/jemalloc_conf", + "tuwunel-service/jemalloc_conf", ] jemalloc_prof = [ - "conduwuit-core/jemalloc_prof", - "conduwuit-service/jemalloc_prof", + "tuwunel-core/jemalloc_prof", + "tuwunel-service/jemalloc_prof", ] jemalloc_stats = [ - "conduwuit-core/jemalloc_stats", - "conduwuit-service/jemalloc_stats", + "tuwunel-core/jemalloc_stats", + "tuwunel-service/jemalloc_stats", ] release_max_log_level = [ - "conduwuit-core/release_max_log_level", - "conduwuit-service/release_max_log_level", + "tuwunel-core/release_max_log_level", + "tuwunel-service/release_max_log_level", "log/max_level_trace", "log/release_max_level_info", "tracing/max_level_trace", "tracing/release_max_level_info", ] zstd_compression = [ - "conduwuit-core/zstd_compression", - "conduwuit-service/zstd_compression", + "tuwunel-core/zstd_compression", + "tuwunel-service/zstd_compression", "reqwest/zstd", ] @@ -70,8 +70,8 @@ axum-extra.workspace = true axum.workspace = true base64.workspace = true bytes.workspace = true -conduwuit-core.workspace = true -conduwuit-service.workspace = true +tuwunel-core.workspace = true +tuwunel-service.workspace = true const-str.workspace = true futures.workspace = true hmac.workspace = true diff --git a/src/api/client/account.rs b/src/api/client/account.rs index 32f2530c..1157d94c 100644 --- a/src/api/client/account.rs +++ b/src/api/client/account.rs @@ -2,14 +2,6 @@ use std::fmt::Write; use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Error, Result, debug_info, err, error, info, is_equal_to, - matrix::pdu::PduBuilder, - utils, - utils::{ReadyExt, stream::BroadbandExt}, - warn, -}; -use conduwuit_service::Services; use futures::{FutureExt, StreamExt}; use register::RegistrationKind; use ruma::{ @@ -33,6 +25,14 @@ use ruma::{ }, push, }; +use tuwunel_core::{ + Err, Error, Result, debug_info, err, error, info, is_equal_to, + matrix::pdu::PduBuilder, + utils, + utils::{ReadyExt, stream::BroadbandExt}, + warn, +}; +use tuwunel_service::Services; use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH, join_room_by_id_helper}; use crate::Ruma; diff --git a/src/api/client/account_data.rs b/src/api/client/account_data.rs index e44ce4e7..f9e22eb7 100644 --- a/src/api/client/account_data.rs +++ b/src/api/client/account_data.rs @@ -1,6 +1,4 @@ use axum::extract::State; -use conduwuit::{Err, Result, err}; -use conduwuit_service::Services; use ruma::{ RoomId, UserId, api::client::config::{ @@ -15,6 +13,8 @@ use ruma::{ }; use serde::Deserialize; use serde_json::{json, value::RawValue as RawJsonValue}; +use tuwunel_core::{Err, Result, err}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/client/alias.rs b/src/api/client/alias.rs index 9f1b05f8..5bb4f529 100644 --- a/src/api/client/alias.rs +++ b/src/api/client/alias.rs @@ -1,12 +1,12 @@ use axum::extract::State; -use conduwuit::{Err, Result, debug}; -use conduwuit_service::Services; use futures::StreamExt; use rand::seq::SliceRandom; use ruma::{ OwnedServerName, RoomAliasId, RoomId, api::client::alias::{create_alias, delete_alias, get_alias}, }; +use tuwunel_core::{Err, Result, debug}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/client/appservice.rs b/src/api/client/appservice.rs index eb6b3312..bea665f3 100644 --- a/src/api/client/appservice.rs +++ b/src/api/client/appservice.rs @@ -1,6 +1,6 @@ use axum::extract::State; -use conduwuit::{Err, Result, err}; use ruma::api::{appservice::ping, client::appservice::request_ping}; +use tuwunel_core::{Err, Result, err}; use crate::Ruma; diff --git a/src/api/client/backup.rs b/src/api/client/backup.rs index 2ad37cf3..15b19348 100644 --- a/src/api/client/backup.rs +++ b/src/api/client/backup.rs @@ -1,7 +1,6 @@ use std::cmp::Ordering; use axum::extract::State; -use conduwuit::{Err, Result, err}; use ruma::{ UInt, api::client::backup::{ @@ -12,6 +11,7 @@ use ruma::{ update_backup_version, }, }; +use tuwunel_core::{Err, Result, err}; use crate::Ruma; diff --git a/src/api/client/capabilities.rs b/src/api/client/capabilities.rs index 470ff6ab..fab7ac22 100644 --- a/src/api/client/capabilities.rs +++ b/src/api/client/capabilities.rs @@ -1,7 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{Result, Server}; use ruma::{ RoomVersionId, api::client::discovery::get_capabilities::{ @@ -10,6 +9,7 @@ use ruma::{ }, }; use serde_json::json; +use tuwunel_core::{Result, Server}; use crate::Ruma; diff --git a/src/api/client/context.rs b/src/api/client/context.rs index dbc2a22f..b5e50d85 100644 --- a/src/api/client/context.rs +++ b/src/api/client/context.rs @@ -1,5 +1,10 @@ use axum::extract::State; -use conduwuit::{ +use futures::{ + FutureExt, StreamExt, TryFutureExt, TryStreamExt, + future::{OptionFuture, join, join3, try_join3}, +}; +use ruma::{OwnedEventId, UserId, api::client::context::get_context, events::StateEventType}; +use tuwunel_core::{ Err, Result, at, debug_warn, err, matrix::pdu::PduEvent, ref_at, @@ -9,12 +14,7 @@ use conduwuit::{ stream::{BroadbandExt, ReadyExt, TryIgnore, WidebandExt}, }, }; -use conduwuit_service::rooms::{lazy_loading, lazy_loading::Options, short::ShortStateKey}; -use futures::{ - FutureExt, StreamExt, TryFutureExt, TryStreamExt, - future::{OptionFuture, join, join3, try_join3}, -}; -use ruma::{OwnedEventId, UserId, api::client::context::get_context, events::StateEventType}; +use tuwunel_service::rooms::{lazy_loading, lazy_loading::Options, short::ShortStateKey}; use crate::{ Ruma, diff --git a/src/api/client/device.rs b/src/api/client/device.rs index 5519a1a5..1d62745c 100644 --- a/src/api/client/device.rs +++ b/src/api/client/device.rs @@ -1,6 +1,5 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{Err, Error, Result, debug, err, utils}; use futures::StreamExt; use ruma::{ MilliSecondsSinceUnixEpoch, OwnedDeviceId, @@ -10,6 +9,7 @@ use ruma::{ uiaa::{AuthFlow, AuthType, UiaaInfo}, }, }; +use tuwunel_core::{Err, Error, Result, debug, err, utils}; use super::SESSION_ID_LENGTH; use crate::{Ruma, client::DEVICE_ID_LENGTH}; diff --git a/src/api/client/directory.rs b/src/api/client/directory.rs index b44b9f64..55580f1a 100644 --- a/src/api/client/directory.rs +++ b/src/api/client/directory.rs @@ -1,15 +1,5 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Result, err, info, - utils::{ - TryFutureExtExt, - math::Expected, - result::FlatOk, - stream::{ReadyExt, WidebandExt}, - }, -}; -use conduwuit_service::Services; use futures::{ FutureExt, StreamExt, TryFutureExt, future::{join, join4, join5}, @@ -36,6 +26,16 @@ use ruma::{ }, uint, }; +use tuwunel_core::{ + Err, Result, err, info, + utils::{ + TryFutureExtExt, + math::Expected, + result::FlatOk, + stream::{ReadyExt, WidebandExt}, + }, +}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/client/filter.rs b/src/api/client/filter.rs index 97044ffc..48fc8e4c 100644 --- a/src/api/client/filter.rs +++ b/src/api/client/filter.rs @@ -1,6 +1,6 @@ use axum::extract::State; -use conduwuit::{Result, err}; use ruma::api::client::filter::{create_filter, get_filter}; +use tuwunel_core::{Result, err}; use crate::Ruma; diff --git a/src/api/client/keys.rs b/src/api/client/keys.rs index 650c573f..2b4db65b 100644 --- a/src/api/client/keys.rs +++ b/src/api/client/keys.rs @@ -1,8 +1,6 @@ use std::collections::{BTreeMap, HashMap, HashSet}; use axum::extract::State; -use conduwuit::{Err, Error, Result, debug, debug_warn, err, result::NotFound, utils}; -use conduwuit_service::{Services, users::parse_master_key}; use futures::{StreamExt, stream::FuturesUnordered}; use ruma::{ OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId, @@ -22,6 +20,8 @@ use ruma::{ serde::Raw, }; use serde_json::json; +use tuwunel_core::{Err, Error, Result, debug, debug_warn, err, result::NotFound, utils}; +use tuwunel_service::{Services, users::parse_master_key}; use super::SESSION_ID_LENGTH; use crate::Ruma; diff --git a/src/api/client/media.rs b/src/api/client/media.rs index 94572413..9aae3ec7 100644 --- a/src/api/client/media.rs +++ b/src/api/client/media.rs @@ -2,14 +2,6 @@ use std::time::Duration; use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Result, err, - utils::{self, content_disposition::make_content_disposition, math::ruma_from_usize}, -}; -use conduwuit_service::{ - Services, - media::{CACHE_CONTROL_IMMUTABLE, CORP_CROSS_ORIGIN, Dim, FileMeta, MXC_LENGTH}, -}; use reqwest::Url; use ruma::{ Mxc, UserId, @@ -21,6 +13,14 @@ use ruma::{ media::create_content, }, }; +use tuwunel_core::{ + Err, Result, err, + utils::{self, content_disposition::make_content_disposition, math::ruma_from_usize}, +}; +use tuwunel_service::{ + Services, + media::{CACHE_CONTROL_IMMUTABLE, CORP_CROSS_ORIGIN, Dim, FileMeta, MXC_LENGTH}, +}; use crate::Ruma; diff --git a/src/api/client/media_legacy.rs b/src/api/client/media_legacy.rs index d9f24f77..ba7a5302 100644 --- a/src/api/client/media_legacy.rs +++ b/src/api/client/media_legacy.rs @@ -2,11 +2,6 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Result, err, - utils::{content_disposition::make_content_disposition, math::ruma_from_usize}, -}; -use conduwuit_service::media::{CACHE_CONTROL_IMMUTABLE, CORP_CROSS_ORIGIN, Dim, FileMeta}; use reqwest::Url; use ruma::{ Mxc, @@ -15,6 +10,11 @@ use ruma::{ get_media_config, get_media_preview, }, }; +use tuwunel_core::{ + Err, Result, err, + utils::{content_disposition::make_content_disposition, math::ruma_from_usize}, +}; +use tuwunel_service::media::{CACHE_CONTROL_IMMUTABLE, CORP_CROSS_ORIGIN, Dim, FileMeta}; use crate::{Ruma, RumaResponse, client::create_content_route}; diff --git a/src/api/client/membership.rs b/src/api/client/membership.rs index 18a1c741..8337d21a 100644 --- a/src/api/client/membership.rs +++ b/src/api/client/membership.rs @@ -8,31 +8,6 @@ use std::{ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Result, at, debug, debug_error, debug_info, debug_warn, err, error, info, is_matching, - matrix::{ - StateKey, - pdu::{PduBuilder, PduEvent, gen_event_id, gen_event_id_canonical_json}, - state_res, - }, - result::{FlatOk, NotFound}, - trace, - utils::{ - self, FutureBoolExt, - future::ReadyEqExt, - shuffle, - stream::{BroadbandExt, IterStream, ReadyExt}, - }, - warn, -}; -use conduwuit_service::{ - Services, - appservice::RegistrationInfo, - rooms::{ - state::RoomMutexGuard, - state_compressor::{CompressedState, HashSetCompressStateEvent}, - }, -}; use futures::{FutureExt, StreamExt, TryFutureExt, join, pin_mut}; use ruma::{ CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName, @@ -60,6 +35,31 @@ use ruma::{ }, }, }; +use tuwunel_core::{ + Err, Result, at, debug, debug_error, debug_info, debug_warn, err, error, info, is_matching, + matrix::{ + StateKey, + pdu::{PduBuilder, PduEvent, gen_event_id, gen_event_id_canonical_json}, + state_res, + }, + result::{FlatOk, NotFound}, + trace, + utils::{ + self, FutureBoolExt, + future::ReadyEqExt, + shuffle, + stream::{BroadbandExt, IterStream, ReadyExt}, + }, + warn, +}; +use tuwunel_service::{ + Services, + appservice::RegistrationInfo, + rooms::{ + state::RoomMutexGuard, + state_compressor::{CompressedState, HashSetCompressStateEvent}, + }, +}; use crate::{Ruma, client::full_user_deactivate}; diff --git a/src/api/client/message.rs b/src/api/client/message.rs index db11ef4a..089eb540 100644 --- a/src/api/client/message.rs +++ b/src/api/client/message.rs @@ -1,5 +1,15 @@ use axum::extract::State; -use conduwuit::{ +use futures::{FutureExt, StreamExt, TryFutureExt, future::OptionFuture, pin_mut}; +use ruma::{ + RoomId, UserId, + api::{ + Direction, + client::{filter::RoomEventFilter, message::get_message_events}, + }, + events::{AnyStateEvent, StateEventType, TimelineEventType, TimelineEventType::*}, + serde::Raw, +}; +use tuwunel_core::{ Err, Result, at, matrix::{ Event, @@ -11,7 +21,7 @@ use conduwuit::{ stream::{BroadbandExt, TryIgnore, WidebandExt}, }, }; -use conduwuit_service::{ +use tuwunel_service::{ Services, rooms::{ lazy_loading, @@ -19,16 +29,6 @@ use conduwuit_service::{ timeline::PdusIterItem, }, }; -use futures::{FutureExt, StreamExt, TryFutureExt, future::OptionFuture, pin_mut}; -use ruma::{ - RoomId, UserId, - api::{ - Direction, - client::{filter::RoomEventFilter, message::get_message_events}, - }, - events::{AnyStateEvent, StateEventType, TimelineEventType, TimelineEventType::*}, - serde::Raw, -}; use crate::Ruma; @@ -296,7 +296,7 @@ pub(crate) fn event_filter(item: PdusIterItem, filter: &RoomEventFilter) -> Opti pdu.matches(filter).then_some(item) } -#[cfg_attr(debug_assertions, conduwuit::ctor)] +#[cfg_attr(debug_assertions, tuwunel_core::ctor)] fn _is_sorted() { debug_assert!( IGNORED_MESSAGE_TYPES.is_sorted(), diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index be54e65f..ef62f7ec 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -90,4 +90,4 @@ const DEVICE_ID_LENGTH: usize = 10; const TOKEN_LENGTH: usize = 32; /// generated user session ID length -const SESSION_ID_LENGTH: usize = service::uiaa::SESSION_ID_LENGTH; +const SESSION_ID_LENGTH: usize = tuwunel_service::uiaa::SESSION_ID_LENGTH; diff --git a/src/api/client/openid.rs b/src/api/client/openid.rs index 8d2de68d..cab53055 100644 --- a/src/api/client/openid.rs +++ b/src/api/client/openid.rs @@ -1,11 +1,11 @@ use std::time::Duration; use axum::extract::State; -use conduwuit::{Error, Result, utils}; use ruma::{ api::client::{account, error::ErrorKind}, authentication::TokenType, }; +use tuwunel_core::{Error, Result, utils}; use super::TOKEN_LENGTH; use crate::Ruma; diff --git a/src/api/client/presence.rs b/src/api/client/presence.rs index 548e5cce..0176cdb8 100644 --- a/src/api/client/presence.rs +++ b/src/api/client/presence.rs @@ -1,8 +1,8 @@ use std::time::Duration; use axum::extract::State; -use conduwuit::{Err, Result}; use ruma::api::client::presence::{get_presence, set_presence}; +use tuwunel_core::{Err, Result}; use crate::Ruma; diff --git a/src/api/client/profile.rs b/src/api/client/profile.rs index 3699b590..4ef248e8 100644 --- a/src/api/client/profile.rs +++ b/src/api/client/profile.rs @@ -1,13 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{ - Err, Error, Result, - matrix::pdu::PduBuilder, - utils::{IterStream, stream::TryIgnore}, - warn, -}; -use conduwuit_service::Services; use futures::{StreamExt, TryStreamExt, future::join3}; use ruma::{ OwnedMxcUri, OwnedRoomId, UserId, @@ -23,6 +16,13 @@ use ruma::{ events::room::member::{MembershipState, RoomMemberEventContent}, presence::PresenceState, }; +use tuwunel_core::{ + Err, Error, Result, + matrix::pdu::PduBuilder, + utils::{IterStream, stream::TryIgnore}, + warn, +}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/client/push.rs b/src/api/client/push.rs index 81020ffa..298232c8 100644 --- a/src/api/client/push.rs +++ b/src/api/client/push.rs @@ -1,6 +1,4 @@ use axum::extract::State; -use conduwuit::{Err, Error, Result, err}; -use conduwuit_service::Services; use ruma::{ CanonicalJsonObject, CanonicalJsonValue, api::client::{ @@ -20,6 +18,8 @@ use ruma::{ RemovePushRuleError, Ruleset, }, }; +use tuwunel_core::{Err, Error, Result, err}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/client/read_marker.rs b/src/api/client/read_marker.rs index fbfc8fea..7e7ebd0b 100644 --- a/src/api/client/read_marker.rs +++ b/src/api/client/read_marker.rs @@ -1,7 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{Err, PduCount, Result, err}; use ruma::{ MilliSecondsSinceUnixEpoch, api::client::{read_marker::set_read_marker, receipt::create_receipt}, @@ -10,6 +9,7 @@ use ruma::{ receipt::{ReceiptThread, ReceiptType}, }, }; +use tuwunel_core::{Err, PduCount, Result, err}; use crate::Ruma; diff --git a/src/api/client/redact.rs b/src/api/client/redact.rs index 8dbe47a6..3666c7c9 100644 --- a/src/api/client/redact.rs +++ b/src/api/client/redact.rs @@ -1,8 +1,8 @@ use axum::extract::State; -use conduwuit::{Result, matrix::pdu::PduBuilder}; use ruma::{ api::client::redact::redact_event, events::room::redaction::RoomRedactionEventContent, }; +use tuwunel_core::{Result, matrix::pdu::PduBuilder}; use crate::Ruma; diff --git a/src/api/client/relations.rs b/src/api/client/relations.rs index b8c2dd4d..dc148bc1 100644 --- a/src/api/client/relations.rs +++ b/src/api/client/relations.rs @@ -1,10 +1,4 @@ use axum::extract::State; -use conduwuit::{ - Result, at, - matrix::pdu::PduCount, - utils::{IterStream, ReadyExt, result::FlatOk, stream::WidebandExt}, -}; -use conduwuit_service::{Services, rooms::timeline::PdusIterItem}; use futures::StreamExt; use ruma::{ EventId, RoomId, UInt, UserId, @@ -17,6 +11,12 @@ use ruma::{ }, events::{TimelineEventType, relation::RelationType}, }; +use tuwunel_core::{ + Result, at, + matrix::pdu::PduCount, + utils::{IterStream, ReadyExt, result::FlatOk, stream::WidebandExt}, +}; +use tuwunel_service::{Services, rooms::timeline::PdusIterItem}; use crate::Ruma; diff --git a/src/api/client/report.rs b/src/api/client/report.rs index 4ee8ebe5..67367ed3 100644 --- a/src/api/client/report.rs +++ b/src/api/client/report.rs @@ -2,8 +2,6 @@ use std::time::Duration; use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{Err, Error, Result, debug_info, info, matrix::pdu::PduEvent, utils::ReadyExt}; -use conduwuit_service::Services; use rand::Rng; use ruma::{ EventId, RoomId, UserId, @@ -15,6 +13,10 @@ use ruma::{ int, }; use tokio::time::sleep; +use tuwunel_core::{ + Err, Error, Result, debug_info, info, matrix::pdu::PduEvent, utils::ReadyExt, +}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/client/room/aliases.rs b/src/api/client/room/aliases.rs index 3f0016af..0775c1e5 100644 --- a/src/api/client/room/aliases.rs +++ b/src/api/client/room/aliases.rs @@ -1,7 +1,7 @@ use axum::extract::State; -use conduwuit::{Error, Result}; use futures::StreamExt; use ruma::api::client::{error::ErrorKind, room::aliases}; +use tuwunel_core::{Error, Result}; use crate::Ruma; diff --git a/src/api/client/room/create.rs b/src/api/client/room/create.rs index 4ce53f15..f5676884 100644 --- a/src/api/client/room/create.rs +++ b/src/api/client/room/create.rs @@ -1,12 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{ - Err, Error, Result, debug_info, debug_warn, err, error, info, - matrix::{StateKey, pdu::PduBuilder}, - warn, -}; -use conduwuit_service::{Services, appservice::RegistrationInfo}; use futures::FutureExt; use ruma::{ CanonicalJsonObject, Int, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, RoomId, RoomVersionId, @@ -32,6 +26,12 @@ use ruma::{ serde::{JsonObject, Raw}, }; use serde_json::{json, value::to_raw_value}; +use tuwunel_core::{ + Err, Error, Result, debug_info, debug_warn, err, error, info, + matrix::{StateKey, pdu::PduBuilder}, + warn, +}; +use tuwunel_service::{Services, appservice::RegistrationInfo}; use crate::{Ruma, client::invite_helper}; diff --git a/src/api/client/room/event.rs b/src/api/client/room/event.rs index 2b115b5c..57d11e3b 100644 --- a/src/api/client/room/event.rs +++ b/src/api/client/room/event.rs @@ -1,7 +1,7 @@ use axum::extract::State; -use conduwuit::{Err, Event, Result, err}; use futures::{FutureExt, TryFutureExt, future::try_join}; use ruma::api::client::room::get_room_event; +use tuwunel_core::{Err, Event, Result, err}; use crate::{Ruma, client::is_ignored_pdu}; diff --git a/src/api/client/room/initial_sync.rs b/src/api/client/room/initial_sync.rs index ca63610b..581dd96b 100644 --- a/src/api/client/room/initial_sync.rs +++ b/src/api/client/room/initial_sync.rs @@ -1,10 +1,10 @@ use axum::extract::State; -use conduwuit::{ +use futures::TryStreamExt; +use ruma::api::client::room::initial_sync::v3::{PaginationChunk, Request, Response}; +use tuwunel_core::{ Err, PduEvent, Result, at, utils::{BoolExt, stream::TryTools}, }; -use futures::TryStreamExt; -use ruma::api::client::room::initial_sync::v3::{PaginationChunk, Request, Response}; use crate::Ruma; diff --git a/src/api/client/room/summary.rs b/src/api/client/room/summary.rs index 67d2e2ad..1809bc8e 100644 --- a/src/api/client/room/summary.rs +++ b/src/api/client/room/summary.rs @@ -1,9 +1,5 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Result, debug_warn, trace, - utils::{IterStream, future::TryExtExt}, -}; use futures::{ FutureExt, StreamExt, future::{OptionFuture, join3}, @@ -18,7 +14,11 @@ use ruma::{ events::room::member::MembershipState, space::SpaceRoomJoinRule::{self, *}, }; -use service::Services; +use tuwunel_core::{ + Err, Result, debug_warn, trace, + utils::{IterStream, future::TryExtExt}, +}; +use tuwunel_service::Services; use crate::{Ruma, RumaResponse}; diff --git a/src/api/client/room/upgrade.rs b/src/api/client/room/upgrade.rs index 9ec0b3bb..e9da2aff 100644 --- a/src/api/client/room/upgrade.rs +++ b/src/api/client/room/upgrade.rs @@ -1,10 +1,6 @@ use std::cmp::max; use axum::extract::State; -use conduwuit::{ - Error, Result, err, info, - matrix::{StateKey, pdu::PduBuilder}, -}; use futures::StreamExt; use ruma::{ CanonicalJsonObject, RoomId, RoomVersionId, @@ -20,6 +16,10 @@ use ruma::{ int, }; use serde_json::{json, value::to_raw_value}; +use tuwunel_core::{ + Error, Result, err, info, + matrix::{StateKey, pdu::PduBuilder}, +}; use crate::Ruma; diff --git a/src/api/client/search.rs b/src/api/client/search.rs index d4dcde57..c4b2190e 100644 --- a/src/api/client/search.rs +++ b/src/api/client/search.rs @@ -1,13 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{ - Err, Result, at, is_true, - matrix::pdu::PduEvent, - result::FlatOk, - utils::{IterStream, stream::ReadyExt}, -}; -use conduwuit_service::{Services, rooms::search::RoomQuery}; use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::OptionFuture}; use ruma::{ OwnedRoomId, RoomId, UInt, UserId, @@ -19,6 +12,13 @@ use ruma::{ serde::Raw, }; use search_events::v3::{Request, Response}; +use tuwunel_core::{ + Err, Result, at, is_true, + matrix::pdu::PduEvent, + result::FlatOk, + utils::{IterStream, stream::ReadyExt}, +}; +use tuwunel_service::{Services, rooms::search::RoomQuery}; use crate::Ruma; diff --git a/src/api/client/send.rs b/src/api/client/send.rs index f753fa65..c806237e 100644 --- a/src/api/client/send.rs +++ b/src/api/client/send.rs @@ -1,9 +1,9 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{Err, Result, err, matrix::pdu::PduBuilder, utils}; use ruma::{api::client::message::send_message_event, events::MessageLikeEventType}; use serde_json::from_str; +use tuwunel_core::{Err, Result, err, matrix::pdu::PduBuilder, utils}; use crate::Ruma; diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 2499a43d..baf72100 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -2,11 +2,6 @@ use std::time::Duration; use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Error, Result, debug, err, info, utils, - utils::{ReadyExt, hash}, -}; -use conduwuit_service::uiaa::SESSION_ID_LENGTH; use futures::StreamExt; use ruma::{ UserId, @@ -26,6 +21,11 @@ use ruma::{ uiaa, }, }; +use tuwunel_core::{ + Err, Error, Result, debug, err, info, utils, + utils::{ReadyExt, hash}, +}; +use tuwunel_service::uiaa::SESSION_ID_LENGTH; use super::{DEVICE_ID_LENGTH, TOKEN_LENGTH}; use crate::Ruma; diff --git a/src/api/client/space.rs b/src/api/client/space.rs index 951ab9f1..c4ffe812 100644 --- a/src/api/client/space.rs +++ b/src/api/client/space.rs @@ -4,20 +4,20 @@ use std::{ }; use axum::extract::State; -use conduwuit::{ +use futures::{StreamExt, TryFutureExt, future::OptionFuture}; +use ruma::{ + OwnedRoomId, OwnedServerName, RoomId, UInt, UserId, api::client::space::get_hierarchy, +}; +use tuwunel_core::{ Err, Result, utils::{future::TryExtExt, stream::IterStream}, }; -use conduwuit_service::{ +use tuwunel_service::{ Services, rooms::spaces::{ PaginationToken, SummaryAccessibility, get_parent_children_via, summary_to_chunk, }, }; -use futures::{StreamExt, TryFutureExt, future::OptionFuture}; -use ruma::{ - OwnedRoomId, OwnedServerName, RoomId, UInt, UserId, api::client::space::get_hierarchy, -}; use crate::Ruma; diff --git a/src/api/client/state.rs b/src/api/client/state.rs index 2ddc8f14..2b6a89b0 100644 --- a/src/api/client/state.rs +++ b/src/api/client/state.rs @@ -1,10 +1,4 @@ use axum::extract::State; -use conduwuit::{ - Err, Result, err, - matrix::pdu::{PduBuilder, PduEvent}, - utils::BoolExt, -}; -use conduwuit_service::Services; use futures::TryStreamExt; use ruma::{ OwnedEventId, RoomId, UserId, @@ -21,6 +15,12 @@ use ruma::{ }, serde::Raw, }; +use tuwunel_core::{ + Err, Result, err, + matrix::pdu::{PduBuilder, PduEvent}, + utils::BoolExt, +}; +use tuwunel_service::Services; use crate::{Ruma, RumaResponse}; diff --git a/src/api/client/sync/mod.rs b/src/api/client/sync/mod.rs index 40370160..10f5ad9d 100644 --- a/src/api/client/sync/mod.rs +++ b/src/api/client/sync/mod.rs @@ -2,12 +2,6 @@ mod v3; mod v4; mod v5; -use conduwuit::{ - Error, PduCount, Result, - matrix::pdu::PduEvent, - utils::stream::{BroadbandExt, ReadyExt, TryIgnore}, -}; -use conduwuit_service::Services; use futures::{StreamExt, pin_mut}; use ruma::{ RoomId, UserId, @@ -15,6 +9,12 @@ use ruma::{ self, Beacon, CallInvite, PollStart, RoomEncrypted, RoomMessage, Sticker, }, }; +use tuwunel_core::{ + Error, PduCount, Result, + matrix::pdu::PduEvent, + utils::stream::{BroadbandExt, ReadyExt, TryIgnore}, +}; +use tuwunel_service::Services; pub(crate) use self::{ v3::sync_events_route, v4::sync_events_v4_route, v5::sync_events_v5_route, diff --git a/src/api/client/sync/v3.rs b/src/api/client/sync/v3.rs index 8eac6b66..4b40d03c 100644 --- a/src/api/client/sync/v3.rs +++ b/src/api/client/sync/v3.rs @@ -5,30 +5,6 @@ use std::{ }; use axum::extract::State; -use conduwuit::{ - Result, at, err, error, extract_variant, is_equal_to, - matrix::{ - Event, - pdu::{EventHash, PduCount, PduEvent}, - }, - pair_of, ref_at, - result::FlatOk, - utils::{ - self, BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt, - future::{OptionStream, ReadyEqExt}, - math::ruma_from_u64, - stream::{BroadbandExt, Tools, TryExpect, WidebandExt}, - }, - warn, -}; -use conduwuit_service::{ - Services, - rooms::{ - lazy_loading, - lazy_loading::{Options, Witness}, - short::ShortStateHash, - }, -}; use futures::{ FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::{OptionFuture, join, join3, join4, join5, try_join, try_join4}, @@ -57,7 +33,30 @@ use ruma::{ serde::Raw, uint, }; -use service::rooms::short::{ShortEventId, ShortStateKey}; +use tuwunel_core::{ + Result, at, err, error, extract_variant, is_equal_to, + matrix::{ + Event, + pdu::{EventHash, PduCount, PduEvent}, + }, + pair_of, ref_at, + result::FlatOk, + utils::{ + self, BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt, + future::{OptionStream, ReadyEqExt}, + math::ruma_from_u64, + stream::{BroadbandExt, Tools, TryExpect, WidebandExt}, + }, + warn, +}; +use tuwunel_service::{ + Services, + rooms::{ + lazy_loading, + lazy_loading::{Options, Witness}, + short::{ShortEventId, ShortStateHash, ShortStateKey}, + }, +}; use super::{load_timeline, share_encrypted_room}; use crate::{Ruma, RumaResponse, client::ignored_filter}; diff --git a/src/api/client/sync/v4.rs b/src/api/client/sync/v4.rs index f153b2da..060ef971 100644 --- a/src/api/client/sync/v4.rs +++ b/src/api/client/sync/v4.rs @@ -5,20 +5,6 @@ use std::{ }; use axum::extract::State; -use conduwuit::{ - Err, Error, PduCount, PduEvent, Result, debug, error, extract_variant, - matrix::TypeStateKey, - utils::{ - BoolExt, IterStream, ReadyExt, TryFutureExtExt, - math::{ruma_from_usize, usize_from_ruma, usize_from_u64_truncated}, - }, - warn, -}; -use conduwuit_service::{ - Services, - rooms::read_receipt::pack_receipts, - sync::{into_db_key, into_snake_key}, -}; use futures::{FutureExt, StreamExt, TryFutureExt}; use ruma::{ MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, RoomId, UInt, UserId, @@ -35,6 +21,20 @@ use ruma::{ serde::Raw, uint, }; +use tuwunel_core::{ + Err, Error, PduCount, PduEvent, Result, debug, error, extract_variant, + matrix::TypeStateKey, + utils::{ + BoolExt, IterStream, ReadyExt, TryFutureExtExt, + math::{ruma_from_usize, usize_from_ruma, usize_from_u64_truncated}, + }, + warn, +}; +use tuwunel_service::{ + Services, + rooms::read_receipt::pack_receipts, + sync::{into_db_key, into_snake_key}, +}; use super::{load_timeline, share_encrypted_room}; use crate::{ diff --git a/src/api/client/sync/v5.rs b/src/api/client/sync/v5.rs index f3fc0f44..207a82a7 100644 --- a/src/api/client/sync/v5.rs +++ b/src/api/client/sync/v5.rs @@ -6,21 +6,6 @@ use std::{ }; use axum::extract::State; -use conduwuit::{ - Err, Error, Result, error, extract_variant, is_equal_to, - matrix::{ - TypeStateKey, - pdu::{PduCount, PduEvent}, - }, - trace, - utils::{ - BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt, - future::ReadyEqExt, - math::{ruma_from_usize, usize_from_ruma}, - }, - warn, -}; -use conduwuit_service::{Services, rooms::read_receipt::pack_receipts, sync::into_snake_key}; use futures::{ FutureExt, Stream, StreamExt, TryFutureExt, future::{OptionFuture, join3, try_join4}, @@ -37,6 +22,21 @@ use ruma::{ serde::Raw, uint, }; +use tuwunel_core::{ + Err, Error, Result, error, extract_variant, is_equal_to, + matrix::{ + TypeStateKey, + pdu::{PduCount, PduEvent}, + }, + trace, + utils::{ + BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt, + future::ReadyEqExt, + math::{ruma_from_usize, usize_from_ruma}, + }, + warn, +}; +use tuwunel_service::{Services, rooms::read_receipt::pack_receipts, sync::into_snake_key}; use super::share_encrypted_room; use crate::{ diff --git a/src/api/client/tag.rs b/src/api/client/tag.rs index caafe10d..579c8d36 100644 --- a/src/api/client/tag.rs +++ b/src/api/client/tag.rs @@ -1,7 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::Result; use ruma::{ api::client::tag::{create_tag, delete_tag, get_tags}, events::{ @@ -9,6 +8,7 @@ use ruma::{ tag::{TagEvent, TagEventContent}, }, }; +use tuwunel_core::Result; use crate::Ruma; diff --git a/src/api/client/thirdparty.rs b/src/api/client/thirdparty.rs index 0713a882..9e179915 100644 --- a/src/api/client/thirdparty.rs +++ b/src/api/client/thirdparty.rs @@ -1,7 +1,7 @@ use std::collections::BTreeMap; -use conduwuit::Result; use ruma::api::client::thirdparty::get_protocols; +use tuwunel_core::Result; use crate::{Ruma, RumaResponse}; diff --git a/src/api/client/threads.rs b/src/api/client/threads.rs index 5b838bef..5201837a 100644 --- a/src/api/client/threads.rs +++ b/src/api/client/threads.rs @@ -1,10 +1,10 @@ use axum::extract::State; -use conduwuit::{ +use futures::StreamExt; +use ruma::{api::client::threads::get_threads, uint}; +use tuwunel_core::{ Result, at, matrix::pdu::{PduCount, PduEvent}, }; -use futures::StreamExt; -use ruma::{api::client::threads::get_threads, uint}; use crate::Ruma; diff --git a/src/api/client/to_device.rs b/src/api/client/to_device.rs index 8ad9dc99..19d38627 100644 --- a/src/api/client/to_device.rs +++ b/src/api/client/to_device.rs @@ -1,8 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{Error, Result}; -use conduwuit_service::sending::EduBuf; use futures::StreamExt; use ruma::{ api::{ @@ -11,6 +9,8 @@ use ruma::{ }, to_device::DeviceIdOrAllDevices, }; +use tuwunel_core::{Error, Result}; +use tuwunel_service::sending::EduBuf; use crate::Ruma; diff --git a/src/api/client/typing.rs b/src/api/client/typing.rs index 1d8d02fd..78e5512c 100644 --- a/src/api/client/typing.rs +++ b/src/api/client/typing.rs @@ -1,6 +1,6 @@ use axum::extract::State; -use conduwuit::{Err, Result, utils, utils::math::Tried}; use ruma::api::client::typing::create_typing_event; +use tuwunel_core::{Err, Result, utils, utils::math::Tried}; use crate::Ruma; diff --git a/src/api/client/unstable.rs b/src/api/client/unstable.rs index e21eaf21..47a2d1ff 100644 --- a/src/api/client/unstable.rs +++ b/src/api/client/unstable.rs @@ -2,7 +2,6 @@ use std::collections::BTreeMap; use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{Err, Error, Result}; use futures::StreamExt; use ruma::{ OwnedRoomId, @@ -19,6 +18,7 @@ use ruma::{ }, presence::PresenceState, }; +use tuwunel_core::{Err, Error, Result}; use super::{update_avatar_url, update_displayname}; use crate::Ruma; diff --git a/src/api/client/unversioned.rs b/src/api/client/unversioned.rs index 232d5b28..e5c696ba 100644 --- a/src/api/client/unversioned.rs +++ b/src/api/client/unversioned.rs @@ -1,9 +1,9 @@ use std::collections::BTreeMap; use axum::{Json, extract::State, response::IntoResponse}; -use conduwuit::Result; use futures::StreamExt; use ruma::api::client::discovery::get_supported_versions; +use tuwunel_core::Result; use crate::Ruma; @@ -60,23 +60,23 @@ pub(crate) async fn get_supported_versions_route( Ok(resp) } -/// # `GET /_conduwuit/server_version` +/// # `GET /_tuwunel/server_version` /// -/// Conduwuit-specific API to get the server version, results akin to +/// Tuwunel-specific API to get the server version, results akin to /// `/_matrix/federation/v1/version` -pub(crate) async fn conduwuit_server_version() -> Result { +pub(crate) async fn tuwunel_server_version() -> Result { Ok(Json(serde_json::json!({ - "name": conduwuit::version::name(), - "version": conduwuit::version::version(), + "name": tuwunel_core::version::name(), + "version": tuwunel_core::version::version(), }))) } -/// # `GET /_conduwuit/local_user_count` +/// # `GET /_tuwunel/local_user_count` /// -/// conduwuit-specific API to return the amount of users registered on this +/// Tuwunel-specific API to return the amount of users registered on this /// homeserver. Endpoint is disabled if federation is disabled for privacy. This /// only includes active users (not deactivated, no guests, etc) -pub(crate) async fn conduwuit_local_user_count( +pub(crate) async fn tuwunel_local_user_count( State(services): State, ) -> Result { let user_count = services.users.list_local_users().count().await; diff --git a/src/api/client/user_directory.rs b/src/api/client/user_directory.rs index 748fc049..31013c68 100644 --- a/src/api/client/user_directory.rs +++ b/src/api/client/user_directory.rs @@ -1,16 +1,16 @@ use axum::extract::State; -use conduwuit::{ +use futures::{FutureExt, StreamExt, pin_mut}; +use ruma::{ + api::client::user_directory::search_users::{self}, + events::room::join_rules::JoinRule, +}; +use tuwunel_core::{ Result, utils::{ future::BoolExt, stream::{BroadbandExt, ReadyExt}, }, }; -use futures::{FutureExt, StreamExt, pin_mut}; -use ruma::{ - api::client::user_directory::search_users::{self}, - events::room::join_rules::JoinRule, -}; use crate::Ruma; diff --git a/src/api/client/voip.rs b/src/api/client/voip.rs index 91991d24..41a36154 100644 --- a/src/api/client/voip.rs +++ b/src/api/client/voip.rs @@ -2,10 +2,10 @@ use std::time::{Duration, SystemTime}; use axum::extract::State; use base64::{Engine as _, engine::general_purpose}; -use conduwuit::{Err, Result, utils}; use hmac::{Hmac, Mac}; use ruma::{SecondsSinceUnixEpoch, UserId, api::client::voip::get_turn_server_info}; use sha1::Sha1; +use tuwunel_core::{Err, Result, utils}; use crate::Ruma; diff --git a/src/api/client/well_known.rs b/src/api/client/well_known.rs index eedab981..64b4af67 100644 --- a/src/api/client/well_known.rs +++ b/src/api/client/well_known.rs @@ -1,5 +1,4 @@ use axum::{Json, extract::State, response::IntoResponse}; -use conduwuit::{Error, Result}; use ruma::api::client::{ discovery::{ discover_homeserver::{self, HomeserverInfo, SlidingSyncProxyInfo}, @@ -7,6 +6,7 @@ use ruma::api::client::{ }, error::ErrorKind, }; +use tuwunel_core::{Error, Result}; use crate::Ruma; @@ -94,6 +94,6 @@ pub(crate) async fn syncv3_client_server_json( Ok(Json(serde_json::json!({ "server": server_url, - "version": conduwuit::version(), + "version": tuwunel_core::version(), }))) } diff --git a/src/api/mod.rs b/src/api/mod.rs index 9ca24e72..42583c93 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -5,10 +5,7 @@ pub mod client; pub mod router; pub mod server; -extern crate conduwuit_core as conduwuit; -extern crate conduwuit_service as service; - pub(crate) use self::router::{Ruma, RumaResponse, State}; -conduwuit::mod_ctor! {} -conduwuit::mod_dtor! {} +tuwunel_core::mod_ctor! {} +tuwunel_core::mod_dtor! {} diff --git a/src/api/router.rs b/src/api/router.rs index 3fbef275..c66e80e4 100644 --- a/src/api/router.rs +++ b/src/api/router.rs @@ -12,8 +12,8 @@ use axum::{ response::{IntoResponse, Redirect}, routing::{any, get, post}, }; -use conduwuit::{Server, err}; use http::{Uri, uri}; +use tuwunel_core::{Server, err}; use self::handler::RouterExt; pub(super) use self::{args::Args as Ruma, response::RumaResponse, state::State}; @@ -185,7 +185,7 @@ pub fn build(router: Router, server: &Server) -> Router { ) .ruma_route(&client::well_known_support) .ruma_route(&client::well_known_client) - .route("/_conduwuit/server_version", get(client::conduwuit_server_version)) + .route("/_tuwunel/server_version", get(client::tuwunel_server_version)) .ruma_route(&client::room_initial_sync_route) .route("/client/server.json", get(client::syncv3_client_server_json)); @@ -225,13 +225,13 @@ pub fn build(router: Router, server: &Server) -> Router { .ruma_route(&server::well_known_server) .ruma_route(&server::get_content_route) .ruma_route(&server::get_content_thumbnail_route) - .route("/_conduwuit/local_user_count", get(client::conduwuit_local_user_count)); + .route("/_tuwunel/local_user_count", get(client::tuwunel_local_user_count)); } else { router = router .route("/_matrix/federation/*path", any(federation_disabled)) .route("/.well-known/matrix/server", any(federation_disabled)) .route("/_matrix/key/*path", any(federation_disabled)) - .route("/_conduwuit/local_user_count", any(federation_disabled)); + .route("/_tuwunel/local_user_count", any(federation_disabled)); } if config.allow_legacy_media { diff --git a/src/api/router/args.rs b/src/api/router/args.rs index 26713dcc..a10cdfd9 100644 --- a/src/api/router/args.rs +++ b/src/api/router/args.rs @@ -3,15 +3,15 @@ use std::{mem, ops::Deref}; use async_trait::async_trait; use axum::{body::Body, extract::FromRequest}; use bytes::{BufMut, Bytes, BytesMut}; -use conduwuit::{Error, Result, debug, debug_warn, err, trace, utils::string::EMPTY}; use ruma::{ CanonicalJsonObject, CanonicalJsonValue, DeviceId, OwnedDeviceId, OwnedServerName, OwnedUserId, ServerName, UserId, api::IncomingRequest, }; -use service::Services; +use tuwunel_core::{Error, Result, debug, debug_warn, err, trace, utils::string::EMPTY}; +use tuwunel_service::{Services, appservice::RegistrationInfo}; use super::{auth, auth::Auth, request, request::Request}; -use crate::{State, service::appservice::RegistrationInfo}; +use crate::State; /// Extractor for Ruma request structs pub(crate) struct Args { diff --git a/src/api/router/auth.rs b/src/api/router/auth.rs index 0eb61ca6..b4a73fee 100644 --- a/src/api/router/auth.rs +++ b/src/api/router/auth.rs @@ -4,7 +4,6 @@ use axum_extra::{ headers::{Authorization, authorization::Bearer}, typed_header::TypedHeaderRejectionReason, }; -use conduwuit::{Err, Error, Result, debug_error, err, warn}; use ruma::{ CanonicalJsonObject, CanonicalJsonValue, OwnedDeviceId, OwnedServerName, OwnedUserId, UserId, api::{ @@ -20,13 +19,14 @@ use ruma::{ federation::{authentication::XMatrix, openid::get_openid_userinfo}, }, }; -use service::{ +use tuwunel_core::{Err, Error, Result, debug_error, err, warn}; +use tuwunel_service::{ Services, + appservice::RegistrationInfo, server_keys::{PubKeyMap, PubKeys}, }; use super::request::Request; -use crate::service::appservice::RegistrationInfo; enum Token { Appservice(Box), diff --git a/src/api/router/handler.rs b/src/api/router/handler.rs index ab013945..d7846b83 100644 --- a/src/api/router/handler.rs +++ b/src/api/router/handler.rs @@ -4,10 +4,10 @@ use axum::{ response::IntoResponse, routing::{MethodFilter, on}, }; -use conduwuit::Result; use futures::{Future, TryFutureExt}; use http::Method; use ruma::api::IncomingRequest; +use tuwunel_core::Result; use super::{Ruma, RumaResponse, State}; diff --git a/src/api/router/request.rs b/src/api/router/request.rs index 3cdc452b..5df1c625 100644 --- a/src/api/router/request.rs +++ b/src/api/router/request.rs @@ -2,10 +2,10 @@ use std::str; use axum::{RequestExt, RequestPartsExt, extract::Path}; use bytes::Bytes; -use conduwuit::{Result, err}; use http::request::Parts; use serde::Deserialize; -use service::Services; +use tuwunel_core::{Result, err}; +use tuwunel_service::Services; #[derive(Deserialize)] pub(super) struct QueryParams { diff --git a/src/api/router/response.rs b/src/api/router/response.rs index 03c9060e..9468eb60 100644 --- a/src/api/router/response.rs +++ b/src/api/router/response.rs @@ -1,9 +1,9 @@ use axum::response::{IntoResponse, Response}; use bytes::BytesMut; -use conduwuit::{Error, error}; use http::StatusCode; use http_body_util::Full; use ruma::api::{OutgoingResponse, client::uiaa::UiaaResponse}; +use tuwunel_core::{Error, error}; pub(crate) struct RumaResponse(pub(crate) T) where diff --git a/src/api/router/state.rs b/src/api/router/state.rs index 57eb94ca..3362ef4f 100644 --- a/src/api/router/state.rs +++ b/src/api/router/state.rs @@ -1,6 +1,6 @@ use std::{ops::Deref, sync::Arc}; -use conduwuit_service::Services; +use tuwunel_service::Services; #[derive(Clone, Copy)] pub struct State { diff --git a/src/api/server/backfill.rs b/src/api/server/backfill.rs index 3cfbcedc..c9cab812 100644 --- a/src/api/server/backfill.rs +++ b/src/api/server/backfill.rs @@ -1,12 +1,12 @@ use std::cmp; use axum::extract::State; -use conduwuit::{ +use futures::{FutureExt, StreamExt, TryStreamExt}; +use ruma::{MilliSecondsSinceUnixEpoch, api::federation::backfill::get_backfill}; +use tuwunel_core::{ PduCount, Result, utils::{IterStream, ReadyExt, stream::TryTools}, }; -use futures::{FutureExt, StreamExt, TryStreamExt}; -use ruma::{MilliSecondsSinceUnixEpoch, api::federation::backfill::get_backfill}; use super::AccessCheck; use crate::Ruma; diff --git a/src/api/server/event.rs b/src/api/server/event.rs index 5846c6d7..92352151 100644 --- a/src/api/server/event.rs +++ b/src/api/server/event.rs @@ -1,6 +1,6 @@ use axum::extract::State; -use conduwuit::{Result, err}; use ruma::{MilliSecondsSinceUnixEpoch, RoomId, api::federation::event::get_event}; +use tuwunel_core::{Result, err}; use super::AccessCheck; use crate::Ruma; diff --git a/src/api/server/event_auth.rs b/src/api/server/event_auth.rs index c9e210f5..53965c97 100644 --- a/src/api/server/event_auth.rs +++ b/src/api/server/event_auth.rs @@ -1,12 +1,12 @@ use std::{borrow::Borrow, iter::once}; use axum::extract::State; -use conduwuit::{Error, Result, utils::stream::ReadyExt}; use futures::StreamExt; use ruma::{ RoomId, api::{client::error::ErrorKind, federation::authorization::get_event_authorization}, }; +use tuwunel_core::{Error, Result, utils::stream::ReadyExt}; use super::AccessCheck; use crate::Ruma; diff --git a/src/api/server/get_missing_events.rs b/src/api/server/get_missing_events.rs index 04dc30ed..1737db57 100644 --- a/src/api/server/get_missing_events.rs +++ b/src/api/server/get_missing_events.rs @@ -1,6 +1,6 @@ use axum::extract::State; -use conduwuit::{Result, debug, debug_error, utils::to_canonical_object}; use ruma::api::federation::event::get_missing_events; +use tuwunel_core::{Result, debug, debug_error, utils::to_canonical_object}; use super::AccessCheck; use crate::Ruma; diff --git a/src/api/server/hierarchy.rs b/src/api/server/hierarchy.rs index 42c348f9..2fa97fea 100644 --- a/src/api/server/hierarchy.rs +++ b/src/api/server/hierarchy.rs @@ -1,13 +1,11 @@ use axum::extract::State; -use conduwuit::{ +use futures::{FutureExt, StreamExt}; +use ruma::api::federation::space::get_hierarchy; +use tuwunel_core::{ Err, Result, utils::stream::{BroadbandExt, IterStream}, }; -use conduwuit_service::rooms::spaces::{ - Identifier, SummaryAccessibility, get_parent_children_via, -}; -use futures::{FutureExt, StreamExt}; -use ruma::api::federation::space::get_hierarchy; +use tuwunel_service::rooms::spaces::{Identifier, SummaryAccessibility, get_parent_children_via}; use crate::Ruma; diff --git a/src/api/server/invite.rs b/src/api/server/invite.rs index edd6ac16..f7b9e9c2 100644 --- a/src/api/server/invite.rs +++ b/src/api/server/invite.rs @@ -1,15 +1,15 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; use base64::{Engine as _, engine::general_purpose}; -use conduwuit::{ - Err, Error, PduEvent, Result, err, pdu::gen_event_id, utils, utils::hash::sha256, warn, -}; use ruma::{ CanonicalJsonValue, OwnedUserId, UserId, api::{client::error::ErrorKind, federation::membership::create_invite}, events::room::member::{MembershipState, RoomMemberEventContent}, serde::JsonObject, }; +use tuwunel_core::{ + Err, Error, PduEvent, Result, err, pdu::gen_event_id, utils, utils::hash::sha256, warn, +}; use crate::Ruma; diff --git a/src/api/server/key.rs b/src/api/server/key.rs index f9bd0926..1655ec01 100644 --- a/src/api/server/key.rs +++ b/src/api/server/key.rs @@ -4,7 +4,6 @@ use std::{ }; use axum::{Json, extract::State, response::IntoResponse}; -use conduwuit::{Result, utils::timepoint_from_now}; use ruma::{ MilliSecondsSinceUnixEpoch, Signatures, api::{ @@ -13,6 +12,7 @@ use ruma::{ }, serde::Raw, }; +use tuwunel_core::{Result, utils::timepoint_from_now}; /// # `GET /_matrix/key/v2/server` /// diff --git a/src/api/server/make_join.rs b/src/api/server/make_join.rs index ac2c5485..0a46e83d 100644 --- a/src/api/server/make_join.rs +++ b/src/api/server/make_join.rs @@ -1,8 +1,4 @@ use axum::extract::State; -use conduwuit::{ - Err, Error, Result, debug_info, matrix::pdu::PduBuilder, utils::IterStream, warn, -}; -use conduwuit_service::Services; use futures::StreamExt; use ruma::{ CanonicalJsonObject, OwnedUserId, RoomId, RoomVersionId, UserId, @@ -16,6 +12,10 @@ use ruma::{ }, }; use serde_json::value::to_raw_value; +use tuwunel_core::{ + Err, Error, Result, debug_info, matrix::pdu::PduBuilder, utils::IterStream, warn, +}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/server/make_knock.rs b/src/api/server/make_knock.rs index 511c13b2..4a07e9f4 100644 --- a/src/api/server/make_knock.rs +++ b/src/api/server/make_knock.rs @@ -1,12 +1,12 @@ use RoomVersionId::*; use axum::extract::State; -use conduwuit::{Err, Error, Result, debug_warn, matrix::pdu::PduBuilder, warn}; use ruma::{ RoomVersionId, api::{client::error::ErrorKind, federation::knock::create_knock_event_template}, events::room::member::{MembershipState, RoomMemberEventContent}, }; use serde_json::value::to_raw_value; +use tuwunel_core::{Err, Error, Result, debug_warn, matrix::pdu::PduBuilder, warn}; use crate::Ruma; diff --git a/src/api/server/make_leave.rs b/src/api/server/make_leave.rs index cb6bd2fa..50e32107 100644 --- a/src/api/server/make_leave.rs +++ b/src/api/server/make_leave.rs @@ -1,10 +1,10 @@ use axum::extract::State; -use conduwuit::{Err, Result, matrix::pdu::PduBuilder}; use ruma::{ api::federation::membership::prepare_leave_event, events::room::member::{MembershipState, RoomMemberEventContent}, }; use serde_json::value::to_raw_value; +use tuwunel_core::{Err, Result, matrix::pdu::PduBuilder}; use super::make_join::maybe_strip_event_id; use crate::Ruma; diff --git a/src/api/server/media.rs b/src/api/server/media.rs index cbe8595b..cb0c0c48 100644 --- a/src/api/server/media.rs +++ b/src/api/server/media.rs @@ -1,13 +1,13 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{Err, Result, utils::content_disposition::make_content_disposition}; -use conduwuit_service::media::{Dim, FileMeta}; use ruma::{ Mxc, api::federation::authenticated_media::{ Content, ContentMetadata, FileOrLocation, get_content, get_content_thumbnail, }, }; +use tuwunel_core::{Err, Result, utils::content_disposition::make_content_disposition}; +use tuwunel_service::media::{Dim, FileMeta}; use crate::Ruma; diff --git a/src/api/server/openid.rs b/src/api/server/openid.rs index a09cd7ad..2d043ef0 100644 --- a/src/api/server/openid.rs +++ b/src/api/server/openid.rs @@ -1,6 +1,6 @@ use axum::extract::State; -use conduwuit::Result; use ruma::api::federation::openid::get_openid_userinfo; +use tuwunel_core::Result; use crate::Ruma; diff --git a/src/api/server/publicrooms.rs b/src/api/server/publicrooms.rs index cf66ea71..5a010f02 100644 --- a/src/api/server/publicrooms.rs +++ b/src/api/server/publicrooms.rs @@ -1,6 +1,5 @@ use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{Error, Result}; use ruma::{ api::{ client::error::ErrorKind, @@ -8,6 +7,7 @@ use ruma::{ }, directory::Filter, }; +use tuwunel_core::{Error, Result}; use crate::Ruma; diff --git a/src/api/server/query.rs b/src/api/server/query.rs index 9d4fcf73..2862b65e 100644 --- a/src/api/server/query.rs +++ b/src/api/server/query.rs @@ -1,7 +1,6 @@ use std::collections::BTreeMap; use axum::extract::State; -use conduwuit::{Error, Result, err}; use futures::StreamExt; use get_profile_information::v1::ProfileField; use rand::seq::SliceRandom; @@ -12,6 +11,7 @@ use ruma::{ federation::query::{get_profile_information, get_room_information}, }, }; +use tuwunel_core::{Error, Result, err}; use crate::Ruma; diff --git a/src/api/server/send.rs b/src/api/server/send.rs index 9c5bfd2b..299d6c6a 100644 --- a/src/api/server/send.rs +++ b/src/api/server/send.rs @@ -2,22 +2,6 @@ use std::{collections::BTreeMap, net::IpAddr, time::Instant}; use axum::extract::State; use axum_client_ip::InsecureClientIp; -use conduwuit::{ - Err, Error, Result, debug, - debug::INFO_SPAN_LEVEL, - debug_warn, err, error, - result::LogErr, - trace, - utils::{ - IterStream, ReadyExt, millis_since_unix_epoch, - stream::{BroadbandExt, TryBroadbandExt, automatic_width}, - }, - warn, -}; -use conduwuit_service::{ - Services, - sending::{EDU_LIMIT, PDU_LIMIT}, -}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use itertools::Itertools; use ruma::{ @@ -37,6 +21,22 @@ use ruma::{ serde::Raw, to_device::DeviceIdOrAllDevices, }; +use tuwunel_core::{ + Err, Error, Result, debug, + debug::INFO_SPAN_LEVEL, + debug_warn, err, error, + result::LogErr, + trace, + utils::{ + IterStream, ReadyExt, millis_since_unix_epoch, + stream::{BroadbandExt, TryBroadbandExt, automatic_width}, + }, + warn, +}; +use tuwunel_service::{ + Services, + sending::{EDU_LIMIT, PDU_LIMIT}, +}; use crate::Ruma; diff --git a/src/api/server/send_join.rs b/src/api/server/send_join.rs index a66d8890..97934cf7 100644 --- a/src/api/server/send_join.rs +++ b/src/api/server/send_join.rs @@ -3,13 +3,6 @@ use std::borrow::Borrow; use axum::extract::State; -use conduwuit::{ - Err, Result, at, err, - pdu::gen_event_id_canonical_json, - utils::stream::{IterStream, TryBroadbandExt}, - warn, -}; -use conduwuit_service::Services; use futures::{FutureExt, StreamExt, TryStreamExt}; use ruma::{ CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedUserId, RoomId, @@ -21,6 +14,13 @@ use ruma::{ }, }; use serde_json::value::{RawValue as RawJsonValue, to_raw_value}; +use tuwunel_core::{ + Err, Result, at, err, + pdu::gen_event_id_canonical_json, + utils::stream::{IterStream, TryBroadbandExt}, + warn, +}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/server/send_knock.rs b/src/api/server/send_knock.rs index ee7b6cba..8b9c50d7 100644 --- a/src/api/server/send_knock.rs +++ b/src/api/server/send_knock.rs @@ -1,9 +1,4 @@ use axum::extract::State; -use conduwuit::{ - Err, Result, err, - matrix::pdu::{PduEvent, gen_event_id_canonical_json}, - warn, -}; use futures::FutureExt; use ruma::{ OwnedServerName, OwnedUserId, @@ -15,6 +10,11 @@ use ruma::{ }, serde::JsonObject, }; +use tuwunel_core::{ + Err, Result, err, + matrix::pdu::{PduEvent, gen_event_id_canonical_json}, + warn, +}; use crate::Ruma; diff --git a/src/api/server/send_leave.rs b/src/api/server/send_leave.rs index d3dc994c..8b2f26e0 100644 --- a/src/api/server/send_leave.rs +++ b/src/api/server/send_leave.rs @@ -1,8 +1,6 @@ #![allow(deprecated)] use axum::extract::State; -use conduwuit::{Err, Result, err, matrix::pdu::gen_event_id_canonical_json}; -use conduwuit_service::Services; use futures::FutureExt; use ruma::{ OwnedRoomId, OwnedUserId, RoomId, ServerName, @@ -13,6 +11,8 @@ use ruma::{ }, }; use serde_json::value::RawValue as RawJsonValue; +use tuwunel_core::{Err, Result, err, matrix::pdu::gen_event_id_canonical_json}; +use tuwunel_service::Services; use crate::Ruma; diff --git a/src/api/server/state.rs b/src/api/server/state.rs index 8c786815..34880143 100644 --- a/src/api/server/state.rs +++ b/src/api/server/state.rs @@ -1,9 +1,9 @@ use std::{borrow::Borrow, iter::once}; use axum::extract::State; -use conduwuit::{Result, at, err, utils::IterStream}; use futures::{FutureExt, StreamExt, TryStreamExt}; use ruma::{OwnedEventId, api::federation::event::get_room_state}; +use tuwunel_core::{Result, at, err, utils::IterStream}; use super::AccessCheck; use crate::Ruma; diff --git a/src/api/server/state_ids.rs b/src/api/server/state_ids.rs index 648d4575..ee8f1b22 100644 --- a/src/api/server/state_ids.rs +++ b/src/api/server/state_ids.rs @@ -1,9 +1,9 @@ use std::{borrow::Borrow, iter::once}; use axum::extract::State; -use conduwuit::{Result, at, err}; use futures::{StreamExt, TryStreamExt}; use ruma::{OwnedEventId, api::federation::event::get_room_state_ids}; +use tuwunel_core::{Result, at, err}; use super::AccessCheck; use crate::Ruma; diff --git a/src/api/server/user.rs b/src/api/server/user.rs index 80c353ab..d2742f5f 100644 --- a/src/api/server/user.rs +++ b/src/api/server/user.rs @@ -1,5 +1,4 @@ use axum::extract::State; -use conduwuit::{Error, Result}; use futures::{FutureExt, StreamExt, TryFutureExt}; use ruma::api::{ client::error::ErrorKind, @@ -8,6 +7,7 @@ use ruma::api::{ keys::{claim_keys, get_keys}, }, }; +use tuwunel_core::{Error, Result}; use crate::{ Ruma, diff --git a/src/api/server/utils.rs b/src/api/server/utils.rs index 5696e44b..9182b018 100644 --- a/src/api/server/utils.rs +++ b/src/api/server/utils.rs @@ -1,7 +1,7 @@ -use conduwuit::{Err, Result, implement, is_false}; -use conduwuit_service::Services; use futures::{FutureExt, StreamExt, future::OptionFuture, join}; use ruma::{EventId, RoomId, ServerName}; +use tuwunel_core::{Err, Result, implement, is_false}; +use tuwunel_service::Services; pub(super) struct AccessCheck<'a> { pub(super) services: &'a Services, diff --git a/src/api/server/version.rs b/src/api/server/version.rs index b08ff77a..cea8f468 100644 --- a/src/api/server/version.rs +++ b/src/api/server/version.rs @@ -1,5 +1,5 @@ -use conduwuit::Result; use ruma::api::federation::discovery::get_server_version; +use tuwunel_core::Result; use crate::Ruma; @@ -11,8 +11,8 @@ pub(crate) async fn get_server_version_route( ) -> Result { Ok(get_server_version::v1::Response { server: Some(get_server_version::v1::Server { - name: Some(conduwuit::version::name().into()), - version: Some(conduwuit::version::version().into()), + name: Some(tuwunel_core::version::name().into()), + version: Some(tuwunel_core::version::version().into()), }), }) } diff --git a/src/api/server/well_known.rs b/src/api/server/well_known.rs index 75c7cf5d..f58f59c7 100644 --- a/src/api/server/well_known.rs +++ b/src/api/server/well_known.rs @@ -1,6 +1,6 @@ use axum::extract::State; -use conduwuit::{Error, Result}; use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver}; +use tuwunel_core::{Error, Result}; use crate::Ruma; diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index f42b049b..363e6bfc 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "conduwuit_core" +name = "tuwunel_core" categories.workspace = true description.workspace = true edition.workspace = true @@ -20,7 +20,7 @@ crate-type = [ brotli_compression = [ "reqwest/brotli", ] -conduwuit_mods = [ +tuwunel_mods = [ "dep:libloading" ] gzip_compression = [ @@ -66,7 +66,7 @@ cargo_toml.workspace = true checked_ops.workspace = true chrono.workspace = true clap.workspace = true -conduwuit-macros.workspace = true +tuwunel-macros.workspace = true const-str.workspace = true core_affinity.workspace = true ctor.workspace = true diff --git a/src/core/config/check.rs b/src/core/config/check.rs index f9d51eeb..505dfd91 100644 --- a/src/core/config/check.rs +++ b/src/core/config/check.rs @@ -25,12 +25,15 @@ pub fn reload(old: &Config, new: &Config) -> Result { #[allow(clippy::cognitive_complexity)] pub fn check(config: &Config) -> Result { if cfg!(debug_assertions) { - warn!("Note: conduwuit was built without optimisations (i.e. debug build)"); + warn!("Note: tuwunel was built without optimisations (i.e. debug build)"); } - if config.allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure { - warn!("\n\nWARNING: \n\nTLS CERTIFICATE VALIDATION IS DISABLED, THIS IS HIGHLY INSECURE AND SHOULD NOT BE USED IN PRODUCTION.\n\n"); - } + if config.allow_invalid_tls_certificates { + warn!( + "\n\nWARNING: \n\nTLS CERTIFICATE VALIDATION IS DISABLED, THIS IS HIGHLY INSECURE \ + AND SHOULD NOT BE USED IN PRODUCTION.\n\n" + ); + } warn_deprecated(config); warn_unknown_key(config); @@ -89,17 +92,17 @@ pub fn check(config: &Config) -> Result { error!( "You are detected using Docker with a loopback/localhost listening \ address of {addr}. If you are using a reverse proxy on the host and \ - require communication to conduwuit in the Docker container via \ - NAT-based networking, this will NOT work. Please change this to \ - \"0.0.0.0\". If this is expected, you can ignore.", + require communication to tuwunel in the Docker container via NAT-based \ + networking, this will NOT work. Please change this to \"0.0.0.0\". If \ + this is expected, you can ignore.", ); } else if Path::new("/run/.containerenv").exists() { error!( "You are detected using Podman with a loopback/localhost listening \ address of {addr}. If you are using a reverse proxy on the host and \ - require communication to conduwuit in the Podman container via \ - NAT-based networking, this will NOT work. Please change this to \ - \"0.0.0.0\". If this is expected, you can ignore.", + require communication to tuwunel in the Podman container via NAT-based \ + networking, this will NOT work. Please change this to \"0.0.0.0\". If \ + this is expected, you can ignore.", ); } } @@ -118,7 +121,7 @@ pub fn check(config: &Config) -> Result { if cfg!(not(debug_assertions)) && config.server_name == "your.server.name" { return Err!(Config( "server_name", - "You must specify a valid server name for production usage of conduwuit." + "You must specify a valid server name for production usage of tuwunel." )); } @@ -188,9 +191,9 @@ pub fn check(config: &Config) -> Result { return Err!(Config( "registration_token", "!! You have `allow_registration` enabled without a token configured in your config \ - which means you are allowing ANYONE to register on your conduwuit instance without \ + which means you are allowing ANYONE to register on your tuwunel instance without \ any 2nd-step (e.g. registration token). If this is not the intended behaviour, \ - please set a registration token. For security and safety reasons, conduwuit will \ + please set a registration token. For security and safety reasons, tuwunel will \ shut down. If you are extra sure this is the desired behaviour you want, please \ set the following config option to true: `yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse`" @@ -290,8 +293,8 @@ fn warn_deprecated(config: &Config) { if was_deprecated { warn!( - "Read conduwuit config documentation at https://conduwuit.puppyirl.gay/configuration.html and check your \ - configuration if any new configuration parameters should be adjusted" + "Read tuwunel config documentation at https://tuwunel.chat/configuration.html and \ + check your configuration if any new configuration parameters should be adjusted" ); } } @@ -305,7 +308,7 @@ fn warn_unknown_key(config: &Config) { .keys() .filter(|key| "config".to_owned().ne(key.to_owned()) /* "config" is expected */) { - warn!("Config parameter \"{}\" is unknown to conduwuit, ignoring.", key); + warn!("Config parameter \"{}\" is unknown to tuwunel, ignoring.", key); } } diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index ab4b84e3..27885937 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -8,7 +8,6 @@ use std::{ path::{Path, PathBuf}, }; -use conduwuit_macros::config_example_generator; use either::{ Either, Either::{Left, Right}, @@ -21,21 +20,22 @@ use ruma::{ api::client::discovery::discover_support::ContactRole, }; use serde::{Deserialize, de::IgnoredAny}; +use tuwunel_macros::config_example_generator; use url::Url; use self::proxy::ProxyConfig; pub use self::{check::check, manager::Manager}; use crate::{Result, err, error::Error, utils::sys}; -/// All the config options for conduwuit. +/// All the config options for tuwunel. #[allow(clippy::struct_excessive_bools)] #[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] #[derive(Clone, Debug, Deserialize)] #[config_example_generator( - filename = "conduwuit-example.toml", + filename = "tuwunel-example.toml", section = "global", undocumented = "# This item is undocumented. Please contribute documentation for it.", - header = r#"### conduwuit Configuration + header = r#"### Tuwunel Configuration ### ### THIS FILE IS GENERATED. CHANGES/CONTRIBUTIONS IN THE REPO WILL BE ### OVERWRITTEN! @@ -50,30 +50,30 @@ use crate::{Result, err, error::Error, utils::sys}; ### that say "YOU NEED TO EDIT THIS". ### ### For more information, see: -### https://conduwuit.puppyirl.gay/configuration.html +### https://tuwunel.chat/configuration.html "#, - ignore = "catchall well_known tls blurhashing allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure" + ignore = "catchall well_known tls blurhashing allow_invalid_tls_certificates" )] pub struct Config { /// The server_name is the pretty name of this server. It is used as a /// suffix for user and room IDs/aliases. /// /// See the docs for reverse proxying and delegation: - /// https://conduwuit.puppyirl.gay/deploying/generic.html#setting-up-the-reverse-proxy + /// https://tuwunel.chat/deploying/generic.html#setting-up-the-reverse-proxy /// /// Also see the `[global.well_known]` config section at the very bottom. /// /// Examples of delegation: - /// - https://puppygock.gay/.well-known/matrix/server - /// - https://puppygock.gay/.well-known/matrix/client + /// - https://matrix.org/.well-known/matrix/server + /// - https://matrix.org/.well-known/matrix/client /// /// YOU NEED TO EDIT THIS. THIS CANNOT BE CHANGED AFTER WITHOUT A DATABASE /// WIPE. /// - /// example: "conduwuit.woof" + /// example: "girlboss.ceo" pub server_name: OwnedServerName, - /// The default address (IPv4 or IPv6) conduwuit will listen on. + /// The default address (IPv4 or IPv6) tuwunel will listen on. /// /// If you are using Docker or a container NAT networking setup, this must /// be "0.0.0.0". @@ -85,10 +85,10 @@ pub struct Config { #[serde(default = "default_address")] address: ListeningAddr, - /// The port(s) conduwuit will listen on. + /// The port(s) tuwunel will listen on. /// /// For reverse proxying, see: - /// https://conduwuit.puppyirl.gay/deploying/generic.html#setting-up-the-reverse-proxy + /// https://tuwunel.chat/deploying/generic.html#setting-up-the-reverse-proxy /// /// If you are using Docker, don't change this, you'll need to map an /// external port to this. @@ -103,16 +103,16 @@ pub struct Config { #[serde(default)] pub tls: TlsConfig, - /// The UNIX socket conduwuit will listen on. + /// The UNIX socket tuwunel will listen on. /// - /// conduwuit cannot listen on both an IP address and a UNIX socket. If + /// tuwunel cannot listen on both an IP address and a UNIX socket. If /// listening on a UNIX socket, you MUST remove/comment the `address` key. /// /// Remember to make sure that your reverse proxy has access to this socket - /// file, either by adding your reverse proxy to the 'conduwuit' group or + /// file, either by adding your reverse proxy to the 'tuwunel' group or /// granting world R/W permissions with `unix_socket_perms` (666 minimum). /// - /// example: "/run/conduwuit/conduwuit.sock" + /// example: "/run/tuwunel/tuwunel.sock" pub unix_socket_path: Option, /// The default permissions (in octal) to create the UNIX socket with. @@ -121,22 +121,22 @@ pub struct Config { #[serde(default = "default_unix_socket_perms")] pub unix_socket_perms: u32, - /// This is the only directory where conduwuit will save its data, including + /// This is the only directory where tuwunel will save its data, including /// media. Note: this was previously "/var/lib/matrix-conduit". /// /// YOU NEED TO EDIT THIS. /// - /// example: "/var/lib/conduwuit" + /// example: "/var/lib/tuwunel" pub database_path: PathBuf, - /// conduwuit supports online database backups using RocksDB's Backup engine - /// API. To use this, set a database backup path that conduwuit can write + /// tuwunel supports online database backups using RocksDB's Backup engine + /// API. To use this, set a database backup path that tuwunel can write /// to. /// /// For more information, see: - /// https://conduwuit.puppyirl.gay/maintenance.html#backups + /// https://tuwunel.chat/maintenance.html#backups /// - /// example: "/opt/conduwuit-db-backups" + /// example: "/opt/tuwunel-db-backups" pub database_backup_path: Option, /// The amount of online RocksDB database backups to keep/retain, if using @@ -152,15 +152,11 @@ pub struct Config { /// /// To disable, set this to "" (an empty string). /// - /// The default is the trans pride flag. - /// - /// example: "🏳️‍⚧️" - /// - /// default: "🏳️‍⚧️" + /// default: "🎔" #[serde(default = "default_new_user_displayname_suffix")] pub new_user_displayname_suffix: String, - /// Set this to any float value to multiply conduwuit's in-memory LRU caches + /// Set this to any float value to multiply tuwunel's in-memory LRU caches /// with such as "auth_chain_cache_capacity". /// /// May be useful if you have significant memory to spare to increase @@ -178,7 +174,7 @@ pub struct Config { )] pub cache_capacity_modifier: f64, - /// Set this to any float value in megabytes for conduwuit to tell the + /// Set this to any float value in megabytes for tuwunel to tell the /// database engine that this much memory is available for database read /// caches. /// @@ -194,7 +190,7 @@ pub struct Config { #[serde(default = "default_db_cache_capacity_mb")] pub db_cache_capacity_mb: f64, - /// Set this to any float value in megabytes for conduwuit to tell the + /// Set this to any float value in megabytes for tuwunel to tell the /// database engine that this much memory is available for database write /// caches. /// @@ -311,9 +307,9 @@ pub struct Config { /// Enable using *only* TCP for querying your specified nameservers instead /// of UDP. /// - /// If you are running conduwuit in a container environment, this config + /// If you are running tuwunel in a container environment, this config /// option may need to be enabled. For more details, see: - /// https://conduwuit.puppyirl.gay/troubleshooting.html#potential-dns-issues-when-using-docker + /// https://tuwunel.chat/troubleshooting.html#potential-dns-issues-when-using-docker #[serde(default)] pub query_over_tcp_only: bool, @@ -526,9 +522,9 @@ pub struct Config { /// tokens. Multiple tokens can be added if you separate them with /// whitespace /// - /// conduwuit must be able to access the file, and it must not be empty + /// tuwunel must be able to access the file, and it must not be empty /// - /// example: "/etc/conduwuit/.reg_token" + /// example: "/etc/tuwunel/.reg_token" pub registration_token_file: Option, /// Controls whether encrypted rooms and events are allowed. @@ -619,16 +615,16 @@ pub struct Config { pub allow_room_creation: bool, /// Set to false to disable users from joining or creating room versions - /// that aren't officially supported by conduwuit. + /// that aren't officially supported by tuwunel. /// - /// conduwuit officially supports room versions 6 - 11. + /// tuwunel officially supports room versions 6 - 11. /// - /// conduwuit has slightly experimental (though works fine in practice) + /// tuwunel has slightly experimental (though works fine in practice) /// support for versions 3 - 5. #[serde(default = "true_fn")] pub allow_unstable_room_versions: bool, - /// Default room version conduwuit will create rooms with. + /// Default room version tuwunel will create rooms with. /// /// Per spec, room version 11 is the default. /// @@ -702,7 +698,7 @@ pub struct Config { /// Servers listed here will be used to gather public keys of other servers /// (notary trusted key servers). /// - /// Currently, conduwuit doesn't support inbound batched key requests, so + /// Currently, tuwunel doesn't support inbound batched key requests, so /// this list should only contain other Synapse servers. /// /// example: ["matrix.org", "tchncs.de"] @@ -747,7 +743,7 @@ pub struct Config { #[serde(default = "default_trusted_server_batch_size")] pub trusted_server_batch_size: usize, - /// Max log level for conduwuit. Allows debug, info, warn, or error. + /// Max log level for tuwunel. Allows debug, info, warn, or error. /// /// See also: /// https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives @@ -772,7 +768,7 @@ pub struct Config { #[serde(default = "default_log_span_events")] pub log_span_events: String, - /// Configures whether CONDUWUIT_LOG EnvFilter matches values using regular + /// Configures whether TUWUNEL_LOG EnvFilter matches values using regular /// expressions. See the tracing_subscriber documentation on Directives. /// /// default: true @@ -855,7 +851,7 @@ pub struct Config { /// This takes priority over "turn_secret" first, and falls back to /// "turn_secret" if invalid or failed to open. /// - /// example: "/etc/conduwuit/.turn_secret" + /// example: "/etc/tuwunel/.turn_secret" pub turn_secret_file: Option, /// TURN TTL, in seconds. @@ -864,12 +860,12 @@ pub struct Config { #[serde(default = "default_turn_ttl")] pub turn_ttl: u64, - /// List/vector of room IDs or room aliases that conduwuit will make newly + /// List/vector of room IDs or room aliases that tuwunel will make newly /// registered users join. The rooms specified must be rooms that you have /// joined at least once on the server, and must be public. /// - /// example: ["#conduwuit:puppygock.gay", - /// "!eoIzvAvVwY23LPDay8:puppygock.gay"] + /// example: ["#tuwunel:tuwunel.chat", + /// "!eoIzvAvVwY23LPDay8:tuwunel.chat"] /// /// default: [] #[serde(default = "Vec::new")] @@ -894,9 +890,9 @@ pub struct Config { #[serde(default)] pub auto_deactivate_banned_room_attempts: bool, - /// RocksDB log level. This is not the same as conduwuit's log level. This + /// RocksDB log level. This is not the same as tuwunel's log level. This /// is the log level for the RocksDB engine/library which show up in your - /// database folder/path as `LOG` files. conduwuit will log RocksDB errors + /// database folder/path as `LOG` files. tuwunel will log RocksDB errors /// as normal through tracing or panics if severe for safety. /// /// default: "error" @@ -922,7 +918,7 @@ pub struct Config { /// Set this to true to use RocksDB config options that are tailored to HDDs /// (slower device storage). /// - /// It is worth noting that by default, conduwuit will use RocksDB with + /// It is worth noting that by default, tuwunel will use RocksDB with /// Direct IO enabled. *Generally* speaking this improves performance as it /// bypasses buffered I/O (system page cache). However there is a potential /// chance that Direct IO may cause issues with database operations if your @@ -930,7 +926,7 @@ pub struct Config { /// possibly ZFS filesystem. RocksDB generally deals/corrects these issues /// but it cannot account for all setups. If you experience any weird /// RocksDB issues, try enabling this option as it turns off Direct IO and - /// feel free to report in the conduwuit Matrix room if this option fixes + /// feel free to report in the tuwunel Matrix room if this option fixes /// your DB issues. /// /// For more information, see: @@ -991,7 +987,7 @@ pub struct Config { /// as they all differ. See their `kDefaultCompressionLevel`. /// /// Note when using the default value we may override it with a setting - /// tailored specifically conduwuit. + /// tailored specifically tuwunel. /// /// default: 32767 #[serde(default = "default_rocksdb_compression_level")] @@ -1009,7 +1005,7 @@ pub struct Config { /// algorithm. /// /// Note when using the default value we may override it with a setting - /// tailored specifically conduwuit. + /// tailored specifically tuwunel. /// /// default: 32767 #[serde(default = "default_rocksdb_bottommost_compression_level")] @@ -1051,13 +1047,13 @@ pub struct Config { /// 0 = AbsoluteConsistency /// 1 = TolerateCorruptedTailRecords (default) /// 2 = PointInTime (use me if trying to recover) - /// 3 = SkipAnyCorruptedRecord (you now voided your Conduwuit warranty) + /// 3 = SkipAnyCorruptedRecord (you now voided your tuwunel warranty) /// /// For more information on these modes, see: /// https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes /// /// For more details on recovering a corrupt database, see: - /// https://conduwuit.puppyirl.gay/troubleshooting.html#database-corruption + /// https://tuwunel.chat/troubleshooting.html#database-corruption /// /// default: 1 #[serde(default = "default_rocksdb_recovery_mode")] @@ -1101,7 +1097,7 @@ pub struct Config { /// - Disabling repair mode and restarting the server is recommended after /// running the repair. /// - /// See https://conduwuit.puppyirl.gay/troubleshooting.html#database-corruption for more details on recovering a corrupt database. + /// See https://tuwunel.chat/troubleshooting.html#database-corruption for more details on recovering a corrupt database. #[serde(default)] pub rocksdb_repair: bool, @@ -1126,7 +1122,7 @@ pub struct Config { /// Enables RocksDB compaction. You should never ever have to set this /// option to false. If you for some reason find yourself needing to use /// this option as part of troubleshooting or a bug, please reach out to us - /// in the conduwuit Matrix room with information and details. + /// in the tuwunel Matrix room with information and details. /// /// Disabling compaction will lead to a significantly bloated and /// explosively large database, gradually poor performance, unnecessarily @@ -1154,7 +1150,7 @@ pub struct Config { /// purposes such as recovering/recreating your admin room, or inviting /// yourself back. /// - /// See https://conduwuit.puppyirl.gay/troubleshooting.html#lost-access-to-admin-room for other ways to get back into your admin room. + /// See https://tuwunel.chat/troubleshooting.html#lost-access-to-admin-room for other ways to get back into your admin room. /// /// Once this password is unset, all sessions will be logged out for /// security purposes. @@ -1170,7 +1166,7 @@ pub struct Config { /// Allow local (your server only) presence updates/requests. /// - /// Note that presence on conduwuit is very fast unlike Synapse's. If using + /// Note that presence on tuwunel is very fast unlike Synapse's. If using /// outgoing presence, this MUST be enabled. #[serde(default = "true_fn")] pub allow_local_presence: bool, @@ -1179,7 +1175,7 @@ pub struct Config { /// /// This option receives presence updates from other servers, but does not /// send any unless `allow_outgoing_presence` is true. Note that presence on - /// conduwuit is very fast unlike Synapse's. + /// tuwunel is very fast unlike Synapse's. #[serde(default = "true_fn")] pub allow_incoming_presence: bool, @@ -1187,7 +1183,7 @@ pub struct Config { /// /// This option sends presence updates to other servers, but does not /// receive any unless `allow_incoming_presence` is true. Note that presence - /// on conduwuit is very fast unlike Synapse's. If using outgoing presence, + /// on tuwunel is very fast unlike Synapse's. If using outgoing presence, /// you MUST enable `allow_local_presence` as well. #[serde(default = "true_fn")] pub allow_outgoing_presence: bool, @@ -1251,8 +1247,8 @@ pub struct Config { #[serde(default = "default_typing_client_timeout_max_s")] pub typing_client_timeout_max_s: u64, - /// Set this to true for conduwuit to compress HTTP response bodies using - /// zstd. This option does nothing if conduwuit was not built with + /// Set this to true for tuwunel to compress HTTP response bodies using + /// zstd. This option does nothing if tuwunel was not built with /// `zstd_compression` feature. Please be aware that enabling HTTP /// compression may weaken TLS. Most users should not need to enable this. /// See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH @@ -1260,8 +1256,8 @@ pub struct Config { #[serde(default)] pub zstd_compression: bool, - /// Set this to true for conduwuit to compress HTTP response bodies using - /// gzip. This option does nothing if conduwuit was not built with + /// Set this to true for tuwunel to compress HTTP response bodies using + /// gzip. This option does nothing if tuwunel was not built with /// `gzip_compression` feature. Please be aware that enabling HTTP /// compression may weaken TLS. Most users should not need to enable this. /// See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before @@ -1272,8 +1268,8 @@ pub struct Config { #[serde(default)] pub gzip_compression: bool, - /// Set this to true for conduwuit to compress HTTP response bodies using - /// brotli. This option does nothing if conduwuit was not built with + /// Set this to true for tuwunel to compress HTTP response bodies using + /// brotli. This option does nothing if tuwunel was not built with /// `brotli_compression` feature. Please be aware that enabling HTTP /// compression may weaken TLS. Most users should not need to enable this. /// See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH @@ -1316,8 +1312,8 @@ pub struct Config { /// Check consistency of the media directory at startup: /// 1. When `media_compat_file_link` is enabled, this check will upgrade - /// media when switching back and forth between Conduit and conduwuit. - /// Both options must be enabled to handle this. + /// media when switching back and forth between Conduit and tuwunel. Both + /// options must be enabled to handle this. /// 2. When media is deleted from the directory, this check will also delete /// its database entry. /// @@ -1334,7 +1330,7 @@ pub struct Config { /// Otherwise setting this to false reduces filesystem clutter and overhead /// for managing these symlinks in the directory. This is now disabled by /// default. You may still return to upstream Conduit but you have to run - /// conduwuit at least once with this set to true and allow the + /// tuwunel at least once with this set to true and allow the /// media_startup_check to take place before shutting down to return to /// Conduit. #[serde(default)] @@ -1351,7 +1347,7 @@ pub struct Config { #[serde(default)] pub prune_missing_media: bool, - /// Vector list of regex patterns of server names that conduwuit will refuse + /// Vector list of regex patterns of server names that tuwunel will refuse /// to download remote media from. /// /// example: ["badserver\.tld$", "badphrase", "19dollarfortnitecards"] @@ -1387,7 +1383,7 @@ pub struct Config { pub forbidden_remote_room_directory_server_names: RegexSet, /// Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you - /// do not want conduwuit to send outbound requests to. Defaults to + /// do not want tuwunel to send outbound requests to. Defaults to /// RFC1918, unroutable, loopback, multicast, and testnet addresses for /// security. /// @@ -1555,25 +1551,25 @@ pub struct Config { /// Allow admins to enter commands in rooms other than "#admins" (admin /// room) by prefixing your message with "\!admin" or "\\!admin" followed up - /// a normal conduwuit admin command. The reply will be publicly visible to + /// a normal tuwunel admin command. The reply will be publicly visible to /// the room, originating from the sender. /// /// example: \\!admin debug ping puppygock.gay #[serde(default = "true_fn")] pub admin_escape_commands: bool, - /// Automatically activate the conduwuit admin room console / CLI on - /// startup. This option can also be enabled with `--console` conduwuit + /// Automatically activate the tuwunel admin room console / CLI on + /// startup. This option can also be enabled with `--console` tuwunel /// argument. #[serde(default)] pub admin_console_automatic: bool, /// List of admin commands to execute on startup. /// - /// This option can also be configured with the `--execute` conduwuit + /// This option can also be configured with the `--execute` tuwunel /// argument and can take standard shell commands and environment variables /// - /// For example: `./conduwuit --execute "server admin-notice conduwuit has + /// For example: `./tuwunel --execute "server admin-notice tuwunel has /// started up at $(date)"` /// /// example: admin_execute = ["debug ping puppygock.gay", "debug echo hi"]` @@ -1584,7 +1580,7 @@ pub struct Config { /// Ignore errors in startup commands. /// - /// If false, conduwuit will error and fail to start if an admin execute + /// If false, tuwunel will error and fail to start if an admin execute /// command (`--execute` / `admin_execute`) fails. #[serde(default)] pub admin_execute_errors_ignore: bool, @@ -1609,7 +1605,7 @@ pub struct Config { /// The default room tag to apply on the admin room. /// /// On some clients like Element, the room tag "m.server_notice" is a - /// special pinned room at the very bottom of your room list. The conduwuit + /// special pinned room at the very bottom of your room list. The tuwunel /// admin room can be pinned here so you always have an easy-to-access /// shortcut dedicated to your admin room. /// @@ -1618,7 +1614,7 @@ pub struct Config { pub admin_room_tag: String, /// Sentry.io crash/panic reporting, performance monitoring/metrics, etc. - /// This is NOT enabled by default. conduwuit's default Sentry reporting + /// This is NOT enabled by default. tuwunel's default Sentry reporting /// endpoint domain is `o4506996327251968.ingest.us.sentry.io`. #[serde(default)] pub sentry: bool, @@ -1630,7 +1626,7 @@ pub struct Config { #[serde(default = "default_sentry_endpoint")] pub sentry_endpoint: Option, - /// Report your conduwuit server_name in Sentry.io crash reports and + /// Report your tuwunel server_name in Sentry.io crash reports and /// metrics. #[serde(default)] pub sentry_send_server_name: bool, @@ -1671,7 +1667,7 @@ pub struct Config { /// Enable the tokio-console. This option is only relevant to developers. /// /// For more information, see: - /// https://conduwuit.puppyirl.gay/development.html#debugging-with-tokio-console + /// https://tuwunel.chat/development.html#debugging-with-tokio-console #[serde(default)] pub tokio_console: bool, @@ -1800,8 +1796,7 @@ pub struct Config { /// it is highly insecure and I will personally yell at you if I catch you /// using this. #[serde(default)] - pub allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure: - bool, + pub allow_invalid_tls_certificates: bool, // external structure; separate section #[serde(default)] @@ -1813,7 +1808,7 @@ pub struct Config { } #[derive(Clone, Debug, Deserialize, Default)] -#[config_example_generator(filename = "conduwuit-example.toml", section = "global.tls")] +#[config_example_generator(filename = "tuwunel-example.toml", section = "global.tls")] pub struct TlsConfig { /// Path to a valid TLS certificate file. /// @@ -1832,7 +1827,7 @@ pub struct TlsConfig { #[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] #[derive(Clone, Debug, Deserialize, Default)] -#[config_example_generator(filename = "conduwuit-example.toml", section = "global.well_known")] +#[config_example_generator(filename = "tuwunel-example.toml", section = "global.well_known")] pub struct WellKnownConfig { /// The server URL that the client well-known file will serve. This should /// not contain a port, and should just be a valid HTTPS URL. @@ -1858,7 +1853,7 @@ pub struct WellKnownConfig { #[derive(Clone, Copy, Debug, Deserialize, Default)] #[allow(rustdoc::broken_intra_doc_links, rustdoc::bare_urls)] -#[config_example_generator(filename = "conduwuit-example.toml", section = "global.blurhashing")] +#[config_example_generator(filename = "tuwunel-example.toml", section = "global.blurhashing")] pub struct BlurhashConfig { /// blurhashing x component, 4 is recommended by https://blurha.sh/ /// @@ -1913,7 +1908,11 @@ impl Config { where I: Iterator, { - let envs = [Env::var("CONDUIT_CONFIG"), Env::var("CONDUWUIT_CONFIG")]; + let envs = [ + Env::var("CONDUIT_CONFIG"), + Env::var("CONDUWUIT_CONFIG"), + Env::var("TUWUNEL_CONFIG"), + ]; let config = envs .into_iter() @@ -1922,7 +1921,8 @@ impl Config { .chain(paths.map(Toml::file)) .fold(Figment::new(), |config, file| config.merge(file.nested())) .merge(Env::prefixed("CONDUIT_").global().split("__")) - .merge(Env::prefixed("CONDUWUIT_").global().split("__")); + .merge(Env::prefixed("CONDUWUIT_").global().split("__")) + .merge(Env::prefixed("TUWUNEL_").global().split("__")); Ok(config) } @@ -2195,7 +2195,7 @@ fn default_url_preview_max_spider_size() -> usize { 256_000 // 256KB } -fn default_new_user_displayname_suffix() -> String { "🏳️‍⚧️".to_owned() } +fn default_new_user_displayname_suffix() -> String { "🎔".to_owned() } fn default_sentry_endpoint() -> Option { None } diff --git a/src/core/debug.rs b/src/core/debug.rs index 21a5ada4..8a850b4d 100644 --- a/src/core/debug.rs +++ b/src/core/debug.rs @@ -2,9 +2,9 @@ use std::{any::Any, env, panic, sync::LazyLock}; -// Export debug proc_macros -pub use conduwuit_macros::recursion_depth; use tracing::Level; +// Export debug proc_macros +pub use tuwunel_macros::recursion_depth; // Export all of the ancillary tools from here as well. pub use crate::{result::DebugInspect, utils::debug::*}; diff --git a/src/core/error/mod.rs b/src/core/error/mod.rs index e46edf09..162165da 100644 --- a/src/core/error/mod.rs +++ b/src/core/error/mod.rs @@ -85,7 +85,7 @@ pub enum Error { #[error(transparent)] Yaml(#[from] serde_yaml::Error), - // ruma/conduwuit + // ruma/tuwunel #[error("Arithmetic operation failed: {0}")] Arithmetic(Cow<'static, str>), #[error("{0}: {1}")] diff --git a/src/core/info/cargo.rs b/src/core/info/cargo.rs index 28c6590e..0a747bb8 100644 --- a/src/core/info/cargo.rs +++ b/src/core/info/cargo.rs @@ -6,7 +6,7 @@ use std::sync::OnceLock; use cargo_toml::{DepsSet, Manifest}; -use conduwuit_macros::cargo_manifest; +use tuwunel_macros::cargo_manifest; use crate::Result; diff --git a/src/core/info/mod.rs b/src/core/info/mod.rs index ca39b348..00a4484e 100644 --- a/src/core/info/mod.rs +++ b/src/core/info/mod.rs @@ -6,7 +6,7 @@ pub mod room_version; pub mod rustc; pub mod version; -pub use conduwuit_macros::rustc_flags_capture; +pub use tuwunel_macros::rustc_flags_capture; pub const MODULE_ROOT: &str = const_str::split!(std::module_path!(), "::")[0]; pub const CRATE_PREFIX: &str = const_str::split!(MODULE_ROOT, '_')[0]; diff --git a/src/core/info/version.rs b/src/core/info/version.rs index 37580210..5350ac34 100644 --- a/src/core/info/version.rs +++ b/src/core/info/version.rs @@ -1,13 +1,13 @@ -//! one true function for returning the conduwuit version with the necessary -//! CONDUWUIT_VERSION_EXTRA env variables used if specified +//! one true function for returning the application version with the necessary +//! TUWUNEL_VERSION_EXTRA env variables used if specified //! -//! Set the environment variable `CONDUWUIT_VERSION_EXTRA` to any UTF-8 string +//! Set the environment variable `TUWUNEL_VERSION_EXTRA` to any UTF-8 string //! to include it in parenthesis after the SemVer version. A common value are //! git commit hashes. use std::sync::OnceLock; -static BRANDING: &str = "conduwuit"; +static BRANDING: &str = "Tuwunel"; static SEMANTIC: &str = env!("CARGO_PKG_VERSION"); static VERSION: OnceLock = OnceLock::new(); @@ -26,7 +26,8 @@ pub fn user_agent() -> &'static str { USER_AGENT.get_or_init(init_user_agent) } fn init_user_agent() -> String { format!("{}/{}", name(), version()) } fn init_version() -> String { - option_env!("CONDUWUIT_VERSION_EXTRA") + option_env!("TUWUNEL_VERSION_EXTRA") + .or(option_env!("CONDUWUIT_VERSION_EXTRA")) .or(option_env!("CONDUIT_VERSION_EXTRA")) .map_or(SEMANTIC.to_owned(), |extra| { if extra.is_empty() { diff --git a/src/core/mod.rs b/src/core/mod.rs index b91cdf0b..a8dda08b 100644 --- a/src/core/mod.rs +++ b/src/core/mod.rs @@ -26,11 +26,11 @@ pub use matrix::{Event, EventTypeExt, PduCount, PduEvent, PduId, RoomVersion, pd pub use server::Server; pub use utils::{ctor, dtor, implement, result, result::Result}; -pub use crate as conduwuit_core; +pub use crate as tuwunel_core; rustc_flags_capture! {} -#[cfg(any(not(conduwuit_mods), not(feature = "conduwuit_mods")))] +#[cfg(any(not(tuwunel_mods), not(feature = "tuwunel_mods")))] pub mod mods { #[macro_export] macro_rules! mod_ctor { diff --git a/src/core/mods/mod.rs b/src/core/mods/mod.rs index b8f06f29..daaa4160 100644 --- a/src/core/mods/mod.rs +++ b/src/core/mods/mod.rs @@ -1,4 +1,4 @@ -#![cfg(all(conduwuit_mods, feature = "conduwuit_mods"))] +#![cfg(all(tuwunel_mods, feature = "tuwunel_mods"))] pub(crate) use libloading::os::unix::{Library, Symbol}; diff --git a/src/core/server.rs b/src/core/server.rs index 4b673f32..ab6d5135 100644 --- a/src/core/server.rs +++ b/src/core/server.rs @@ -65,7 +65,7 @@ impl Server { } pub fn reload(&self) -> Result<()> { - if cfg!(any(not(conduwuit_mods), not(feature = "conduwuit_mods"))) { + if cfg!(any(not(tuwunel_mods), not(feature = "tuwunel_mods"))) { return Err!("Reloading not enabled"); } diff --git a/src/core/utils/debug.rs b/src/core/utils/debug.rs index b16ae754..31163a54 100644 --- a/src/core/utils/debug.rs +++ b/src/core/utils/debug.rs @@ -25,7 +25,7 @@ impl fmt::Debug for TruncatedSlice<'_, T> { /// See [`TruncatedSlice`]. Useful for `#[instrument]`: /// /// ``` -/// use conduwuit_core::utils::debug::slice_truncated; +/// use tuwunel_core::utils::debug::slice_truncated; /// /// #[tracing::instrument(fields(foos = slice_truncated(foos, 42)))] /// fn bar(foos: &[&str]); diff --git a/src/core/utils/mod.rs b/src/core/utils/mod.rs index 54404e4c..320871fe 100644 --- a/src/core/utils/mod.rs +++ b/src/core/utils/mod.rs @@ -20,8 +20,8 @@ pub mod sys; mod tests; pub mod time; -pub use ::conduwuit_macros::implement; pub use ::ctor::{ctor, dtor}; +pub use ::tuwunel_macros::implement; pub use self::{ arrayvec::ArrayVecExt, diff --git a/src/core/utils/string.rs b/src/core/utils/string.rs index 7d81903d..179fe733 100644 --- a/src/core/utils/string.rs +++ b/src/core/utils/string.rs @@ -87,7 +87,7 @@ where /// Find the common prefix from a collection of strings and return a slice /// ``` -/// use conduwuit_core::utils::string::common_prefix; +/// use tuwunel_core::utils::string::common_prefix; /// let input = ["conduwuit", "conduit", "construct"]; /// common_prefix(&input) == "con"; /// ``` diff --git a/src/database/Cargo.toml b/src/database/Cargo.toml index 55d4793f..9191623b 100644 --- a/src/database/Cargo.toml +++ b/src/database/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "conduwuit_database" +name = "tuwunel_database" categories.workspace = true description.workspace = true edition.workspace = true @@ -21,33 +21,32 @@ io_uring = [ "rust-rocksdb/io-uring", ] jemalloc = [ - "conduwuit-core/jemalloc", + "tuwunel-core/jemalloc", "rust-rocksdb/jemalloc", ] jemalloc_conf = [ - "conduwuit-core/jemalloc_conf", + "tuwunel-core/jemalloc_conf", ] jemalloc_prof = [ - "conduwuit-core/jemalloc_prof", + "tuwunel-core/jemalloc_prof", ] jemalloc_stats = [ - "conduwuit-core/jemalloc_stats", + "tuwunel-core/jemalloc_stats", ] release_max_log_level = [ - "conduwuit-core/release_max_log_level", + "tuwunel-core/release_max_log_level", "log/max_level_trace", "log/release_max_level_info", "tracing/max_level_trace", "tracing/release_max_level_info", ] zstd_compression = [ - "conduwuit-core/zstd_compression", + "tuwunel-core/zstd_compression", "rust-rocksdb/zstd", ] [dependencies] async-channel.workspace = true -conduwuit-core.workspace = true const-str.workspace = true futures.workspace = true log.workspace = true @@ -58,6 +57,7 @@ serde.workspace = true serde_json.workspace = true tokio.workspace = true tracing.workspace = true +tuwunel-core.workspace = true [lints] workspace = true diff --git a/src/database/benches.rs b/src/database/benches.rs index 56d1411c..76edee78 100644 --- a/src/database/benches.rs +++ b/src/database/benches.rs @@ -1,10 +1,10 @@ -#[cfg(conduwuit_bench)] +#[cfg(tuwunel_bench)] extern crate test; -#[cfg(conduwuit_bench)] -#[cfg_attr(conduwuit_bench, bench)] +#[cfg(tuwunel_bench)] +#[cfg_attr(tuwunel_bench, bench)] fn ser_str(b: &mut test::Bencher) { - use conduwuit::ruma::{RoomId, UserId}; + use tuwunel::ruma::{RoomId, UserId}; use crate::ser::serialize_to_vec; diff --git a/src/database/de.rs b/src/database/de.rs index 849b3b2e..f6f2ab0f 100644 --- a/src/database/de.rs +++ b/src/database/de.rs @@ -1,10 +1,10 @@ -use conduwuit::{ - Error, Result, arrayvec::ArrayVec, checked, debug::DebugInspect, err, utils::string, -}; use serde::{ Deserialize, de, de::{DeserializeSeed, Visitor}, }; +use tuwunel_core::{ + Error, Result, arrayvec::ArrayVec, checked, debug::DebugInspect, err, utils::string, +}; use crate::util::unhandled; @@ -416,7 +416,7 @@ impl<'a, 'de: 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> { )] fn deserialize_any>(self, visitor: V) -> Result { debug_assert_eq!( - conduwuit::debug::type_name::(), + tuwunel_core::debug::type_name::(), "serde_json::value::de::::deserialize::ValueVisitor", "deserialize_any: type not expected" diff --git a/src/database/deserialized.rs b/src/database/deserialized.rs index 66541b2a..48ddeda2 100644 --- a/src/database/deserialized.rs +++ b/src/database/deserialized.rs @@ -1,7 +1,7 @@ use std::convert::identity; -use conduwuit::Result; use serde::Deserialize; +use tuwunel_core::Result; pub trait Deserialized { fn map_de(self, f: F) -> Result diff --git a/src/database/engine.rs b/src/database/engine.rs index 38dd7512..cfaa1c7c 100644 --- a/src/database/engine.rs +++ b/src/database/engine.rs @@ -17,11 +17,11 @@ use std::{ }, }; -use conduwuit::{Err, Result, debug, info, warn}; use rocksdb::{ AsColumnFamilyRef, BoundColumnFamily, DBCommon, DBWithThreadMode, MultiThreaded, WaitForCompactOptions, }; +use tuwunel_core::{Err, Result, debug, info, warn}; use crate::{ Context, diff --git a/src/database/engine/backup.rs b/src/database/engine/backup.rs index ac72e6d4..1c7de263 100644 --- a/src/database/engine/backup.rs +++ b/src/database/engine/backup.rs @@ -1,7 +1,9 @@ use std::{ffi::OsString, path::PathBuf}; -use conduwuit::{Err, Result, error, implement, info, utils::time::rfc2822_from_seconds, warn}; use rocksdb::backup::{BackupEngine, BackupEngineOptions}; +use tuwunel_core::{ + Err, Result, error, implement, info, utils::time::rfc2822_from_seconds, warn, +}; use super::Engine; use crate::util::map_err; diff --git a/src/database/engine/cf_opts.rs b/src/database/engine/cf_opts.rs index 7ceec722..e21e1681 100644 --- a/src/database/engine/cf_opts.rs +++ b/src/database/engine/cf_opts.rs @@ -1,9 +1,9 @@ -use conduwuit::{Config, Result, err, utils::math::Expected}; use rocksdb::{ BlockBasedIndexType, BlockBasedOptions, BlockBasedPinningTier, Cache, DBCompressionType as CompressionType, DataBlockIndexType, FifoCompactOptions, LruCacheOptions, Options, UniversalCompactOptions, UniversalCompactionStopStyle, }; +use tuwunel_core::{Config, Result, err, utils::math::Expected}; use super::descriptor::{CacheDisp, Descriptor}; use crate::{Context, util::map_err}; diff --git a/src/database/engine/context.rs b/src/database/engine/context.rs index 380e37af..c089da2a 100644 --- a/src/database/engine/context.rs +++ b/src/database/engine/context.rs @@ -3,8 +3,8 @@ use std::{ sync::{Arc, Mutex}, }; -use conduwuit::{Result, Server, debug, utils::math::usize_from_f64}; use rocksdb::{Cache, Env, LruCacheOptions}; +use tuwunel_core::{Result, Server, debug, utils::math::usize_from_f64}; use crate::{or_else, pool::Pool}; diff --git a/src/database/engine/db_opts.rs b/src/database/engine/db_opts.rs index 18cec742..9c0c788f 100644 --- a/src/database/engine/db_opts.rs +++ b/src/database/engine/db_opts.rs @@ -1,7 +1,7 @@ use std::{cmp, convert::TryFrom}; -use conduwuit::{Config, Result, utils}; use rocksdb::{Cache, DBRecoveryMode, Env, LogLevel, Options, statistics::StatsLevel}; +use tuwunel_core::{Config, Result, utils}; use super::{cf_opts::cache_size_f64, logger::handle as handle_log}; diff --git a/src/database/engine/descriptor.rs b/src/database/engine/descriptor.rs index 2274da9c..bb18fabb 100644 --- a/src/database/engine/descriptor.rs +++ b/src/database/engine/descriptor.rs @@ -1,8 +1,8 @@ -use conduwuit::utils::string::EMPTY; use rocksdb::{ DBCompactionPri as CompactionPri, DBCompactionStyle as CompactionStyle, DBCompressionType as CompressionType, }; +use tuwunel_core::utils::string::EMPTY; use super::cf_opts::SENTINEL_COMPRESSION_LEVEL; diff --git a/src/database/engine/files.rs b/src/database/engine/files.rs index 1f38a63c..31f8d00f 100644 --- a/src/database/engine/files.rs +++ b/src/database/engine/files.rs @@ -1,5 +1,5 @@ -use conduwuit::{Result, implement}; use rocksdb::LiveFile as SstFile; +use tuwunel_core::{Result, implement}; use super::Engine; use crate::util::map_err; diff --git a/src/database/engine/logger.rs b/src/database/engine/logger.rs index 23e23fc7..1cbba4da 100644 --- a/src/database/engine/logger.rs +++ b/src/database/engine/logger.rs @@ -1,5 +1,5 @@ -use conduwuit::{debug, error, warn}; use rocksdb::LogLevel; +use tuwunel_core::{debug, error, warn}; #[tracing::instrument( parent = None, diff --git a/src/database/engine/memory_usage.rs b/src/database/engine/memory_usage.rs index 9bb5c535..1fd329df 100644 --- a/src/database/engine/memory_usage.rs +++ b/src/database/engine/memory_usage.rs @@ -1,7 +1,7 @@ use std::fmt::Write; -use conduwuit::{Result, implement}; use rocksdb::perf::get_memory_usage_stats; +use tuwunel_core::{Result, implement}; use super::Engine; use crate::or_else; diff --git a/src/database/engine/open.rs b/src/database/engine/open.rs index 84e59a6a..b59bdcbd 100644 --- a/src/database/engine/open.rs +++ b/src/database/engine/open.rs @@ -4,8 +4,8 @@ use std::{ sync::{Arc, atomic::AtomicU32}, }; -use conduwuit::{Result, debug, implement, info, warn}; use rocksdb::{ColumnFamilyDescriptor, Options}; +use tuwunel_core::{Result, debug, implement, info, warn}; use super::{ Db, Engine, diff --git a/src/database/engine/repair.rs b/src/database/engine/repair.rs index aeec0caf..b3fd802c 100644 --- a/src/database/engine/repair.rs +++ b/src/database/engine/repair.rs @@ -1,7 +1,7 @@ use std::path::PathBuf; -use conduwuit::{Err, Result, info, warn}; use rocksdb::Options; +use tuwunel_core::{Err, Result, info, warn}; use super::Db; diff --git a/src/database/handle.rs b/src/database/handle.rs index 484e5618..f25c414f 100644 --- a/src/database/handle.rs +++ b/src/database/handle.rs @@ -1,8 +1,8 @@ use std::{fmt, fmt::Debug, ops::Deref}; -use conduwuit::Result; use rocksdb::DBPinnableSlice; use serde::{Deserialize, Serialize, Serializer}; +use tuwunel_core::Result; use crate::{Deserialized, Slice, keyval::deserialize_val}; diff --git a/src/database/keyval.rs b/src/database/keyval.rs index 6059cd53..79f1398f 100644 --- a/src/database/keyval.rs +++ b/src/database/keyval.rs @@ -1,5 +1,5 @@ -use conduwuit::{Result, smallvec::SmallVec}; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Result, smallvec::SmallVec}; use crate::{de, ser}; diff --git a/src/database/map.rs b/src/database/map.rs index ed38e1fc..f9f2c502 100644 --- a/src/database/map.rs +++ b/src/database/map.rs @@ -33,8 +33,8 @@ use std::{ sync::Arc, }; -use conduwuit::Result; use rocksdb::{AsColumnFamilyRef, ColumnFamily, ReadOptions, WriteOptions}; +use tuwunel_core::Result; pub(crate) use self::options::{ cache_iter_options_default, cache_read_options_default, iter_options_default, diff --git a/src/database/map/clear.rs b/src/database/map/clear.rs index 321ec79c..7ca164d9 100644 --- a/src/database/map/clear.rs +++ b/src/database/map/clear.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use conduwuit::{ +use futures::{Stream, TryStreamExt}; +use tuwunel_core::{ Result, implement, utils::stream::{ReadyExt, TryIgnore}, }; -use futures::{Stream, TryStreamExt}; use crate::keyval::Key; diff --git a/src/database/map/compact.rs b/src/database/map/compact.rs index b49bf30b..96aa5c96 100644 --- a/src/database/map/compact.rs +++ b/src/database/map/compact.rs @@ -1,5 +1,5 @@ -use conduwuit::{Err, Result, implement}; use rocksdb::{BottommostLevelCompaction, CompactOptions}; +use tuwunel_core::{Err, Result, implement}; use crate::keyval::KeyBuf; diff --git a/src/database/map/contains.rs b/src/database/map/contains.rs index 474818e8..17f4a664 100644 --- a/src/database/map/contains.rs +++ b/src/database/map/contains.rs @@ -1,13 +1,13 @@ use std::{convert::AsRef, fmt::Debug, future::Future, io::Write, sync::Arc}; -use conduwuit::{ +use futures::FutureExt; +use serde::Serialize; +use tuwunel_core::{ Result, arrayvec::ArrayVec, err, implement, utils::{future::TryExtExt, result::FlatOk}, }; -use futures::FutureExt; -use serde::Serialize; use crate::{keyval::KeyBuf, ser}; diff --git a/src/database/map/count.rs b/src/database/map/count.rs index 78f9e2e3..2f6b9d83 100644 --- a/src/database/map/count.rs +++ b/src/database/map/count.rs @@ -1,8 +1,8 @@ use std::{fmt::Debug, future::Future, sync::Arc}; -use conduwuit::implement; use futures::stream::StreamExt; use serde::Serialize; +use tuwunel_core::implement; /// Count the total number of entries in the map. #[implement(super::Map)] diff --git a/src/database/map/get.rs b/src/database/map/get.rs index 0971fb17..b35d2966 100644 --- a/src/database/map/get.rs +++ b/src/database/map/get.rs @@ -1,9 +1,9 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Err, Result, err, implement, utils::result::MapExpect}; use futures::{Future, FutureExt, TryFutureExt, future::ready}; use rocksdb::{DBPinnableSlice, ReadOptions}; use tokio::task; +use tuwunel_core::{Err, Result, err, implement, utils::result::MapExpect}; use crate::{ Handle, diff --git a/src/database/map/get_batch.rs b/src/database/map/get_batch.rs index e23a8848..c0ef709d 100644 --- a/src/database/map/get_batch.rs +++ b/src/database/map/get_batch.rs @@ -1,14 +1,14 @@ use std::{convert::AsRef, sync::Arc}; -use conduwuit::{ +use futures::{Stream, StreamExt, TryStreamExt}; +use rocksdb::{DBPinnableSlice, ReadOptions}; +use tuwunel_core::{ Result, implement, utils::{ IterStream, stream::{WidebandExt, automatic_amplification, automatic_width}, }, }; -use futures::{Stream, StreamExt, TryStreamExt}; -use rocksdb::{DBPinnableSlice, ReadOptions}; use super::get::{cached_handle_from, handle_from}; use crate::Handle; diff --git a/src/database/map/insert.rs b/src/database/map/insert.rs index 6f010097..0441c8f8 100644 --- a/src/database/map/insert.rs +++ b/src/database/map/insert.rs @@ -5,9 +5,9 @@ use std::{convert::AsRef, fmt::Debug, io::Write}; -use conduwuit::{arrayvec::ArrayVec, implement}; use rocksdb::WriteBatchWithTransaction; use serde::Serialize; +use tuwunel_core::{arrayvec::ArrayVec, implement}; use crate::{ keyval::{KeyBuf, ValBuf}, diff --git a/src/database/map/keys.rs b/src/database/map/keys.rs index 7ca932a5..a3a6c405 100644 --- a/src/database/map/keys.rs +++ b/src/database/map/keys.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::Deserialize; use tokio::task; +use tuwunel_core::{Result, implement}; use super::stream::is_cached; use crate::{keyval, keyval::Key, stream}; diff --git a/src/database/map/keys_from.rs b/src/database/map/keys_from.rs index c9b1717a..d89bf99d 100644 --- a/src/database/map/keys_from.rs +++ b/src/database/map/keys_from.rs @@ -1,9 +1,9 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Result, implement}; use super::stream_from::is_cached; use crate::{ diff --git a/src/database/map/keys_prefix.rs b/src/database/map/keys_prefix.rs index 09dd79ac..a3c21969 100644 --- a/src/database/map/keys_prefix.rs +++ b/src/database/map/keys_prefix.rs @@ -1,8 +1,8 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{Stream, StreamExt, TryStreamExt, future}; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Result, implement}; use crate::keyval::{Key, result_deserialize_key, serialize_key}; diff --git a/src/database/map/qry.rs b/src/database/map/qry.rs index c6f13c0b..c994ac0f 100644 --- a/src/database/map/qry.rs +++ b/src/database/map/qry.rs @@ -1,8 +1,8 @@ use std::{convert::AsRef, fmt::Debug, io::Write, sync::Arc}; -use conduwuit::{Result, arrayvec::ArrayVec, implement}; use futures::Future; use serde::Serialize; +use tuwunel_core::{Result, arrayvec::ArrayVec, implement}; use crate::{Handle, keyval::KeyBuf, ser}; diff --git a/src/database/map/qry_batch.rs b/src/database/map/qry_batch.rs index e42d3e63..0cb5294c 100644 --- a/src/database/map/qry_batch.rs +++ b/src/database/map/qry_batch.rs @@ -1,14 +1,14 @@ use std::{fmt::Debug, sync::Arc}; -use conduwuit::{ +use futures::{Stream, StreamExt, TryStreamExt}; +use serde::Serialize; +use tuwunel_core::{ Result, implement, utils::{ IterStream, stream::{WidebandExt, automatic_amplification, automatic_width}, }, }; -use futures::{Stream, StreamExt, TryStreamExt}; -use serde::Serialize; use crate::{Handle, keyval::KeyBuf, ser}; diff --git a/src/database/map/remove.rs b/src/database/map/remove.rs index a7ae9133..b3b49ace 100644 --- a/src/database/map/remove.rs +++ b/src/database/map/remove.rs @@ -1,7 +1,7 @@ use std::{convert::AsRef, fmt::Debug, io::Write}; -use conduwuit::{arrayvec::ArrayVec, implement}; use serde::Serialize; +use tuwunel_core::{arrayvec::ArrayVec, implement}; use crate::{keyval::KeyBuf, ser, util::or_else}; diff --git a/src/database/map/rev_keys.rs b/src/database/map/rev_keys.rs index c00f3e55..adfd5b7c 100644 --- a/src/database/map/rev_keys.rs +++ b/src/database/map/rev_keys.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::Deserialize; use tokio::task; +use tuwunel_core::{Result, implement}; use super::rev_stream::is_cached; use crate::{keyval, keyval::Key, stream}; diff --git a/src/database/map/rev_keys_from.rs b/src/database/map/rev_keys_from.rs index 04e457dc..18e34309 100644 --- a/src/database/map/rev_keys_from.rs +++ b/src/database/map/rev_keys_from.rs @@ -1,9 +1,9 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Result, implement}; use super::rev_stream_from::is_cached; use crate::{ diff --git a/src/database/map/rev_keys_prefix.rs b/src/database/map/rev_keys_prefix.rs index fbe9f9ca..de2e20a2 100644 --- a/src/database/map/rev_keys_prefix.rs +++ b/src/database/map/rev_keys_prefix.rs @@ -1,8 +1,8 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{Stream, StreamExt, TryStreamExt, future}; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Result, implement}; use crate::keyval::{Key, result_deserialize_key, serialize_key}; diff --git a/src/database/map/rev_stream.rs b/src/database/map/rev_stream.rs index 789a52e8..96bec397 100644 --- a/src/database/map/rev_stream.rs +++ b/src/database/map/rev_stream.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::Deserialize; use tokio::task; +use tuwunel_core::{Result, implement}; use crate::{keyval, keyval::KeyVal, stream}; diff --git a/src/database/map/rev_stream_from.rs b/src/database/map/rev_stream_from.rs index a612d2a2..1489b392 100644 --- a/src/database/map/rev_stream_from.rs +++ b/src/database/map/rev_stream_from.rs @@ -1,10 +1,10 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::{Deserialize, Serialize}; use tokio::task; +use tuwunel_core::{Result, implement}; use crate::{ keyval::{KeyVal, result_deserialize, serialize_key}, diff --git a/src/database/map/rev_stream_prefix.rs b/src/database/map/rev_stream_prefix.rs index 46dc9247..72ff2d5b 100644 --- a/src/database/map/rev_stream_prefix.rs +++ b/src/database/map/rev_stream_prefix.rs @@ -1,8 +1,8 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{Stream, StreamExt, TryStreamExt, future}; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Result, implement}; use crate::keyval::{KeyVal, result_deserialize, serialize_key}; diff --git a/src/database/map/stream.rs b/src/database/map/stream.rs index f7371b6c..2a610cd1 100644 --- a/src/database/map/stream.rs +++ b/src/database/map/stream.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::Deserialize; use tokio::task; +use tuwunel_core::{Result, implement}; use crate::{keyval, keyval::KeyVal, stream}; diff --git a/src/database/map/stream_from.rs b/src/database/map/stream_from.rs index ccf48db6..f7888862 100644 --- a/src/database/map/stream_from.rs +++ b/src/database/map/stream_from.rs @@ -1,10 +1,10 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; use rocksdb::Direction; use serde::{Deserialize, Serialize}; use tokio::task; +use tuwunel_core::{Result, implement}; use crate::{ keyval::{KeyVal, result_deserialize, serialize_key}, diff --git a/src/database/map/stream_prefix.rs b/src/database/map/stream_prefix.rs index a26478aa..672de1b1 100644 --- a/src/database/map/stream_prefix.rs +++ b/src/database/map/stream_prefix.rs @@ -1,8 +1,8 @@ use std::{convert::AsRef, fmt::Debug, sync::Arc}; -use conduwuit::{Result, implement}; use futures::{Stream, StreamExt, TryStreamExt, future}; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Result, implement}; use crate::keyval::{KeyVal, result_deserialize, serialize_key}; diff --git a/src/database/maps.rs b/src/database/maps.rs index 19f9ced4..2152353e 100644 --- a/src/database/maps.rs +++ b/src/database/maps.rs @@ -1,6 +1,6 @@ use std::{collections::BTreeMap, sync::Arc}; -use conduwuit::Result; +use tuwunel_core::Result; use crate::{ Engine, Map, diff --git a/src/database/mod.rs b/src/database/mod.rs index ffcefee9..1dde8adc 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -1,11 +1,10 @@ #![type_length_limit = "3072"] -extern crate conduwuit_core as conduwuit; extern crate rust_rocksdb as rocksdb; -conduwuit::mod_ctor! {} -conduwuit::mod_dtor! {} -conduwuit::rustc_flags_capture! {} +tuwunel_core::mod_ctor! {} +tuwunel_core::mod_dtor! {} +tuwunel_core::rustc_flags_capture! {} #[cfg(test)] mod benches; @@ -27,7 +26,7 @@ mod watchers; use std::{ops::Index, sync::Arc}; -use conduwuit::{Result, Server, err}; +use tuwunel_core::{Result, Server, err}; pub use self::{ de::{Ignore, IgnoreAll}, diff --git a/src/database/pool.rs b/src/database/pool.rs index 0fa742d1..ff20d760 100644 --- a/src/database/pool.rs +++ b/src/database/pool.rs @@ -11,16 +11,16 @@ use std::{ }; use async_channel::{QueueStrategy, Receiver, RecvError, Sender}; -use conduwuit::{ +use futures::{TryFutureExt, channel::oneshot}; +use oneshot::Sender as ResultSender; +use rocksdb::Direction; +use tuwunel_core::{ Error, Result, Server, debug, err, error, implement, result::DebugInspect, smallvec::SmallVec, trace, utils::sys::compute::{get_affinity, nth_core_available, set_affinity}, }; -use futures::{TryFutureExt, channel::oneshot}; -use oneshot::Sender as ResultSender; -use rocksdb::Direction; use self::configure::configure; use crate::{Handle, Map, keyval::KeyBuf, stream}; @@ -70,7 +70,7 @@ const QUEUE_LIMIT: (usize, usize) = (1, 4096); const BATCH_INLINE: usize = 1; const WORKER_STACK_SIZE: usize = 1_048_576; -const WORKER_NAME: &str = "conduwuit:db"; +const WORKER_NAME: &str = "tuwunel:db"; #[implement(Pool)] pub(crate) fn new(server: &Arc) -> Result> { @@ -281,8 +281,8 @@ fn worker_init(&self, id: usize) { set_affinity(affinity.clone()); #[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))] - if affinity.clone().count() == 1 && conduwuit::alloc::je::is_affine_arena() { - use conduwuit::{ + if affinity.clone().count() == 1 && tuwunel_core::alloc::je::is_affine_arena() { + use tuwunel_core::{ alloc::je::this_thread::{arena_id, set_arena}, result::LogDebugErr, }; diff --git a/src/database/pool/configure.rs b/src/database/pool/configure.rs index 92dda56e..3eaa51a4 100644 --- a/src/database/pool/configure.rs +++ b/src/database/pool/configure.rs @@ -1,6 +1,6 @@ use std::{path::PathBuf, sync::Arc}; -use conduwuit::{ +use tuwunel_core::{ Server, debug, debug_info, expected, is_equal_to, utils::{ math::usize_from_f64, diff --git a/src/database/ser.rs b/src/database/ser.rs index 2e1a2cb0..e5387327 100644 --- a/src/database/ser.rs +++ b/src/database/ser.rs @@ -1,7 +1,7 @@ use std::io::Write; -use conduwuit::{Error, Result, debug::type_name, err, result::DebugInspect, utils::exchange}; use serde::{Deserialize, Serialize, ser}; +use tuwunel_core::{Error, Result, debug::type_name, err, result::DebugInspect, utils::exchange}; use crate::util::unhandled; diff --git a/src/database/stream.rs b/src/database/stream.rs index eb264ccd..72a45824 100644 --- a/src/database/stream.rs +++ b/src/database/stream.rs @@ -5,8 +5,8 @@ mod keys_rev; use std::sync::Arc; -use conduwuit::{Result, utils::exchange}; use rocksdb::{DBRawIteratorWithThreadMode, ReadOptions}; +use tuwunel_core::{Result, utils::exchange}; pub(crate) use self::{items::Items, items_rev::ItemsRev, keys::Keys, keys_rev::KeysRev}; use crate::{ diff --git a/src/database/stream/items.rs b/src/database/stream/items.rs index ede2b822..9180d582 100644 --- a/src/database/stream/items.rs +++ b/src/database/stream/items.rs @@ -1,11 +1,11 @@ use std::pin::Pin; -use conduwuit::Result; use futures::{ Stream, stream::FusedStream, task::{Context, Poll}, }; +use tuwunel_core::Result; use super::{Cursor, State, keyval_longevity}; use crate::keyval::KeyVal; diff --git a/src/database/stream/items_rev.rs b/src/database/stream/items_rev.rs index dba8d16c..ae5b9fbd 100644 --- a/src/database/stream/items_rev.rs +++ b/src/database/stream/items_rev.rs @@ -1,11 +1,11 @@ use std::pin::Pin; -use conduwuit::Result; use futures::{ Stream, stream::FusedStream, task::{Context, Poll}, }; +use tuwunel_core::Result; use super::{Cursor, State, keyval_longevity}; use crate::keyval::KeyVal; diff --git a/src/database/stream/keys.rs b/src/database/stream/keys.rs index 7c89869b..e0257934 100644 --- a/src/database/stream/keys.rs +++ b/src/database/stream/keys.rs @@ -1,11 +1,11 @@ use std::pin::Pin; -use conduwuit::Result; use futures::{ Stream, stream::FusedStream, task::{Context, Poll}, }; +use tuwunel_core::Result; use super::{Cursor, State, slice_longevity}; use crate::keyval::Key; diff --git a/src/database/stream/keys_rev.rs b/src/database/stream/keys_rev.rs index 51561e5c..a6007b38 100644 --- a/src/database/stream/keys_rev.rs +++ b/src/database/stream/keys_rev.rs @@ -1,11 +1,11 @@ use std::pin::Pin; -use conduwuit::Result; use futures::{ Stream, stream::FusedStream, task::{Context, Poll}, }; +use tuwunel_core::Result; use super::{Cursor, State, slice_longevity}; use crate::keyval::Key; diff --git a/src/database/tests.rs b/src/database/tests.rs index c1a9f47c..6fe53060 100644 --- a/src/database/tests.rs +++ b/src/database/tests.rs @@ -2,11 +2,11 @@ use std::fmt::Debug; -use conduwuit::{ +use serde::Serialize; +use tuwunel_core::{ arrayvec::ArrayVec, ruma::{EventId, RoomId, UserId, serde::Raw}, }; -use serde::Serialize; use crate::{ Ignore, Interfix, de, ser, @@ -76,7 +76,7 @@ fn ser_overflow() { #[test] fn ser_complex() { - use conduwuit::ruma::Mxc; + use tuwunel_core::ruma::Mxc; #[derive(Debug, Serialize)] struct Dim { @@ -110,7 +110,7 @@ fn ser_complex() { #[test] fn ser_json() { - use conduwuit::ruma::api::client::filter::FilterDefinition; + use tuwunel_core::ruma::api::client::filter::FilterDefinition; let filter = FilterDefinition { event_fields: Some(vec!["content.body".to_owned()]), @@ -125,7 +125,7 @@ fn ser_json() { #[test] fn ser_json_value() { - use conduwuit::ruma::api::client::filter::FilterDefinition; + use tuwunel_core::ruma::api::client::filter::FilterDefinition; let filter = FilterDefinition { event_fields: Some(vec!["content.body".to_owned()]), @@ -164,7 +164,7 @@ fn ser_json_macro() { #[test] #[cfg_attr(debug_assertions, should_panic(expected = "serializing string at the top-level"))] fn ser_json_raw() { - use conduwuit::ruma::api::client::filter::FilterDefinition; + use tuwunel_core::ruma::api::client::filter::FilterDefinition; let filter = FilterDefinition { event_fields: Some(vec!["content.body".to_owned()]), @@ -181,7 +181,7 @@ fn ser_json_raw() { #[test] #[cfg_attr(debug_assertions, should_panic(expected = "you can skip serialization instead"))] fn ser_json_raw_json() { - use conduwuit::ruma::api::client::filter::FilterDefinition; + use tuwunel_core::ruma::api::client::filter::FilterDefinition; let filter = FilterDefinition { event_fields: Some(vec!["content.body".to_owned()]), diff --git a/src/database/util.rs b/src/database/util.rs index caef94f1..cc9dba7a 100644 --- a/src/database/util.rs +++ b/src/database/util.rs @@ -1,5 +1,5 @@ -use conduwuit::Result; use rocksdb::{Direction, ErrorKind, IteratorMode}; +use tuwunel_core::Result; //#[cfg(debug_assertions)] macro_rules! unhandled { @@ -38,19 +38,19 @@ pub(crate) fn _into_direction(mode: &IteratorMode<'_>) -> Direction { #[inline] pub(crate) fn result( r: std::result::Result, -) -> Result { +) -> Result { r.map_or_else(or_else, and_then) } #[inline(always)] -pub(crate) fn and_then(t: T) -> Result { Ok(t) } +pub(crate) fn and_then(t: T) -> Result { Ok(t) } -pub(crate) fn or_else(e: rocksdb::Error) -> Result { Err(map_err(e)) } +pub(crate) fn or_else(e: rocksdb::Error) -> Result { Err(map_err(e)) } #[inline] pub(crate) fn is_incomplete(e: &rocksdb::Error) -> bool { e.kind() == ErrorKind::Incomplete } -pub(crate) fn map_err(e: rocksdb::Error) -> conduwuit::Error { +pub(crate) fn map_err(e: rocksdb::Error) -> tuwunel_core::Error { let kind = io_error_kind(&e.kind()); let string = e.into_string(); diff --git a/src/macros/Cargo.toml b/src/macros/Cargo.toml index 167de8c0..92d4b808 100644 --- a/src/macros/Cargo.toml +++ b/src/macros/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "conduwuit_macros" +name = "tuwunel_macros" categories.workspace = true description.workspace = true edition.workspace = true @@ -10,7 +10,7 @@ repository.workspace = true version.workspace = true [lib] -name = "conduwuit_macros" +name = "tuwunel_macros" path = "mod.rs" proc-macro = true diff --git a/src/macros/admin.rs b/src/macros/admin.rs index fe227b43..719356ce 100644 --- a/src/macros/admin.rs +++ b/src/macros/admin.rs @@ -8,7 +8,7 @@ use crate::{Result, utils::camel_to_snake_string}; pub(super) fn command(mut item: ItemFn, _args: &[Meta]) -> Result { let attr: Attribute = parse_quote! { - #[conduwuit_macros::implement(crate::Context, params = "<'_>")] + #[tuwunel_macros::implement(crate::Context, params = "<'_>")] }; item.attrs.push(attr); diff --git a/src/macros/cargo.rs b/src/macros/cargo.rs index a452c672..64b08bd8 100644 --- a/src/macros/cargo.rs +++ b/src/macros/cargo.rs @@ -30,14 +30,14 @@ fn manifest_path(member: Option<&str>) -> Result { let mut path: PathBuf = path.into(); - // conduwuit/src/macros/ -> conduwuit/src/ + // tuwunel/src/macros/ -> tuwunel/src/ path.pop(); if let Some(member) = member { - // conduwuit/$member/Cargo.toml + // tuwunel/$member/Cargo.toml path.push(member); } else { - // conduwuit/src/ -> conduwuit/ + // tuwunel/src/ -> tuwunel/ path.pop(); } diff --git a/src/macros/rustc.rs b/src/macros/rustc.rs index 1220c8d4..b870ae3b 100644 --- a/src/macros/rustc.rs +++ b/src/macros/rustc.rs @@ -5,7 +5,7 @@ pub(super) fn flags_capture(args: TokenStream) -> TokenStream { let cargo_crate_name = std::env::var("CARGO_CRATE_NAME"); let crate_name = match cargo_crate_name.as_ref() { | Err(_) => return args, - | Ok(crate_name) => crate_name.trim_start_matches("conduwuit_"), + | Ok(crate_name) => crate_name.trim_start_matches("tuwunel_"), }; let flag = std::env::args().collect::>(); @@ -13,15 +13,15 @@ pub(super) fn flags_capture(args: TokenStream) -> TokenStream { let ret = quote! { pub static RUSTC_FLAGS: [&str; #flag_len] = [#( #flag ),*]; - #[conduwuit_core::ctor] + #[tuwunel_core::ctor] fn _set_rustc_flags() { - conduwuit_core::info::rustc::FLAGS.lock().expect("locked").insert(#crate_name, &RUSTC_FLAGS); + tuwunel_core::info::rustc::FLAGS.lock().expect("locked").insert(#crate_name, &RUSTC_FLAGS); } // static strings have to be yanked on module unload - #[conduwuit_core::dtor] + #[tuwunel_core::dtor] fn _unset_rustc_flags() { - conduwuit_core::info::rustc::FLAGS.lock().expect("locked").remove(#crate_name); + tuwunel_core::info::rustc::FLAGS.lock().expect("locked").remove(#crate_name); } }; diff --git a/src/main/Cargo.toml b/src/main/Cargo.toml index e2fed5d5..7e7ac276 100644 --- a/src/main/Cargo.toml +++ b/src/main/Cargo.toml @@ -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 " -copyright = "2024, strawberry " +name = "tuwunel" +maintainer = "Jason Volk " +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" diff --git a/src/main/clap.rs b/src/main/clap.rs index 707a1c76..bd012f56 100644 --- a/src/main/clap.rs +++ b/src/main/clap.rs @@ -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), diff --git a/src/main/logging.rs b/src/main/logging.rs index eeeda127..13453566 100644 --- a/src/main/logging.rs +++ b/src/main/logging.rs @@ -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); diff --git a/src/main/main.rs b/src/main/main.rs index 1a9d3fe4..40706084 100644 --- a/src/main/main.rs +++ b/src/main/main.rs @@ -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) -> 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) -> 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) -> Result<(), Error> { let mut starts = true; let mut reloads = true; diff --git a/src/main/mods.rs b/src/main/mods.rs index d585a381..9cf22fee 100644 --- a/src/main/mods.rs +++ b/src/main/mods.rs @@ -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>> + Send>>; -type StartFuncProto = fn(&Arc) -> StartFuncResult; +type StartFuncProto = fn(&Arc) -> StartFuncResult; type RunFuncResult = Pin> + Send>>; type RunFuncProto = fn(&Arc) -> RunFuncResult; @@ -23,19 +23,19 @@ type RunFuncProto = fn(&Arc) -> RunFuncResult; type StopFuncResult = Pin> + Send>>; type StopFuncProto = fn(Arc) -> 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, starts: bool) -> Result<(bool, bool), Error> { diff --git a/src/main/restart.rs b/src/main/restart.rs index b9d1dc94..be598414 100644 --- a/src/main/restart.rs +++ b/src/main/restart.rs @@ -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() -> ! { diff --git a/src/main/runtime.rs b/src/main/runtime.rs index 1c58ea81..0fed6003 100644 --- a/src/main/runtime.rs +++ b/src/main/runtime.rs @@ -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, 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(); } diff --git a/src/main/sentry.rs b/src/main/sentry.rs index 68f12eb7..cf8e2fa1 100644 --- a/src/main/sentry.rs +++ b/src/main/sentry.rs @@ -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 = OnceLock::new(); static SEND_ERROR: OnceLock = 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)), diff --git a/src/main/server.rs b/src/main/server.rs index 8f697ca4..afbd5ff9 100644 --- a/src/main/server.rs +++ b/src/main/server.rs @@ -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, + pub(crate) server: Arc, - pub(crate) services: Mutex>>, + pub(crate) services: Mutex>>, _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>, + pub(crate) mods: tokio::sync::RwLock>, } 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()), })) } diff --git a/src/main/signal.rs b/src/main/signal.rs index a5d07774..72fd40c8 100644 --- a/src/main/signal.rs +++ b/src/main/signal.rs @@ -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) { 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"); diff --git a/src/router/Cargo.toml b/src/router/Cargo.toml index 31a44983..a84688a2 100644 --- a/src/router/Cargo.toml +++ b/src/router/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "conduwuit_router" +name = "tuwunel_router" categories.workspace = true description.workspace = true edition.workspace = true @@ -18,10 +18,10 @@ crate-type = [ [features] brotli_compression = [ - "conduwuit-admin/brotli_compression", - "conduwuit-api/brotli_compression", - "conduwuit-core/brotli_compression", - "conduwuit-service/brotli_compression", + "tuwunel-admin/brotli_compression", + "tuwunel-api/brotli_compression", + "tuwunel-core/brotli_compression", + "tuwunel-service/brotli_compression", "tower-http/compression-br", ] direct_tls = [ @@ -30,54 +30,54 @@ direct_tls = [ "dep:axum-server-dual-protocol", ] gzip_compression = [ - "conduwuit-admin/gzip_compression", - "conduwuit-api/gzip_compression", - "conduwuit-core/gzip_compression", - "conduwuit-service/gzip_compression", + "tuwunel-admin/gzip_compression", + "tuwunel-api/gzip_compression", + "tuwunel-core/gzip_compression", + "tuwunel-service/gzip_compression", "tower-http/compression-gzip", ] io_uring = [ - "conduwuit-admin/io_uring", - "conduwuit-api/io_uring", - "conduwuit-service/io_uring", - "conduwuit-api/io_uring", + "tuwunel-admin/io_uring", + "tuwunel-api/io_uring", + "tuwunel-service/io_uring", + "tuwunel-api/io_uring", ] jemalloc = [ - "conduwuit-admin/jemalloc", - "conduwuit-api/jemalloc", - "conduwuit-core/jemalloc", - "conduwuit-service/jemalloc", + "tuwunel-admin/jemalloc", + "tuwunel-api/jemalloc", + "tuwunel-core/jemalloc", + "tuwunel-service/jemalloc", ] jemalloc_conf = [ - "conduwuit-admin/jemalloc_conf", - "conduwuit-api/jemalloc_conf", - "conduwuit-core/jemalloc_conf", - "conduwuit-service/jemalloc_conf", + "tuwunel-admin/jemalloc_conf", + "tuwunel-api/jemalloc_conf", + "tuwunel-core/jemalloc_conf", + "tuwunel-service/jemalloc_conf", ] jemalloc_prof = [ - "conduwuit-admin/jemalloc_prof", - "conduwuit-api/jemalloc_prof", - "conduwuit-core/jemalloc_prof", - "conduwuit-service/jemalloc_prof", + "tuwunel-admin/jemalloc_prof", + "tuwunel-api/jemalloc_prof", + "tuwunel-core/jemalloc_prof", + "tuwunel-service/jemalloc_prof", ] jemalloc_stats = [ - "conduwuit-admin/jemalloc_stats", - "conduwuit-api/jemalloc_stats", - "conduwuit-core/jemalloc_stats", - "conduwuit-service/jemalloc_stats", + "tuwunel-admin/jemalloc_stats", + "tuwunel-api/jemalloc_stats", + "tuwunel-core/jemalloc_stats", + "tuwunel-service/jemalloc_stats", ] release_max_log_level = [ - "conduwuit-admin/release_max_log_level", - "conduwuit-api/release_max_log_level", - "conduwuit-core/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-service/release_max_log_level", "tracing/max_level_trace", "tracing/release_max_level_info", "log/max_level_trace", "log/release_max_level_info", ] sentry_telemetry = [ - "conduwuit-core/sentry_telemetry", + "tuwunel-core/sentry_telemetry", "dep:sentry", "dep:sentry-tracing", "dep:sentry-tower", @@ -86,9 +86,9 @@ systemd = [ "dep:sd-notify", ] zstd_compression = [ - "conduwuit-api/zstd_compression", - "conduwuit-core/zstd_compression", - "conduwuit-service/zstd_compression", + "tuwunel-api/zstd_compression", + "tuwunel-core/zstd_compression", + "tuwunel-service/zstd_compression", "tower-http/compression-zstd", ] @@ -99,10 +99,6 @@ axum-server-dual-protocol.optional = true axum-server.workspace = true axum.workspace = true bytes.workspace = true -conduwuit-admin.workspace = true -conduwuit-api.workspace = true -conduwuit-core.workspace = true -conduwuit-service.workspace = true const-str.workspace = true futures.workspace = true http.workspace = true @@ -124,6 +120,10 @@ tokio.workspace = true tower.workspace = true tower-http.workspace = true tracing.workspace = true +tuwunel-admin.workspace = true +tuwunel-api.workspace = true +tuwunel-core.workspace = true +tuwunel-service.workspace = true [target.'cfg(all(unix, target_os = "linux"))'.dependencies] sd-notify.workspace = true diff --git a/src/router/layers.rs b/src/router/layers.rs index 6920555d..9697a423 100644 --- a/src/router/layers.rs +++ b/src/router/layers.rs @@ -5,9 +5,6 @@ use axum::{ extract::{DefaultBodyLimit, MatchedPath}, }; use axum_client_ip::SecureClientIpSource; -use conduwuit::{Result, Server, debug, error}; -use conduwuit_api::router::state::Guard; -use conduwuit_service::Services; use http::{ HeaderValue, Method, StatusCode, header::{self, HeaderName}, @@ -22,10 +19,13 @@ use tower_http::{ trace::{DefaultOnFailure, DefaultOnRequest, DefaultOnResponse, TraceLayer}, }; use tracing::Level; +use tuwunel_api::router::state::Guard; +use tuwunel_core::{Result, Server, debug, error}; +use tuwunel_service::Services; use crate::{request, router}; -const CONDUWUIT_CSP: &[&str; 5] = &[ +const TUWUNEL_CSP: &[&str; 5] = &[ "default-src 'none'", "frame-ancestors 'none'", "form-action 'none'", @@ -33,7 +33,7 @@ const CONDUWUIT_CSP: &[&str; 5] = &[ "sandbox", ]; -const CONDUWUIT_PERMISSIONS_POLICY: &[&str; 2] = &["interest-cohort=()", "browsing-topics=()"]; +const TUWUNEL_PERMISSIONS_POLICY: &[&str; 2] = &["interest-cohort=()", "browsing-topics=()"]; pub(crate) fn build(services: &Arc) -> Result<(Router, Guard)> { let server = &services.server; @@ -86,11 +86,11 @@ pub(crate) fn build(services: &Arc) -> Result<(Router, Guard)> { )) .layer(SetResponseHeaderLayer::if_not_present( HeaderName::from_static("permissions-policy"), - HeaderValue::from_str(&CONDUWUIT_PERMISSIONS_POLICY.join(","))?, + HeaderValue::from_str(&TUWUNEL_PERMISSIONS_POLICY.join(","))?, )) .layer(SetResponseHeaderLayer::if_not_present( header::CONTENT_SECURITY_POLICY, - HeaderValue::from_str(&CONDUWUIT_CSP.join(";"))?, + HeaderValue::from_str(&TUWUNEL_CSP.join(";"))?, )) .layer(cors_layer(server)) .layer(body_limit_layer(server)) diff --git a/src/router/mod.rs b/src/router/mod.rs index 7038c5df..b7b3df31 100644 --- a/src/router/mod.rs +++ b/src/router/mod.rs @@ -6,17 +6,15 @@ mod router; mod run; mod serve; -extern crate conduwuit_core as conduwuit; - use std::{panic::AssertUnwindSafe, pin::Pin, sync::Arc}; -use conduwuit::{Error, Result, Server}; -use conduwuit_service::Services; use futures::{Future, FutureExt, TryFutureExt}; +use tuwunel_core::{Error, Result, Server}; +use tuwunel_service::Services; -conduwuit::mod_ctor! {} -conduwuit::mod_dtor! {} -conduwuit::rustc_flags_capture! {} +tuwunel_core::mod_ctor! {} +tuwunel_core::mod_dtor! {} +tuwunel_core::rustc_flags_capture! {} #[unsafe(no_mangle)] pub extern "Rust" fn start( diff --git a/src/router/request.rs b/src/router/request.rs index dba90324..66346c7f 100644 --- a/src/router/request.rs +++ b/src/router/request.rs @@ -8,12 +8,12 @@ use axum::{ extract::State, response::{IntoResponse, Response}, }; -use conduwuit::{Result, debug, debug_error, debug_warn, err, error, trace}; -use conduwuit_service::Services; use futures::FutureExt; use http::{Method, StatusCode, Uri}; use tokio::time::sleep; use tracing::Span; +use tuwunel_core::{Result, debug, debug_error, debug_warn, err, error, trace}; +use tuwunel_service::Services; #[tracing::instrument(name = "request", level = "debug", skip_all)] pub(crate) async fn handle( @@ -82,7 +82,7 @@ async fn execute( parent: &Span, ) -> Response { #[cfg(debug_assertions)] - conduwuit::defer! {{ + tuwunel_core::defer! {{ _ = services.server .metrics .requests_handle_finished diff --git a/src/router/router.rs b/src/router/router.rs index 0f95b924..0b9f0929 100644 --- a/src/router/router.rs +++ b/src/router/router.rs @@ -1,16 +1,16 @@ use std::sync::Arc; use axum::{Router, response::IntoResponse, routing::get}; -use conduwuit::Error; -use conduwuit_api::router::{state, state::Guard}; -use conduwuit_service::Services; use http::{StatusCode, Uri}; use ruma::api::client::error::ErrorKind; +use tuwunel_api::router::{state, state::Guard}; +use tuwunel_core::Error; +use tuwunel_service::Services; pub(crate) fn build(services: &Arc) -> (Router, Guard) { let router = Router::::new(); let (state, guard) = state::create(services.clone()); - let router = conduwuit_api::router::build(router, &services.server) + let router = tuwunel_api::router::build(router, &services.server) .route("/", get(it_works)) .fallback(not_found) .with_state(state); @@ -22,4 +22,4 @@ async fn not_found(_uri: Uri) -> impl IntoResponse { Error::Request(ErrorKind::Unrecognized, "Not Found".into(), StatusCode::NOT_FOUND) } -async fn it_works() -> &'static str { "hewwo from conduwuit woof!" } +async fn it_works() -> &'static str { "hewwo from tuwunel woof!" } diff --git a/src/router/run.rs b/src/router/run.rs index ff54594f..65bae548 100644 --- a/src/router/run.rs +++ b/src/router/run.rs @@ -1,20 +1,16 @@ -extern crate conduwuit_admin as admin; -extern crate conduwuit_core as conduwuit; -extern crate conduwuit_service as service; - use std::{ sync::{Arc, Weak, atomic::Ordering}, time::Duration, }; use axum_server::Handle as ServerHandle; -use conduwuit::{Error, Result, Server, debug, debug_error, debug_info, error, info}; use futures::FutureExt; -use service::Services; use tokio::{ sync::broadcast::{self, Sender}, task::JoinHandle, }; +use tuwunel_core::{Error, Result, Server, debug, debug_error, debug_info, error, info}; +use tuwunel_service::Services; use crate::serve; @@ -25,7 +21,7 @@ pub(crate) async fn run(services: Arc) -> Result<()> { debug!("Start"); // Install the admin room callback here for now - admin::init(&services.admin).await; + tuwunel_admin::init(&services.admin).await; // Setup shutdown/signal handling let handle = ServerHandle::new(); @@ -51,7 +47,7 @@ pub(crate) async fn run(services: Arc) -> Result<()> { _ = sigs.await; // Remove the admin room callback - admin::fini(&services.admin).await; + tuwunel_admin::fini(&services.admin).await; debug_info!("Finish"); res diff --git a/src/router/serve/mod.rs b/src/router/serve/mod.rs index 2399edf0..10e16716 100644 --- a/src/router/serve/mod.rs +++ b/src/router/serve/mod.rs @@ -6,9 +6,9 @@ mod unix; use std::sync::Arc; use axum_server::Handle as ServerHandle; -use conduwuit::{Result, err}; -use conduwuit_service::Services; use tokio::sync::broadcast; +use tuwunel_core::{Result, err}; +use tuwunel_service::Services; use super::layers; @@ -36,9 +36,9 @@ pub(super) async fn serve( return tls::serve(server, app, handle, addrs).await; #[cfg(not(feature = "direct_tls"))] - return conduwuit::Err!(Config( + return tuwunel_core::Err!(Config( "tls", - "conduwuit was not built with direct TLS support (\"direct_tls\")" + "tuwunel was not built with direct TLS support (\"direct_tls\")" )); } else { plain::serve(server, app, handle, addrs).await diff --git a/src/router/serve/plain.rs b/src/router/serve/plain.rs index 6db7e138..f2b4f626 100644 --- a/src/router/serve/plain.rs +++ b/src/router/serve/plain.rs @@ -5,8 +5,8 @@ use std::{ use axum::Router; use axum_server::{Handle as ServerHandle, bind}; -use conduwuit::{Result, Server, debug_info, info}; use tokio::task::JoinSet; +use tuwunel_core::{Result, Server, debug_info, info}; pub(super) async fn serve( server: &Arc, diff --git a/src/router/serve/tls.rs b/src/router/serve/tls.rs index 20b58601..59728937 100644 --- a/src/router/serve/tls.rs +++ b/src/router/serve/tls.rs @@ -6,9 +6,8 @@ use axum_server_dual_protocol::{ ServerExt, axum_server::{bind_rustls, tls_rustls::RustlsConfig}, }; -use conduwuit::{Result, Server, err}; use tokio::task::JoinSet; -use tracing::{debug, info, warn}; +use tuwunel_core::{Result, Server, debug, err, info, warn}; pub(super) async fn serve( server: &Arc, @@ -33,7 +32,7 @@ pub(super) async fn serve( info!( "Note: It is strongly recommended that you use a reverse proxy instead of running \ - conduwuit directly with TLS." + tuwunel directly with TLS." ); debug!("Using direct TLS. Certificate path {certs} and certificate private key path {key}",); let conf = RustlsConfig::from_pem_file(certs, key) diff --git a/src/router/serve/unix.rs b/src/router/serve/unix.rs index 2af17274..7c7726db 100644 --- a/src/router/serve/unix.rs +++ b/src/router/serve/unix.rs @@ -11,9 +11,6 @@ use axum::{ Router, extract::{Request, connect_info::IntoMakeServiceWithConnectInfo}, }; -use conduwuit::{ - Err, Result, Server, debug, debug_error, info, result::UnwrapInfallible, trace, warn, -}; use hyper::{body::Incoming, service::service_fn}; use hyper_util::{ rt::{TokioExecutor, TokioIo}, @@ -27,6 +24,9 @@ use tokio::{ time::{Duration, sleep}, }; use tower::{Service, ServiceExt}; +use tuwunel_core::{ + Err, Result, Server, debug, debug_error, info, result::UnwrapInfallible, trace, warn, +}; type MakeService = IntoMakeServiceWithConnectInfo; diff --git a/src/service/Cargo.toml b/src/service/Cargo.toml index 8b0d1405..5f400dd5 100644 --- a/src/service/Cargo.toml +++ b/src/service/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "conduwuit_service" +name = "tuwunel_service" categories.workspace = true description.workspace = true edition.workspace = true @@ -22,7 +22,7 @@ blurhashing = [ "dep:blurhash", ] brotli_compression = [ - "conduwuit-core/brotli_compression", + "tuwunel-core/brotli_compression", "reqwest/brotli", ] console = [ @@ -31,34 +31,34 @@ console = [ ] element_hacks = [] gzip_compression = [ - "conduwuit-core/gzip_compression", + "tuwunel-core/gzip_compression", "reqwest/gzip", ] io_uring = [ - "conduwuit-database/io_uring", + "tuwunel-database/io_uring", ] jemalloc = [ - "conduwuit-core/jemalloc", - "conduwuit-database/jemalloc", + "tuwunel-core/jemalloc", + "tuwunel-database/jemalloc", ] jemalloc_conf = [ - "conduwuit-core/jemalloc_conf", - "conduwuit-database/jemalloc_conf", + "tuwunel-core/jemalloc_conf", + "tuwunel-database/jemalloc_conf", ] jemalloc_prof = [ - "conduwuit-core/jemalloc_prof", - "conduwuit-database/jemalloc_prof", + "tuwunel-core/jemalloc_prof", + "tuwunel-database/jemalloc_prof", ] jemalloc_stats = [ - "conduwuit-core/jemalloc_stats", - "conduwuit-database/jemalloc_stats", + "tuwunel-core/jemalloc_stats", + "tuwunel-database/jemalloc_stats", ] media_thumbnail = [ "dep:image", ] release_max_log_level = [ - "conduwuit-core/release_max_log_level", - "conduwuit-database/release_max_log_level", + "tuwunel-core/release_max_log_level", + "tuwunel-database/release_max_log_level", "log/max_level_trace", "log/release_max_level_info", "tracing/max_level_trace", @@ -69,8 +69,8 @@ url_preview = [ "dep:webpage", ] zstd_compression = [ - "conduwuit-core/zstd_compression", - "conduwuit-database/zstd_compression", + "tuwunel-core/zstd_compression", + "tuwunel-database/zstd_compression", "reqwest/zstd", ] @@ -78,8 +78,6 @@ zstd_compression = [ async-trait.workspace = true base64.workspace = true bytes.workspace = true -conduwuit-core.workspace = true -conduwuit-database.workspace = true const-str.workspace = true either.workspace = true futures.workspace = true @@ -111,6 +109,8 @@ webpage.workspace = true webpage.optional = true blurhash.workspace = true blurhash.optional = true +tuwunel-core.workspace = true +tuwunel-database.workspace = true [lints] workspace = true diff --git a/src/service/account_data/mod.rs b/src/service/account_data/mod.rs index 453051be..893187f1 100644 --- a/src/service/account_data/mod.rs +++ b/src/service/account_data/mod.rs @@ -1,10 +1,5 @@ use std::sync::Arc; -use conduwuit::{ - Err, Result, err, implement, - utils::{ReadyExt, result::LogErr, stream::TryIgnore}, -}; -use database::{Deserialized, Handle, Ignore, Json, Map}; use futures::{Stream, StreamExt, TryFutureExt}; use ruma::{ RoomId, UserId, @@ -15,6 +10,11 @@ use ruma::{ serde::Raw, }; use serde::Deserialize; +use tuwunel_core::{ + Err, Result, err, implement, + utils::{ReadyExt, result::LogErr, stream::TryIgnore}, +}; +use tuwunel_database::{Deserialized, Handle, Ignore, Json, Map}; use crate::{Dep, globals}; diff --git a/src/service/admin/console.rs b/src/service/admin/console.rs index 02f41303..5465f7ca 100644 --- a/src/service/admin/console.rs +++ b/src/service/admin/console.rs @@ -5,12 +5,12 @@ use std::{ sync::{Arc, Mutex}, }; -use conduwuit::{Server, debug, defer, error, log, log::is_systemd_mode}; use futures::future::{AbortHandle, Abortable}; use ruma::events::room::message::RoomMessageEventContent; use rustyline_async::{Readline, ReadlineError, ReadlineEvent}; use termimad::MadSkin; use tokio::task::JoinHandle; +use tuwunel_core::{Server, debug, defer, error, log, log::is_systemd_mode}; use crate::{Dep, admin}; @@ -96,7 +96,7 @@ impl Console { debug!("session starting"); self.output - .print_inline(&format!("**conduwuit {}** admin console\n", conduwuit::version())); + .print_inline(&format!("**conduwuit {}** admin console\n", tuwunel_core::version())); self.output .print_text("\"help\" for help, ^D to exit the console, ^\\ to stop the server\n"); diff --git a/src/service/admin/create.rs b/src/service/admin/create.rs index cd0fc5a9..6ce498fd 100644 --- a/src/service/admin/create.rs +++ b/src/service/admin/create.rs @@ -1,6 +1,5 @@ use std::collections::BTreeMap; -use conduwuit::{Result, pdu::PduBuilder}; use futures::FutureExt; use ruma::{ RoomId, RoomVersionId, @@ -17,6 +16,7 @@ use ruma::{ topic::RoomTopicEventContent, }, }; +use tuwunel_core::{Result, pdu::PduBuilder}; use crate::Services; diff --git a/src/service/admin/execute.rs b/src/service/admin/execute.rs index 174b28ed..8c209e79 100644 --- a/src/service/admin/execute.rs +++ b/src/service/admin/execute.rs @@ -1,6 +1,6 @@ -use conduwuit::{Err, Result, debug, debug_info, error, implement, info}; use ruma::events::room::message::RoomMessageEventContent; use tokio::time::{Duration, sleep}; +use tuwunel_core::{Err, Result, debug, debug_info, error, implement, info}; pub(super) const SIGNAL: &str = "SIGUSR2"; diff --git a/src/service/admin/grant.rs b/src/service/admin/grant.rs index 6780b7ae..fce4d030 100644 --- a/src/service/admin/grant.rs +++ b/src/service/admin/grant.rs @@ -1,6 +1,5 @@ use std::collections::BTreeMap; -use conduwuit::{Err, Result, debug_info, debug_warn, error, implement, matrix::pdu::PduBuilder}; use ruma::{ RoomId, UserId, events::{ @@ -13,6 +12,9 @@ use ruma::{ tag::{TagEvent, TagEventContent, TagInfo}, }, }; +use tuwunel_core::{ + Err, Result, debug_info, debug_warn, error, implement, matrix::pdu::PduBuilder, +}; /// Invite the user to the conduwuit admin room. /// diff --git a/src/service/admin/mod.rs b/src/service/admin/mod.rs index b3466711..a48f7fe9 100644 --- a/src/service/admin/mod.rs +++ b/src/service/admin/mod.rs @@ -10,9 +10,6 @@ use std::{ }; use async_trait::async_trait; -use conduwuit::{ - Error, PduEvent, Result, Server, debug, err, error, error::default_log, pdu::PduBuilder, -}; pub use create::create_admin_room; use futures::{FutureExt, TryFutureExt}; use loole::{Receiver, Sender}; @@ -21,6 +18,9 @@ use ruma::{ events::room::message::{Relation, RoomMessageEventContent}, }; use tokio::sync::RwLock; +use tuwunel_core::{ + Error, PduEvent, Result, Server, debug, err, error, error::default_log, pdu::PduBuilder, +}; use crate::{Dep, account_data, globals, rooms, rooms::state::RoomMutexGuard}; diff --git a/src/service/appservice/mod.rs b/src/service/appservice/mod.rs index 7be8a471..3ec454d3 100644 --- a/src/service/appservice/mod.rs +++ b/src/service/appservice/mod.rs @@ -4,11 +4,11 @@ mod registration_info; use std::{collections::BTreeMap, iter::IntoIterator, sync::Arc}; use async_trait::async_trait; -use conduwuit::{Result, err, utils::stream::IterStream}; -use database::Map; use futures::{Future, FutureExt, Stream, TryStreamExt}; use ruma::{RoomAliasId, RoomId, UserId, api::appservice::Registration}; use tokio::sync::{RwLock, RwLockReadGuard}; +use tuwunel_core::{Result, err, utils::stream::IterStream}; +use tuwunel_database::Map; pub use self::{namespace_regex::NamespaceRegex, registration_info::RegistrationInfo}; use crate::{Dep, sending}; diff --git a/src/service/appservice/namespace_regex.rs b/src/service/appservice/namespace_regex.rs index fe0fd91f..fb0cb634 100644 --- a/src/service/appservice/namespace_regex.rs +++ b/src/service/appservice/namespace_regex.rs @@ -1,6 +1,6 @@ -use conduwuit::Result; use regex::RegexSet; use ruma::api::appservice::Namespace; +use tuwunel_core::Result; /// Compiled regular expressions for a namespace #[derive(Clone, Debug)] diff --git a/src/service/appservice/registration_info.rs b/src/service/appservice/registration_info.rs index a511f58d..60c348dc 100644 --- a/src/service/appservice/registration_info.rs +++ b/src/service/appservice/registration_info.rs @@ -1,5 +1,5 @@ -use conduwuit::Result; use ruma::{UserId, api::appservice::Registration}; +use tuwunel_core::Result; use super::NamespaceRegex; diff --git a/src/service/client/mod.rs b/src/service/client/mod.rs index 1aeeb492..4a129078 100644 --- a/src/service/client/mod.rs +++ b/src/service/client/mod.rs @@ -1,9 +1,9 @@ use std::{sync::Arc, time::Duration}; -use conduwuit::{Config, Result, err, implement, trace}; use either::Either; use ipaddress::IPAddress; use reqwest::redirect; +use tuwunel_core::{Config, Result, err, implement, trace}; use crate::{resolver, service}; @@ -126,9 +126,9 @@ fn base(config: &Config) -> Result { .timeout(Duration::from_secs(config.request_total_timeout)) .pool_idle_timeout(Duration::from_secs(config.request_idle_timeout)) .pool_max_idle_per_host(config.request_idle_per_host.into()) - .user_agent(conduwuit::version::user_agent()) + .user_agent(tuwunel_core::version::user_agent()) .redirect(redirect::Policy::limited(6)) - .danger_accept_invalid_certs(config.allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure) + .danger_accept_invalid_certs(config.allow_invalid_tls_certificates) .connection_verbose(cfg!(debug_assertions)); #[cfg(feature = "gzip_compression")] @@ -196,7 +196,7 @@ fn builder_interface( builder: reqwest::ClientBuilder, config: Option<&str>, ) -> Result { - use conduwuit::Err; + use tuwunel_core::Err; if let Some(iface) = config { Err!("Binding to network-interface {iface:?} by name is not supported on this platform.") diff --git a/src/service/config/mod.rs b/src/service/config/mod.rs index fd0d8764..d6c13e8e 100644 --- a/src/service/config/mod.rs +++ b/src/service/config/mod.rs @@ -1,7 +1,7 @@ use std::{iter, ops::Deref, path::Path, sync::Arc}; use async_trait::async_trait; -use conduwuit::{ +use tuwunel_core::{ Result, Server, config::{Config, check}, error, implement, diff --git a/src/service/emergency/mod.rs b/src/service/emergency/mod.rs index 3a61f710..9ada8174 100644 --- a/src/service/emergency/mod.rs +++ b/src/service/emergency/mod.rs @@ -1,13 +1,13 @@ use std::sync::Arc; use async_trait::async_trait; -use conduwuit::{Result, error, warn}; use ruma::{ events::{ GlobalAccountDataEvent, GlobalAccountDataEventType, push_rules::PushRulesEventContent, }, push::Ruleset, }; +use tuwunel_core::{Result, error, warn}; use crate::{Dep, account_data, config, globals, users}; diff --git a/src/service/federation/execute.rs b/src/service/federation/execute.rs index 97314ffb..610262f4 100644 --- a/src/service/federation/execute.rs +++ b/src/service/federation/execute.rs @@ -1,10 +1,6 @@ use std::{fmt::Debug, mem}; use bytes::Bytes; -use conduwuit::{ - Err, Error, Result, debug, debug::INFO_SPAN_LEVEL, debug_error, debug_warn, err, - error::inspect_debug_log, implement, trace, utils::string::EMPTY, -}; use http::{HeaderValue, header::AUTHORIZATION}; use ipaddress::IPAddress; use reqwest::{Client, Method, Request, Response, Url}; @@ -16,6 +12,10 @@ use ruma::{ }, serde::Base64, }; +use tuwunel_core::{ + Err, Error, Result, debug, debug::INFO_SPAN_LEVEL, debug_error, debug_warn, err, + error::inspect_debug_log, implement, trace, utils::string::EMPTY, +}; use crate::resolver::actual::ActualDest; diff --git a/src/service/federation/mod.rs b/src/service/federation/mod.rs index ce7765ee..2dcace35 100644 --- a/src/service/federation/mod.rs +++ b/src/service/federation/mod.rs @@ -2,7 +2,7 @@ mod execute; use std::sync::Arc; -use conduwuit::{Result, Server}; +use tuwunel_core::{Result, Server}; use crate::{Dep, client, resolver, server_keys}; diff --git a/src/service/globals/data.rs b/src/service/globals/data.rs index 21c09252..5fa828ff 100644 --- a/src/service/globals/data.rs +++ b/src/service/globals/data.rs @@ -1,7 +1,7 @@ use std::sync::{Arc, RwLock}; -use conduwuit::{Result, utils}; -use database::{Database, Deserialized, Map}; +use tuwunel_core::{Result, utils}; +use tuwunel_database::{Database, Deserialized, Map}; pub struct Data { global: Arc, diff --git a/src/service/globals/mod.rs b/src/service/globals/mod.rs index ad0b26d7..aec88a53 100644 --- a/src/service/globals/mod.rs +++ b/src/service/globals/mod.rs @@ -8,10 +8,10 @@ use std::{ }; use async_trait::async_trait; -use conduwuit::{Result, Server, error, utils::bytes::pretty}; use data::Data; use regex::RegexSet; use ruma::{OwnedEventId, OwnedRoomAliasId, OwnedServerName, OwnedUserId, ServerName, UserId}; +use tuwunel_core::{Result, Server, error, utils::bytes::pretty}; use crate::service; diff --git a/src/service/key_backups/mod.rs b/src/service/key_backups/mod.rs index 1bf048ef..2d94ac11 100644 --- a/src/service/key_backups/mod.rs +++ b/src/service/key_backups/mod.rs @@ -1,16 +1,16 @@ use std::{collections::BTreeMap, sync::Arc}; -use conduwuit::{ - Err, Result, err, implement, - utils::stream::{ReadyExt, TryIgnore}, -}; -use database::{Deserialized, Ignore, Interfix, Json, Map}; use futures::StreamExt; use ruma::{ OwnedRoomId, RoomId, UserId, api::client::backup::{BackupAlgorithm, KeyBackupData, RoomKeyBackup}, serde::Raw, }; +use tuwunel_core::{ + Err, Result, err, implement, + utils::stream::{ReadyExt, TryIgnore}, +}; +use tuwunel_database::{Deserialized, Ignore, Interfix, Json, Map}; use crate::{Dep, globals}; diff --git a/src/service/manager.rs b/src/service/manager.rs index 3cdf5945..7ac513a4 100644 --- a/src/service/manager.rs +++ b/src/service/manager.rs @@ -1,12 +1,14 @@ use std::{panic::AssertUnwindSafe, sync::Arc, time::Duration}; -use conduwuit::{Err, Error, Result, Server, debug, debug_warn, error, trace, utils::time, warn}; use futures::{FutureExt, TryFutureExt}; use tokio::{ sync::{Mutex, MutexGuard}, task::{JoinHandle, JoinSet}, time::sleep, }; +use tuwunel_core::{ + Err, Error, Result, Server, debug, debug_warn, error, trace, utils::time, warn, +}; use crate::{Services, service, service::Service}; diff --git a/src/service/media/blurhash.rs b/src/service/media/blurhash.rs index 91e00228..a947a595 100644 --- a/src/service/media/blurhash.rs +++ b/src/service/media/blurhash.rs @@ -1,6 +1,6 @@ #[cfg(feature = "blurhashing")] -use conduwuit::config::BlurhashConfig as CoreBlurhashConfig; -use conduwuit::{Result, implement}; +use tuwunel_core::config::BlurhashConfig as CoreBlurhashConfig; +use tuwunel_core::{Result, implement}; use super::Service; @@ -12,7 +12,7 @@ pub fn create_blurhash( _content_type: Option<&str>, _file_name: Option<&str>, ) -> Result> { - conduwuit::debug_warn!("blurhashing on upload support was not compiled"); + tuwunel_core::debug_warn!("blurhashing on upload support was not compiled"); Ok(None) } @@ -33,7 +33,7 @@ pub fn create_blurhash( } get_blurhash_from_request(file, content_type, file_name, config) - .map_err(|e| conduwuit::err!(debug_error!("blurhashing error: {e}"))) + .map_err(|e| tuwunel_core::err!(debug_error!("blurhashing error: {e}"))) .map(Some) } diff --git a/src/service/media/data.rs b/src/service/media/data.rs index 0ccd844f..f25a7444 100644 --- a/src/service/media/data.rs +++ b/src/service/media/data.rs @@ -1,12 +1,12 @@ use std::{sync::Arc, time::Duration}; -use conduwuit::{ +use futures::StreamExt; +use ruma::{Mxc, OwnedMxcUri, UserId, http_headers::ContentDisposition}; +use tuwunel_core::{ Err, Result, debug, debug_info, err, utils::{ReadyExt, str_from_bytes, stream::TryIgnore, string_from_bytes}, }; -use database::{Database, Interfix, Map}; -use futures::StreamExt; -use ruma::{Mxc, OwnedMxcUri, UserId, http_headers::ContentDisposition}; +use tuwunel_database::{Database, Interfix, Map, serialize_key}; use super::{preview::UrlPreviewData, thumbnail::Dim}; @@ -42,7 +42,7 @@ impl Data { ) -> Result> { let dim: &[u32] = &[dim.width, dim.height]; let key = (mxc, dim, content_disposition, content_type); - let key = database::serialize_key(key)?; + let key = serialize_key(key)?; self.mediaid_file.insert(&key, []); if let Some(user) = user { let key = (mxc, user); diff --git a/src/service/media/migrations.rs b/src/service/media/migrations.rs index 5fd628cd..dc6208fd 100644 --- a/src/service/media/migrations.rs +++ b/src/service/media/migrations.rs @@ -7,7 +7,7 @@ use std::{ time::Instant, }; -use conduwuit::{ +use tuwunel_core::{ Config, Result, debug, debug_info, debug_warn, error, info, utils::{ReadyExt, stream::TryIgnore}, warn, @@ -95,7 +95,7 @@ pub(crate) async fn checkup_sha256_media(services: &Services) -> Result<()> { } async fn handle_media_check( - dbs: &(&Arc, &Arc), + dbs: &(&Arc, &Arc), config: &Config, files: &HashSet, key: &[u8], diff --git a/src/service/media/mod.rs b/src/service/media/mod.rs index 5c26efe8..250650c9 100644 --- a/src/service/media/mod.rs +++ b/src/service/media/mod.rs @@ -9,16 +9,16 @@ use std::{path::PathBuf, sync::Arc, time::SystemTime}; use async_trait::async_trait; use base64::{Engine as _, engine::general_purpose}; -use conduwuit::{ - Err, Result, Server, debug, debug_error, debug_info, debug_warn, err, error, trace, - utils::{self, MutexMap}, - warn, -}; use ruma::{Mxc, OwnedMxcUri, UserId, http_headers::ContentDisposition}; use tokio::{ fs, io::{AsyncReadExt, AsyncWriteExt, BufReader}, }; +use tuwunel_core::{ + Err, Result, Server, debug, debug_error, debug_info, debug_warn, err, error, trace, + utils::{self, MutexMap}, + warn, +}; use self::data::{Data, Metadata}; pub use self::thumbnail::Dim; diff --git a/src/service/media/preview.rs b/src/service/media/preview.rs index 91660a58..582796fd 100644 --- a/src/service/media/preview.rs +++ b/src/service/media/preview.rs @@ -7,10 +7,9 @@ use std::time::SystemTime; -use conduwuit::{Err, Result, debug, err}; -use conduwuit_core::implement; use ipaddress::IPAddress; use serde::Serialize; +use tuwunel_core::{Err, Result, debug, err, implement}; use url::Url; use super::Service; @@ -105,9 +104,9 @@ async fn request_url_preview(&self, url: &Url) -> Result { #[cfg(feature = "url_preview")] #[implement(Service)] pub async fn download_image(&self, url: &str) -> Result { - use conduwuit::utils::random_string; use image::ImageReader; use ruma::Mxc; + use tuwunel_core::utils::random_string; let image = self.services.client.url_preview.get(url).send().await?; let image = image.bytes().await?; diff --git a/src/service/media/remote.rs b/src/service/media/remote.rs index cdcb429e..4c63fe89 100644 --- a/src/service/media/remote.rs +++ b/src/service/media/remote.rs @@ -1,9 +1,5 @@ use std::{fmt::Debug, time::Duration}; -use conduwuit::{ - Err, Error, Result, debug_warn, err, implement, - utils::content_disposition::make_content_disposition, -}; use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE, HeaderValue}; use ruma::{ Mxc, ServerName, UserId, @@ -17,6 +13,10 @@ use ruma::{ federation::authenticated_media::{Content, FileOrLocation}, }, }; +use tuwunel_core::{ + Err, Error, Result, debug_warn, err, implement, + utils::content_disposition::make_content_disposition, +}; use super::{Dim, FileMeta}; diff --git a/src/service/media/thumbnail.rs b/src/service/media/thumbnail.rs index e5a98774..0357dd74 100644 --- a/src/service/media/thumbnail.rs +++ b/src/service/media/thumbnail.rs @@ -7,12 +7,12 @@ use std::{cmp, num::Saturating as Sat}; -use conduwuit::{Result, checked, err, implement}; use ruma::{Mxc, UInt, UserId, http_headers::ContentDisposition, media::Method}; use tokio::{ fs, io::{AsyncReadExt, AsyncWriteExt}, }; +use tuwunel_core::{Result, checked, err, implement}; use super::{FileMeta, data::Metadata}; diff --git a/src/service/migrations.rs b/src/service/migrations.rs index 512a7867..72baf063 100644 --- a/src/service/migrations.rs +++ b/src/service/migrations.rs @@ -1,14 +1,5 @@ use std::cmp; -use conduwuit::{ - Err, Result, debug, debug_info, debug_warn, error, info, - result::NotFound, - utils::{ - IterStream, ReadyExt, - stream::{TryExpect, TryIgnore}, - }, - warn, -}; use futures::{FutureExt, StreamExt}; use itertools::Itertools; use ruma::{ @@ -18,6 +9,15 @@ use ruma::{ }, push::Ruleset, }; +use tuwunel_core::{ + Err, Result, debug, debug_info, debug_warn, error, info, + result::NotFound, + utils::{ + IterStream, ReadyExt, + stream::{TryExpect, TryIgnore}, + }, + warn, +}; use crate::{Services, media}; @@ -480,7 +480,7 @@ async fn fix_referencedevents_missing_sep(services: &Services) -> Result { .ready_fold(totals, |mut a, (i, (key, val))| { debug_assert!(val.is_empty(), "expected no value"); - let has_sep = key.contains(&database::SEP); + let has_sep = key.contains(&tuwunel_database::SEP); if !has_sep { let key_str = std::str::from_utf8(key).expect("key not utf-8"); @@ -507,8 +507,8 @@ async fn fix_referencedevents_missing_sep(services: &Services) -> Result { } async fn fix_readreceiptid_readreceipt_duplicates(services: &Services) -> Result { - use conduwuit::arrayvec::ArrayString; use ruma::identifiers_validation::MAX_BYTES; + use tuwunel_core::arrayvec::ArrayString; type ArrayId = ArrayString; type Key<'a> = (&'a RoomId, u64, &'a UserId); diff --git a/src/service/mod.rs b/src/service/mod.rs index f79056f4..eb8c21f3 100644 --- a/src/service/mod.rs +++ b/src/service/mod.rs @@ -27,13 +27,10 @@ pub mod transaction_ids; pub mod uiaa; pub mod users; -extern crate conduwuit_core as conduwuit; -extern crate conduwuit_database as database; - pub(crate) use service::{Args, Dep, Service}; pub use crate::services::Services; -conduwuit::mod_ctor! {} -conduwuit::mod_dtor! {} -conduwuit::rustc_flags_capture! {} +tuwunel_core::mod_ctor! {} +tuwunel_core::mod_dtor! {} +tuwunel_core::rustc_flags_capture! {} diff --git a/src/service/presence/data.rs b/src/service/presence/data.rs index d7ef5175..5583bdf5 100644 --- a/src/service/presence/data.rs +++ b/src/service/presence/data.rs @@ -1,12 +1,12 @@ use std::sync::Arc; -use conduwuit::{ +use futures::Stream; +use ruma::{UInt, UserId, events::presence::PresenceEvent, presence::PresenceState}; +use tuwunel_core::{ Result, debug_warn, utils, utils::{ReadyExt, stream::TryIgnore}, }; -use database::{Deserialized, Json, Map}; -use futures::Stream; -use ruma::{UInt, UserId, events::presence::PresenceEvent, presence::PresenceState}; +use tuwunel_database::{Deserialized, Json, Map}; use super::Presence; use crate::{Dep, globals, users}; diff --git a/src/service/presence/mod.rs b/src/service/presence/mod.rs index 8f646be6..f530c051 100644 --- a/src/service/presence/mod.rs +++ b/src/service/presence/mod.rs @@ -4,14 +4,14 @@ mod presence; use std::{sync::Arc, time::Duration}; use async_trait::async_trait; -use conduwuit::{ - Error, Result, Server, checked, debug, debug_warn, error, result::LogErr, trace, -}; -use database::Database; use futures::{Stream, StreamExt, TryFutureExt, stream::FuturesUnordered}; use loole::{Receiver, Sender}; use ruma::{OwnedUserId, UInt, UserId, events::presence::PresenceEvent, presence::PresenceState}; use tokio::time::sleep; +use tuwunel_core::{ + Error, Result, Server, checked, debug, debug_warn, error, result::LogErr, trace, +}; +use tuwunel_database::Database; use self::{data::Data, presence::Presence}; use crate::{Dep, globals, users}; diff --git a/src/service/presence/presence.rs b/src/service/presence/presence.rs index 3357bd61..003a8ac3 100644 --- a/src/service/presence/presence.rs +++ b/src/service/presence/presence.rs @@ -1,10 +1,10 @@ -use conduwuit::{Error, Result, utils}; use ruma::{ UInt, UserId, events::presence::{PresenceEvent, PresenceEventContent}, presence::PresenceState, }; use serde::{Deserialize, Serialize}; +use tuwunel_core::{Error, Result, utils}; use crate::users; diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs index 27490fb8..09f2db90 100644 --- a/src/service/pusher/mod.rs +++ b/src/service/pusher/mod.rs @@ -1,12 +1,6 @@ use std::{fmt::Debug, mem, sync::Arc}; use bytes::BytesMut; -use conduwuit::{ - Err, PduEvent, Result, debug_warn, err, trace, - utils::{stream::TryIgnore, string_from_bytes}, - warn, -}; -use database::{Deserialized, Ignore, Interfix, Json, Map}; use futures::{Stream, StreamExt}; use ipaddress::IPAddress; use ruma::{ @@ -29,6 +23,12 @@ use ruma::{ serde::Raw, uint, }; +use tuwunel_core::{ + Err, PduEvent, Result, debug_warn, err, trace, + utils::{stream::TryIgnore, string_from_bytes}, + warn, +}; +use tuwunel_database::{Deserialized, Ignore, Interfix, Json, Map}; use crate::{Dep, client, globals, rooms, sending, users}; diff --git a/src/service/resolver/actual.rs b/src/service/resolver/actual.rs index 0151c4d7..5d11c776 100644 --- a/src/service/resolver/actual.rs +++ b/src/service/resolver/actual.rs @@ -3,11 +3,11 @@ use std::{ net::{IpAddr, SocketAddr}, }; -use conduwuit::{Err, Result, debug, debug_info, err, error, trace}; use futures::{FutureExt, TryFutureExt}; use hickory_resolver::ResolveError; use ipaddress::IPAddress; use ruma::ServerName; +use tuwunel_core::{Err, Result, debug, debug_info, err, error, trace}; use super::{ cache::{CachedDest, CachedOverride, MAX_IPS}, diff --git a/src/service/resolver/cache.rs b/src/service/resolver/cache.rs index cfea7187..f435058a 100644 --- a/src/service/resolver/cache.rs +++ b/src/service/resolver/cache.rs @@ -1,15 +1,15 @@ use std::{net::IpAddr, sync::Arc, time::SystemTime}; -use conduwuit::{ +use futures::{Stream, StreamExt, future::join}; +use ruma::ServerName; +use serde::{Deserialize, Serialize}; +use tuwunel_core::{ Result, arrayvec::ArrayVec, at, err, implement, utils::{math::Expected, rand, stream::TryIgnore}, }; -use database::{Cbor, Deserialized, Map}; -use futures::{Stream, StreamExt, future::join}; -use ruma::ServerName; -use serde::{Deserialize, Serialize}; +use tuwunel_database::{Cbor, Deserialized, Map}; use super::fed::FedDest; diff --git a/src/service/resolver/dns.rs b/src/service/resolver/dns.rs index 3a0b2551..1db96d7b 100644 --- a/src/service/resolver/dns.rs +++ b/src/service/resolver/dns.rs @@ -1,9 +1,9 @@ use std::{net::SocketAddr, sync::Arc, time::Duration}; -use conduwuit::{Result, Server, err}; use futures::FutureExt; use hickory_resolver::{TokioResolver, lookup_ip::LookupIp}; use reqwest::dns::{Addrs, Name, Resolve, Resolving}; +use tuwunel_core::{Result, Server, err}; use super::cache::{Cache, CachedOverride}; diff --git a/src/service/resolver/fed.rs b/src/service/resolver/fed.rs index e5bee9ac..3456503f 100644 --- a/src/service/resolver/fed.rs +++ b/src/service/resolver/fed.rs @@ -4,8 +4,8 @@ use std::{ net::{IpAddr, SocketAddr}, }; -use conduwuit::{arrayvec::ArrayString, utils::math::Expected}; use serde::{Deserialize, Serialize}; +use tuwunel_core::{arrayvec::ArrayString, utils::math::Expected}; #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)] pub enum FedDest { diff --git a/src/service/resolver/mod.rs b/src/service/resolver/mod.rs index c513cec9..bbf63f24 100644 --- a/src/service/resolver/mod.rs +++ b/src/service/resolver/mod.rs @@ -9,7 +9,7 @@ mod well_known; use std::sync::Arc; use async_trait::async_trait; -use conduwuit::{Result, Server, arrayvec::ArrayString, utils::MutexMap}; +use tuwunel_core::{Result, Server, arrayvec::ArrayString, utils::MutexMap}; use self::{cache::Cache, dns::Resolver}; use crate::{Dep, client}; diff --git a/src/service/resolver/well_known.rs b/src/service/resolver/well_known.rs index 68a8e620..553bf845 100644 --- a/src/service/resolver/well_known.rs +++ b/src/service/resolver/well_known.rs @@ -1,4 +1,4 @@ -use conduwuit::{Result, debug, debug_error, debug_info, debug_warn, implement, trace}; +use tuwunel_core::{Result, debug, debug_error, debug_info, debug_warn, implement, trace}; #[implement(super::Service)] #[tracing::instrument(name = "well-known", level = "debug", skip(self, dest))] diff --git a/src/service/rooms/alias/mod.rs b/src/service/rooms/alias/mod.rs index 866e45a9..605b2a88 100644 --- a/src/service/rooms/alias/mod.rs +++ b/src/service/rooms/alias/mod.rs @@ -2,11 +2,6 @@ mod remote; use std::sync::Arc; -use conduwuit::{ - Err, Result, Server, err, - utils::{ReadyExt, stream::TryIgnore}, -}; -use database::{Deserialized, Ignore, Interfix, Map}; use futures::{Stream, StreamExt, TryFutureExt}; use ruma::{ OwnedRoomId, OwnedServerName, OwnedUserId, RoomAliasId, RoomId, RoomOrAliasId, UserId, @@ -15,6 +10,11 @@ use ruma::{ room::power_levels::{RoomPowerLevels, RoomPowerLevelsEventContent}, }, }; +use tuwunel_core::{ + Err, Result, Server, err, + utils::{ReadyExt, stream::TryIgnore}, +}; +use tuwunel_database::{Deserialized, Ignore, Interfix, Map}; use crate::{Dep, admin, appservice, appservice::RegistrationInfo, globals, rooms, sending}; diff --git a/src/service/rooms/alias/remote.rs b/src/service/rooms/alias/remote.rs index 60aed76d..ca2857c8 100644 --- a/src/service/rooms/alias/remote.rs +++ b/src/service/rooms/alias/remote.rs @@ -1,8 +1,8 @@ use std::iter::once; -use conduwuit::{Result, debug, debug_error, err, implement}; use federation::query::get_room_information::v1::Response; use ruma::{OwnedRoomId, OwnedServerName, RoomAliasId, ServerName, api::federation}; +use tuwunel_core::{Result, debug, debug_error, err, implement}; #[implement(super::Service)] pub(super) async fn remote_resolve( diff --git a/src/service/rooms/auth_chain/data.rs b/src/service/rooms/auth_chain/data.rs index 8c3588cc..4f9a13f8 100644 --- a/src/service/rooms/auth_chain/data.rs +++ b/src/service/rooms/auth_chain/data.rs @@ -3,9 +3,9 @@ use std::{ sync::{Arc, Mutex}, }; -use conduwuit::{Err, Result, err, utils, utils::math::usize_from_f64}; -use database::Map; use lru_cache::LruCache; +use tuwunel_core::{Err, Result, err, utils, utils::math::usize_from_f64}; +use tuwunel_database::Map; use crate::rooms::short::ShortEventId; diff --git a/src/service/rooms/auth_chain/mod.rs b/src/service/rooms/auth_chain/mod.rs index 0903ea75..04b4a34e 100644 --- a/src/service/rooms/auth_chain/mod.rs +++ b/src/service/rooms/auth_chain/mod.rs @@ -7,7 +7,9 @@ use std::{ time::Instant, }; -use conduwuit::{ +use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; +use ruma::{EventId, OwnedEventId, RoomId}; +use tuwunel_core::{ Err, Result, at, debug, debug_error, implement, trace, utils::{ IterStream, @@ -15,8 +17,6 @@ use conduwuit::{ }, validated, warn, }; -use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt}; -use ruma::{EventId, OwnedEventId, RoomId}; use self::data::Data; use crate::{Dep, rooms, rooms::short::ShortEventId}; diff --git a/src/service/rooms/directory/mod.rs b/src/service/rooms/directory/mod.rs index 4ea10641..40fa532b 100644 --- a/src/service/rooms/directory/mod.rs +++ b/src/service/rooms/directory/mod.rs @@ -1,9 +1,9 @@ use std::sync::Arc; -use conduwuit::{Result, implement, utils::stream::TryIgnore}; -use database::Map; use futures::Stream; use ruma::{RoomId, api::client::room::Visibility}; +use tuwunel_core::{Result, implement, utils::stream::TryIgnore}; +use tuwunel_database::Map; pub struct Service { db: Data, diff --git a/src/service/rooms/event_handler/acl_check.rs b/src/service/rooms/event_handler/acl_check.rs index f847015b..5cdfb100 100644 --- a/src/service/rooms/event_handler/acl_check.rs +++ b/src/service/rooms/event_handler/acl_check.rs @@ -1,8 +1,8 @@ -use conduwuit::{Err, Result, debug, implement, trace, warn}; use ruma::{ RoomId, ServerName, events::{StateEventType, room::server_acl::RoomServerAclEventContent}, }; +use tuwunel_core::{Err, Result, debug, implement, trace, warn}; /// Returns Ok if the acl allows the server #[implement(super::Service)] diff --git a/src/service/rooms/event_handler/fetch_and_handle_outliers.rs b/src/service/rooms/event_handler/fetch_and_handle_outliers.rs index b0a7d827..a1566040 100644 --- a/src/service/rooms/event_handler/fetch_and_handle_outliers.rs +++ b/src/service/rooms/event_handler/fetch_and_handle_outliers.rs @@ -3,13 +3,13 @@ use std::{ time::Instant, }; -use conduwuit::{ - PduEvent, debug, debug_error, debug_warn, implement, pdu, trace, - utils::continue_exponential_backoff_secs, warn, -}; use ruma::{ CanonicalJsonValue, OwnedEventId, RoomId, ServerName, api::federation::event::get_event, }; +use tuwunel_core::{ + PduEvent, debug, debug_error, debug_warn, implement, pdu, trace, + utils::continue_exponential_backoff_secs, warn, +}; use super::get_room_version_id; diff --git a/src/service/rooms/event_handler/fetch_prev.rs b/src/service/rooms/event_handler/fetch_prev.rs index 0f92d6e6..3c5a2cfd 100644 --- a/src/service/rooms/event_handler/fetch_prev.rs +++ b/src/service/rooms/event_handler/fetch_prev.rs @@ -1,14 +1,14 @@ use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; -use conduwuit::{ - PduEvent, Result, debug_warn, err, implement, - state_res::{self}, -}; use futures::{FutureExt, future}; use ruma::{ CanonicalJsonValue, MilliSecondsSinceUnixEpoch, OwnedEventId, RoomId, ServerName, UInt, int, uint, }; +use tuwunel_core::{ + PduEvent, Result, debug_warn, err, implement, + state_res::{self}, +}; use super::check_room_id; diff --git a/src/service/rooms/event_handler/fetch_state.rs b/src/service/rooms/event_handler/fetch_state.rs index 0f9e093b..4c2d86af 100644 --- a/src/service/rooms/event_handler/fetch_state.rs +++ b/src/service/rooms/event_handler/fetch_state.rs @@ -1,11 +1,11 @@ use std::collections::{HashMap, hash_map}; -use conduwuit::{Err, Error, PduEvent, Result, debug, debug_warn, implement}; use futures::FutureExt; use ruma::{ EventId, OwnedEventId, RoomId, ServerName, api::federation::event::get_room_state_ids, events::StateEventType, }; +use tuwunel_core::{Err, Error, PduEvent, Result, debug, debug_warn, implement}; use crate::rooms::short::ShortStateKey; diff --git a/src/service/rooms/event_handler/handle_incoming_pdu.rs b/src/service/rooms/event_handler/handle_incoming_pdu.rs index 77cae41d..999ab4f8 100644 --- a/src/service/rooms/event_handler/handle_incoming_pdu.rs +++ b/src/service/rooms/event_handler/handle_incoming_pdu.rs @@ -3,15 +3,15 @@ use std::{ time::Instant, }; -use conduwuit::{ - Err, Result, debug, debug::INFO_SPAN_LEVEL, defer, err, implement, utils::stream::IterStream, - warn, -}; use futures::{ FutureExt, TryFutureExt, TryStreamExt, future::{OptionFuture, try_join5}, }; use ruma::{CanonicalJsonValue, EventId, RoomId, ServerName, UserId, events::StateEventType}; +use tuwunel_core::{ + Err, Result, debug, debug::INFO_SPAN_LEVEL, defer, err, implement, utils::stream::IterStream, + warn, +}; use crate::rooms::timeline::RawPduId; diff --git a/src/service/rooms/event_handler/handle_outlier_pdu.rs b/src/service/rooms/event_handler/handle_outlier_pdu.rs index 5339249d..315264c9 100644 --- a/src/service/rooms/event_handler/handle_outlier_pdu.rs +++ b/src/service/rooms/event_handler/handle_outlier_pdu.rs @@ -1,13 +1,13 @@ use std::collections::{BTreeMap, HashMap, hash_map}; -use conduwuit::{ - Err, Error, PduEvent, Result, debug, debug_info, err, implement, state_res, trace, warn, -}; use futures::future::ready; use ruma::{ CanonicalJsonObject, CanonicalJsonValue, EventId, RoomId, ServerName, api::client::error::ErrorKind, events::StateEventType, }; +use tuwunel_core::{ + Err, Error, PduEvent, Result, debug, debug_info, err, implement, state_res, trace, warn, +}; use super::{check_room_id, get_room_version_id, to_room_version}; diff --git a/src/service/rooms/event_handler/handle_prev_pdu.rs b/src/service/rooms/event_handler/handle_prev_pdu.rs index d612b2bf..eb08874c 100644 --- a/src/service/rooms/event_handler/handle_prev_pdu.rs +++ b/src/service/rooms/event_handler/handle_prev_pdu.rs @@ -1,10 +1,10 @@ use std::{collections::BTreeMap, time::Instant}; -use conduwuit::{ +use ruma::{CanonicalJsonValue, EventId, RoomId, ServerName, UInt}; +use tuwunel_core::{ Err, PduEvent, Result, debug, debug::INFO_SPAN_LEVEL, defer, implement, utils::continue_exponential_backoff_secs, }; -use ruma::{CanonicalJsonValue, EventId, RoomId, ServerName, UInt}; #[implement(super::Service)] #[allow(clippy::type_complexity)] diff --git a/src/service/rooms/event_handler/mod.rs b/src/service/rooms/event_handler/mod.rs index 45675da8..e993505b 100644 --- a/src/service/rooms/event_handler/mod.rs +++ b/src/service/rooms/event_handler/mod.rs @@ -18,11 +18,11 @@ use std::{ }; use async_trait::async_trait; -use conduwuit::{Err, PduEvent, Result, RoomVersion, Server, utils::MutexMap}; use ruma::{ OwnedEventId, OwnedRoomId, RoomId, RoomVersionId, events::room::create::RoomCreateEventContent, }; +use tuwunel_core::{Err, PduEvent, Result, RoomVersion, Server, utils::MutexMap}; use crate::{Dep, globals, rooms, sending, server_keys}; diff --git a/src/service/rooms/event_handler/parse_incoming_pdu.rs b/src/service/rooms/event_handler/parse_incoming_pdu.rs index a49fc541..3cf126a7 100644 --- a/src/service/rooms/event_handler/parse_incoming_pdu.rs +++ b/src/service/rooms/event_handler/parse_incoming_pdu.rs @@ -1,6 +1,6 @@ -use conduwuit::{Result, err, implement, pdu::gen_event_id_canonical_json, result::FlatOk}; use ruma::{CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId}; use serde_json::value::RawValue as RawJsonValue; +use tuwunel_core::{Result, err, implement, pdu::gen_event_id_canonical_json, result::FlatOk}; type Parsed = (OwnedRoomId, OwnedEventId, CanonicalJsonObject); diff --git a/src/service/rooms/event_handler/resolve_state.rs b/src/service/rooms/event_handler/resolve_state.rs index b3a7a71b..a57ec1a8 100644 --- a/src/service/rooms/event_handler/resolve_state.rs +++ b/src/service/rooms/event_handler/resolve_state.rs @@ -4,14 +4,14 @@ use std::{ sync::Arc, }; -use conduwuit::{ +use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join}; +use ruma::{OwnedEventId, RoomId, RoomVersionId}; +use tuwunel_core::{ Error, Result, err, implement, state_res::{self, StateMap}, trace, utils::stream::{IterStream, ReadyExt, TryWidebandExt, WidebandExt, automatic_width}, }; -use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join}; -use ruma::{OwnedEventId, RoomId, RoomVersionId}; use crate::rooms::state_compressor::CompressedState; diff --git a/src/service/rooms/event_handler/state_at_incoming.rs b/src/service/rooms/event_handler/state_at_incoming.rs index eb38c2c3..17b4389f 100644 --- a/src/service/rooms/event_handler/state_at_incoming.rs +++ b/src/service/rooms/event_handler/state_at_incoming.rs @@ -4,14 +4,14 @@ use std::{ iter::Iterator, }; -use conduwuit::{ +use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join}; +use ruma::{OwnedEventId, RoomId, RoomVersionId}; +use tuwunel_core::{ Result, debug, err, implement, matrix::{PduEvent, StateMap}, trace, utils::stream::{BroadbandExt, IterStream, ReadyExt, TryBroadbandExt, TryWidebandExt}, }; -use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join}; -use ruma::{OwnedEventId, RoomId, RoomVersionId}; use crate::rooms::short::ShortStateHash; diff --git a/src/service/rooms/event_handler/upgrade_outlier_pdu.rs b/src/service/rooms/event_handler/upgrade_outlier_pdu.rs index 97d3df97..34f3e621 100644 --- a/src/service/rooms/event_handler/upgrade_outlier_pdu.rs +++ b/src/service/rooms/event_handler/upgrade_outlier_pdu.rs @@ -1,14 +1,14 @@ use std::{borrow::Borrow, collections::BTreeMap, iter::once, sync::Arc, time::Instant}; -use conduwuit::{ +use futures::{FutureExt, StreamExt, future::ready}; +use ruma::{CanonicalJsonValue, RoomId, ServerName, events::StateEventType}; +use tuwunel_core::{ Err, Result, debug, debug_info, err, implement, matrix::{EventTypeExt, PduEvent, StateKey, state_res}, trace, utils::stream::{BroadbandExt, ReadyExt}, warn, }; -use futures::{FutureExt, StreamExt, future::ready}; -use ruma::{CanonicalJsonValue, RoomId, ServerName, events::StateEventType}; use super::{get_room_version_id, to_room_version}; use crate::rooms::{ diff --git a/src/service/rooms/lazy_loading/mod.rs b/src/service/rooms/lazy_loading/mod.rs index 346314d1..368c376a 100644 --- a/src/service/rooms/lazy_loading/mod.rs +++ b/src/service/rooms/lazy_loading/mod.rs @@ -2,13 +2,13 @@ use std::{collections::HashSet, sync::Arc}; -use conduwuit::{ +use futures::{Stream, StreamExt, pin_mut}; +use ruma::{DeviceId, OwnedUserId, RoomId, UserId, api::client::filter::LazyLoadOptions}; +use tuwunel_core::{ Result, implement, utils::{IterStream, ReadyExt, stream::TryIgnore}, }; -use database::{Database, Deserialized, Handle, Interfix, Map, Qry}; -use futures::{Stream, StreamExt, pin_mut}; -use ruma::{DeviceId, OwnedUserId, RoomId, UserId, api::client::filter::LazyLoadOptions}; +use tuwunel_database::{Database, Deserialized, Handle, Interfix, Map, Qry}; pub struct Service { db: Data, diff --git a/src/service/rooms/metadata/mod.rs b/src/service/rooms/metadata/mod.rs index 54eef47d..2b452b3e 100644 --- a/src/service/rooms/metadata/mod.rs +++ b/src/service/rooms/metadata/mod.rs @@ -1,9 +1,9 @@ use std::sync::Arc; -use conduwuit::{Result, implement, utils::stream::TryIgnore}; -use database::Map; use futures::{Stream, StreamExt}; use ruma::RoomId; +use tuwunel_core::{Result, implement, utils::stream::TryIgnore}; +use tuwunel_database::Map; use crate::{Dep, rooms}; diff --git a/src/service/rooms/outlier/mod.rs b/src/service/rooms/outlier/mod.rs index 12b56935..7fcc5c27 100644 --- a/src/service/rooms/outlier/mod.rs +++ b/src/service/rooms/outlier/mod.rs @@ -1,8 +1,8 @@ use std::sync::Arc; -use conduwuit::{Result, implement, matrix::pdu::PduEvent}; -use conduwuit_database::{Deserialized, Json, Map}; use ruma::{CanonicalJsonObject, EventId}; +use tuwunel_core::{Result, implement, matrix::pdu::PduEvent}; +use tuwunel_database::{Deserialized, Json, Map}; pub struct Service { db: Data, diff --git a/src/service/rooms/pdu_metadata/data.rs b/src/service/rooms/pdu_metadata/data.rs index f0beab5a..9e7f3a4f 100644 --- a/src/service/rooms/pdu_metadata/data.rs +++ b/src/service/rooms/pdu_metadata/data.rs @@ -1,6 +1,8 @@ use std::{mem::size_of, sync::Arc}; -use conduwuit::{ +use futures::{Stream, StreamExt}; +use ruma::{EventId, RoomId, UserId, api::Direction}; +use tuwunel_core::{ PduCount, PduEvent, arrayvec::ArrayVec, result::LogErr, @@ -10,9 +12,7 @@ use conduwuit::{ u64_from_u8, }, }; -use database::Map; -use futures::{Stream, StreamExt}; -use ruma::{EventId, RoomId, UserId, api::Direction}; +use tuwunel_database::Map; use crate::{ Dep, rooms, diff --git a/src/service/rooms/pdu_metadata/mod.rs b/src/service/rooms/pdu_metadata/mod.rs index 18221c2d..f46b41ee 100644 --- a/src/service/rooms/pdu_metadata/mod.rs +++ b/src/service/rooms/pdu_metadata/mod.rs @@ -1,9 +1,9 @@ mod data; use std::sync::Arc; -use conduwuit::{PduCount, Result}; use futures::{StreamExt, future::try_join}; use ruma::{EventId, RoomId, UserId, api::Direction}; +use tuwunel_core::{PduCount, Result}; use self::data::{Data, PdusIterItem}; use crate::{Dep, rooms}; diff --git a/src/service/rooms/read_receipt/data.rs b/src/service/rooms/read_receipt/data.rs index 62f87948..844722fe 100644 --- a/src/service/rooms/read_receipt/data.rs +++ b/src/service/rooms/read_receipt/data.rs @@ -1,16 +1,16 @@ use std::sync::Arc; -use conduwuit::{ - Result, - utils::{ReadyExt, stream::TryIgnore}, -}; -use database::{Deserialized, Json, Map}; use futures::{Stream, StreamExt}; use ruma::{ CanonicalJsonObject, RoomId, UserId, events::{AnySyncEphemeralRoomEvent, receipt::ReceiptEvent}, serde::Raw, }; +use tuwunel_core::{ + Result, + utils::{ReadyExt, stream::TryIgnore}, +}; +use tuwunel_database::{Deserialized, Json, Map}; use crate::{Dep, globals}; diff --git a/src/service/rooms/read_receipt/mod.rs b/src/service/rooms/read_receipt/mod.rs index 69e859c4..658568b0 100644 --- a/src/service/rooms/read_receipt/mod.rs +++ b/src/service/rooms/read_receipt/mod.rs @@ -2,11 +2,6 @@ mod data; use std::{collections::BTreeMap, sync::Arc}; -use conduwuit::{ - Result, debug, err, - matrix::pdu::{PduCount, PduId, RawPduId}, - warn, -}; use futures::{Stream, TryFutureExt, try_join}; use ruma::{ OwnedEventId, OwnedUserId, RoomId, UserId, @@ -16,6 +11,11 @@ use ruma::{ }, serde::Raw, }; +use tuwunel_core::{ + Result, debug, err, + matrix::pdu::{PduCount, PduId, RawPduId}, + warn, +}; use self::data::{Data, ReceiptItem}; use crate::{Dep, rooms, sending}; @@ -161,7 +161,7 @@ where } let content = ReceiptEventContent::from_iter(json); - conduwuit::trace!(?content); + tuwunel_core::trace!(?content); Raw::from_json( serde_json::value::to_raw_value(&SyncEphemeralRoomEvent { content }) .expect("received valid json"), diff --git a/src/service/rooms/search/mod.rs b/src/service/rooms/search/mod.rs index 4100dd75..08cadb68 100644 --- a/src/service/rooms/search/mod.rs +++ b/src/service/rooms/search/mod.rs @@ -1,6 +1,8 @@ use std::sync::Arc; -use conduwuit::{ +use futures::{Stream, StreamExt}; +use ruma::{RoomId, UserId, api::client::search::search_events::v3::Criteria}; +use tuwunel_core::{ PduCount, PduEvent, Result, arrayvec::ArrayVec, implement, @@ -9,9 +11,7 @@ use conduwuit::{ stream::{TryIgnore, WidebandExt}, }, }; -use database::{Map, keyval::Val}; -use futures::{Stream, StreamExt}; -use ruma::{RoomId, UserId, api::client::search::search_events::v3::Criteria}; +use tuwunel_database::{Map, keyval::Val}; use crate::{ Dep, rooms, @@ -224,7 +224,7 @@ fn make_prefix(shortroomid: ShortRoomId, word: &str) -> TokenId { let mut key = TokenId::new(); key.extend_from_slice(&shortroomid.to_be_bytes()); key.extend_from_slice(word.as_bytes()); - key.push(database::SEP); + key.push(tuwunel_database::SEP); key } diff --git a/src/service/rooms/short/mod.rs b/src/service/rooms/short/mod.rs index 06ff6493..a4d1243c 100644 --- a/src/service/rooms/short/mod.rs +++ b/src/service/rooms/short/mod.rs @@ -1,11 +1,11 @@ use std::{borrow::Borrow, fmt::Debug, mem::size_of_val, sync::Arc}; -pub use conduwuit::matrix::pdu::{ShortEventId, ShortId, ShortRoomId, ShortStateKey}; -use conduwuit::{Result, err, implement, matrix::StateKey, utils, utils::IterStream}; -use database::{Deserialized, Get, Map, Qry}; use futures::{Stream, StreamExt}; use ruma::{EventId, RoomId, events::StateEventType}; use serde::Deserialize; +pub use tuwunel_core::matrix::pdu::{ShortEventId, ShortId, ShortRoomId, ShortStateKey}; +use tuwunel_core::{Result, err, implement, matrix::StateKey, utils, utils::IterStream}; +use tuwunel_database::{Deserialized, Get, Map, Qry}; use crate::{Dep, globals}; diff --git a/src/service/rooms/spaces/mod.rs b/src/service/rooms/spaces/mod.rs index ea9756ba..9e648acc 100644 --- a/src/service/rooms/spaces/mod.rs +++ b/src/service/rooms/spaces/mod.rs @@ -5,15 +5,6 @@ mod tests; use std::{fmt::Write, sync::Arc}; use async_trait::async_trait; -use conduwuit::{ - Err, Error, PduEvent, Result, implement, - utils::{ - IterStream, - future::{BoolExt, TryExtExt}, - math::usize_from_f64, - stream::{BroadbandExt, ReadyExt}, - }, -}; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, pin_mut, stream::FuturesUnordered}; use lru_cache::LruCache; use ruma::{ @@ -33,6 +24,15 @@ use ruma::{ space::SpaceRoomJoinRule, }; use tokio::sync::{Mutex, MutexGuard}; +use tuwunel_core::{ + Err, Error, PduEvent, Result, implement, + utils::{ + IterStream, + future::{BoolExt, TryExtExt}, + math::usize_from_f64, + stream::{BroadbandExt, ReadyExt}, + }, +}; pub use self::pagination_token::PaginationToken; use crate::{Dep, rooms, sending}; diff --git a/src/service/rooms/spaces/pagination_token.rs b/src/service/rooms/spaces/pagination_token.rs index d97b7a2f..93b487a3 100644 --- a/src/service/rooms/spaces/pagination_token.rs +++ b/src/service/rooms/spaces/pagination_token.rs @@ -3,8 +3,8 @@ use std::{ str::FromStr, }; -use conduwuit::{Error, Result}; use ruma::{UInt, api::client::error::ErrorKind}; +use tuwunel_core::{Error, Result}; use crate::rooms::short::ShortRoomId; diff --git a/src/service/rooms/state/mod.rs b/src/service/rooms/state/mod.rs index 803ba9d7..04fe78ba 100644 --- a/src/service/rooms/state/mod.rs +++ b/src/service/rooms/state/mod.rs @@ -1,17 +1,6 @@ use std::{collections::HashMap, fmt::Write, iter::once, sync::Arc}; use async_trait::async_trait; -use conduwuit::{ - PduEvent, Result, err, - result::FlatOk, - state_res::{self, StateMap}, - utils::{ - IterStream, MutexMap, MutexMapGuard, ReadyExt, calculate_hash, - stream::{BroadbandExt, TryIgnore}, - }, - warn, -}; -use database::{Deserialized, Ignore, Interfix, Map}; use futures::{ FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt, future::join_all, pin_mut, }; @@ -23,6 +12,17 @@ use ruma::{ }, serde::Raw, }; +use tuwunel_core::{ + PduEvent, Result, err, + result::FlatOk, + state_res::{self, StateMap}, + utils::{ + IterStream, MutexMap, MutexMapGuard, ReadyExt, calculate_hash, + stream::{BroadbandExt, TryIgnore}, + }, + warn, +}; +use tuwunel_database::{Deserialized, Ignore, Interfix, Map}; use crate::{ Dep, globals, rooms, diff --git a/src/service/rooms/state_accessor/mod.rs b/src/service/rooms/state_accessor/mod.rs index f719fc7b..9143ad75 100644 --- a/src/service/rooms/state_accessor/mod.rs +++ b/src/service/rooms/state_accessor/mod.rs @@ -6,8 +6,6 @@ mod user_can; use std::sync::Arc; use async_trait::async_trait; -use conduwuit::{Result, err}; -use database::Map; use ruma::{ EventEncryptionAlgorithm, JsOption, OwnedRoomAliasId, RoomId, UserId, events::{ @@ -27,6 +25,8 @@ use ruma::{ }, room::RoomType, }; +use tuwunel_core::{Result, err}; +use tuwunel_database::Map; use crate::{Dep, rooms}; diff --git a/src/service/rooms/state_accessor/room_state.rs b/src/service/rooms/state_accessor/room_state.rs index 89fa2a83..8c6f2cf4 100644 --- a/src/service/rooms/state_accessor/room_state.rs +++ b/src/service/rooms/state_accessor/room_state.rs @@ -1,12 +1,12 @@ use std::borrow::Borrow; -use conduwuit::{ - Result, err, implement, - matrix::{PduEvent, StateKey}, -}; use futures::{Stream, StreamExt, TryFutureExt}; use ruma::{EventId, RoomId, events::StateEventType}; use serde::Deserialize; +use tuwunel_core::{ + Result, err, implement, + matrix::{PduEvent, StateKey}, +}; /// Returns a single PDU from `room_id` with key (`event_type`,`state_key`). #[implement(super::Service)] diff --git a/src/service/rooms/state_accessor/server_can.rs b/src/service/rooms/state_accessor/server_can.rs index 2befec22..224018b0 100644 --- a/src/service/rooms/state_accessor/server_can.rs +++ b/src/service/rooms/state_accessor/server_can.rs @@ -1,4 +1,3 @@ -use conduwuit::{implement, utils::stream::ReadyExt}; use futures::StreamExt; use ruma::{ EventId, RoomId, ServerName, @@ -7,6 +6,7 @@ use ruma::{ room::history_visibility::{HistoryVisibility, RoomHistoryVisibilityEventContent}, }, }; +use tuwunel_core::{implement, utils::stream::ReadyExt}; /// Whether a server is allowed to see an event through federation, based on /// the room's history_visibility at that event's state. diff --git a/src/service/rooms/state_accessor/state.rs b/src/service/rooms/state_accessor/state.rs index 169e69e9..8f20e1a3 100644 --- a/src/service/rooms/state_accessor/state.rs +++ b/src/service/rooms/state_accessor/state.rs @@ -1,15 +1,5 @@ use std::{borrow::Borrow, ops::Deref, sync::Arc}; -use conduwuit::{ - Result, at, err, implement, - matrix::{PduEvent, StateKey}, - pair_of, - utils::{ - result::FlatOk, - stream::{BroadbandExt, IterStream, ReadyExt, TryIgnore}, - }, -}; -use conduwuit_database::Deserialized; use futures::{FutureExt, Stream, StreamExt, TryFutureExt, future::try_join, pin_mut}; use ruma::{ EventId, OwnedEventId, UserId, @@ -19,6 +9,16 @@ use ruma::{ }, }; use serde::Deserialize; +use tuwunel_core::{ + Result, at, err, implement, + matrix::{PduEvent, StateKey}, + pair_of, + utils::{ + result::FlatOk, + stream::{BroadbandExt, IterStream, ReadyExt, TryIgnore}, + }, +}; +use tuwunel_database::Deserialized; use crate::rooms::{ short::{ShortEventId, ShortStateHash, ShortStateKey}, diff --git a/src/service/rooms/state_accessor/user_can.rs b/src/service/rooms/state_accessor/user_can.rs index 67e0b52b..4973b062 100644 --- a/src/service/rooms/state_accessor/user_can.rs +++ b/src/service/rooms/state_accessor/user_can.rs @@ -1,4 +1,3 @@ -use conduwuit::{Err, Result, implement, pdu::PduBuilder}; use ruma::{ EventId, RoomId, UserId, events::{ @@ -10,6 +9,7 @@ use ruma::{ }, }, }; +use tuwunel_core::{Err, Result, implement, pdu::PduBuilder}; use crate::rooms::state::RoomMutexGuard; diff --git a/src/service/rooms/state_cache/mod.rs b/src/service/rooms/state_cache/mod.rs index d3dbc143..f77af80b 100644 --- a/src/service/rooms/state_cache/mod.rs +++ b/src/service/rooms/state_cache/mod.rs @@ -3,13 +3,6 @@ use std::{ sync::{Arc, RwLock}, }; -use conduwuit::{ - Result, is_not_empty, - result::LogErr, - utils::{ReadyExt, StreamTools, stream::TryIgnore}, - warn, -}; -use database::{Deserialized, Ignore, Interfix, Json, Map, serialize_key}; use futures::{Stream, StreamExt, future::join5, pin_mut, stream::iter}; use itertools::Itertools; use ruma::{ @@ -27,6 +20,13 @@ use ruma::{ int, serde::Raw, }; +use tuwunel_core::{ + Result, is_not_empty, + result::LogErr, + utils::{ReadyExt, StreamTools, stream::TryIgnore}, + warn, +}; +use tuwunel_database::{Deserialized, Ignore, Interfix, Json, Map, serialize_key}; use crate::{Dep, account_data, appservice::RegistrationInfo, config, globals, rooms, users}; @@ -499,7 +499,7 @@ impl Service { user_a: &'a UserId, user_b: &'a UserId, ) -> impl Stream + Send + 'a { - use conduwuit::utils::set; + use tuwunel_core::utils::set; let a = self.rooms_joined(user_a); let b = self.rooms_joined(user_b); diff --git a/src/service/rooms/state_compressor/mod.rs b/src/service/rooms/state_compressor/mod.rs index 56a91d0e..385cf0c2 100644 --- a/src/service/rooms/state_compressor/mod.rs +++ b/src/service/rooms/state_compressor/mod.rs @@ -6,16 +6,16 @@ use std::{ }; use async_trait::async_trait; -use conduwuit::{ +use futures::{Stream, StreamExt}; +use lru_cache::LruCache; +use ruma::{EventId, RoomId}; +use tuwunel_core::{ Result, arrayvec::ArrayVec, at, checked, err, expected, utils, utils::{bytes, math::usize_from_f64, stream::IterStream}, }; -use database::Map; -use futures::{Stream, StreamExt}; -use lru_cache::LruCache; -use ruma::{EventId, RoomId}; +use tuwunel_database::Map; use crate::{ Dep, rooms, diff --git a/src/service/rooms/threads/mod.rs b/src/service/rooms/threads/mod.rs index a680df55..a766779a 100644 --- a/src/service/rooms/threads/mod.rs +++ b/src/service/rooms/threads/mod.rs @@ -1,6 +1,12 @@ use std::{collections::BTreeMap, sync::Arc}; -use conduwuit::{ +use futures::{Stream, StreamExt}; +use ruma::{ + CanonicalJsonValue, EventId, OwnedUserId, RoomId, UserId, + api::client::threads::get_threads::v1::IncludeThreads, events::relation::BundledThread, uint, +}; +use serde_json::json; +use tuwunel_core::{ Result, err, matrix::pdu::{PduCount, PduEvent, PduId, RawPduId}, utils::{ @@ -8,13 +14,7 @@ use conduwuit::{ stream::{TryIgnore, WidebandExt}, }, }; -use conduwuit_database::{Deserialized, Map}; -use futures::{Stream, StreamExt}; -use ruma::{ - CanonicalJsonValue, EventId, OwnedUserId, RoomId, UserId, - api::client::threads::get_threads::v1::IncludeThreads, events::relation::BundledThread, uint, -}; -use serde_json::json; +use tuwunel_database::{Deserialized, Map}; use crate::{Dep, rooms, rooms::short::ShortRoomId}; diff --git a/src/service/rooms/timeline/data.rs b/src/service/rooms/timeline/data.rs index 94c78bb0..7f2caaae 100644 --- a/src/service/rooms/timeline/data.rs +++ b/src/service/rooms/timeline/data.rs @@ -1,14 +1,14 @@ use std::{borrow::Borrow, sync::Arc}; -use conduwuit::{ +use futures::{FutureExt, Stream, TryFutureExt, TryStreamExt, future::select_ok, pin_mut}; +use ruma::{CanonicalJsonObject, EventId, OwnedUserId, RoomId, UserId, api::Direction}; +use tuwunel_core::{ Err, PduCount, PduEvent, Result, at, err, result::{LogErr, NotFound}, utils, utils::stream::TryReadyExt, }; -use database::{Database, Deserialized, Json, KeyVal, Map}; -use futures::{FutureExt, Stream, TryFutureExt, TryStreamExt, future::select_ok, pin_mut}; -use ruma::{CanonicalJsonObject, EventId, OwnedUserId, RoomId, UserId, api::Direction}; +use tuwunel_database::{Database, Deserialized, Json, KeyVal, Map}; use super::{PduId, RawPduId}; use crate::{Dep, rooms, rooms::short::ShortRoomId}; diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index 947e1c38..b6c7ad87 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -10,19 +10,6 @@ use std::{ }; use async_trait::async_trait; -pub use conduwuit::matrix::pdu::{PduId, RawPduId}; -use conduwuit::{ - Err, Error, Result, Server, at, debug, debug_warn, err, error, implement, info, - matrix::{ - Event, - pdu::{EventHash, PduBuilder, PduCount, PduEvent, gen_event_id}, - state_res::{self, RoomVersion}, - }, - utils::{ - self, IterStream, MutexMap, MutexMapGuard, ReadyExt, future::TryExtExt, stream::TryIgnore, - }, - validated, warn, -}; use futures::{ Future, FutureExt, Stream, StreamExt, TryStreamExt, future, future::ready, pin_mut, }; @@ -47,6 +34,19 @@ use ruma::{ }; use serde::Deserialize; use serde_json::value::{RawValue as RawJsonValue, to_raw_value}; +pub use tuwunel_core::matrix::pdu::{PduId, RawPduId}; +use tuwunel_core::{ + Err, Error, Result, Server, at, debug, debug_warn, err, error, implement, info, + matrix::{ + Event, + pdu::{EventHash, PduBuilder, PduCount, PduEvent, gen_event_id}, + state_res::{self, RoomVersion}, + }, + utils::{ + self, IterStream, MutexMap, MutexMapGuard, ReadyExt, future::TryExtExt, stream::TryIgnore, + }, + validated, warn, +}; use self::data::Data; pub use self::data::PdusIterItem; diff --git a/src/service/rooms/typing/mod.rs b/src/service/rooms/typing/mod.rs index a81ee95c..b1071ce4 100644 --- a/src/service/rooms/typing/mod.rs +++ b/src/service/rooms/typing/mod.rs @@ -1,9 +1,5 @@ use std::{collections::BTreeMap, sync::Arc}; -use conduwuit::{ - Result, Server, debug_info, trace, - utils::{self, IterStream}, -}; use futures::StreamExt; use ruma::{ OwnedRoomId, OwnedUserId, RoomId, UserId, @@ -11,6 +7,10 @@ use ruma::{ events::SyncEphemeralRoomEvent, }; use tokio::sync::{RwLock, broadcast}; +use tuwunel_core::{ + Result, Server, debug_info, trace, + utils::{self, IterStream}, +}; use crate::{Dep, globals, sending, sending::EduBuf, users}; diff --git a/src/service/rooms/user/mod.rs b/src/service/rooms/user/mod.rs index bd76f1f4..9a92e900 100644 --- a/src/service/rooms/user/mod.rs +++ b/src/service/rooms/user/mod.rs @@ -1,8 +1,8 @@ use std::sync::Arc; -use conduwuit::{Result, implement}; -use database::{Database, Deserialized, Map}; use ruma::{RoomId, UserId}; +use tuwunel_core::{Result, implement}; +use tuwunel_database::{Database, Deserialized, Map}; use crate::{Dep, globals, rooms, rooms::short::ShortStateHash}; diff --git a/src/service/sending/appservice.rs b/src/service/sending/appservice.rs index c7fae11f..f7b1f75e 100644 --- a/src/service/sending/appservice.rs +++ b/src/service/sending/appservice.rs @@ -1,11 +1,11 @@ use std::{fmt::Debug, mem}; use bytes::BytesMut; -use conduwuit::{Err, Result, debug_error, err, trace, utils, warn}; use reqwest::Client; use ruma::api::{ IncomingResponse, MatrixVersion, OutgoingRequest, SendAccessToken, appservice::Registration, }; +use tuwunel_core::{Err, Result, debug_error, err, trace, utils, warn}; /// Sends a request to an appservice /// diff --git a/src/service/sending/data.rs b/src/service/sending/data.rs index a6bcc2b2..c1675d40 100644 --- a/src/service/sending/data.rs +++ b/src/service/sending/data.rs @@ -1,12 +1,12 @@ use std::{fmt::Debug, sync::Arc}; -use conduwuit::{ +use futures::{Stream, StreamExt}; +use ruma::{OwnedServerName, ServerName, UserId}; +use tuwunel_core::{ Error, Result, at, utils, utils::{ReadyExt, stream::TryIgnore}, }; -use database::{Database, Deserialized, Map}; -use futures::{Stream, StreamExt}; -use ruma::{OwnedServerName, ServerName, UserId}; +use tuwunel_database::{Database, Deserialized, Map}; use super::{Destination, SendingEvent}; use crate::{Dep, globals}; diff --git a/src/service/sending/dest.rs b/src/service/sending/dest.rs index 4099d372..52cad6fe 100644 --- a/src/service/sending/dest.rs +++ b/src/service/sending/dest.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; -use conduwuit::implement; use ruma::{OwnedServerName, OwnedUserId}; +use tuwunel_core::implement; #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub enum Destination { diff --git a/src/service/sending/mod.rs b/src/service/sending/mod.rs index 08ca7010..7f5be21d 100644 --- a/src/service/sending/mod.rs +++ b/src/service/sending/mod.rs @@ -11,18 +11,18 @@ use std::{ }; use async_trait::async_trait; -use conduwuit::{ - Result, Server, debug, debug_warn, err, error, - smallvec::SmallVec, - utils::{ReadyExt, TryReadyExt, available_parallelism, math::usize_from_u64_truncated}, - warn, -}; use futures::{FutureExt, Stream, StreamExt}; use ruma::{ RoomId, ServerName, UserId, api::{OutgoingRequest, appservice::Registration}, }; use tokio::{task, task::JoinSet}; +use tuwunel_core::{ + Result, Server, debug, debug_warn, err, error, + smallvec::SmallVec, + utils::{ReadyExt, TryReadyExt, available_parallelism, math::usize_from_u64_truncated}, + warn, +}; use self::data::Data; pub use self::{ diff --git a/src/service/sending/sender.rs b/src/service/sending/sender.rs index fab02f6b..52f7a07a 100644 --- a/src/service/sending/sender.rs +++ b/src/service/sending/sender.rs @@ -9,17 +9,6 @@ use std::{ }; use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD}; -use conduwuit::{ - Error, Result, debug, err, error, - result::LogErr, - trace, - utils::{ - ReadyExt, calculate_hash, continue_exponential_backoff_secs, - future::TryExtExt, - stream::{BroadbandExt, IterStream, WidebandExt}, - }, - warn, -}; use futures::{ FutureExt, StreamExt, future::{BoxFuture, OptionFuture}, @@ -49,6 +38,17 @@ use ruma::{ uint, }; use serde_json::value::{RawValue as RawJsonValue, to_raw_value}; +use tuwunel_core::{ + Error, Result, debug, err, error, + result::LogErr, + trace, + utils::{ + ReadyExt, calculate_hash, continue_exponential_backoff_secs, + future::TryExtExt, + stream::{BroadbandExt, IterStream, WidebandExt}, + }, + warn, +}; use super::{ Destination, EduBuf, EduVec, Msg, SendingEvent, Service, appservice, data::QueueItem, diff --git a/src/service/server_keys/acquire.rs b/src/service/server_keys/acquire.rs index 64b936b6..1ac2b9ff 100644 --- a/src/service/server_keys/acquire.rs +++ b/src/service/server_keys/acquire.rs @@ -4,9 +4,6 @@ use std::{ time::Duration, }; -use conduwuit::{ - debug, debug_error, debug_warn, error, implement, info, result::FlatOk, trace, warn, -}; use futures::{StreamExt, stream::FuturesUnordered}; use ruma::{ CanonicalJsonObject, OwnedServerName, OwnedServerSigningKeyId, ServerName, @@ -14,6 +11,9 @@ use ruma::{ }; use serde_json::value::RawValue as RawJsonValue; use tokio::time::{Instant, timeout_at}; +use tuwunel_core::{ + debug, debug_error, debug_warn, error, implement, info, result::FlatOk, trace, warn, +}; use super::key_exists; diff --git a/src/service/server_keys/get.rs b/src/service/server_keys/get.rs index f9c5bdaf..0fe691d4 100644 --- a/src/service/server_keys/get.rs +++ b/src/service/server_keys/get.rs @@ -1,10 +1,10 @@ use std::borrow::Borrow; -use conduwuit::{Err, Result, implement}; use ruma::{ CanonicalJsonObject, RoomVersionId, ServerName, ServerSigningKeyId, api::federation::discovery::VerifyKey, }; +use tuwunel_core::{Err, Result, implement}; use super::{PubKeyMap, PubKeys, extract_key}; diff --git a/src/service/server_keys/keypair.rs b/src/service/server_keys/keypair.rs index 259c37fb..26153172 100644 --- a/src/service/server_keys/keypair.rs +++ b/src/service/server_keys/keypair.rs @@ -1,8 +1,8 @@ use std::sync::Arc; -use conduwuit::{Result, debug, debug_info, err, error, utils, utils::string_from_bytes}; -use database::Database; use ruma::{api::federation::discovery::VerifyKey, serde::Base64, signatures::Ed25519KeyPair}; +use tuwunel_core::{Result, debug, debug_info, err, error, utils, utils::string_from_bytes}; +use tuwunel_database::Database; use super::VerifyKeys; diff --git a/src/service/server_keys/mod.rs b/src/service/server_keys/mod.rs index bf6799ba..5fae5e05 100644 --- a/src/service/server_keys/mod.rs +++ b/src/service/server_keys/mod.rs @@ -7,11 +7,6 @@ mod verify; use std::{collections::BTreeMap, sync::Arc, time::Duration}; -use conduwuit::{ - Result, Server, implement, - utils::{IterStream, timepoint_from_now}, -}; -use database::{Deserialized, Json, Map}; use futures::StreamExt; use ruma::{ CanonicalJsonObject, MilliSecondsSinceUnixEpoch, OwnedServerSigningKeyId, RoomVersionId, @@ -21,6 +16,11 @@ use ruma::{ signatures::{Ed25519KeyPair, PublicKeyMap, PublicKeySet}, }; use serde_json::value::RawValue as RawJsonValue; +use tuwunel_core::{ + Result, Server, implement, + utils::{IterStream, timepoint_from_now}, +}; +use tuwunel_database::{Deserialized, Json, Map}; use crate::{Dep, globals, sending}; diff --git a/src/service/server_keys/request.rs b/src/service/server_keys/request.rs index d9907616..2cb0f52c 100644 --- a/src/service/server_keys/request.rs +++ b/src/service/server_keys/request.rs @@ -1,6 +1,5 @@ use std::{collections::BTreeMap, fmt::Debug}; -use conduwuit::{Err, Result, debug, implement}; use ruma::{ OwnedServerName, OwnedServerSigningKeyId, ServerName, ServerSigningKeyId, api::federation::discovery::{ @@ -9,6 +8,7 @@ use ruma::{ get_server_keys, }, }; +use tuwunel_core::{Err, Result, debug, implement}; #[implement(super::Service)] pub(super) async fn batch_notary_request<'a, S, K>( diff --git a/src/service/server_keys/sign.rs b/src/service/server_keys/sign.rs index e8cc485d..6b17b557 100644 --- a/src/service/server_keys/sign.rs +++ b/src/service/server_keys/sign.rs @@ -1,5 +1,5 @@ -use conduwuit::{Result, implement}; use ruma::{CanonicalJsonObject, RoomVersionId}; +use tuwunel_core::{Result, implement}; #[implement(super::Service)] pub fn sign_json(&self, object: &mut CanonicalJsonObject) -> Result { diff --git a/src/service/server_keys/verify.rs b/src/service/server_keys/verify.rs index 84433628..7f77db0d 100644 --- a/src/service/server_keys/verify.rs +++ b/src/service/server_keys/verify.rs @@ -1,8 +1,8 @@ -use conduwuit::{Err, Result, implement, pdu::gen_event_id_canonical_json}; use ruma::{ CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, RoomVersionId, signatures::Verified, }; use serde_json::value::RawValue as RawJsonValue; +use tuwunel_core::{Err, Result, implement, pdu::gen_event_id_canonical_json}; #[implement(super::Service)] pub async fn validate_and_add_event_id( diff --git a/src/service/service.rs b/src/service/service.rs index 574efd8f..f1ab6f4e 100644 --- a/src/service/service.rs +++ b/src/service/service.rs @@ -7,8 +7,10 @@ use std::{ }; use async_trait::async_trait; -use conduwuit::{Err, Result, Server, err, error::inspect_log, utils::string::SplitInfallible}; -use database::Database; +use tuwunel_core::{ + Err, Result, Server, err, error::inspect_log, utils::string::SplitInfallible, +}; +use tuwunel_database::Database; /// Abstract interface for a Service #[async_trait] diff --git a/src/service/services.rs b/src/service/services.rs index 170e2daa..a2d3fd3f 100644 --- a/src/service/services.rs +++ b/src/service/services.rs @@ -4,10 +4,10 @@ use std::{ sync::{Arc, RwLock}, }; -use conduwuit::{Result, Server, debug, debug_info, info, trace, utils::stream::IterStream}; -use database::Database; use futures::{Stream, StreamExt, TryStreamExt}; use tokio::sync::Mutex; +use tuwunel_core::{Result, Server, debug, debug_info, info, trace, utils::stream::IterStream}; +use tuwunel_database::Database; use crate::{ account_data, admin, appservice, client, config, emergency, federation, globals, key_backups, diff --git a/src/service/sync/mod.rs b/src/service/sync/mod.rs index b095d2c1..001ed521 100644 --- a/src/service/sync/mod.rs +++ b/src/service/sync/mod.rs @@ -5,8 +5,6 @@ use std::{ sync::{Arc, Mutex, Mutex as StdMutex}, }; -use conduwuit::{Result, Server}; -use database::Map; use ruma::{ OwnedDeviceId, OwnedRoomId, OwnedUserId, api::client::sync::sync_events::{ @@ -15,6 +13,8 @@ use ruma::{ v5, }, }; +use tuwunel_core::{Result, Server}; +use tuwunel_database::Map; use crate::{Dep, rooms}; diff --git a/src/service/sync/watch.rs b/src/service/sync/watch.rs index 96981472..74ce0e5d 100644 --- a/src/service/sync/watch.rs +++ b/src/service/sync/watch.rs @@ -1,6 +1,6 @@ -use conduwuit::{Result, implement, trace}; use futures::{FutureExt, StreamExt, pin_mut, stream::FuturesUnordered}; use ruma::{DeviceId, UserId}; +use tuwunel_core::{Result, implement, trace}; #[implement(super::Service)] #[tracing::instrument(skip(self), level = "debug")] diff --git a/src/service/transaction_ids/mod.rs b/src/service/transaction_ids/mod.rs index 9c284b70..57e9e6ae 100644 --- a/src/service/transaction_ids/mod.rs +++ b/src/service/transaction_ids/mod.rs @@ -1,8 +1,8 @@ use std::sync::Arc; -use conduwuit::{Result, implement}; -use database::{Handle, Map}; use ruma::{DeviceId, TransactionId, UserId}; +use tuwunel_core::{Result, implement}; +use tuwunel_database::{Handle, Map}; pub struct Service { db: Data, diff --git a/src/service/uiaa/mod.rs b/src/service/uiaa/mod.rs index 7803c736..b436880c 100644 --- a/src/service/uiaa/mod.rs +++ b/src/service/uiaa/mod.rs @@ -3,11 +3,6 @@ use std::{ sync::{Arc, RwLock}, }; -use conduwuit::{ - Err, Error, Result, err, error, implement, utils, - utils::{hash, string::EMPTY}, -}; -use database::{Deserialized, Json, Map}; use ruma::{ CanonicalJsonValue, DeviceId, OwnedDeviceId, OwnedUserId, UserId, api::client::{ @@ -15,6 +10,11 @@ use ruma::{ uiaa::{AuthData, AuthType, Password, UiaaInfo, UserIdentifier}, }, }; +use tuwunel_core::{ + Err, Error, Result, err, error, implement, utils, + utils::{hash, string::EMPTY}, +}; +use tuwunel_database::{Deserialized, Json, Map}; use crate::{Dep, config, globals, users}; diff --git a/src/service/users/mod.rs b/src/service/users/mod.rs index 1eb289fc..68278b2a 100644 --- a/src/service/users/mod.rs +++ b/src/service/users/mod.rs @@ -1,10 +1,5 @@ use std::{collections::BTreeMap, mem, sync::Arc}; -use conduwuit::{ - Err, Error, Result, Server, at, debug_warn, err, trace, - utils::{self, ReadyExt, stream::TryIgnore, string::Unquoted}, -}; -use database::{Deserialized, Ignore, Interfix, Json, Map}; use futures::{Stream, StreamExt, TryFutureExt}; use ruma::{ DeviceId, KeyId, MilliSecondsSinceUnixEpoch, OneTimeKeyAlgorithm, OneTimeKeyId, @@ -17,6 +12,11 @@ use ruma::{ serde::Raw, }; use serde_json::json; +use tuwunel_core::{ + Err, Error, Result, Server, at, debug_warn, err, trace, + utils::{self, ReadyExt, stream::TryIgnore, string::Unquoted}, +}; +use tuwunel_database::{Deserialized, Ignore, Interfix, Json, Map}; use crate::{Dep, account_data, admin, globals, rooms}; diff --git a/tests/cargo_smoke.sh b/tests/cargo_smoke.sh index 946790c3..5ea8e08b 100755 --- a/tests/cargo_smoke.sh +++ b/tests/cargo_smoke.sh @@ -18,7 +18,7 @@ run () { fi } -conduwuit () { +tuwunel () { UWU_OPTS=$@ rm -rf /tmp/uwu_smoketest.db echo -e "[global]\nserver_name = \"localhost\"\ndatabase_path = \"/tmp/uwu_smoketest.db\"" > /tmp/uwu_smoketest.toml @@ -38,8 +38,8 @@ element () { run cargo "$TOOLCHAIN" build $ELEMENT_OPTS --all-targets run cargo "$TOOLCHAIN" test $ELEMENT_OPTS --all-targets run cargo "$TOOLCHAIN" bench $ELEMENT_OPTS --all-targets - run cargo "$TOOLCHAIN" run $ELEMENT_OPTS --bin conduwuit -- -V - run conduwuit "$TOOLCHAIN" run $ELEMENT_OPTS --bin conduwuit + run cargo "$TOOLCHAIN" run $ELEMENT_OPTS --bin tuwunel -- -V + run tuwunel "$TOOLCHAIN" run $ELEMENT_OPTS --bin tuwunel fi } diff --git a/conduwuit-example.toml b/tuwunel-example.toml similarity index 91% rename from conduwuit-example.toml rename to tuwunel-example.toml index eaa0615b..29e71cfb 100644 --- a/conduwuit-example.toml +++ b/tuwunel-example.toml @@ -1,4 +1,4 @@ -### conduwuit Configuration +### Tuwunel Configuration ### ### THIS FILE IS GENERATED. CHANGES/CONTRIBUTIONS IN THE REPO WILL BE ### OVERWRITTEN! @@ -13,7 +13,7 @@ ### that say "YOU NEED TO EDIT THIS". ### ### For more information, see: -### https://conduwuit.puppyirl.gay/configuration.html +### https://tuwunel.chat/configuration.html [global] @@ -21,22 +21,22 @@ # suffix for user and room IDs/aliases. # # See the docs for reverse proxying and delegation: -# https://conduwuit.puppyirl.gay/deploying/generic.html#setting-up-the-reverse-proxy +# https://tuwunel.chat/deploying/generic.html#setting-up-the-reverse-proxy # # Also see the `[global.well_known]` config section at the very bottom. # # Examples of delegation: -# - https://puppygock.gay/.well-known/matrix/server -# - https://puppygock.gay/.well-known/matrix/client +# - https://matrix.org/.well-known/matrix/server +# - https://matrix.org/.well-known/matrix/client # # YOU NEED TO EDIT THIS. THIS CANNOT BE CHANGED AFTER WITHOUT A DATABASE # WIPE. # -# example: "conduwuit.woof" +# example: "girlboss.ceo" # #server_name = -# The default address (IPv4 or IPv6) conduwuit will listen on. +# The default address (IPv4 or IPv6) tuwunel will listen on. # # If you are using Docker or a container NAT networking setup, this must # be "0.0.0.0". @@ -46,10 +46,10 @@ # #address = ["127.0.0.1", "::1"] -# The port(s) conduwuit will listen on. +# The port(s) tuwunel will listen on. # # For reverse proxying, see: -# https://conduwuit.puppyirl.gay/deploying/generic.html#setting-up-the-reverse-proxy +# https://tuwunel.chat/deploying/generic.html#setting-up-the-reverse-proxy # # If you are using Docker, don't change this, you'll need to map an # external port to this. @@ -58,16 +58,16 @@ # #port = 8008 -# The UNIX socket conduwuit will listen on. +# The UNIX socket tuwunel will listen on. # -# conduwuit cannot listen on both an IP address and a UNIX socket. If +# tuwunel cannot listen on both an IP address and a UNIX socket. If # listening on a UNIX socket, you MUST remove/comment the `address` key. # # Remember to make sure that your reverse proxy has access to this socket -# file, either by adding your reverse proxy to the 'conduwuit' group or +# file, either by adding your reverse proxy to the 'tuwunel' group or # granting world R/W permissions with `unix_socket_perms` (666 minimum). # -# example: "/run/conduwuit/conduwuit.sock" +# example: "/run/tuwunel/tuwunel.sock" # #unix_socket_path = @@ -75,23 +75,23 @@ # #unix_socket_perms = 660 -# This is the only directory where conduwuit will save its data, including +# This is the only directory where tuwunel will save its data, including # media. Note: this was previously "/var/lib/matrix-conduit". # # YOU NEED TO EDIT THIS. # -# example: "/var/lib/conduwuit" +# example: "/var/lib/tuwunel" # #database_path = -# conduwuit supports online database backups using RocksDB's Backup engine -# API. To use this, set a database backup path that conduwuit can write +# tuwunel supports online database backups using RocksDB's Backup engine +# API. To use this, set a database backup path that tuwunel can write # to. # # For more information, see: -# https://conduwuit.puppyirl.gay/maintenance.html#backups +# https://tuwunel.chat/maintenance.html#backups # -# example: "/opt/conduwuit-db-backups" +# example: "/opt/tuwunel-db-backups" # #database_backup_path = @@ -106,13 +106,9 @@ # # To disable, set this to "" (an empty string). # -# The default is the trans pride flag. -# -# example: "🏳️‍⚧️" -# -#new_user_displayname_suffix = "🏳️‍⚧️" +#new_user_displayname_suffix = "🎔" -# Set this to any float value to multiply conduwuit's in-memory LRU caches +# Set this to any float value to multiply tuwunel's in-memory LRU caches # with such as "auth_chain_cache_capacity". # # May be useful if you have significant memory to spare to increase @@ -125,7 +121,7 @@ # #cache_capacity_modifier = 1.0 -# Set this to any float value in megabytes for conduwuit to tell the +# Set this to any float value in megabytes for tuwunel to tell the # database engine that this much memory is available for database read # caches. # @@ -139,7 +135,7 @@ # #db_cache_capacity_mb = varies by system -# Set this to any float value in megabytes for conduwuit to tell the +# Set this to any float value in megabytes for tuwunel to tell the # database engine that this much memory is available for database write # caches. # @@ -244,9 +240,9 @@ # Enable using *only* TCP for querying your specified nameservers instead # of UDP. # -# If you are running conduwuit in a container environment, this config +# If you are running tuwunel in a container environment, this config # option may need to be enabled. For more details, see: -# https://conduwuit.puppyirl.gay/troubleshooting.html#potential-dns-issues-when-using-docker +# https://tuwunel.chat/troubleshooting.html#potential-dns-issues-when-using-docker # #query_over_tcp_only = false @@ -412,9 +408,9 @@ # tokens. Multiple tokens can be added if you separate them with # whitespace # -# conduwuit must be able to access the file, and it must not be empty +# tuwunel must be able to access the file, and it must not be empty # -# example: "/etc/conduwuit/.reg_token" +# example: "/etc/tuwunel/.reg_token" # #registration_token_file = @@ -506,16 +502,16 @@ #allow_room_creation = true # Set to false to disable users from joining or creating room versions -# that aren't officially supported by conduwuit. +# that aren't officially supported by tuwunel. # -# conduwuit officially supports room versions 6 - 11. +# tuwunel officially supports room versions 6 - 11. # -# conduwuit has slightly experimental (though works fine in practice) +# tuwunel has slightly experimental (though works fine in practice) # support for versions 3 - 5. # #allow_unstable_room_versions = true -# Default room version conduwuit will create rooms with. +# Default room version tuwunel will create rooms with. # # Per spec, room version 11 is the default. # @@ -581,7 +577,7 @@ # Servers listed here will be used to gather public keys of other servers # (notary trusted key servers). # -# Currently, conduwuit doesn't support inbound batched key requests, so +# Currently, tuwunel doesn't support inbound batched key requests, so # this list should only contain other Synapse servers. # # example: ["matrix.org", "tchncs.de"] @@ -622,7 +618,7 @@ # #trusted_server_batch_size = 1024 -# Max log level for conduwuit. Allows debug, info, warn, or error. +# Max log level for tuwunel. Allows debug, info, warn, or error. # # See also: # https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives @@ -643,7 +639,7 @@ # #log_span_events = "none" -# Configures whether CONDUWUIT_LOG EnvFilter matches values using regular +# Configures whether TUWUNEL_LOG EnvFilter matches values using regular # expressions. See the tracing_subscriber documentation on Directives. # #log_filter_regex = true @@ -712,7 +708,7 @@ # This takes priority over "turn_secret" first, and falls back to # "turn_secret" if invalid or failed to open. # -# example: "/etc/conduwuit/.turn_secret" +# example: "/etc/tuwunel/.turn_secret" # #turn_secret_file = @@ -720,12 +716,12 @@ # #turn_ttl = 86400 -# List/vector of room IDs or room aliases that conduwuit will make newly +# List/vector of room IDs or room aliases that tuwunel will make newly # registered users join. The rooms specified must be rooms that you have # joined at least once on the server, and must be public. # -# example: ["#conduwuit:puppygock.gay", -# "!eoIzvAvVwY23LPDay8:puppygock.gay"] +# example: ["#tuwunel:tuwunel.chat", +# "!eoIzvAvVwY23LPDay8:tuwunel.chat"] # #auto_join_rooms = [] @@ -748,9 +744,9 @@ # #auto_deactivate_banned_room_attempts = false -# RocksDB log level. This is not the same as conduwuit's log level. This +# RocksDB log level. This is not the same as tuwunel's log level. This # is the log level for the RocksDB engine/library which show up in your -# database folder/path as `LOG` files. conduwuit will log RocksDB errors +# database folder/path as `LOG` files. tuwunel will log RocksDB errors # as normal through tracing or panics if severe for safety. # #rocksdb_log_level = "error" @@ -771,7 +767,7 @@ # Set this to true to use RocksDB config options that are tailored to HDDs # (slower device storage). # -# It is worth noting that by default, conduwuit will use RocksDB with +# It is worth noting that by default, tuwunel will use RocksDB with # Direct IO enabled. *Generally* speaking this improves performance as it # bypasses buffered I/O (system page cache). However there is a potential # chance that Direct IO may cause issues with database operations if your @@ -779,7 +775,7 @@ # possibly ZFS filesystem. RocksDB generally deals/corrects these issues # but it cannot account for all setups. If you experience any weird # RocksDB issues, try enabling this option as it turns off Direct IO and -# feel free to report in the conduwuit Matrix room if this option fixes +# feel free to report in the tuwunel Matrix room if this option fixes # your DB issues. # # For more information, see: @@ -834,7 +830,7 @@ # as they all differ. See their `kDefaultCompressionLevel`. # # Note when using the default value we may override it with a setting -# tailored specifically conduwuit. +# tailored specifically tuwunel. # #rocksdb_compression_level = 32767 @@ -850,7 +846,7 @@ # algorithm. # # Note when using the default value we may override it with a setting -# tailored specifically conduwuit. +# tailored specifically tuwunel. # #rocksdb_bottommost_compression_level = 32767 @@ -890,13 +886,13 @@ # 0 = AbsoluteConsistency # 1 = TolerateCorruptedTailRecords (default) # 2 = PointInTime (use me if trying to recover) -# 3 = SkipAnyCorruptedRecord (you now voided your Conduwuit warranty) +# 3 = SkipAnyCorruptedRecord (you now voided your tuwunel warranty) # # For more information on these modes, see: # https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes # # For more details on recovering a corrupt database, see: -# https://conduwuit.puppyirl.gay/troubleshooting.html#database-corruption +# https://tuwunel.chat/troubleshooting.html#database-corruption # #rocksdb_recovery_mode = 1 @@ -936,7 +932,7 @@ # - Disabling repair mode and restarting the server is recommended after # running the repair. # -# See https://conduwuit.puppyirl.gay/troubleshooting.html#database-corruption for more details on recovering a corrupt database. +# See https://tuwunel.chat/troubleshooting.html#database-corruption for more details on recovering a corrupt database. # #rocksdb_repair = false @@ -963,7 +959,7 @@ # Enables RocksDB compaction. You should never ever have to set this # option to false. If you for some reason find yourself needing to use # this option as part of troubleshooting or a bug, please reach out to us -# in the conduwuit Matrix room with information and details. +# in the tuwunel Matrix room with information and details. # # Disabling compaction will lead to a significantly bloated and # explosively large database, gradually poor performance, unnecessarily @@ -989,7 +985,7 @@ # purposes such as recovering/recreating your admin room, or inviting # yourself back. # -# See https://conduwuit.puppyirl.gay/troubleshooting.html#lost-access-to-admin-room for other ways to get back into your admin room. +# See https://tuwunel.chat/troubleshooting.html#lost-access-to-admin-room for other ways to get back into your admin room. # # Once this password is unset, all sessions will be logged out for # security purposes. @@ -1004,7 +1000,7 @@ # Allow local (your server only) presence updates/requests. # -# Note that presence on conduwuit is very fast unlike Synapse's. If using +# Note that presence on tuwunel is very fast unlike Synapse's. If using # outgoing presence, this MUST be enabled. # #allow_local_presence = true @@ -1013,7 +1009,7 @@ # # This option receives presence updates from other servers, but does not # send any unless `allow_outgoing_presence` is true. Note that presence on -# conduwuit is very fast unlike Synapse's. +# tuwunel is very fast unlike Synapse's. # #allow_incoming_presence = true @@ -1021,7 +1017,7 @@ # # This option sends presence updates to other servers, but does not # receive any unless `allow_incoming_presence` is true. Note that presence -# on conduwuit is very fast unlike Synapse's. If using outgoing presence, +# on tuwunel is very fast unlike Synapse's. If using outgoing presence, # you MUST enable `allow_local_presence` as well. # #allow_outgoing_presence = true @@ -1075,8 +1071,8 @@ # #typing_client_timeout_max_s = 45 -# Set this to true for conduwuit to compress HTTP response bodies using -# zstd. This option does nothing if conduwuit was not built with +# Set this to true for tuwunel to compress HTTP response bodies using +# zstd. This option does nothing if tuwunel was not built with # `zstd_compression` feature. Please be aware that enabling HTTP # compression may weaken TLS. Most users should not need to enable this. # See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH @@ -1084,8 +1080,8 @@ # #zstd_compression = false -# Set this to true for conduwuit to compress HTTP response bodies using -# gzip. This option does nothing if conduwuit was not built with +# Set this to true for tuwunel to compress HTTP response bodies using +# gzip. This option does nothing if tuwunel was not built with # `gzip_compression` feature. Please be aware that enabling HTTP # compression may weaken TLS. Most users should not need to enable this. # See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before @@ -1096,8 +1092,8 @@ # #gzip_compression = false -# Set this to true for conduwuit to compress HTTP response bodies using -# brotli. This option does nothing if conduwuit was not built with +# Set this to true for tuwunel to compress HTTP response bodies using +# brotli. This option does nothing if tuwunel was not built with # `brotli_compression` feature. Please be aware that enabling HTTP # compression may weaken TLS. Most users should not need to enable this. # See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH @@ -1141,8 +1137,8 @@ # Check consistency of the media directory at startup: # 1. When `media_compat_file_link` is enabled, this check will upgrade -# media when switching back and forth between Conduit and conduwuit. -# Both options must be enabled to handle this. +# media when switching back and forth between Conduit and tuwunel. Both +# options must be enabled to handle this. # 2. When media is deleted from the directory, this check will also delete # its database entry. # @@ -1159,7 +1155,7 @@ # Otherwise setting this to false reduces filesystem clutter and overhead # for managing these symlinks in the directory. This is now disabled by # default. You may still return to upstream Conduit but you have to run -# conduwuit at least once with this set to true and allow the +# tuwunel at least once with this set to true and allow the # media_startup_check to take place before shutting down to return to # Conduit. # @@ -1176,7 +1172,7 @@ # #prune_missing_media = false -# Vector list of regex patterns of server names that conduwuit will refuse +# Vector list of regex patterns of server names that tuwunel will refuse # to download remote media from. # # example: ["badserver\.tld$", "badphrase", "19dollarfortnitecards"] @@ -1206,7 +1202,7 @@ #forbidden_remote_room_directory_server_names = [] # Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you -# do not want conduwuit to send outbound requests to. Defaults to +# do not want tuwunel to send outbound requests to. Defaults to # RFC1918, unroutable, loopback, multicast, and testnet addresses for # security. # @@ -1356,25 +1352,25 @@ # Allow admins to enter commands in rooms other than "#admins" (admin # room) by prefixing your message with "\!admin" or "\\!admin" followed up -# a normal conduwuit admin command. The reply will be publicly visible to +# a normal tuwunel admin command. The reply will be publicly visible to # the room, originating from the sender. # # example: \\!admin debug ping puppygock.gay # #admin_escape_commands = true -# Automatically activate the conduwuit admin room console / CLI on -# startup. This option can also be enabled with `--console` conduwuit +# Automatically activate the tuwunel admin room console / CLI on +# startup. This option can also be enabled with `--console` tuwunel # argument. # #admin_console_automatic = false # List of admin commands to execute on startup. # -# This option can also be configured with the `--execute` conduwuit +# This option can also be configured with the `--execute` tuwunel # argument and can take standard shell commands and environment variables # -# For example: `./conduwuit --execute "server admin-notice conduwuit has +# For example: `./tuwunel --execute "server admin-notice tuwunel has # started up at $(date)"` # # example: admin_execute = ["debug ping puppygock.gay", "debug echo hi"]` @@ -1383,7 +1379,7 @@ # Ignore errors in startup commands. # -# If false, conduwuit will error and fail to start if an admin execute +# If false, tuwunel will error and fail to start if an admin execute # command (`--execute` / `admin_execute`) fails. # #admin_execute_errors_ignore = false @@ -1404,14 +1400,14 @@ # The default room tag to apply on the admin room. # # On some clients like Element, the room tag "m.server_notice" is a -# special pinned room at the very bottom of your room list. The conduwuit +# special pinned room at the very bottom of your room list. The tuwunel # admin room can be pinned here so you always have an easy-to-access # shortcut dedicated to your admin room. # #admin_room_tag = "m.server_notice" # Sentry.io crash/panic reporting, performance monitoring/metrics, etc. -# This is NOT enabled by default. conduwuit's default Sentry reporting +# This is NOT enabled by default. tuwunel's default Sentry reporting # endpoint domain is `o4506996327251968.ingest.us.sentry.io`. # #sentry = false @@ -1420,7 +1416,7 @@ # #sentry_endpoint = "" -# Report your conduwuit server_name in Sentry.io crash reports and +# Report your tuwunel server_name in Sentry.io crash reports and # metrics. # #sentry_send_server_name = false @@ -1457,7 +1453,7 @@ # Enable the tokio-console. This option is only relevant to developers. # # For more information, see: -# https://conduwuit.puppyirl.gay/development.html#debugging-with-tokio-console +# https://tuwunel.chat/development.html#debugging-with-tokio-console # #tokio_console = false