From ba4e2e1df29505d946912aa9d3fc3d5a8510bb1f Mon Sep 17 00:00:00 2001 From: cottongin Date: Tue, 10 Mar 2026 21:49:42 -0400 Subject: [PATCH] feat: scaffold project with dependencies and config Made-with: Cursor --- .gitignore | 3 + Cargo.lock | 2632 +++++++++++++++++ Cargo.toml | 31 + .../2026-03-10_brainstorm-summary.md | 24 + config.example.toml | 21 + .../2026-03-10-owncast-irc-bridge-design.md | 273 ++ .../2026-03-10-owncast-irc-bridge-impl.md | 2058 +++++++++++++ src/bin/bridge_ctl.rs | 3 + src/main.rs | 3 + 9 files changed, 5048 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 chat-summaries/2026-03-10_brainstorm-summary.md create mode 100644 config.example.toml create mode 100644 docs/plans/2026-03-10-owncast-irc-bridge-design.md create mode 100644 docs/plans/2026-03-10-owncast-irc-bridge-impl.md create mode 100644 src/bin/bridge_ctl.rs create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4a2bb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/target +.env +config.toml diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..7e95ae8 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2632 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "axum" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" +dependencies = [ + "axum-core", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cc" +version = "1.2.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.5.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +dependencies = [ + "encoding-index-japanese", + "encoding-index-korean", + "encoding-index-simpchinese", + "encoding-index-singlebyte", + "encoding-index-tradchinese", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +dependencies = [ + "encoding_index_tests", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "h2" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "irc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1be91867682072063576cac1279b7838f1cdfa87a346de8f8b1dc93cfb337b8" +dependencies = [ + "chrono", + "encoding", + "futures-util", + "irc-proto", + "log", + "native-tls", + "parking_lot", + "pin-project", + "serde", + "thiserror 1.0.69", + "tokio", + "tokio-native-tls", + "tokio-stream", + "tokio-util", + "toml 0.7.8", +] + +[[package]] +name = "irc-proto" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "259640031f2f3e6d9fa632c7b314ba1eb5d1f88b3583bd2dd2e8f17155a19b5b" +dependencies = [ + "bytes", + "encoding", + "thiserror 1.0.69", + "tokio", + "tokio-util", +] + +[[package]] +name = "iri-string" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "js-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.183" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "openssl" +version = "0.10.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "owncast-irc-bridge" +version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "clap", + "futures-util", + "irc", + "reqwest", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tokio-test", + "tokio-tungstenite", + "toml 0.8.23", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-test" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6d24790a10a7af737693a3e8f1d03faef7e6ca0cc99aae5066f533766de545" +dependencies = [ + "futures-core", + "tokio", + "tokio-stream", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" +dependencies = [ + "futures-util", + "log", + "native-tls", + "tokio", + "tokio-native-tls", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.19.15", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow 0.7.15", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tungstenite" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "native-tls", + "rand", + "sha1", + "thiserror 2.0.18", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" +dependencies = [ + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..01c16d7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "owncast-irc-bridge" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "owncast-irc-bridge" +path = "src/main.rs" + +[[bin]] +name = "bridge-ctl" +path = "src/bin/bridge_ctl.rs" + +[dependencies] +tokio = { version = "1", features = ["full"] } +axum = "0.8" +irc = "1" +tokio-tungstenite = { version = "0.26", features = ["native-tls"] } +reqwest = { version = "0.12", features = ["json"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.8" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["json", "env-filter"] } +clap = { version = "4", features = ["derive"] } +thiserror = "2" +anyhow = "1" +futures-util = "0.3" + +[dev-dependencies] +tokio-test = "0.4" diff --git a/chat-summaries/2026-03-10_brainstorm-summary.md b/chat-summaries/2026-03-10_brainstorm-summary.md new file mode 100644 index 0000000..8997e32 --- /dev/null +++ b/chat-summaries/2026-03-10_brainstorm-summary.md @@ -0,0 +1,24 @@ +# Owncast–IRC Bridge: Brainstorm & Design Session + +**Date:** 2026-03-10 + +## Task +Design a bidirectional chat bridge between Owncast (`https://owncast.bowlafterbowl.com`) and IRC (`irc.zeronode.net` / `#BowlAfterBowl`). + +## Decisions Made +- **Language:** Rust +- **Architecture:** Tokio async runtime with concurrent tasks (IRC, Webhook, WebSocket, Health Poller, Router, Control Socket) communicating via mpsc channels +- **Owncast ingest:** Webhooks (primary) + WebSocket (fallback) +- **Identity:** Prefixed messages — `[IRC] ` / `[OC] ` +- **Extras:** Stream start/stop announcements in IRC, auto-reconnect with exponential backoff +- **Owncast lifecycle:** Three-state model (Online, OfflineChatOpen, Unavailable) with health polling +- **Runtime control:** Unix domain socket + `bridge-ctl` CLI tool +- **Deployment:** Binary + Dockerfile (multi-stage) + +## Files Created +- `docs/plans/2026-03-10-owncast-irc-bridge-design.md` — Full design document +- `docs/plans/2026-03-10-owncast-irc-bridge-impl.md` — 15-task implementation plan + +## Follow-up +- Open a new session and execute the implementation plan using `superpowers:executing-plans` skill +- Plan file: `docs/plans/2026-03-10-owncast-irc-bridge-impl.md` diff --git a/config.example.toml b/config.example.toml new file mode 100644 index 0000000..72a79ad --- /dev/null +++ b/config.example.toml @@ -0,0 +1,21 @@ +[irc] +server = "irc.zeronode.net" +port = 6667 +tls = false +nick = "owncast-bridge" +channel = "#BowlAfterBowl" + +[owncast] +url = "https://owncast.bowlafterbowl.com" +# Set OWNCAST_ACCESS_TOKEN env var for the token +webhook_port = 9078 +websocket_enabled = true +health_poll_interval_secs = 30 + +[bridge] +irc_prefix = "[IRC]" +owncast_prefix = "[OC]" +message_buffer_size = 0 + +[control] +socket_path = "/tmp/owncast-irc-bridge.sock" diff --git a/docs/plans/2026-03-10-owncast-irc-bridge-design.md b/docs/plans/2026-03-10-owncast-irc-bridge-design.md new file mode 100644 index 0000000..863be45 --- /dev/null +++ b/docs/plans/2026-03-10-owncast-irc-bridge-design.md @@ -0,0 +1,273 @@ +# Owncast–IRC Bridge Design + +Bidirectional chat bridge between an Owncast instance and an IRC channel. + +- **IRC**: `irc.zeronode.net` / `#BowlAfterBowl` +- **Owncast**: `https://owncast.bowlafterbowl.com` +- **Language**: Rust +- **Deployment**: Compiled binary + Docker + +## 1. Architecture + +Single async Rust binary (tokio runtime) with four concurrent tasks communicating through `mpsc` channels: + +``` +┌──────────────────────────────────────────────────────────┐ +│ Bridge Process │ +│ │ +│ ┌─────────────┐ BridgeEvent ┌──────────────┐ │ +│ │ IRC Task │────────────────────▶│ Router │ │ +│ │ (irc crate) │◀────────────────────│ Task │ │ +│ └─────────────┘ IrcOutbound └──────┬───────┘ │ +│ │ ▲ │ +│ ┌─────────────┐ BridgeEvent │ │ │ +│ │ Webhook │────────────────────────────┘ │ │ +│ │ HTTP Server │ (axum, POST /webhook) │ │ +│ └─────────────┘ │ │ +│ │ │ +│ ┌─────────────┐ BridgeEvent │ │ +│ │ WebSocket │───────────────────────────────┘ │ +│ │ Task (opt) │ (tokio-tungstenite) │ +│ └─────────────┘ │ +│ │ +│ ┌─────────────┐ │ +│ │ Owncast API │◀── Router sends relayed IRC messages │ +│ │ Sender │ via reqwest POST │ +│ └─────────────┘ │ +│ │ +│ ┌─────────────┐ │ +│ │ Control │◀── Unix socket, receives commands │ +│ │ Task │ from bridge-ctl CLI │ +│ └─────────────┘ │ +└──────────────────────────────────────────────────────────┘ +``` + +### Tasks + +1. **IRC Task** — Connects to the IRC server, joins channel, listens for PRIVMSG events. Sends incoming messages as `BridgeEvent::ChatMessage` to the router. Receives outbound messages from the router to relay Owncast → IRC. + +2. **Webhook HTTP Task** — Runs an axum server on a configurable port. Exposes `POST /webhook` that Owncast hits. Parses CHAT, STREAM_STARTED, STREAM_STOPPED events and forwards them as `BridgeEvent` variants. + +3. **WebSocket Task** (optional, enabled via config) — Connects to Owncast's internal WebSocket. Parses chat messages from the WS stream. Acts as a fallback if webhooks aren't reachable. + +4. **Router Task** — Central fan-in/fan-out. Receives `BridgeEvent` from all sources, deduplicates (if both webhook and WS are active), applies echo suppression, and dispatches to the appropriate output. + +5. **Control Task** — Listens on a Unix domain socket for runtime commands from `bridge-ctl`. + +**Owncast API Sender** — Async function called by the router. Uses reqwest to `POST /api/integrations/chat/send` with Bearer token auth. + +## 2. Data Flow & Message Types + +### Core types + +```rust +enum BridgeEvent { + ChatMessage { + source: Source, + username: String, + body: String, + id: Option, // Owncast message ID for dedup + }, + StreamStarted { title: String }, + StreamStopped, +} + +enum Source { + Irc, + Owncast, +} +``` + +### IRC → Owncast + +1. IRC task receives `PRIVMSG #BowlAfterBowl :hello everyone` +2. Extracts nick + body, sends `BridgeEvent::ChatMessage { source: Irc, username: "somenick", body: "hello everyone" }` to router +3. Router calls Owncast API: `POST /api/integrations/chat/send` with body `{"body": "[IRC] hello everyone"}` + +### Owncast → IRC + +1. Webhook receives POST with `{ "type": "CHAT", "eventData": { "user": { "displayName": "viewer42" }, "body": "hey chat" } }` +2. Strips HTML (Owncast sends emoji as `` tags), extracts display name + raw text +3. Sends `BridgeEvent::ChatMessage { source: Owncast, ... }` to router +4. Router sends to IRC: `PRIVMSG #BowlAfterBowl :[OC] hey chat` + +### Stream announcements (Owncast → IRC) + +- `STREAM_STARTED` → `PRIVMSG #BowlAfterBowl :Stream started: — https://owncast.bowlafterbowl.com` +- `STREAM_STOPPED` → `PRIVMSG #BowlAfterBowl :Stream ended.` + +### Echo suppression + +The bridge's own messages sent via the Owncast API come back through webhook/WS. The router keeps a short-lived set of recently sent message bodies and uses the Owncast `user.isBot` field or known bot display name to suppress echoes. + +### Deduplication (webhook + WS both active) + +The router tracks seen Owncast message IDs in a bounded `HashSet` with TTL, dropping duplicates. + +## 3. Configuration + +TOML config file with environment variable overrides for secrets. + +```toml +[irc] +server = "irc.zeronode.net" +port = 6667 +tls = false +nick = "owncast-bridge" +channel = "#BowlAfterBowl" + +[owncast] +url = "https://owncast.bowlafterbowl.com" +# access_token loaded from OWNCAST_ACCESS_TOKEN env var +webhook_port = 9078 +websocket_enabled = true +health_poll_interval_secs = 30 + +[bridge] +irc_prefix = "[IRC]" +owncast_prefix = "[OC]" +message_buffer_size = 0 # 0 = drop messages when Owncast unavailable + +[control] +socket_path = "/tmp/owncast-irc-bridge.sock" +``` + +The access token is never stored in the config file. + +## 4. Error Handling & Reconnection + +- **IRC**: Exponential backoff reconnect loop (1s → 2s → 4s → ... capped at 60s). Transient send failures logged and retried once; persistent failures trigger reconnect. +- **Webhook HTTP server**: Bind failure exits the process. Individual request parse failures return 400 and log a warning. +- **WebSocket**: Same exponential backoff reconnect. If optional and failing repeatedly, bridge continues on webhooks alone. +- **Owncast API sends**: Failed POSTs logged. No retry on 4xx. Single retry with 1s delay on 5xx/network errors. +- **Logging**: `tracing` with structured JSON output. Level configurable via `RUST_LOG`. + +## 5. Owncast Lifecycle Handling + +### Three states + +```rust +enum OwncastState { + Online, // Stream active, chat available + OfflineChatOpen, // Stream offline, chat still accepting messages + Unavailable, // Chat unreachable or disabled +} +``` + +### State detection + +1. **Webhook signals** — `STREAM_STARTED` → `Online`, `STREAM_STOPPED` → probe chat availability. +2. **Health polling** — Background task polls `GET /api/status` at a configurable interval (default 30s). This is the ground truth. +3. **API response codes** — `POST /api/integrations/chat/send` returning 400/503 marks chat as `Unavailable`. +4. **WebSocket disconnects** — Check health endpoint before deciding state. + +### Behavior per state + +| State | IRC → Owncast | Owncast → IRC | IRC notification | +|---|---|---|---| +| `Online` | Relay | Relay | (stream start already announced) | +| `OfflineChatOpen` | Relay | Relay | None | +| `Unavailable` | Buffer or drop (configurable) | No messages arriving | Single notice: "Owncast chat is currently unavailable" | + +### Startup + +1. Hit `GET /api/status` to determine initial state. +2. Connect to IRC regardless. +3. Start webhook listener regardless. +4. Only attempt WS connection if status shows chat is available. +5. Post current stream status to IRC once connected. + +IRC is the anchor — always stays up. Owncast is the side that comes and goes. + +## 6. Runtime Control + +### Unix socket control interface + +The bridge listens on a Unix domain socket for line-based text commands. + +| Command | Effect | +|---|---| +| `irc connect` | Initiate IRC connection (if disconnected) | +| `irc disconnect` | Gracefully QUIT from IRC | +| `irc reconnect` | Disconnect then connect | +| `owncast connect` | Connect WS + start health polling + resume API sends | +| `owncast disconnect` | Drop WS, stop polling, stop sends | +| `owncast reconnect` | Disconnect then connect | +| `status` | Returns JSON with state of both sides | +| `quit` | Graceful shutdown | + +Internal type: + +```rust +enum ControlCommand { + IrcConnect, + IrcDisconnect, + IrcReconnect, + OwncastConnect, + OwncastDisconnect, + OwncastReconnect, + Status { reply: oneshot::Sender<BridgeStatus> }, + Quit, +} +``` + +### `bridge-ctl` CLI + +Separate binary in the same Cargo workspace using `clap`: + +```bash +bridge-ctl status +bridge-ctl irc connect|disconnect|reconnect +bridge-ctl owncast connect|disconnect|reconnect +bridge-ctl quit +bridge-ctl --socket /var/run/bridge.sock status +``` + +Connects to the Unix socket, sends command, reads response, pretty-prints, exits. + +### Signal handling + +- `SIGHUP` → reconnect both sides +- `SIGTERM` / `SIGINT` → graceful quit + +## 7. Project Structure + +``` +owncast-irc-bridge/ +├── Cargo.toml # workspace root +├── config.example.toml +├── Dockerfile +├── src/ +│ ├── main.rs # bridge daemon entry point +│ ├── config.rs # TOML + env var loading +│ ├── events.rs # BridgeEvent, Source, OwncastState enums +│ ├── router.rs # central routing, dedup, echo suppression +│ ├── irc_task.rs # IRC connection, send/recv +│ ├── webhook.rs # axum HTTP server for Owncast webhooks +│ ├── websocket.rs # optional Owncast WS client +│ ├── owncast_api.rs # reqwest client for sending to Owncast +│ ├── health.rs # Owncast /api/status poller +│ ├── control.rs # Unix socket listener, ControlCommand handling +│ └── html.rs # strip HTML/emoji img tags from Owncast messages +├── src/bin/ +│ └── bridge_ctl.rs # CLI tool +└── tests/ + └── integration.rs +``` + +### Key dependencies + +| Crate | Purpose | +|---|---| +| `tokio` | Async runtime | +| `axum` | Webhook HTTP server | +| `irc` | IRC protocol client | +| `tokio-tungstenite` | Owncast WebSocket client | +| `reqwest` | HTTP client for Owncast API + health checks | +| `serde` / `toml` | Config deserialization | +| `tracing` / `tracing-subscriber` | Structured logging | +| `clap` | CLI argument parsing (bridge-ctl) | + +### Dockerfile + +Multi-stage build: `rust:slim` for compilation, `debian:bookworm-slim` for runtime. Copies both binaries into the final image. diff --git a/docs/plans/2026-03-10-owncast-irc-bridge-impl.md b/docs/plans/2026-03-10-owncast-irc-bridge-impl.md new file mode 100644 index 0000000..20bc12b --- /dev/null +++ b/docs/plans/2026-03-10-owncast-irc-bridge-impl.md @@ -0,0 +1,2058 @@ +# Owncast–IRC Bridge Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Build a bidirectional Rust chat bridge between Owncast (`https://owncast.bowlafterbowl.com`) and IRC (`irc.zeronode.net` / `#BowlAfterBowl`). + +**Architecture:** Single tokio async binary with concurrent tasks (IRC, Webhook, WebSocket, Health Poller, Router, Control Socket) communicating via mpsc channels. A separate `bridge-ctl` CLI binary talks to the daemon over a Unix socket. + +**Tech Stack:** Rust, tokio, axum, irc crate, tokio-tungstenite, reqwest, serde/toml, tracing, clap + +**Design doc:** `docs/plans/2026-03-10-owncast-irc-bridge-design.md` + +--- + +### Task 1: Project Scaffolding + +**Files:** +- Create: `Cargo.toml` +- Create: `src/main.rs` +- Create: `src/bin/bridge_ctl.rs` +- Create: `config.example.toml` +- Create: `.gitignore` + +**Step 1: Initialize Cargo project** + +Run: +```bash +cargo init --name owncast-irc-bridge +``` + +**Step 2: Set up Cargo.toml with all dependencies** + +Replace `Cargo.toml` with: + +```toml +[package] +name = "owncast-irc-bridge" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "owncast-irc-bridge" +path = "src/main.rs" + +[[bin]] +name = "bridge-ctl" +path = "src/bin/bridge_ctl.rs" + +[dependencies] +tokio = { version = "1", features = ["full"] } +axum = "0.8" +irc = "1" +tokio-tungstenite = { version = "0.26", features = ["native-tls"] } +reqwest = { version = "0.12", features = ["json"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.8" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["json", "env-filter"] } +clap = { version = "4", features = ["derive"] } +thiserror = "2" +anyhow = "1" +futures-util = "0.3" + +[dev-dependencies] +tokio-test = "0.4" +``` + +**Step 3: Create `.gitignore`** + +```gitignore +/target +.env +config.toml +``` + +**Step 4: Create `config.example.toml`** + +```toml +[irc] +server = "irc.zeronode.net" +port = 6667 +tls = false +nick = "owncast-bridge" +channel = "#BowlAfterBowl" + +[owncast] +url = "https://owncast.bowlafterbowl.com" +# Set OWNCAST_ACCESS_TOKEN env var for the token +webhook_port = 9078 +websocket_enabled = true +health_poll_interval_secs = 30 + +[bridge] +irc_prefix = "[IRC]" +owncast_prefix = "[OC]" +message_buffer_size = 0 + +[control] +socket_path = "/tmp/owncast-irc-bridge.sock" +``` + +**Step 5: Create placeholder `src/main.rs`** + +```rust +fn main() { + println!("owncast-irc-bridge"); +} +``` + +**Step 6: Create placeholder `src/bin/bridge_ctl.rs`** + +```rust +fn main() { + println!("bridge-ctl"); +} +``` + +**Step 7: Verify it compiles** + +Run: `cargo check` +Expected: compiles with no errors (warnings about unused deps are fine) + +**Step 8: Commit** + +```bash +git init +git add -A +git commit -m "feat: scaffold project with dependencies and config" +``` + +--- + +### Task 2: Config Module + +**Files:** +- Create: `src/config.rs` +- Modify: `src/main.rs` (add `mod config;`) + +**Step 1: Write tests for config loading** + +At the bottom of `src/config.rs`: + +```rust +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_minimal_config() { + let toml_str = r#" +[irc] +server = "irc.example.com" +channel = "#test" + +[owncast] +url = "https://owncast.example.com" +"#; + let config: BridgeConfig = toml::from_str(toml_str).unwrap(); + assert_eq!(config.irc.server, "irc.example.com"); + assert_eq!(config.irc.port, 6667); + assert_eq!(config.irc.tls, false); + assert_eq!(config.irc.nick, "owncast-bridge"); + assert_eq!(config.irc.channel, "#test"); + assert_eq!(config.owncast.url, "https://owncast.example.com"); + assert_eq!(config.owncast.webhook_port, 9078); + assert_eq!(config.owncast.websocket_enabled, false); + assert_eq!(config.owncast.health_poll_interval_secs, 30); + assert_eq!(config.bridge.irc_prefix, "[IRC]"); + assert_eq!(config.bridge.owncast_prefix, "[OC]"); + assert_eq!(config.bridge.message_buffer_size, 0); + assert_eq!(config.control.socket_path, "/tmp/owncast-irc-bridge.sock"); + } + + #[test] + fn test_parse_full_config() { + let toml_str = r#" +[irc] +server = "irc.example.com" +port = 6697 +tls = true +nick = "mybot" +channel = "#mychan" + +[owncast] +url = "https://oc.example.com" +webhook_port = 8888 +websocket_enabled = true +health_poll_interval_secs = 10 + +[bridge] +irc_prefix = "<IRC>" +owncast_prefix = "<OC>" +message_buffer_size = 50 + +[control] +socket_path = "/var/run/bridge.sock" +"#; + let config: BridgeConfig = toml::from_str(toml_str).unwrap(); + assert_eq!(config.irc.port, 6697); + assert!(config.irc.tls); + assert_eq!(config.irc.nick, "mybot"); + assert_eq!(config.owncast.webhook_port, 8888); + assert!(config.owncast.websocket_enabled); + assert_eq!(config.bridge.message_buffer_size, 50); + assert_eq!(config.control.socket_path, "/var/run/bridge.sock"); + } + + #[test] + fn test_access_token_from_env() { + std::env::set_var("OWNCAST_ACCESS_TOKEN", "test-token-123"); + let config = BridgeConfig::default_for_test(); + let token = config.owncast_access_token(); + assert_eq!(token.unwrap(), "test-token-123"); + std::env::remove_var("OWNCAST_ACCESS_TOKEN"); + } +} +``` + +**Step 2: Run tests to verify they fail** + +Run: `cargo test --lib config` +Expected: FAIL — `BridgeConfig` not defined + +**Step 3: Implement config structs** + +Write `src/config.rs`: + +```rust +use std::path::Path; + +use serde::Deserialize; + +#[derive(Debug, Deserialize)] +pub struct BridgeConfig { + pub irc: IrcConfig, + pub owncast: OwncastConfig, + #[serde(default)] + pub bridge: BridgeSettings, + #[serde(default)] + pub control: ControlConfig, +} + +#[derive(Debug, Deserialize)] +pub struct IrcConfig { + pub server: String, + #[serde(default = "default_irc_port")] + pub port: u16, + #[serde(default)] + pub tls: bool, + #[serde(default = "default_nick")] + pub nick: String, + pub channel: String, +} + +#[derive(Debug, Deserialize)] +pub struct OwncastConfig { + pub url: String, + #[serde(default = "default_webhook_port")] + pub webhook_port: u16, + #[serde(default)] + pub websocket_enabled: bool, + #[serde(default = "default_health_poll_interval")] + pub health_poll_interval_secs: u64, +} + +#[derive(Debug, Deserialize)] +pub struct BridgeSettings { + #[serde(default = "default_irc_prefix")] + pub irc_prefix: String, + #[serde(default = "default_owncast_prefix")] + pub owncast_prefix: String, + #[serde(default)] + pub message_buffer_size: usize, +} + +#[derive(Debug, Deserialize)] +pub struct ControlConfig { + #[serde(default = "default_socket_path")] + pub socket_path: String, +} + +impl BridgeConfig { + pub fn load(path: &Path) -> anyhow::Result<Self> { + let contents = std::fs::read_to_string(path)?; + let config: BridgeConfig = toml::from_str(&contents)?; + Ok(config) + } + + pub fn owncast_access_token(&self) -> anyhow::Result<String> { + std::env::var("OWNCAST_ACCESS_TOKEN") + .map_err(|_| anyhow::anyhow!("OWNCAST_ACCESS_TOKEN env var not set")) + } +} + +fn default_irc_port() -> u16 { 6667 } +fn default_nick() -> String { "owncast-bridge".to_string() } +fn default_webhook_port() -> u16 { 9078 } +fn default_health_poll_interval() -> u64 { 30 } +fn default_irc_prefix() -> String { "[IRC]".to_string() } +fn default_owncast_prefix() -> String { "[OC]".to_string() } +fn default_socket_path() -> String { "/tmp/owncast-irc-bridge.sock".to_string() } + +impl Default for BridgeSettings { + fn default() -> Self { + Self { + irc_prefix: default_irc_prefix(), + owncast_prefix: default_owncast_prefix(), + message_buffer_size: 0, + } + } +} + +impl Default for ControlConfig { + fn default() -> Self { + Self { socket_path: default_socket_path() } + } +} + +#[cfg(test)] +impl BridgeConfig { + pub fn default_for_test() -> Self { + Self { + irc: IrcConfig { + server: "localhost".to_string(), + port: 6667, + tls: false, + nick: "test-bot".to_string(), + channel: "#test".to_string(), + }, + owncast: OwncastConfig { + url: "http://localhost:8080".to_string(), + webhook_port: 9078, + websocket_enabled: false, + health_poll_interval_secs: 30, + }, + bridge: BridgeSettings::default(), + control: ControlConfig::default(), + } + } +} +``` + +**Step 4: Add module to main.rs** + +Add `mod config;` to `src/main.rs`. + +**Step 5: Run tests to verify they pass** + +Run: `cargo test --lib config` +Expected: 3 tests PASS + +**Step 6: Commit** + +```bash +git add -A +git commit -m "feat: add config module with TOML parsing and env var support" +``` + +--- + +### Task 3: Events Module (Core Types) + +**Files:** +- Create: `src/events.rs` +- Modify: `src/main.rs` (add `mod events;`) + +**Step 1: Write `src/events.rs`** + +```rust +use tokio::sync::oneshot; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum Source { + Irc, + Owncast, +} + +#[derive(Debug, Clone)] +pub enum BridgeEvent { + ChatMessage { + source: Source, + username: String, + body: String, + id: Option<String>, + }, + StreamStarted { + title: String, + }, + StreamStopped, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum OwncastState { + Online, + OfflineChatOpen, + Unavailable, +} + +#[derive(Debug)] +pub enum ControlCommand { + IrcConnect, + IrcDisconnect, + IrcReconnect, + OwncastConnect, + OwncastDisconnect, + OwncastReconnect, + Status { + reply: oneshot::Sender<BridgeStatus>, + }, + Quit, +} + +#[derive(Debug, Clone, serde::Serialize)] +pub struct BridgeStatus { + pub irc_connected: bool, + pub owncast_state: String, + pub webhook_listening: bool, + pub websocket_connected: bool, + pub uptime_secs: u64, +} +``` + +**Step 2: Add module to `src/main.rs`** + +Add `mod events;`. + +**Step 3: Verify it compiles** + +Run: `cargo check` +Expected: compiles + +**Step 4: Commit** + +```bash +git add -A +git commit -m "feat: add events module with BridgeEvent, ControlCommand, OwncastState types" +``` + +--- + +### Task 4: HTML Stripping Utility + +**Files:** +- Create: `src/html.rs` +- Modify: `src/main.rs` (add `mod html;`) + +**Step 1: Write tests** + +At the bottom of `src/html.rs`: + +```rust +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_plain_text_unchanged() { + assert_eq!(strip_html("hello world"), "hello world"); + } + + #[test] + fn test_strips_basic_tags() { + assert_eq!(strip_html("<b>bold</b> text"), "bold text"); + } + + #[test] + fn test_emoji_img_to_alt_text() { + let input = r#"hello <img class="emoji" alt=":beerparrot:" title=":beerparrot:" src="/img/emoji/beerparrot.gif"> world"#; + assert_eq!(strip_html(input), "hello :beerparrot: world"); + } + + #[test] + fn test_multiple_emoji() { + let input = r#"<img class="emoji" alt=":a:" src="/a.gif"><img class="emoji" alt=":b:" src="/b.gif">"#; + assert_eq!(strip_html(input), ":a::b:"); + } + + #[test] + fn test_strips_links() { + let input = r#"check <a href="https://example.com">this link</a>"#; + assert_eq!(strip_html(input), "check this link"); + } + + #[test] + fn test_decodes_html_entities() { + assert_eq!(strip_html("a & b < c"), "a & b < c"); + } +} +``` + +**Step 2: Run tests to verify they fail** + +Run: `cargo test --lib html` +Expected: FAIL + +**Step 3: Implement `strip_html`** + +```rust +use std::borrow::Cow; + +/// Extracts alt text from <img> tags (for Owncast emoji) and strips all other HTML. +pub fn strip_html(input: &str) -> String { + let mut result = String::with_capacity(input.len()); + let mut chars = input.chars().peekable(); + + while let Some(&ch) = chars.peek() { + if ch == '<' { + let tag: String = chars.by_ref().take_while(|&c| c != '>').collect(); + if tag.starts_with("img ") || tag.starts_with("img\t") { + if let Some(alt) = extract_attr(&tag, "alt") { + result.push_str(&alt); + } + } + } else if ch == '&' { + let entity: String = std::iter::once(ch) + .chain(chars.by_ref().take_while(|&c| c != ';')) + .collect(); + result.push_str(&decode_entity(&entity)); + } else { + result.push(ch); + chars.next(); + } + } + + result +} + +fn extract_attr(tag: &str, attr_name: &str) -> Option<String> { + let pattern = format!("{}=\"", attr_name); + let start = tag.find(&pattern)? + pattern.len(); + let rest = &tag[start..]; + let end = rest.find('"')?; + Some(rest[..end].to_string()) +} + +fn decode_entity(entity: &str) -> Cow<'static, str> { + match entity { + "&" => Cow::Borrowed("&"), + "<" => Cow::Borrowed("<"), + ">" => Cow::Borrowed(">"), + """ => Cow::Borrowed("\""), + "'" | "&apos" => Cow::Borrowed("'"), + " " => Cow::Borrowed(" "), + other => Cow::Owned(other.to_string()), + } +} +``` + +**Step 4: Run tests** + +Run: `cargo test --lib html` +Expected: all PASS + +**Step 5: Commit** + +```bash +git add -A +git commit -m "feat: add HTML stripping utility for Owncast emoji and markup" +``` + +--- + +### Task 5: Owncast API Sender + +**Files:** +- Create: `src/owncast_api.rs` +- Modify: `src/main.rs` (add `mod owncast_api;`) + +**Step 1: Implement the Owncast API client** + +```rust +use reqwest::Client; +use tracing::{error, warn}; + +pub struct OwncastApiClient { + client: Client, + base_url: String, + access_token: String, +} + +impl OwncastApiClient { + pub fn new(base_url: String, access_token: String) -> Self { + Self { + client: Client::new(), + base_url: base_url.trim_end_matches('/').to_string(), + access_token, + } + } + + pub async fn send_chat_message(&self, body: &str) -> anyhow::Result<()> { + let url = format!("{}/api/integrations/chat/send", self.base_url); + let resp = self + .client + .post(&url) + .bearer_auth(&self.access_token) + .json(&serde_json::json!({ "body": body })) + .send() + .await?; + + let status = resp.status(); + if status.is_success() { + return Ok(()); + } + + let resp_body = resp.text().await.unwrap_or_default(); + if status.is_client_error() { + error!(status = %status, body = %resp_body, "Owncast API client error (not retrying)"); + anyhow::bail!("Owncast API returned {status}"); + } + + warn!(status = %status, body = %resp_body, "Owncast API server error, retrying once"); + tokio::time::sleep(std::time::Duration::from_secs(1)).await; + + let retry_resp = self + .client + .post(&url) + .bearer_auth(&self.access_token) + .json(&serde_json::json!({ "body": body })) + .send() + .await?; + + if retry_resp.status().is_success() { + Ok(()) + } else { + let retry_body = retry_resp.text().await.unwrap_or_default(); + error!(status = %retry_resp.status(), body = %retry_body, "Owncast API retry failed"); + anyhow::bail!("Owncast API retry returned {}", retry_resp.status()) + } + } + + pub async fn get_status(&self) -> anyhow::Result<OwncastStatus> { + let url = format!("{}/api/status", self.base_url); + let resp = self.client.get(&url).send().await?; + let status: OwncastStatus = resp.json().await?; + Ok(status) + } +} + +#[derive(Debug, serde::Deserialize)] +pub struct OwncastStatus { + pub online: bool, + #[serde(default)] + #[serde(rename = "streamTitle")] + pub stream_title: Option<String>, + #[serde(default)] + #[serde(rename = "viewerCount")] + pub viewer_count: Option<u64>, +} +``` + +**Step 2: Add module and verify compilation** + +Run: `cargo check` +Expected: compiles + +**Step 3: Commit** + +```bash +git add -A +git commit -m "feat: add Owncast API client for sending messages and checking status" +``` + +--- + +### Task 6: Health Poller + +**Files:** +- Create: `src/health.rs` +- Modify: `src/main.rs` (add `mod health;`) + +**Step 1: Implement health poller** + +```rust +use std::time::Duration; + +use tokio::sync::mpsc; +use tracing::{info, warn}; + +use crate::events::OwncastState; +use crate::owncast_api::OwncastApiClient; + +pub async fn run_health_poller( + api_client: &OwncastApiClient, + state_tx: mpsc::Sender<OwncastState>, + interval: Duration, + mut shutdown: tokio::sync::watch::Receiver<bool>, +) { + let mut current_state = OwncastState::Unavailable; + + loop { + tokio::select! { + _ = tokio::time::sleep(interval) => {}, + _ = shutdown.changed() => { + info!("Health poller shutting down"); + return; + } + } + + let new_state = match api_client.get_status().await { + Ok(status) => { + if status.online { + OwncastState::Online + } else { + OwncastState::OfflineChatOpen + } + } + Err(e) => { + warn!(error = %e, "Failed to poll Owncast status"); + OwncastState::Unavailable + } + }; + + if new_state != current_state { + info!(old = ?current_state, new = ?new_state, "Owncast state changed"); + current_state = new_state.clone(); + if state_tx.send(new_state).await.is_err() { + return; + } + } + } +} +``` + +**Step 2: Add module and verify compilation** + +Run: `cargo check` +Expected: compiles + +**Step 3: Commit** + +```bash +git add -A +git commit -m "feat: add Owncast health poller with state change detection" +``` + +--- + +### Task 7: Webhook HTTP Server + +**Files:** +- Create: `src/webhook.rs` +- Modify: `src/main.rs` (add `mod webhook;`) + +**Step 1: Write tests for webhook payload parsing** + +At the bottom of `src/webhook.rs`: + +```rust +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_chat_event() { + let json = serde_json::json!({ + "type": "CHAT", + "eventData": { + "user": { "displayName": "viewer42", "isBot": false }, + "body": "hello <b>world</b>", + "id": "abc123", + "visible": true + } + }); + let payload: WebhookPayload = serde_json::from_value(json).unwrap(); + let event = payload.into_bridge_event(); + assert!(event.is_some()); + if let Some(BridgeEvent::ChatMessage { source, username, body, id }) = event { + assert_eq!(source, Source::Owncast); + assert_eq!(username, "viewer42"); + assert_eq!(body, "hello world"); + assert_eq!(id, Some("abc123".to_string())); + } else { + panic!("Expected ChatMessage"); + } + } + + #[test] + fn test_parse_stream_started() { + let json = serde_json::json!({ + "type": "STREAM_STARTED", + "eventData": { + "id": "x", + "name": "Test", + "streamTitle": "Friday bowls", + "summary": "", + "timestamp": "2026-01-01T00:00:00Z" + } + }); + let payload: WebhookPayload = serde_json::from_value(json).unwrap(); + let event = payload.into_bridge_event(); + assert!(matches!(event, Some(BridgeEvent::StreamStarted { title }) if title == "Friday bowls")); + } + + #[test] + fn test_parse_stream_stopped() { + let json = serde_json::json!({ + "type": "STREAM_STOPPED", + "eventData": { + "id": "x", + "name": "Test", + "streamTitle": "", + "summary": "", + "timestamp": "2026-01-01T00:00:00Z" + } + }); + let payload: WebhookPayload = serde_json::from_value(json).unwrap(); + let event = payload.into_bridge_event(); + assert!(matches!(event, Some(BridgeEvent::StreamStopped))); + } + + #[test] + fn test_ignores_bot_messages() { + let json = serde_json::json!({ + "type": "CHAT", + "eventData": { + "user": { "displayName": "bot", "isBot": true }, + "body": "automated message", + "id": "x", + "visible": true + } + }); + let payload: WebhookPayload = serde_json::from_value(json).unwrap(); + let event = payload.into_bridge_event(); + assert!(event.is_none()); + } + + #[test] + fn test_ignores_unknown_event_type() { + let json = serde_json::json!({ + "type": "USER_JOINED", + "eventData": { "id": "x" } + }); + let payload: WebhookPayload = serde_json::from_value(json).unwrap(); + let event = payload.into_bridge_event(); + assert!(event.is_none()); + } +} +``` + +**Step 2: Run tests to verify they fail** + +Run: `cargo test --lib webhook` +Expected: FAIL + +**Step 3: Implement webhook server** + +```rust +use axum::{extract::State, http::StatusCode, routing::post, Json, Router}; +use serde::Deserialize; +use tokio::sync::mpsc; +use tracing::{info, warn}; + +use crate::events::{BridgeEvent, Source}; +use crate::html::strip_html; + +#[derive(Debug, Deserialize)] +pub struct WebhookPayload { + #[serde(rename = "type")] + pub event_type: String, + #[serde(rename = "eventData")] + pub event_data: serde_json::Value, +} + +#[derive(Debug, Deserialize)] +struct ChatEventData { + user: ChatUser, + body: String, + id: String, + #[serde(default = "default_visible")] + visible: bool, +} + +fn default_visible() -> bool { true } + +#[derive(Debug, Deserialize)] +struct ChatUser { + #[serde(rename = "displayName")] + display_name: String, + #[serde(default, rename = "isBot")] + is_bot: bool, +} + +#[derive(Debug, Deserialize)] +struct StreamEventData { + #[serde(default, rename = "streamTitle")] + stream_title: Option<String>, +} + +impl WebhookPayload { + pub fn into_bridge_event(self) -> Option<BridgeEvent> { + match self.event_type.as_str() { + "CHAT" => { + let data: ChatEventData = serde_json::from_value(self.event_data).ok()?; + if data.user.is_bot || !data.visible { + return None; + } + Some(BridgeEvent::ChatMessage { + source: Source::Owncast, + username: data.user.display_name, + body: strip_html(&data.body), + id: Some(data.id), + }) + } + "STREAM_STARTED" => { + let data: StreamEventData = serde_json::from_value(self.event_data).ok()?; + Some(BridgeEvent::StreamStarted { + title: data.stream_title.unwrap_or_default(), + }) + } + "STREAM_STOPPED" => Some(BridgeEvent::StreamStopped), + _ => None, + } + } +} + +#[derive(Clone)] +struct WebhookState { + event_tx: mpsc::Sender<BridgeEvent>, +} + +async fn handle_webhook( + State(state): State<WebhookState>, + Json(payload): Json<WebhookPayload>, +) -> StatusCode { + info!(event_type = %payload.event_type, "Received webhook"); + + match payload.into_bridge_event() { + Some(event) => { + if state.event_tx.send(event).await.is_err() { + warn!("Router channel closed"); + return StatusCode::INTERNAL_SERVER_ERROR; + } + StatusCode::OK + } + None => StatusCode::OK, + } +} + +pub async fn run_webhook_server( + port: u16, + event_tx: mpsc::Sender<BridgeEvent>, +) -> anyhow::Result<()> { + let state = WebhookState { event_tx }; + let app = Router::new() + .route("/webhook", post(handle_webhook)) + .with_state(state); + + let addr = std::net::SocketAddr::from(([0, 0, 0, 0], port)); + info!(%addr, "Starting webhook server"); + + let listener = tokio::net::TcpListener::bind(addr).await?; + axum::serve(listener, app).await?; + Ok(()) +} +``` + +**Step 4: Run tests** + +Run: `cargo test --lib webhook` +Expected: all PASS + +**Step 5: Commit** + +```bash +git add -A +git commit -m "feat: add webhook server with payload parsing and chat/stream event handling" +``` + +--- + +### Task 8: IRC Task + +**Files:** +- Create: `src/irc_task.rs` +- Modify: `src/main.rs` (add `mod irc_task;`) + +**Step 1: Implement IRC task** + +```rust +use std::time::Duration; + +use futures_util::StreamExt; +use irc::client::prelude::*; +use tokio::sync::mpsc; +use tracing::{error, info, warn}; + +use crate::config::IrcConfig; +use crate::events::{BridgeEvent, Source}; + +pub async fn run_irc_task( + config: IrcConfig, + event_tx: mpsc::Sender<BridgeEvent>, + mut outbound_rx: mpsc::Receiver<String>, + mut shutdown: tokio::sync::watch::Receiver<bool>, +) { + let mut backoff = Duration::from_secs(1); + let max_backoff = Duration::from_secs(60); + + loop { + info!(server = %config.server, channel = %config.channel, "Connecting to IRC"); + + match connect_and_run(&config, &event_tx, &mut outbound_rx, &mut shutdown).await { + Ok(()) => { + info!("IRC task exiting cleanly"); + return; + } + Err(e) => { + error!(error = %e, "IRC connection error"); + info!(backoff_secs = backoff.as_secs(), "Reconnecting after backoff"); + + tokio::select! { + _ = tokio::time::sleep(backoff) => {}, + _ = shutdown.changed() => return, + } + + backoff = (backoff * 2).min(max_backoff); + } + } + } +} + +async fn connect_and_run( + config: &IrcConfig, + event_tx: &mpsc::Sender<BridgeEvent>, + outbound_rx: &mut mpsc::Receiver<String>, + shutdown: &mut tokio::sync::watch::Receiver<bool>, +) -> anyhow::Result<()> { + let irc_config = Config { + nickname: Some(config.nick.clone()), + server: Some(config.server.clone()), + port: Some(config.port), + use_tls: Some(config.tls), + channels: vec![config.channel.clone()], + ..Config::default() + }; + + let mut client = Client::from_config(irc_config).await?; + client.identify()?; + + let mut stream = client.stream()?; + let sender = client.sender(); + + info!("IRC connected, waiting for messages"); + + loop { + tokio::select! { + msg = stream.next() => { + match msg { + Some(Ok(message)) => { + if let Command::PRIVMSG(ref target, ref text) = message.command { + if target == &config.channel { + let nick = message.source_nickname().unwrap_or("unknown").to_string(); + let event = BridgeEvent::ChatMessage { + source: Source::Irc, + username: nick, + body: text.clone(), + id: None, + }; + if event_tx.send(event).await.is_err() { + return Ok(()); + } + } + } + } + Some(Err(e)) => return Err(e.into()), + None => return Err(anyhow::anyhow!("IRC stream ended")), + } + } + Some(text) = outbound_rx.recv() => { + sender.send_privmsg(&config.channel, &text)?; + } + _ = shutdown.changed() => { + let _ = sender.send_quit("Bridge shutting down"); + return Ok(()); + } + } + } +} +``` + +**Step 2: Add module and verify compilation** + +Run: `cargo check` +Expected: compiles + +**Step 3: Commit** + +```bash +git add -A +git commit -m "feat: add IRC task with auto-reconnect and backoff" +``` + +--- + +### Task 9: WebSocket Task + +**Files:** +- Create: `src/websocket.rs` +- Modify: `src/main.rs` (add `mod websocket;`) + +**Step 1: Implement WebSocket task** + +```rust +use std::time::Duration; + +use futures_util::{SinkExt, StreamExt}; +use tokio::sync::mpsc; +use tokio_tungstenite::connect_async; +use tracing::{error, info, warn}; + +use crate::events::{BridgeEvent, Source}; +use crate::html::strip_html; + +pub async fn run_websocket_task( + owncast_url: String, + event_tx: mpsc::Sender<BridgeEvent>, + mut shutdown: tokio::sync::watch::Receiver<bool>, +) { + let mut backoff = Duration::from_secs(1); + let max_backoff = Duration::from_secs(60); + + loop { + let ws_url = build_ws_url(&owncast_url); + info!(url = %ws_url, "Connecting to Owncast WebSocket"); + + match connect_and_listen(&ws_url, &event_tx, &mut shutdown).await { + Ok(()) => { + info!("WebSocket task exiting cleanly"); + return; + } + Err(e) => { + warn!(error = %e, "WebSocket connection error"); + info!(backoff_secs = backoff.as_secs(), "Reconnecting after backoff"); + + tokio::select! { + _ = tokio::time::sleep(backoff) => {}, + _ = shutdown.changed() => return, + } + + backoff = (backoff * 2).min(max_backoff); + } + } + } +} + +fn build_ws_url(base_url: &str) -> String { + let base = base_url.trim_end_matches('/'); + let ws_base = if base.starts_with("https://") { + base.replacen("https://", "wss://", 1) + } else { + base.replacen("http://", "ws://", 1) + }; + format!("{}/ws", ws_base) +} + +async fn connect_and_listen( + ws_url: &str, + event_tx: &mpsc::Sender<BridgeEvent>, + shutdown: &mut tokio::sync::watch::Receiver<bool>, +) -> anyhow::Result<()> { + let (ws_stream, _) = connect_async(ws_url).await?; + let (mut _write, mut read) = ws_stream.split(); + + info!("WebSocket connected"); + + loop { + tokio::select! { + msg = read.next() => { + match msg { + Some(Ok(ws_msg)) => { + if let Ok(text) = ws_msg.into_text() { + if let Some(event) = parse_ws_message(&text) { + if event_tx.send(event).await.is_err() { + return Ok(()); + } + } + } + } + Some(Err(e)) => return Err(e.into()), + None => return Err(anyhow::anyhow!("WebSocket stream ended")), + } + } + _ = shutdown.changed() => return Ok(()), + } + } +} + +fn parse_ws_message(text: &str) -> Option<BridgeEvent> { + let value: serde_json::Value = serde_json::from_str(text).ok()?; + let msg_type = value.get("type")?.as_str()?; + + match msg_type { + "CHAT" => { + let user = value.get("user")?; + let is_bot = user.get("isBot").and_then(|v| v.as_bool()).unwrap_or(false); + if is_bot { + return None; + } + let display_name = user.get("displayName")?.as_str()?.to_string(); + let body = value.get("body")?.as_str()?; + let id = value.get("id").and_then(|v| v.as_str()).map(String::from); + + Some(BridgeEvent::ChatMessage { + source: Source::Owncast, + username: display_name, + body: strip_html(body), + id, + }) + } + _ => None, + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_build_ws_url_https() { + assert_eq!( + build_ws_url("https://owncast.example.com"), + "wss://owncast.example.com/ws" + ); + } + + #[test] + fn test_build_ws_url_http() { + assert_eq!( + build_ws_url("http://localhost:8080"), + "ws://localhost:8080/ws" + ); + } + + #[test] + fn test_build_ws_url_trailing_slash() { + assert_eq!( + build_ws_url("https://owncast.example.com/"), + "wss://owncast.example.com/ws" + ); + } + + #[test] + fn test_parse_ws_chat_message() { + let json = r#"{"type":"CHAT","id":"abc","body":"hello","user":{"displayName":"viewer","isBot":false}}"#; + let event = parse_ws_message(json); + assert!(matches!( + event, + Some(BridgeEvent::ChatMessage { ref username, ref body, .. }) + if username == "viewer" && body == "hello" + )); + } + + #[test] + fn test_parse_ws_bot_message_ignored() { + let json = r#"{"type":"CHAT","id":"abc","body":"hello","user":{"displayName":"bot","isBot":true}}"#; + assert!(parse_ws_message(json).is_none()); + } +} +``` + +**Step 2: Add module and verify compilation** + +Run: `cargo check` +Expected: compiles + +**Step 3: Run tests** + +Run: `cargo test --lib websocket` +Expected: all PASS + +**Step 4: Commit** + +```bash +git add -A +git commit -m "feat: add WebSocket task for Owncast chat with reconnect" +``` + +--- + +### Task 10: Control Task & Unix Socket + +**Files:** +- Create: `src/control.rs` +- Modify: `src/main.rs` (add `mod control;`) + +**Step 1: Write tests for command parsing** + +At the bottom of `src/control.rs`: + +```rust +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_irc_commands() { + assert!(matches!(parse_command("irc connect"), Some(ParsedCommand::IrcConnect))); + assert!(matches!(parse_command("irc disconnect"), Some(ParsedCommand::IrcDisconnect))); + assert!(matches!(parse_command("irc reconnect"), Some(ParsedCommand::IrcReconnect))); + } + + #[test] + fn test_parse_owncast_commands() { + assert!(matches!(parse_command("owncast connect"), Some(ParsedCommand::OwncastConnect))); + assert!(matches!(parse_command("owncast disconnect"), Some(ParsedCommand::OwncastDisconnect))); + assert!(matches!(parse_command("owncast reconnect"), Some(ParsedCommand::OwncastReconnect))); + } + + #[test] + fn test_parse_status_and_quit() { + assert!(matches!(parse_command("status"), Some(ParsedCommand::Status))); + assert!(matches!(parse_command("quit"), Some(ParsedCommand::Quit))); + } + + #[test] + fn test_parse_unknown() { + assert!(parse_command("unknown command").is_none()); + assert!(parse_command("").is_none()); + } + + #[test] + fn test_parse_case_insensitive_trimmed() { + assert!(matches!(parse_command(" IRC CONNECT "), Some(ParsedCommand::IrcConnect))); + assert!(matches!(parse_command("QUIT\n"), Some(ParsedCommand::Quit))); + } +} +``` + +**Step 2: Run tests to verify they fail** + +Run: `cargo test --lib control` +Expected: FAIL + +**Step 3: Implement control socket listener** + +```rust +use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader}; +use tokio::net::UnixListener; +use tokio::sync::{mpsc, oneshot}; +use tracing::{error, info, warn}; + +use crate::events::{BridgeStatus, ControlCommand}; + +#[derive(Debug, PartialEq)] +enum ParsedCommand { + IrcConnect, + IrcDisconnect, + IrcReconnect, + OwncastConnect, + OwncastDisconnect, + OwncastReconnect, + Status, + Quit, +} + +fn parse_command(input: &str) -> Option<ParsedCommand> { + let trimmed = input.trim().to_lowercase(); + match trimmed.as_str() { + "irc connect" => Some(ParsedCommand::IrcConnect), + "irc disconnect" => Some(ParsedCommand::IrcDisconnect), + "irc reconnect" => Some(ParsedCommand::IrcReconnect), + "owncast connect" => Some(ParsedCommand::OwncastConnect), + "owncast disconnect" => Some(ParsedCommand::OwncastDisconnect), + "owncast reconnect" => Some(ParsedCommand::OwncastReconnect), + "status" => Some(ParsedCommand::Status), + "quit" => Some(ParsedCommand::Quit), + _ => None, + } +} + +pub async fn run_control_socket( + socket_path: &str, + control_tx: mpsc::Sender<ControlCommand>, +) -> anyhow::Result<()> { + let _ = std::fs::remove_file(socket_path); + let listener = UnixListener::bind(socket_path)?; + info!(path = %socket_path, "Control socket listening"); + + loop { + let (stream, _) = listener.accept().await?; + let control_tx = control_tx.clone(); + + tokio::spawn(async move { + let (reader, mut writer) = stream.into_split(); + let mut reader = BufReader::new(reader); + let mut line = String::new(); + + if reader.read_line(&mut line).await.is_err() { + return; + } + + match parse_command(&line) { + Some(ParsedCommand::Status) => { + let (reply_tx, reply_rx) = oneshot::channel(); + let cmd = ControlCommand::Status { reply: reply_tx }; + if control_tx.send(cmd).await.is_ok() { + if let Ok(status) = reply_rx.await { + let json = serde_json::to_string_pretty(&status).unwrap_or_default(); + let _ = writer.write_all(json.as_bytes()).await; + let _ = writer.write_all(b"\n").await; + } + } + } + Some(parsed) => { + let cmd = match parsed { + ParsedCommand::IrcConnect => ControlCommand::IrcConnect, + ParsedCommand::IrcDisconnect => ControlCommand::IrcDisconnect, + ParsedCommand::IrcReconnect => ControlCommand::IrcReconnect, + ParsedCommand::OwncastConnect => ControlCommand::OwncastConnect, + ParsedCommand::OwncastDisconnect => ControlCommand::OwncastDisconnect, + ParsedCommand::OwncastReconnect => ControlCommand::OwncastReconnect, + ParsedCommand::Quit => ControlCommand::Quit, + ParsedCommand::Status => unreachable!(), + }; + if control_tx.send(cmd).await.is_ok() { + let _ = writer.write_all(b"OK\n").await; + } else { + let _ = writer.write_all(b"ERROR: channel closed\n").await; + } + } + None => { + let _ = writer.write_all(b"ERROR: unknown command\n").await; + } + } + }); + } +} +``` + +**Step 4: Run tests** + +Run: `cargo test --lib control` +Expected: all PASS + +**Step 5: Commit** + +```bash +git add -A +git commit -m "feat: add Unix socket control interface with command parsing" +``` + +--- + +### Task 11: Router (Central Orchestration) + +**Files:** +- Create: `src/router.rs` +- Modify: `src/main.rs` (add `mod router;`) + +**Step 1: Write tests for echo suppression and dedup** + +At the bottom of `src/router.rs`: + +```rust +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_dedup_tracker_new_id() { + let mut tracker = DedupTracker::new(100); + assert!(!tracker.is_duplicate("msg-1")); + } + + #[test] + fn test_dedup_tracker_duplicate() { + let mut tracker = DedupTracker::new(100); + assert!(!tracker.is_duplicate("msg-1")); + assert!(tracker.is_duplicate("msg-1")); + } + + #[test] + fn test_dedup_tracker_evicts_old() { + let mut tracker = DedupTracker::new(2); + tracker.is_duplicate("a"); + tracker.is_duplicate("b"); + tracker.is_duplicate("c"); + assert!(!tracker.is_duplicate("a")); + } + + #[test] + fn test_echo_suppressor() { + let mut suppressor = EchoSuppressor::new(10); + suppressor.record_sent("hello from IRC"); + assert!(suppressor.is_echo("hello from IRC")); + assert!(!suppressor.is_echo("different message")); + } +} +``` + +**Step 2: Run tests to verify they fail** + +Run: `cargo test --lib router` +Expected: FAIL + +**Step 3: Implement router** + +```rust +use std::collections::{HashSet, VecDeque}; +use std::time::Instant; + +use tokio::sync::mpsc; +use tracing::{info, warn}; + +use crate::config::BridgeSettings; +use crate::events::{BridgeEvent, ControlCommand, OwncastState, Source}; +use crate::owncast_api::OwncastApiClient; + +pub struct DedupTracker { + seen: VecDeque<String>, + set: HashSet<String>, + capacity: usize, +} + +impl DedupTracker { + pub fn new(capacity: usize) -> Self { + Self { + seen: VecDeque::with_capacity(capacity), + set: HashSet::with_capacity(capacity), + capacity, + } + } + + pub fn is_duplicate(&mut self, id: &str) -> bool { + if self.set.contains(id) { + return true; + } + if self.seen.len() >= self.capacity { + if let Some(old) = self.seen.pop_front() { + self.set.remove(&old); + } + } + self.set.insert(id.to_string()); + self.seen.push_back(id.to_string()); + false + } +} + +pub struct EchoSuppressor { + recent: VecDeque<String>, + capacity: usize, +} + +impl EchoSuppressor { + pub fn new(capacity: usize) -> Self { + Self { + recent: VecDeque::with_capacity(capacity), + capacity, + } + } + + pub fn record_sent(&mut self, body: &str) { + if self.recent.len() >= self.capacity { + self.recent.pop_front(); + } + self.recent.push_back(body.to_string()); + } + + pub fn is_echo(&mut self, body: &str) -> bool { + if let Some(pos) = self.recent.iter().position(|s| s == body) { + self.recent.remove(pos); + true + } else { + false + } + } +} + +pub async fn run_router( + settings: BridgeSettings, + owncast_url: String, + api_client: OwncastApiClient, + mut event_rx: mpsc::Receiver<BridgeEvent>, + irc_outbound_tx: mpsc::Sender<String>, + mut state_rx: mpsc::Receiver<OwncastState>, + mut control_rx: mpsc::Receiver<ControlCommand>, + shutdown_tx: tokio::sync::watch::Sender<bool>, + start_time: Instant, +) { + let mut dedup = DedupTracker::new(500); + let mut echo_suppressor = EchoSuppressor::new(50); + let mut owncast_state = OwncastState::Unavailable; + + loop { + tokio::select! { + Some(event) = event_rx.recv() => { + handle_event( + event, + &settings, + &owncast_url, + &api_client, + &irc_outbound_tx, + &mut dedup, + &mut echo_suppressor, + &owncast_state, + ).await; + } + Some(new_state) = state_rx.recv() => { + if new_state != owncast_state { + handle_state_change(&new_state, &owncast_state, &irc_outbound_tx).await; + owncast_state = new_state; + } + } + Some(cmd) = control_rx.recv() => { + match cmd { + ControlCommand::Quit => { + info!("Quit command received, shutting down"); + let _ = shutdown_tx.send(true); + return; + } + ControlCommand::Status { reply } => { + let status = crate::events::BridgeStatus { + irc_connected: true, + owncast_state: format!("{:?}", owncast_state), + webhook_listening: true, + websocket_connected: false, + uptime_secs: start_time.elapsed().as_secs(), + }; + let _ = reply.send(status); + } + other => { + warn!(command = ?other, "Control command not yet implemented in router"); + } + } + } + else => break, + } + } +} + +async fn handle_event( + event: BridgeEvent, + settings: &BridgeSettings, + owncast_url: &str, + api_client: &OwncastApiClient, + irc_tx: &mpsc::Sender<String>, + dedup: &mut DedupTracker, + echo: &mut EchoSuppressor, + owncast_state: &OwncastState, +) { + match event { + BridgeEvent::ChatMessage { source, username, body, id } => { + if let Some(ref msg_id) = id { + if dedup.is_duplicate(msg_id) { + return; + } + } + + match source { + Source::Irc => { + if *owncast_state == OwncastState::Unavailable { + return; + } + let formatted = format!("{} <{}> {}", settings.irc_prefix, username, body); + echo.record_sent(&formatted); + if let Err(e) = api_client.send_chat_message(&formatted).await { + warn!(error = %e, "Failed to send to Owncast"); + } + } + Source::Owncast => { + let formatted = format!("{} <{}> {}", settings.owncast_prefix, username, body); + if echo.is_echo(&body) { + return; + } + if irc_tx.send(formatted).await.is_err() { + warn!("IRC outbound channel closed"); + } + } + } + } + BridgeEvent::StreamStarted { title } => { + let msg = if title.is_empty() { + format!("Stream started — {}", owncast_url) + } else { + format!("Stream started: {} — {}", title, owncast_url) + }; + let _ = irc_tx.send(msg).await; + } + BridgeEvent::StreamStopped => { + let _ = irc_tx.send("Stream ended.".to_string()).await; + } + } +} + +async fn handle_state_change( + new: &OwncastState, + _old: &OwncastState, + irc_tx: &mpsc::Sender<String>, +) { + match new { + OwncastState::Online => { + let _ = irc_tx.send("Owncast chat is now available.".to_string()).await; + } + OwncastState::Unavailable => { + let _ = irc_tx.send("Owncast chat is currently unavailable.".to_string()).await; + } + OwncastState::OfflineChatOpen => {} + } +} +``` + +**Step 4: Run tests** + +Run: `cargo test --lib router` +Expected: all PASS + +**Step 5: Commit** + +```bash +git add -A +git commit -m "feat: add router with dedup, echo suppression, and state handling" +``` + +--- + +### Task 12: Main Entry Point (Wire Everything Together) + +**Files:** +- Modify: `src/main.rs` + +**Step 1: Implement main** + +```rust +mod config; +mod control; +mod events; +mod health; +mod html; +mod irc_task; +mod owncast_api; +mod router; +mod webhook; +mod websocket; + +use std::path::PathBuf; +use std::time::Instant; + +use clap::Parser; +use tokio::sync::{mpsc, watch}; +use tracing::info; + +#[derive(Parser)] +#[command(name = "owncast-irc-bridge")] +#[command(about = "Bidirectional chat bridge between Owncast and IRC")] +struct Cli { + /// Path to config file + #[arg(short, long, default_value = "config.toml")] + config: PathBuf, +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + tracing_subscriber::fmt() + .with_env_filter( + tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")), + ) + .init(); + + let cli = Cli::parse(); + let config = config::BridgeConfig::load(&cli.config)?; + let access_token = config.owncast_access_token()?; + + info!("Starting owncast-irc-bridge"); + + let start_time = Instant::now(); + let (shutdown_tx, shutdown_rx) = watch::channel(false); + + let (event_tx, event_rx) = mpsc::channel(256); + let (irc_outbound_tx, irc_outbound_rx) = mpsc::channel(256); + let (state_tx, state_rx) = mpsc::channel(32); + let (control_tx, control_rx) = mpsc::channel(32); + + let api_client = owncast_api::OwncastApiClient::new( + config.owncast.url.clone(), + access_token, + ); + + // IRC task + let irc_config = config.irc.clone(); + let irc_event_tx = event_tx.clone(); + let irc_shutdown = shutdown_rx.clone(); + let irc_handle = tokio::spawn(async move { + irc_task::run_irc_task(irc_config, irc_event_tx, irc_outbound_rx, irc_shutdown).await; + }); + + // Webhook server + let webhook_port = config.owncast.webhook_port; + let webhook_event_tx = event_tx.clone(); + let webhook_handle = tokio::spawn(async move { + if let Err(e) = webhook::run_webhook_server(webhook_port, webhook_event_tx).await { + tracing::error!(error = %e, "Webhook server failed"); + } + }); + + // WebSocket task (optional) + let ws_handle = if config.owncast.websocket_enabled { + let ws_url = config.owncast.url.clone(); + let ws_event_tx = event_tx.clone(); + let ws_shutdown = shutdown_rx.clone(); + Some(tokio::spawn(async move { + websocket::run_websocket_task(ws_url, ws_event_tx, ws_shutdown).await; + })) + } else { + None + }; + + // Health poller + let health_api = owncast_api::OwncastApiClient::new( + config.owncast.url.clone(), + String::new(), + ); + let health_interval = std::time::Duration::from_secs(config.owncast.health_poll_interval_secs); + let health_shutdown = shutdown_rx.clone(); + let health_handle = tokio::spawn(async move { + health::run_health_poller(&health_api, state_tx, health_interval, health_shutdown).await; + }); + + // Control socket + let control_socket_path = config.control.socket_path.clone(); + let control_handle = tokio::spawn(async move { + if let Err(e) = control::run_control_socket(&control_socket_path, control_tx).await { + tracing::error!(error = %e, "Control socket failed"); + } + }); + + // Signal handling + let sig_shutdown_tx = shutdown_tx.clone(); + tokio::spawn(async move { + let mut sigterm = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate()) + .expect("Failed to register SIGTERM handler"); + let mut sighup = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::hangup()) + .expect("Failed to register SIGHUP handler"); + + tokio::select! { + _ = tokio::signal::ctrl_c() => { + info!("SIGINT received, shutting down"); + let _ = sig_shutdown_tx.send(true); + } + _ = sigterm.recv() => { + info!("SIGTERM received, shutting down"); + let _ = sig_shutdown_tx.send(true); + } + _ = sighup.recv() => { + info!("SIGHUP received (reconnect not yet wired)"); + } + } + }); + + // Router (runs on main task) + router::run_router( + config.bridge, + config.owncast.url, + api_client, + event_rx, + irc_outbound_tx, + state_rx, + control_rx, + shutdown_tx, + start_time, + ) + .await; + + info!("Bridge shutting down"); + Ok(()) +} +``` + +**Step 2: Verify it compiles** + +Run: `cargo check` +Expected: compiles. Fix any issues with `Clone` derives or visibility. + +**Step 3: Commit** + +```bash +git add -A +git commit -m "feat: wire all tasks together in main with signal handling" +``` + +--- + +### Task 13: bridge-ctl CLI + +**Files:** +- Modify: `src/bin/bridge_ctl.rs` + +**Step 1: Implement bridge-ctl** + +```rust +use std::io::{BufRead, BufReader, Write}; +use std::os::unix::net::UnixStream; +use std::path::PathBuf; +use std::time::Duration; + +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +#[command(name = "bridge-ctl")] +#[command(about = "Control a running owncast-irc-bridge instance")] +struct Cli { + /// Path to the bridge control socket + #[arg(short, long, default_value = "/tmp/owncast-irc-bridge.sock")] + socket: PathBuf, + + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + /// Show bridge status + Status, + /// Control IRC connection + Irc { + #[command(subcommand)] + action: ConnectionAction, + }, + /// Control Owncast connection + Owncast { + #[command(subcommand)] + action: ConnectionAction, + }, + /// Shut down the bridge + Quit, +} + +#[derive(Subcommand)] +enum ConnectionAction { + Connect, + Disconnect, + Reconnect, +} + +fn main() { + let cli = Cli::parse(); + + let command_str = match &cli.command { + Commands::Status => "status".to_string(), + Commands::Quit => "quit".to_string(), + Commands::Irc { action } => format!("irc {}", action_str(action)), + Commands::Owncast { action } => format!("owncast {}", action_str(action)), + }; + + match send_command(&cli.socket, &command_str) { + Ok(response) => print!("{response}"), + Err(e) => { + eprintln!("Error: {e}"); + std::process::exit(1); + } + } +} + +fn action_str(action: &ConnectionAction) -> &'static str { + match action { + ConnectionAction::Connect => "connect", + ConnectionAction::Disconnect => "disconnect", + ConnectionAction::Reconnect => "reconnect", + } +} + +fn send_command(socket_path: &PathBuf, command: &str) -> Result<String, Box<dyn std::error::Error>> { + let mut stream = UnixStream::connect(socket_path)?; + stream.set_read_timeout(Some(Duration::from_secs(5)))?; + + writeln!(stream, "{command}")?; + stream.flush()?; + + let reader = BufReader::new(stream); + let mut response = String::new(); + for line in reader.lines() { + match line { + Ok(l) => { + response.push_str(&l); + response.push('\n'); + } + Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => break, + Err(ref e) if e.kind() == std::io::ErrorKind::TimedOut => break, + Err(e) => return Err(e.into()), + } + } + Ok(response) +} +``` + +**Step 2: Verify it compiles** + +Run: `cargo check --bin bridge-ctl` +Expected: compiles + +**Step 3: Commit** + +```bash +git add -A +git commit -m "feat: add bridge-ctl CLI for runtime control" +``` + +--- + +### Task 14: Dockerfile + +**Files:** +- Create: `Dockerfile` + +**Step 1: Write Dockerfile** + +```dockerfile +FROM rust:1.85-slim-bookworm AS builder + +RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/* + +WORKDIR /app +COPY Cargo.toml Cargo.lock ./ +COPY src/ src/ + +RUN cargo build --release + +FROM debian:bookworm-slim + +RUN apt-get update && apt-get install -y ca-certificates libssl3 && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /app/target/release/owncast-irc-bridge /usr/local/bin/ +COPY --from=builder /app/target/release/bridge-ctl /usr/local/bin/ + +ENTRYPOINT ["owncast-irc-bridge"] +CMD ["--config", "/etc/owncast-irc-bridge/config.toml"] +``` + +**Step 2: Commit** + +```bash +git add -A +git commit -m "feat: add multi-stage Dockerfile" +``` + +--- + +### Task 15: Add Clone derives and final compilation fix + +At this point, do a full `cargo build` and fix any missing trait derives (e.g. `Clone` on `IrcConfig`), visibility issues, or type mismatches that appear. Ensure both binaries compile. + +**Step 1: Full build** + +Run: `cargo build` +Expected: compiles with both binaries + +**Step 2: Run all tests** + +Run: `cargo test` +Expected: all tests pass + +**Step 3: Commit any fixes** + +```bash +git add -A +git commit -m "fix: add missing derives and resolve compilation issues" +``` diff --git a/src/bin/bridge_ctl.rs b/src/bin/bridge_ctl.rs new file mode 100644 index 0000000..e0e486e --- /dev/null +++ b/src/bin/bridge_ctl.rs @@ -0,0 +1,3 @@ +fn main() { + println!("bridge-ctl"); +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..75b6503 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("owncast-irc-bridge"); +}