From 90468d5518e8d098a4de94ff9bc37fee7ff45f81 Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 13 Jul 2024 14:04:59 -0700 Subject: [PATCH 01/16] Have burrow gtk use new rpc --- burrow-gtk/Cargo.lock | 1935 +++-------------- burrow-gtk/Cargo.toml | 7 +- burrow-gtk/build-aux/build_appimage.sh | 1 - burrow-gtk/build.rs | 1 + burrow-gtk/src/components/app.rs | 26 +- burrow-gtk/src/components/mod.rs | 7 +- .../src/components/settings/daemon_group.rs | 4 +- .../src/components/settings/diag_group.rs | 6 +- burrow-gtk/src/components/settings_screen.rs | 2 +- burrow-gtk/src/components/switch_screen.rs | 28 +- 10 files changed, 380 insertions(+), 1637 deletions(-) diff --git a/burrow-gtk/Cargo.lock b/burrow-gtk/Cargo.lock index 6721318f..fce2a3b9 100644 --- a/burrow-gtk/Cargo.lock +++ b/burrow-gtk/Cargo.lock @@ -17,27 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -48,89 +27,103 @@ dependencies = [ ] [[package]] -name = "anstream" -version = "0.6.11" +name = "anyhow" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] -name = "anstyle" -version = "1.0.4" +name = "async-stream" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] [[package]] -name = "anstyle-parse" -version = "0.2.3" +name = "async-stream-impl" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ - "utf8parse", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "anstyle-query" -version = "1.0.2" +name = "async-trait" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ - "windows-sys 0.52.0", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "anstyle-wincon" -version = "3.0.2" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] -name = "anyhow" -version = "1.0.79" +name = "autocfg" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "async-channel" -version = "2.1.1" +name = "axum" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ - "concurrent-queue", - "event-listener", - "event-listener-strategy", - "futures-core", + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper 1.0.1", + "tower", + "tower-layer", + "tower-service", ] [[package]] -name = "async-trait" -version = "0.1.77" +name = "axum-core" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "backtrace" version = "0.3.69" @@ -148,60 +141,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bindgen" -version = "0.64.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 1.0.109", - "which", -] - -[[package]] -name = "bindgen" -version = "0.65.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.48", - "which", -] +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" @@ -215,120 +157,41 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - [[package]] name = "block" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -[[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.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" -[[package]] -name = "burrow" -version = "0.1.0" -dependencies = [ - "aead", - "anyhow", - "async-channel", - "base64", - "blake2", - "caps", - "chacha20poly1305", - "clap", - "console", - "fehler", - "futures", - "hmac", - "ip_network", - "ip_network_table", - "libsystemd", - "log", - "nix 0.27.1", - "once_cell", - "parking_lot", - "rand", - "rand_core", - "ring", - "schemars", - "serde", - "serde_json", - "tokio", - "tracing", - "tracing-journald", - "tracing-log 0.1.4", - "tracing-oslog", - "tracing-subscriber", - "tun", - "x25519-dalek", -] - [[package]] name = "burrow-gtk" version = "0.1.0" dependencies = [ "anyhow", - "burrow", "gettext-rs", "glib-build-tools", + "hyper-util", + "prost", + "prost-types", "relm4", "tokio", + "tonic", + "tonic-build", + "tower", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" -[[package]] -name = "bzip2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "cairo-rs" version = "0.17.10" @@ -354,35 +217,15 @@ dependencies = [ "system-deps", ] -[[package]] -name = "caps" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190baaad529bcfbde9e1a19022c42781bdb6ff9de25721abdb8fd98c0807730b" -dependencies = [ - "libc", - "thiserror", -] - [[package]] name = "cc" version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-expr" version = "0.15.6" @@ -399,251 +242,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", -] - -[[package]] -name = "clang-sys" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" -dependencies = [ - "glob", - "libc", - "libloading 0.8.1", -] - -[[package]] -name = "clap" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "concurrent-queue" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.52.0", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[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-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "rand_core", - "typenum", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "fiat-crypto", - "platforms", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "dyn-clone" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" - [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -660,78 +264,27 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener", - "pin-project-lite", -] - [[package]] name = "fastrand" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" -[[package]] -name = "fehler" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5729fe49ba028cd550747b6e62cd3d841beccab5390aa398538c31a2d983635" -dependencies = [ - "fehler-macros", -] - -[[package]] -name = "fehler-macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb5acb1045ebbfa222e2c50679e392a71dd77030b78fb0189f2d9c5974400f9" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "fiat-crypto" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" - [[package]] name = "field-offset" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" dependencies = [ - "memoffset 0.9.0", + "memoffset", "rustc_version", ] [[package]] -name = "flate2" -version = "1.0.28" +name = "fixedbitset" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flume" @@ -752,30 +305,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - [[package]] name = "fragile" version = "2.0.0" @@ -931,16 +460,6 @@ dependencies = [ "system-deps", ] -[[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.12" @@ -1067,12 +586,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "gobject-sys" version = "0.17.10" @@ -1197,23 +710,29 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", - "indexmap", + "indexmap 2.1.0", "slab", "tokio", "tokio-util", "tracing", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.3" @@ -1233,48 +752,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "home" -version = "0.5.9" +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "windows-sys 0.52.0", + "bytes", + "fnv", + "itoa", ] [[package]] -name = "http" -version = "0.2.11" +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "fnv", - "itoa", + "http", ] [[package]] -name = "http-body" -version = "0.4.6" +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", + "futures-util", "http", + "http-body", "pin-project-lite", ] @@ -1292,13 +799,12 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", @@ -1307,98 +813,79 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hyper-timeout" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "bytes", "hyper", - "native-tls", + "hyper-util", + "pin-project-lite", "tokio", - "tokio-native-tls", + "tower-service", ] [[package]] -name = "idna" -version = "0.5.0" +name = "hyper-util" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] name = "indexmap" -version = "2.1.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ - "equivalent", - "hashbrown", + "autocfg", + "hashbrown 0.12.3", ] [[package]] -name = "inout" -version = "0.1.3" +name = "indexmap" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "generic-array", + "equivalent", + "hashbrown 0.14.3", ] [[package]] -name = "ip_network" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" - -[[package]] -name = "ip_network_table" -version = "0.2.0" +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4099b7cfc5c5e2fe8c5edf3f6f7adf7a714c9cc697534f63a5a5da30397cb2c0" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ - "ip_network", - "ip_network_table-deps-treebitmap", + "either", ] -[[package]] -name = "ip_network_table-deps-treebitmap" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e537132deb99c0eb4b752f0346b6a836200eaaa3516dd7e5514b63930a09e5d" - -[[package]] -name = "ipnet" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" - [[package]] name = "itoa" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.67" @@ -1414,12 +901,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libadwaita" version = "0.4.4" @@ -1459,44 +940,6 @@ version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libloading" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "libsystemd" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c592dc396b464005f78a5853555b9f240bc5378bf5221acc4e129910b2678869" -dependencies = [ - "hmac", - "libc", - "log", - "nix 0.27.1", - "nom", - "once_cell", - "serde", - "sha2", - "thiserror", - "uuid", -] - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -1542,13 +985,10 @@ dependencies = [ ] [[package]] -name = "matchers" -version = "0.1.0" +name = "matchit" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" @@ -1556,15 +996,6 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.0" @@ -1574,41 +1005,12 @@ dependencies = [ "autocfg", ] -[[package]] -name = "miette" -version = "5.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" -dependencies = [ - "miette-derive", - "once_cell", - "thiserror", - "unicode-width", -] - -[[package]] -name = "miette-derive" -version = "5.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1629,6 +1031,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + [[package]] name = "nanorand" version = "0.7.0" @@ -1638,69 +1046,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", - "pin-utils", -] - -[[package]] -name = "nix" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" -dependencies = [ - "bitflags 2.4.2", - "cfg-if", - "libc", - "memoffset 0.9.0", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num_cpus" version = "1.16.0" @@ -1755,145 +1100,31 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "openssl" -version = "0.10.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" -dependencies = [ - "bitflags 2.4.2", - "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 2.0.48", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "pango" version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35be456fc620e61f62dff7ff70fbd54dcbaf0a4b920c0f16de1107c47d921d48" -dependencies = [ - "bitflags 1.3.2", - "gio", - "glib", - "libc", - "once_cell", - "pango-sys", -] - -[[package]] -name = "pango-sys" -version = "0.17.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da69f9f3850b0d8990d462f8c709561975e95f689c1cdf0fecdebde78b35195" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - -[[package]] -name = "parking" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "35be456fc620e61f62dff7ff70fbd54dcbaf0a4b920c0f16de1107c47d921d48" dependencies = [ - "digest", - "hmac", - "password-hash", - "sha2", + "bitflags 1.3.2", + "gio", + "glib", + "libc", + "once_cell", + "pango-sys", ] [[package]] -name = "peeking_take_while" -version = "0.1.2" +name = "pango-sys" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +checksum = "3da69f9f3850b0d8990d462f8c709561975e95f689c1cdf0fecdebde78b35195" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] [[package]] name = "percent-encoding" @@ -1901,6 +1132,16 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.1.0", +] + [[package]] name = "pin-project" version = "1.1.4" @@ -1939,29 +1180,6 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" -[[package]] -name = "platforms" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" - -[[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2021,6 +1239,59 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" +dependencies = [ + "bytes", + "heck", + "itertools", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 2.0.48", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "prost-types" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" +dependencies = [ + "prost", +] + [[package]] name = "quote" version = "1.0.35" @@ -2077,17 +1348,8 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.4", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -2098,15 +1360,9 @@ checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.2" @@ -2142,70 +1398,12 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "reqwest" -version = "0.11.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "system-configuration", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "ring" -version = "0.17.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" -dependencies = [ - "cc", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.48.0", -] - [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" version = "0.4.0" @@ -2229,43 +1427,10 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" - -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "schemars" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" -dependencies = [ - "dyn-clone", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.8.16" +name = "rustversion" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 1.0.109", -] +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "scopeguard" @@ -2273,29 +1438,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "security-framework" -version = "2.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.21" @@ -2322,28 +1464,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "serde_derive_internals" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "serde_json" -version = "1.0.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" -dependencies = [ - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_spanned" version = "0.6.5" @@ -2353,66 +1473,6 @@ 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 = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[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 = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -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 = "slab" version = "0.4.9" @@ -2428,16 +1488,6 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.5" @@ -2457,34 +1507,6 @@ dependencies = [ "lock_api", ] -[[package]] -name = "ssri" -version = "9.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da7a2b3c2bc9693bcb40870c4e9b5bf0d79f9cb46273321bf855ec513e919082" -dependencies = [ - "base64", - "digest", - "hex", - "miette", - "sha-1", - "sha2", - "thiserror", - "xxhash-rust", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - [[package]] name = "syn" version = "1.0.109" @@ -2508,25 +1530,16 @@ dependencies = [ ] [[package]] -name = "system-configuration" -version = "0.5.1" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] -name = "system-configuration-sys" -version = "0.5.0" +name = "sync_wrapper" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "system-deps" @@ -2567,73 +1580,30 @@ dependencies = [ ] [[package]] -name = "thiserror" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.31" +name = "thiserror" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ - "deranged", - "powerfmt", - "serde", - "time-core", + "thiserror-impl", ] [[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "tinyvec" -version = "1.6.0" +name = "thiserror-impl" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ - "tinyvec_macros", + "proc-macro2", + "quote", + "syn 2.0.48", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" -version = "1.35.1" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -2641,17 +1611,16 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio-macros", - "tracing", "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", @@ -2659,12 +1628,13 @@ dependencies = [ ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "tokio-stream" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ - "native-tls", + "futures-core", + "pin-project-lite", "tokio", ] @@ -2709,7 +1679,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap", + "indexmap 2.1.0", "toml_datetime", "winnow", ] @@ -2720,7 +1690,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", @@ -2728,107 +1698,110 @@ dependencies = [ ] [[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" +name = "tonic" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "f738b6a169a29bca4e39656db89c44a08e09c5b700b896ee9e7459f0652e81dd" dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", + "async-stream", + "async-trait", + "axum", + "base64", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "prost", + "socket2", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", ] [[package]] -name = "tracing-attributes" -version = "0.1.27" +name = "tonic-build" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "690943cc223adcdd67bb597a2e573ead1b88e999ba37528fe8e6356bf44b29b6" dependencies = [ + "prettyplease", "proc-macro2", + "prost-build", "quote", "syn 2.0.48", ] [[package]] -name = "tracing-core" -version = "0.1.32" +name = "tower" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ - "once_cell", - "valuable", + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", ] [[package]] -name = "tracing-journald" -version = "0.3.0" +name = "tower-layer" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba316a74e8fc3c3896a850dba2375928a9fa171b085ecddfc7c054d39970f3fd" -dependencies = [ - "libc", - "tracing-core", - "tracing-subscriber", -] +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] -name = "tracing-log" -version = "0.1.4" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] -name = "tracing-log" -version = "0.2.0" +name = "tracing" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "log", - "once_cell", + "pin-project-lite", + "tracing-attributes", "tracing-core", ] [[package]] -name = "tracing-oslog" -version = "0.1.2" -source = "git+https://github.com/Stormshield-robinc/tracing-oslog#c4d21a95e70cdd62b1cea04fc4f8be1c547cad6c" +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "bindgen 0.64.0", - "cc", - "cfg-if", - "fnv", - "once_cell", - "parking_lot", - "tracing-core", - "tracing-subscriber", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "tracing-subscriber" -version = "0.3.18" +name = "tracing-core" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "matchers", - "nu-ansi-term", "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log 0.2.0", ] [[package]] @@ -2837,120 +1810,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tun" -version = "0.1.0" -dependencies = [ - "anyhow", - "bindgen 0.65.1", - "byteorder", - "fehler", - "futures", - "lazy_static", - "libc", - "libloading 0.7.4", - "log", - "nix 0.26.4", - "reqwest", - "schemars", - "serde", - "socket2 0.4.10", - "ssri", - "tempfile", - "tokio", - "tracing", - "widestring", - "windows", - "zip", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "uuid" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" -dependencies = [ - "serde", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version-compare" version = "0.1.1" @@ -3003,18 +1868,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.90" @@ -3044,34 +1897,6 @@ version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" -[[package]] -name = "web-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - -[[package]] -name = "widestring" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" - [[package]] name = "winapi" version = "0.3.9" @@ -3094,15 +1919,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -3243,100 +2059,3 @@ checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "x25519-dalek" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" -dependencies = [ - "curve25519-dalek", - "rand_core", - "serde", - "zeroize", -] - -[[package]] -name = "xxhash-rust" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53be06678ed9e83edb1745eb72efc0bbcd7b5c3c35711a860906aed827a13d61" - -[[package]] -name = "zeroize" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "aes", - "byteorder", - "bzip2", - "constant_time_eq", - "crc32fast", - "crossbeam-utils", - "flate2", - "hmac", - "pbkdf2", - "sha1", - "time", - "zstd", -] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/burrow-gtk/Cargo.toml b/burrow-gtk/Cargo.toml index 21cb52ee..b73d936f 100644 --- a/burrow-gtk/Cargo.toml +++ b/burrow-gtk/Cargo.toml @@ -8,10 +8,15 @@ edition = "2021" [dependencies] anyhow = "1.0" relm4 = { version = "0.6", features = ["libadwaita", "gnome_44"]} -burrow = { version = "*", path = "../burrow/" } tokio = { version = "1.35.0", features = ["time", "sync"] } gettext-rs = { version = "0.7.0", features = ["gettext-system"] } +tonic = "0.12" +prost = "0.13" +prost-types = "0.13" +hyper-util = "0.1.6" +tower = "0.4.13" [build-dependencies] anyhow = "1.0" glib-build-tools = "0.18.0" +tonic-build = "0.12" diff --git a/burrow-gtk/build-aux/build_appimage.sh b/burrow-gtk/build-aux/build_appimage.sh index f054cd98..ef88e575 100755 --- a/burrow-gtk/build-aux/build_appimage.sh +++ b/burrow-gtk/build-aux/build_appimage.sh @@ -27,6 +27,5 @@ CFLAGS="-I/usr/local/include -I/usr/include/$MUSL_TARGET -fPIE" meson setup $BURROW_GTK_BUILD --bindir bin --prefix /usr --buildtype $BURROW_BUILD_TYPE meson compile -C $BURROW_GTK_BUILD DESTDIR=AppDir meson install -C $BURROW_GTK_BUILD -cargo b --$BURROW_BUILD_TYPE --manifest-path=../Cargo.toml /tmp/linuxdeploy --appimage-extract-and-run --appdir $BURROW_GTK_BUILD/AppDir -e $BURROW_GTK_BUILD/../../target/$BURROW_BUILD_TYPE/burrow --output appimage mv *.AppImage $BURROW_GTK_BUILD diff --git a/burrow-gtk/build.rs b/burrow-gtk/build.rs index 4db01755..df2e3d29 100644 --- a/burrow-gtk/build.rs +++ b/burrow-gtk/build.rs @@ -2,6 +2,7 @@ use anyhow::Result; fn main() -> Result<()> { compile_gresources()?; + tonic_build::compile_protos("../proto/burrow.proto")?; Ok(()) } diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index 62c98c09..7bc90849 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -1,11 +1,17 @@ use super::*; use anyhow::Context; +use anyhow::Result; +use hyper_util::rt::TokioIo; use std::time::Duration; +use tokio::net::UnixStream; +use tonic::transport::{Channel, Endpoint, Uri}; +use tower::service_fn; +const BURROW_RPC_SOCKET_PATH: &str = "/run/burrow.sock"; const RECONNECT_POLL_TIME: Duration = Duration::from_secs(5); pub struct App { - daemon_client: Arc>>, + daemon_client: Arc>>, settings_screen: Controller, switch_screen: AsyncController, } @@ -58,7 +64,8 @@ impl AsyncComponent for App { root: Self::Root, sender: AsyncComponentSender, ) -> AsyncComponentParts { - let daemon_client = Arc::new(Mutex::new(DaemonClient::new().await.ok())); + // TODO: RPC REFACTOR (Handle Error) + let daemon_client = Arc::new(Mutex::new(Some(daemon_connect().await.unwrap()))); let switch_screen = switch_screen::SwitchScreen::builder() .launch(switch_screen::SwitchScreenInit { @@ -128,7 +135,8 @@ impl AsyncComponent for App { let mut disconnected_daemon_client = false; if let Some(daemon_client) = daemon_client.as_mut() { - if let Err(_e) = daemon_client.send_command(DaemonCommand::ServerInfo).await { + let mut client = tunnel_client::TunnelClient::new(daemon_client); + if let Err(_e) = client.tunnel_status(burrow_rpc::Empty {}).await { disconnected_daemon_client = true; self.switch_screen .emit(switch_screen::SwitchScreenMsg::DaemonDisconnect); @@ -138,7 +146,7 @@ impl AsyncComponent for App { } if disconnected_daemon_client || daemon_client.is_none() { - match DaemonClient::new().await { + match daemon_connect().await { Ok(new_daemon_client) => { *daemon_client = Some(new_daemon_client); self.switch_screen @@ -155,3 +163,13 @@ impl AsyncComponent for App { } } } + +pub async fn daemon_connect() -> Result { + Ok(Endpoint::try_from("http://[::]:50051")? + .connect_with_connector(service_fn(|_: Uri| async { + Ok::<_, std::io::Error>(TokioIo::new( + UnixStream::connect(BURROW_RPC_SOCKET_PATH).await?, + )) + })) + .await?) +} diff --git a/burrow-gtk/src/components/mod.rs b/burrow-gtk/src/components/mod.rs index b1348095..21c51e5d 100644 --- a/burrow-gtk/src/components/mod.rs +++ b/burrow-gtk/src/components/mod.rs @@ -1,6 +1,5 @@ use super::*; use adw::prelude::*; -use burrow::{DaemonClient, DaemonCommand, DaemonResponseData}; use gtk::Align; use relm4::{ component::{ @@ -12,6 +11,12 @@ use relm4::{ use std::sync::Arc; use tokio::sync::Mutex; +pub mod burrow_rpc { + tonic::include_proto!("burrow"); +} +use burrow_rpc::tunnel_client; +use tonic::transport::Channel; + mod app; mod settings; mod settings_screen; diff --git a/burrow-gtk/src/components/settings/daemon_group.rs b/burrow-gtk/src/components/settings/daemon_group.rs index 3817ca66..ef22000e 100644 --- a/burrow-gtk/src/components/settings/daemon_group.rs +++ b/burrow-gtk/src/components/settings/daemon_group.rs @@ -4,12 +4,12 @@ use std::process::Command; #[derive(Debug)] pub struct DaemonGroup { system_setup: SystemSetup, - daemon_client: Arc>>, + daemon_client: Arc>>, already_running: bool, } pub struct DaemonGroupInit { - pub daemon_client: Arc>>, + pub daemon_client: Arc>>, pub system_setup: SystemSetup, } diff --git a/burrow-gtk/src/components/settings/diag_group.rs b/burrow-gtk/src/components/settings/diag_group.rs index a15e0eaa..9e1bcff8 100644 --- a/burrow-gtk/src/components/settings/diag_group.rs +++ b/burrow-gtk/src/components/settings/diag_group.rs @@ -2,7 +2,7 @@ use super::*; #[derive(Debug)] pub struct DiagGroup { - daemon_client: Arc>>, + daemon_client: Arc>>, system_setup: SystemSetup, service_installed: StatusTernary, @@ -12,12 +12,12 @@ pub struct DiagGroup { } pub struct DiagGroupInit { - pub daemon_client: Arc>>, + pub daemon_client: Arc>>, pub system_setup: SystemSetup, } impl DiagGroup { - async fn new(daemon_client: Arc>>) -> Result { + async fn new(daemon_client: Arc>>) -> Result { let system_setup = SystemSetup::new(); let daemon_running = daemon_client.lock().await.is_some(); diff --git a/burrow-gtk/src/components/settings_screen.rs b/burrow-gtk/src/components/settings_screen.rs index 971f2621..13154fa8 100644 --- a/burrow-gtk/src/components/settings_screen.rs +++ b/burrow-gtk/src/components/settings_screen.rs @@ -7,7 +7,7 @@ pub struct SettingsScreen { } pub struct SettingsScreenInit { - pub daemon_client: Arc>>, + pub daemon_client: Arc>>, } #[derive(Debug, PartialEq, Eq)] diff --git a/burrow-gtk/src/components/switch_screen.rs b/burrow-gtk/src/components/switch_screen.rs index f660536d..7155d9f1 100644 --- a/burrow-gtk/src/components/switch_screen.rs +++ b/burrow-gtk/src/components/switch_screen.rs @@ -1,14 +1,14 @@ use super::*; pub struct SwitchScreen { - daemon_client: Arc>>, + daemon_client: Arc>>, switch: gtk::Switch, switch_screen: gtk::Box, disconnected_banner: adw::Banner, } pub struct SwitchScreenInit { - pub daemon_client: Arc>>, + pub daemon_client: Arc>>, } #[derive(Debug, PartialEq, Eq)] @@ -76,15 +76,13 @@ impl AsyncComponent for SwitchScreen { let mut initial_daemon_server_down = false; if let Some(daemon_client) = init.daemon_client.lock().await.as_mut() { - if let Ok(res) = daemon_client - .send_command(DaemonCommand::ServerInfo) - .await - .as_ref() - { - initial_switch_status = match res.result.as_ref() { - Ok(DaemonResponseData::None) => false, - Ok(DaemonResponseData::ServerInfo(_)) => true, - _ => false, + let mut client = tunnel_client::TunnelClient::new(daemon_client); + if let Ok(res) = client.tunnel_status(burrow_rpc::Empty {}).await.as_mut() { + // TODO: RPC REFACTOR (Handle Error) + let res = res.get_mut().message().await.unwrap().unwrap(); + initial_switch_status = match res.state() { + burrow_rpc::State::Running => true, + burrow_rpc::State::Stopped => false, }; } else { initial_daemon_server_down = true; @@ -123,17 +121,15 @@ impl AsyncComponent for SwitchScreen { let mut disconnected_daemon_client = false; if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { + let mut client = tunnel_client::TunnelClient::new(daemon_client); match msg { Self::Input::Start => { - if let Err(_e) = daemon_client - .send_command(DaemonCommand::Start(Default::default())) - .await - { + if let Err(_e) = client.tunnel_start(burrow_rpc::Empty {}).await { disconnected_daemon_client = true; } } Self::Input::Stop => { - if let Err(_e) = daemon_client.send_command(DaemonCommand::Stop).await { + if let Err(_e) = client.tunnel_stop(burrow_rpc::Empty {}).await { disconnected_daemon_client = true; } } From 12f595011a3f7b9f614ee215f8ec67562ea1ac0e Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 13 Jul 2024 16:54:57 -0700 Subject: [PATCH 02/16] Integrate tunnel status streaming --- burrow-gtk/src/components/app.rs | 20 +----- burrow-gtk/src/components/mod.rs | 1 + burrow-gtk/src/components/switch_screen.rs | 78 ++++++++++++++++++---- burrow-gtk/src/daemon.rs | 17 +++++ burrow-gtk/src/main.rs | 1 + 5 files changed, 85 insertions(+), 32 deletions(-) create mode 100644 burrow-gtk/src/daemon.rs diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index 7bc90849..6d64fa01 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -1,13 +1,7 @@ use super::*; use anyhow::Context; -use anyhow::Result; -use hyper_util::rt::TokioIo; use std::time::Duration; -use tokio::net::UnixStream; -use tonic::transport::{Channel, Endpoint, Uri}; -use tower::service_fn; -const BURROW_RPC_SOCKET_PATH: &str = "/run/burrow.sock"; const RECONNECT_POLL_TIME: Duration = Duration::from_secs(5); pub struct App { @@ -65,7 +59,7 @@ impl AsyncComponent for App { sender: AsyncComponentSender, ) -> AsyncComponentParts { // TODO: RPC REFACTOR (Handle Error) - let daemon_client = Arc::new(Mutex::new(Some(daemon_connect().await.unwrap()))); + let daemon_client = Arc::new(Mutex::new(Some(daemon::daemon_connect().await.unwrap()))); let switch_screen = switch_screen::SwitchScreen::builder() .launch(switch_screen::SwitchScreenInit { @@ -146,7 +140,7 @@ impl AsyncComponent for App { } if disconnected_daemon_client || daemon_client.is_none() { - match daemon_connect().await { + match daemon::daemon_connect().await { Ok(new_daemon_client) => { *daemon_client = Some(new_daemon_client); self.switch_screen @@ -163,13 +157,3 @@ impl AsyncComponent for App { } } } - -pub async fn daemon_connect() -> Result { - Ok(Endpoint::try_from("http://[::]:50051")? - .connect_with_connector(service_fn(|_: Uri| async { - Ok::<_, std::io::Error>(TokioIo::new( - UnixStream::connect(BURROW_RPC_SOCKET_PATH).await?, - )) - })) - .await?) -} diff --git a/burrow-gtk/src/components/mod.rs b/burrow-gtk/src/components/mod.rs index 21c51e5d..7490b820 100644 --- a/burrow-gtk/src/components/mod.rs +++ b/burrow-gtk/src/components/mod.rs @@ -3,6 +3,7 @@ use adw::prelude::*; use gtk::Align; use relm4::{ component::{ + worker::{Worker, WorkerController}, AsyncComponent, AsyncComponentController, AsyncComponentParts, AsyncComponentSender, AsyncController, }, diff --git a/burrow-gtk/src/components/switch_screen.rs b/burrow-gtk/src/components/switch_screen.rs index 7155d9f1..72588541 100644 --- a/burrow-gtk/src/components/switch_screen.rs +++ b/burrow-gtk/src/components/switch_screen.rs @@ -1,10 +1,15 @@ use super::*; +use std::time::Duration; + +const RECONNECT_POLL_TIME: Duration = Duration::from_secs(3); pub struct SwitchScreen { daemon_client: Arc>>, switch: gtk::Switch, switch_screen: gtk::Box, disconnected_banner: adw::Banner, + + _tunnel_state_worker: WorkerController, } pub struct SwitchScreenInit { @@ -13,10 +18,13 @@ pub struct SwitchScreenInit { #[derive(Debug, PartialEq, Eq)] pub enum SwitchScreenMsg { + None, DaemonReconnect, DaemonDisconnect, Start, Stop, + SwitchSetStart, + SwitchSetStop, } #[relm4::component(pub, async)] @@ -24,7 +32,7 @@ impl AsyncComponent for SwitchScreen { type Init = SwitchScreenInit; type Input = SwitchScreenMsg; type Output = (); - type CommandOutput = (); + type CommandOutput = SwitchScreenMsg; view! { gtk::Box { @@ -61,7 +69,7 @@ impl AsyncComponent for SwitchScreen { set_hexpand: false, set_vexpand: false, connect_active_notify => move |switch| - sender.input(if switch.is_active() { SwitchScreenMsg::Start } else { SwitchScreenMsg::Stop }) + switch_sender.input(if switch.is_active() { SwitchScreenMsg::Start } else { SwitchScreenMsg::Stop }) }, } } @@ -72,29 +80,25 @@ impl AsyncComponent for SwitchScreen { root: Self::Root, sender: AsyncComponentSender, ) -> AsyncComponentParts { - let mut initial_switch_status = false; let mut initial_daemon_server_down = false; if let Some(daemon_client) = init.daemon_client.lock().await.as_mut() { let mut client = tunnel_client::TunnelClient::new(daemon_client); - if let Ok(res) = client.tunnel_status(burrow_rpc::Empty {}).await.as_mut() { - // TODO: RPC REFACTOR (Handle Error) - let res = res.get_mut().message().await.unwrap().unwrap(); - initial_switch_status = match res.state() { - burrow_rpc::State::Running => true, - burrow_rpc::State::Stopped => false, - }; - } else { + if client + .tunnel_status(burrow_rpc::Empty {}) + .await + .as_mut() + .is_err() + { initial_daemon_server_down = true; } } else { initial_daemon_server_down = true; } + let switch_sender = sender.clone(); let widgets = view_output!(); - widgets.switch.set_active(initial_switch_status); - if initial_daemon_server_down { *init.daemon_client.lock().await = None; widgets.switch.set_active(false); @@ -107,8 +111,13 @@ impl AsyncComponent for SwitchScreen { switch: widgets.switch.clone(), switch_screen: widgets.switch_screen.clone(), disconnected_banner: widgets.setup_banner.clone(), + _tunnel_state_worker: AsyncTunnelStateHandler::builder() + .detach_worker(()) + .forward(sender.input_sender(), |_| SwitchScreenMsg::None), }; + widgets.switch.set_active(false); + AsyncComponentParts { model, widgets } } @@ -133,6 +142,12 @@ impl AsyncComponent for SwitchScreen { disconnected_daemon_client = true; } } + Self::Input::SwitchSetStart => { + self.switch.set_active(true); + } + Self::Input::SwitchSetStop => { + self.switch.set_active(false); + } _ => {} } } else { @@ -146,9 +161,44 @@ impl AsyncComponent for SwitchScreen { if disconnected_daemon_client || msg == Self::Input::DaemonDisconnect { *self.daemon_client.lock().await = None; - self.switch.set_active(false); self.switch_screen.set_sensitive(false); self.disconnected_banner.set_revealed(true); } } } +struct AsyncTunnelStateHandler; + +impl Worker for AsyncTunnelStateHandler { + type Init = (); + type Input = (); + type Output = SwitchScreenMsg; + + fn init(_: Self::Init, _sender: ComponentSender) -> Self { + Self + } + + fn update(&mut self, _: (), sender: ComponentSender) { + let rt = tokio::runtime::Runtime::new().unwrap(); + let task = rt.spawn(async move { + loop { + let conn = daemon::daemon_connect().await; + if let Ok(conn) = conn { + let mut client = tunnel_client::TunnelClient::new(conn); + if let Ok(mut res) = client.tunnel_status(burrow_rpc::Empty {}).await { + let stream = res.get_mut(); + while let Ok(Some(msg)) = stream.message().await { + sender + .output(match msg.state() { + burrow_rpc::State::Running => SwitchScreenMsg::SwitchSetStart, + burrow_rpc::State::Stopped => SwitchScreenMsg::SwitchSetStop, + }) + .unwrap(); + } + } + } + tokio::time::sleep(RECONNECT_POLL_TIME).await; + } + }); + rt.block_on(task).unwrap(); + } +} diff --git a/burrow-gtk/src/daemon.rs b/burrow-gtk/src/daemon.rs new file mode 100644 index 00000000..dc47f247 --- /dev/null +++ b/burrow-gtk/src/daemon.rs @@ -0,0 +1,17 @@ +use anyhow::Result; +use hyper_util::rt::TokioIo; +use tokio::net::UnixStream; +use tonic::transport::{Channel, Endpoint, Uri}; +use tower::service_fn; + +const BURROW_RPC_SOCKET_PATH: &str = "/run/burrow.sock"; + +pub async fn daemon_connect() -> Result { + Ok(Endpoint::try_from("http://[::]:50051")? + .connect_with_connector(service_fn(|_: Uri| async { + Ok::<_, std::io::Error>(TokioIo::new( + UnixStream::connect(BURROW_RPC_SOCKET_PATH).await?, + )) + })) + .await?) +} diff --git a/burrow-gtk/src/main.rs b/burrow-gtk/src/main.rs index 6f91e2af..66e6b36a 100644 --- a/burrow-gtk/src/main.rs +++ b/burrow-gtk/src/main.rs @@ -1,6 +1,7 @@ use anyhow::Result; pub mod components; +mod daemon; mod diag; // Generated using meson From 74325059a7e11dfc3060def2a59b2bb9421231d9 Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 13 Jul 2024 16:56:32 -0700 Subject: [PATCH 03/16] Add proto defs into burrow-gtk --- burrow-gtk/proto/burrow.proto | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 burrow-gtk/proto/burrow.proto diff --git a/burrow-gtk/proto/burrow.proto b/burrow-gtk/proto/burrow.proto new file mode 100644 index 00000000..e0415ad1 --- /dev/null +++ b/burrow-gtk/proto/burrow.proto @@ -0,0 +1,73 @@ +syntax = "proto3"; +package burrow; + +import "google/protobuf/timestamp.proto"; + +service Tunnel { + rpc TunnelConfiguration (Empty) returns (TunnelConfigurationResponse); + rpc TunnelStart (Empty) returns (Empty); + rpc TunnelStop (Empty) returns (Empty); + rpc TunnelStatus (Empty) returns (stream TunnelStatusResponse); +} + +service Networks { + rpc NetworkAdd (Empty) returns (Empty); + rpc NetworkList (Empty) returns (stream NetworkListResponse); + rpc NetworkReorder (NetworkReorderRequest) returns (Empty); + rpc NetworkDelete (NetworkDeleteRequest) returns (Empty); +} + +message NetworkReorderRequest { + int32 id = 1; + int32 index = 2; +} + +message WireGuardPeer { + string endpoint = 1; + repeated string subnet = 2; +} + +message WireGuardNetwork { + string address = 1; + string dns = 2; + repeated WireGuardPeer peer = 3; +} + +message NetworkDeleteRequest { + int32 id = 1; +} + +message Network { + int32 id = 1; + NetworkType type = 2; + bytes payload = 3; +} + +enum NetworkType { + WireGuard = 0; + HackClub = 1; +} + +message NetworkListResponse { + repeated Network network = 1; +} + +message Empty { + +} + +enum State { + Stopped = 0; + Running = 1; +} + +message TunnelStatusResponse { + State state = 1; + optional google.protobuf.Timestamp start = 2; +} + +message TunnelConfigurationResponse { + repeated string addresses = 1; + int32 mtu = 2; +} + From 753e50f79d77a88a677301182b38b1feb8a835c7 Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 13 Jul 2024 17:00:46 -0700 Subject: [PATCH 04/16] Have the app actually open --- burrow-gtk/build.rs | 2 +- burrow-gtk/src/components/app.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/burrow-gtk/build.rs b/burrow-gtk/build.rs index df2e3d29..2e4d607a 100644 --- a/burrow-gtk/build.rs +++ b/burrow-gtk/build.rs @@ -2,7 +2,7 @@ use anyhow::Result; fn main() -> Result<()> { compile_gresources()?; - tonic_build::compile_protos("../proto/burrow.proto")?; + tonic_build::compile_protos("proto/burrow.proto")?; Ok(()) } diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index 6d64fa01..efbaa23f 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -59,7 +59,7 @@ impl AsyncComponent for App { sender: AsyncComponentSender, ) -> AsyncComponentParts { // TODO: RPC REFACTOR (Handle Error) - let daemon_client = Arc::new(Mutex::new(Some(daemon::daemon_connect().await.unwrap()))); + let daemon_client = Arc::new(Mutex::new(daemon::daemon_connect().await.ok())); let switch_screen = switch_screen::SwitchScreen::builder() .launch(switch_screen::SwitchScreenInit { From 87cea6bf647fd111d3882e6e958d9f1c58079e5a Mon Sep 17 00:00:00 2001 From: David Zhong <91637806+davnotdev@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:17:17 -0700 Subject: [PATCH 05/16] Remove TODO comment --- burrow-gtk/src/components/app.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index efbaa23f..ea6890ef 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -58,7 +58,6 @@ impl AsyncComponent for App { root: Self::Root, sender: AsyncComponentSender, ) -> AsyncComponentParts { - // TODO: RPC REFACTOR (Handle Error) let daemon_client = Arc::new(Mutex::new(daemon::daemon_connect().await.ok())); let switch_screen = switch_screen::SwitchScreen::builder() From 9a262a1243f32029a5ce477cd66d05d545d34e40 Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 20 Jul 2024 12:59:02 -0700 Subject: [PATCH 06/16] Tested with mock grpc server --- burrow-gtk/src/components/app.rs | 2 +- burrow-gtk/src/components/mod.rs | 1 - burrow-gtk/src/components/switch_screen.rs | 85 ++++++++++------------ 3 files changed, 41 insertions(+), 47 deletions(-) diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index ea6890ef..333b6f1e 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -122,7 +122,6 @@ impl AsyncComponent for App { _root: &Self::Root, ) { loop { - tokio::time::sleep(RECONNECT_POLL_TIME).await; { let mut daemon_client = self.daemon_client.lock().await; let mut disconnected_daemon_client = false; @@ -153,6 +152,7 @@ impl AsyncComponent for App { } } } + tokio::time::sleep(RECONNECT_POLL_TIME).await; } } } diff --git a/burrow-gtk/src/components/mod.rs b/burrow-gtk/src/components/mod.rs index 7490b820..21c51e5d 100644 --- a/burrow-gtk/src/components/mod.rs +++ b/burrow-gtk/src/components/mod.rs @@ -3,7 +3,6 @@ use adw::prelude::*; use gtk::Align; use relm4::{ component::{ - worker::{Worker, WorkerController}, AsyncComponent, AsyncComponentController, AsyncComponentParts, AsyncComponentSender, AsyncController, }, diff --git a/burrow-gtk/src/components/switch_screen.rs b/burrow-gtk/src/components/switch_screen.rs index 72588541..9af3ba60 100644 --- a/burrow-gtk/src/components/switch_screen.rs +++ b/burrow-gtk/src/components/switch_screen.rs @@ -1,5 +1,8 @@ use super::*; -use std::time::Duration; +use std::{ + thread::{self, JoinHandle}, + time::Duration, +}; const RECONNECT_POLL_TIME: Duration = Duration::from_secs(3); @@ -8,8 +11,7 @@ pub struct SwitchScreen { switch: gtk::Switch, switch_screen: gtk::Box, disconnected_banner: adw::Banner, - - _tunnel_state_worker: WorkerController, + tunnel_state_worker: JoinHandle<()>, } pub struct SwitchScreenInit { @@ -18,13 +20,12 @@ pub struct SwitchScreenInit { #[derive(Debug, PartialEq, Eq)] pub enum SwitchScreenMsg { - None, DaemonReconnect, DaemonDisconnect, Start, Stop, - SwitchSetStart, - SwitchSetStop, + TunnelStateStopped, + TunnelStateRunning, } #[relm4::component(pub, async)] @@ -97,6 +98,7 @@ impl AsyncComponent for SwitchScreen { } let switch_sender = sender.clone(); + let tunnel_state_sender = sender.clone(); let widgets = view_output!(); if initial_daemon_server_down { @@ -111,9 +113,9 @@ impl AsyncComponent for SwitchScreen { switch: widgets.switch.clone(), switch_screen: widgets.switch_screen.clone(), disconnected_banner: widgets.setup_banner.clone(), - _tunnel_state_worker: AsyncTunnelStateHandler::builder() - .detach_worker(()) - .forward(sender.input_sender(), |_| SwitchScreenMsg::None), + tunnel_state_worker: thread::spawn(move || { + tunnel_state_worker(tunnel_state_sender); + }), }; widgets.switch.set_active(false); @@ -133,21 +135,21 @@ impl AsyncComponent for SwitchScreen { let mut client = tunnel_client::TunnelClient::new(daemon_client); match msg { Self::Input::Start => { - if let Err(_e) = client.tunnel_start(burrow_rpc::Empty {}).await { + if let Err(e) = client.tunnel_start(burrow_rpc::Empty {}).await { disconnected_daemon_client = true; } } Self::Input::Stop => { - if let Err(_e) = client.tunnel_stop(burrow_rpc::Empty {}).await { + if let Err(e) = client.tunnel_stop(burrow_rpc::Empty {}).await { disconnected_daemon_client = true; } } - Self::Input::SwitchSetStart => { - self.switch.set_active(true); - } - Self::Input::SwitchSetStop => { + Self::Input::TunnelStateStopped => { self.switch.set_active(false); } + Self::Input::TunnelStateRunning => { + self.switch.set_active(true); + } _ => {} } } else { @@ -166,39 +168,32 @@ impl AsyncComponent for SwitchScreen { } } } -struct AsyncTunnelStateHandler; -impl Worker for AsyncTunnelStateHandler { - type Init = (); - type Input = (); - type Output = SwitchScreenMsg; - - fn init(_: Self::Init, _sender: ComponentSender) -> Self { - Self - } - - fn update(&mut self, _: (), sender: ComponentSender) { - let rt = tokio::runtime::Runtime::new().unwrap(); - let task = rt.spawn(async move { - loop { - let conn = daemon::daemon_connect().await; - if let Ok(conn) = conn { - let mut client = tunnel_client::TunnelClient::new(conn); - if let Ok(mut res) = client.tunnel_status(burrow_rpc::Empty {}).await { - let stream = res.get_mut(); - while let Ok(Some(msg)) = stream.message().await { - sender - .output(match msg.state() { - burrow_rpc::State::Running => SwitchScreenMsg::SwitchSetStart, - burrow_rpc::State::Stopped => SwitchScreenMsg::SwitchSetStop, - }) - .unwrap(); +fn tunnel_state_worker(sender: AsyncComponentSender) { + let rt = tokio::runtime::Runtime::new().unwrap(); + let task = rt.spawn(async move { + loop { + let sender = sender.input_sender(); + let conn = daemon::daemon_connect().await; + if let Ok(conn) = conn { + let mut client = tunnel_client::TunnelClient::new(conn); + if let Ok(mut res) = client.tunnel_status(burrow_rpc::Empty {}).await { + let stream = res.get_mut(); + while let Ok(Some(msg)) = stream.message().await { + match msg.state() { + burrow_rpc::State::Stopped => { + sender.send(SwitchScreenMsg::TunnelStateStopped) + } + burrow_rpc::State::Running => { + sender.send(SwitchScreenMsg::TunnelStateRunning) + } } + .unwrap(); } } - tokio::time::sleep(RECONNECT_POLL_TIME).await; } - }); - rt.block_on(task).unwrap(); - } + tokio::time::sleep(RECONNECT_POLL_TIME).await; + } + }); + rt.block_on(task).unwrap(); } From 37fb4f497425181e504bbc8d30cb7ce775e0f479 Mon Sep 17 00:00:00 2001 From: dav Date: Wed, 14 Aug 2024 15:38:52 -0700 Subject: [PATCH 07/16] Bad workaround for local appimage daemon --- .../src/components/settings/daemon_group.rs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/burrow-gtk/src/components/settings/daemon_group.rs b/burrow-gtk/src/components/settings/daemon_group.rs index ef22000e..73f647b3 100644 --- a/burrow-gtk/src/components/settings/daemon_group.rs +++ b/burrow-gtk/src/components/settings/daemon_group.rs @@ -30,8 +30,8 @@ impl AsyncComponent for DaemonGroup { #[name(group)] adw::PreferencesGroup { #[watch] - set_sensitive: - (model.system_setup == SystemSetup::AppImage || model.system_setup == SystemSetup::Other) && + set_sensitive: + (model.system_setup == SystemSetup::AppImage || model.system_setup == SystemSetup::Other) && !model.already_running, set_title: "Local Daemon", set_description: Some("Run Local Daemon"), @@ -68,27 +68,32 @@ impl AsyncComponent for DaemonGroup { ) { match msg { DaemonGroupMsg::LaunchLocal => { + // TODO: Handle error condition + + const BURROW_LOCAL_DAEMON_PATH: &str = "/tmp/burrow-detached-daemon"; + let burrow_original_bin = std::env::vars() .find(|(k, _)| k == "APPDIR") .map(|(_, v)| v + "/usr/bin/burrow") .unwrap_or("/usr/bin/burrow".to_owned()); + Command::new("cp") + .arg(&burrow_original_bin) + .arg(BURROW_LOCAL_DAEMON_PATH) + .output() + .unwrap(); + let mut burrow_bin = String::from_utf8(Command::new("mktemp").output().unwrap().stdout).unwrap(); burrow_bin.pop(); let privileged_spawn_script = format!( - r#"TEMP=$(mktemp -p /root) -cp {} $TEMP -chmod +x $TEMP -setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN+eip $TEMP -mv $TEMP /tmp/burrow-detached-daemon"#, - burrow_original_bin + r#"chmod +x {} +setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN+eip {}"#, + BURROW_LOCAL_DAEMON_PATH, BURROW_LOCAL_DAEMON_PATH ) .replace('\n', "&&"); - // TODO: Handle error condition - Command::new("pkexec") .arg("sh") .arg("-c") @@ -97,7 +102,7 @@ mv $TEMP /tmp/burrow-detached-daemon"#, .output() .unwrap(); - Command::new("/tmp/burrow-detached-daemon") + Command::new(BURROW_LOCAL_DAEMON_PATH) .env("RUST_LOG", "debug") .arg("daemon") .spawn() From dbacf93418e4b7a2539258a83bc00a5f84dbe0d2 Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 13 Jul 2024 18:15:16 -0700 Subject: [PATCH 08/16] Create main screen with placeholder networks --- burrow-gtk/src/components/app.rs | 18 +- burrow-gtk/src/components/main/mod.rs | 9 + .../src/components/main/network_card.rs | 49 +++++ burrow-gtk/src/components/main/networks.rs | 83 +++++++ burrow-gtk/src/components/main/switch.rs | 205 ++++++++++++++++++ burrow-gtk/src/components/main_screen.rs | 109 ++++++++++ burrow-gtk/src/components/mod.rs | 4 +- burrow-gtk/src/components/template.rs | 39 ++++ 8 files changed, 506 insertions(+), 10 deletions(-) create mode 100644 burrow-gtk/src/components/main/mod.rs create mode 100644 burrow-gtk/src/components/main/network_card.rs create mode 100644 burrow-gtk/src/components/main/networks.rs create mode 100644 burrow-gtk/src/components/main/switch.rs create mode 100644 burrow-gtk/src/components/main_screen.rs create mode 100644 burrow-gtk/src/components/template.rs diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index 333b6f1e..0fa587c0 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -7,7 +7,7 @@ const RECONNECT_POLL_TIME: Duration = Duration::from_secs(5); pub struct App { daemon_client: Arc>>, settings_screen: Controller, - switch_screen: AsyncController, + main_screen: AsyncController, } #[derive(Debug)] @@ -60,8 +60,8 @@ impl AsyncComponent for App { ) -> AsyncComponentParts { let daemon_client = Arc::new(Mutex::new(daemon::daemon_connect().await.ok())); - let switch_screen = switch_screen::SwitchScreen::builder() - .launch(switch_screen::SwitchScreenInit { + let main_screen = main_screen::MainScreen::builder() + .launch(main_screen::MainScreenInit { daemon_client: Arc::clone(&daemon_client), }) .forward(sender.input_sender(), |_| AppMsg::None); @@ -75,7 +75,7 @@ impl AsyncComponent for App { let widgets = view_output!(); let view_stack = adw::ViewStack::new(); - view_stack.add_titled(switch_screen.widget(), None, "Switch"); + view_stack.add_titled(main_screen.widget(), None, "Burrow"); view_stack.add_titled(settings_screen.widget(), None, "Settings"); let view_switcher_bar = adw::ViewSwitcherBar::builder().stack(&view_stack).build(); @@ -108,7 +108,7 @@ impl AsyncComponent for App { let model = App { daemon_client, - switch_screen, + main_screen, settings_screen, }; @@ -130,8 +130,8 @@ impl AsyncComponent for App { let mut client = tunnel_client::TunnelClient::new(daemon_client); if let Err(_e) = client.tunnel_status(burrow_rpc::Empty {}).await { disconnected_daemon_client = true; - self.switch_screen - .emit(switch_screen::SwitchScreenMsg::DaemonDisconnect); + self.main_screen + .emit(main_screen::MainScreenMsg::DaemonDisconnect); self.settings_screen .emit(settings_screen::SettingsScreenMsg::DaemonStateChange) } @@ -141,8 +141,8 @@ impl AsyncComponent for App { match daemon::daemon_connect().await { Ok(new_daemon_client) => { *daemon_client = Some(new_daemon_client); - self.switch_screen - .emit(switch_screen::SwitchScreenMsg::DaemonReconnect); + self.main_screen + .emit(main_screen::MainScreenMsg::DaemonReconnect); self.settings_screen .emit(settings_screen::SettingsScreenMsg::DaemonStateChange) } diff --git a/burrow-gtk/src/components/main/mod.rs b/burrow-gtk/src/components/main/mod.rs new file mode 100644 index 00000000..8e03b41e --- /dev/null +++ b/burrow-gtk/src/components/main/mod.rs @@ -0,0 +1,9 @@ +use super::*; + +mod network_card; +mod networks; +mod switch; + +pub use network_card::{NetworkCard, NetworkCardInit}; +pub use networks::{Networks, NetworksInit}; +pub use switch::{Switch, SwitchInit, SwitchMsg}; diff --git a/burrow-gtk/src/components/main/network_card.rs b/burrow-gtk/src/components/main/network_card.rs new file mode 100644 index 00000000..be75066e --- /dev/null +++ b/burrow-gtk/src/components/main/network_card.rs @@ -0,0 +1,49 @@ +use super::*; + +pub struct NetworkCard {} + +pub struct NetworkCardInit { + pub name: String, + pub enabled: bool, +} + +#[derive(Debug)] +pub enum NetworkCardMsg {} + +#[relm4::component(pub, async)] +impl AsyncComponent for NetworkCard { + type Init = NetworkCardInit; + type Input = NetworkCardMsg; + type Output = (); + type CommandOutput = (); + + view! { + gtk::ListBoxRow { + set_hexpand: true, + set_halign: Align::Center, + gtk::Box { + gtk::Label { + set_label: &init.name + }, + gtk::Switch { + set_halign: Align::Center, + set_hexpand: false, + set_vexpand: false, + set_state: init.enabled, + }, + } + } + } + + async fn init( + init: Self::Init, + root: Self::Root, + sender: AsyncComponentSender, + ) -> AsyncComponentParts { + let widgets = view_output!(); + + let model = NetworkCard {}; + + AsyncComponentParts { model, widgets } + } +} diff --git a/burrow-gtk/src/components/main/networks.rs b/burrow-gtk/src/components/main/networks.rs new file mode 100644 index 00000000..6372e65c --- /dev/null +++ b/burrow-gtk/src/components/main/networks.rs @@ -0,0 +1,83 @@ +use super::*; + +pub struct Networks { + daemon_client: Arc>>, + network_widgets: Vec>, +} + +pub struct NetworksInit { + pub daemon_client: Arc>>, +} + +#[derive(Debug)] +pub enum NetworksMsg { + None, +} + +#[relm4::component(pub, async)] +impl AsyncComponent for Networks { + type Init = NetworksInit; + type Input = NetworksMsg; + type Output = (); + type CommandOutput = (); + + view! { + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_spacing: 5, + set_margin_all: 5, + set_valign: Align::Start, + + #[name = "networks"] + gtk::ListBox {} + } + } + + async fn init( + init: Self::Init, + root: Self::Root, + sender: AsyncComponentSender, + ) -> AsyncComponentParts { + let widgets = view_output!(); + + let network_widgets = vec![ + NetworkCard::builder() + .launch(NetworkCardInit { + name: "Hello".to_owned(), + enabled: true, + }) + .forward(sender.input_sender(), |_| NetworksMsg::None), + NetworkCard::builder() + .launch(NetworkCardInit { + name: "World".to_owned(), + enabled: false, + }) + .forward(sender.input_sender(), |_| NetworksMsg::None), + NetworkCard::builder() + .launch(NetworkCardInit { + name: "Yay".to_owned(), + enabled: false, + }) + .forward(sender.input_sender(), |_| NetworksMsg::None), + ]; + + widgets.networks.append(network_widgets[0].widget()); + widgets.networks.append(network_widgets[1].widget()); + widgets.networks.append(network_widgets[2].widget()); + + let model = Networks { + daemon_client: init.daemon_client, + network_widgets, + }; + + AsyncComponentParts { model, widgets } + } + + async fn update( + &mut self, + msg: Self::Input, + _: AsyncComponentSender, + _root: &Self::Root, + ) { + } +} diff --git a/burrow-gtk/src/components/main/switch.rs b/burrow-gtk/src/components/main/switch.rs new file mode 100644 index 00000000..5958e834 --- /dev/null +++ b/burrow-gtk/src/components/main/switch.rs @@ -0,0 +1,205 @@ +use super::*; +use std::time::Duration; + +const RECONNECT_POLL_TIME: Duration = Duration::from_secs(3); + +pub struct Switch { + daemon_client: Arc>>, + switch: gtk::Switch, + switch_screen: gtk::Box, + disconnected_banner: adw::Banner, + + _tunnel_state_worker: WorkerController, +} + +pub struct SwitchInit { + pub daemon_client: Arc>>, +} + +#[derive(Debug, PartialEq, Eq)] +pub enum SwitchMsg { + None, + DaemonReconnect, + DaemonDisconnect, + Start, + Stop, + SwitchSetStart, + SwitchSetStop, +} + +#[relm4::component(pub, async)] +impl AsyncComponent for Switch { + type Init = SwitchInit; + type Input = SwitchMsg; + type Output = (); + type CommandOutput = (); + + view! { + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_valign: Align::Fill, + + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_spacing: 5, + set_margin_all: 5, + set_valign: Align::Start, + + #[name(setup_banner)] + adw::Banner { + set_title: "Burrow is not running!", + }, + }, + + #[name(switch_screen)] + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_spacing: 10, + set_margin_all: 5, + set_valign: Align::Center, + set_vexpand: true, + + gtk::Label { + set_label: "Burrow Switch", + }, + + #[name(switch)] + gtk::Switch { + set_halign: Align::Center, + set_hexpand: false, + set_vexpand: false, + connect_active_notify => move |switch| + switch_sender.input(if switch.is_active() { SwitchMsg::Start } else { SwitchMsg::Stop }) + }, + } + } + } + + async fn init( + init: Self::Init, + root: Self::Root, + sender: AsyncComponentSender, + ) -> AsyncComponentParts { + let mut initial_daemon_server_down = false; + + if let Some(daemon_client) = init.daemon_client.lock().await.as_mut() { + let mut client = tunnel_client::TunnelClient::new(daemon_client); + if client + .tunnel_status(burrow_rpc::Empty {}) + .await + .as_mut() + .is_err() + { + initial_daemon_server_down = true; + } + } else { + initial_daemon_server_down = true; + } + + let switch_sender = sender.clone(); + let widgets = view_output!(); + + if initial_daemon_server_down { + *init.daemon_client.lock().await = None; + widgets.switch.set_active(false); + widgets.switch_screen.set_sensitive(false); + widgets.setup_banner.set_revealed(true); + } + + let model = Switch { + daemon_client: init.daemon_client, + switch: widgets.switch.clone(), + switch_screen: widgets.switch_screen.clone(), + disconnected_banner: widgets.setup_banner.clone(), + _tunnel_state_worker: AsyncTunnelStateHandler::builder() + .detach_worker(()) + .forward(sender.input_sender(), |_| SwitchMsg::None), + }; + + widgets.switch.set_active(false); + + AsyncComponentParts { model, widgets } + } + + async fn update( + &mut self, + msg: Self::Input, + _: AsyncComponentSender, + _root: &Self::Root, + ) { + let mut disconnected_daemon_client = false; + + if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { + let mut client = tunnel_client::TunnelClient::new(daemon_client); + match msg { + Self::Input::Start => { + if let Err(_e) = client.tunnel_start(burrow_rpc::Empty {}).await { + disconnected_daemon_client = true; + } + } + Self::Input::Stop => { + if let Err(_e) = client.tunnel_stop(burrow_rpc::Empty {}).await { + disconnected_daemon_client = true; + } + } + Self::Input::SwitchSetStart => { + self.switch.set_active(true); + } + Self::Input::SwitchSetStop => { + self.switch.set_active(false); + } + _ => {} + } + } else { + disconnected_daemon_client = true; + } + + if msg == Self::Input::DaemonReconnect { + self.disconnected_banner.set_revealed(false); + self.switch_screen.set_sensitive(true); + } + + if disconnected_daemon_client || msg == Self::Input::DaemonDisconnect { + *self.daemon_client.lock().await = None; + self.switch_screen.set_sensitive(false); + self.disconnected_banner.set_revealed(true); + } + } +} + +struct AsyncTunnelStateHandler; + +impl Worker for AsyncTunnelStateHandler { + type Init = (); + type Input = (); + type Output = SwitchMsg; + + fn init(_: Self::Init, _sender: ComponentSender) -> Self { + Self + } + + fn update(&mut self, _: (), sender: ComponentSender) { + let rt = tokio::runtime::Runtime::new().unwrap(); + let task = rt.spawn(async move { + loop { + let conn = daemon::daemon_connect().await; + if let Ok(conn) = conn { + let mut client = tunnel_client::TunnelClient::new(conn); + if let Ok(mut res) = client.tunnel_status(burrow_rpc::Empty {}).await { + let stream = res.get_mut(); + while let Ok(Some(msg)) = stream.message().await { + sender + .output(match msg.state() { + burrow_rpc::State::Running => SwitchMsg::SwitchSetStart, + burrow_rpc::State::Stopped => SwitchMsg::SwitchSetStop, + }) + .unwrap(); + } + } + } + tokio::time::sleep(RECONNECT_POLL_TIME).await; + } + }); + rt.block_on(task).unwrap(); + } +} diff --git a/burrow-gtk/src/components/main_screen.rs b/burrow-gtk/src/components/main_screen.rs new file mode 100644 index 00000000..52dd98a7 --- /dev/null +++ b/burrow-gtk/src/components/main_screen.rs @@ -0,0 +1,109 @@ +use super::*; + +pub struct MainScreen { + switch: AsyncController, +} + +pub struct MainScreenInit { + pub daemon_client: Arc>>, +} + +#[derive(Debug)] +pub enum MainScreenMsg { + None, + DaemonDisconnect, + DaemonReconnect, +} + +#[relm4::component(pub, async)] +impl AsyncComponent for MainScreen { + type Init = MainScreenInit; + type Input = MainScreenMsg; + type Output = (); + type CommandOutput = (); + + view! { + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_valign: Align::Fill, + set_valign: Align::Center, + + // gtk::Box { + // set_orientation: gtk::Orientation::Vertical, + // set_spacing: 5, + // set_margin_all: 5, + // set_valign: Align::Start, + + // #[name(setup_banner)] + // adw::Banner { + // set_title: "Burrow is not running!", + // }, + // }, + + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_spacing: 10, + set_margin_all: 5, + set_valign: Align::Center, + set_vexpand: true, + }, + + #[name(content)] + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_spacing: 10, + set_margin_all: 5, + set_valign: Align::Center, + set_vexpand: true, + + gtk::Label { + set_label: "Main Screen", + }, + } + } + } + + async fn init( + init: Self::Init, + root: Self::Root, + sender: AsyncComponentSender, + ) -> AsyncComponentParts { + let switch = main::Switch::builder() + .launch(main::SwitchInit { + daemon_client: Arc::clone(&init.daemon_client), + }) + .forward(sender.input_sender(), |_| MainScreenMsg::None); + + let networks = main::Networks::builder() + .launch(main::NetworksInit { + daemon_client: Arc::clone(&init.daemon_client), + }) + .forward(sender.input_sender(), |_| MainScreenMsg::None); + + let widgets = view_output!(); + + widgets.content.append(networks.widget()); + widgets.content.append(switch.widget()); + + let model = MainScreen { switch }; + + AsyncComponentParts { model, widgets } + } + + async fn update( + &mut self, + msg: Self::Input, + _: AsyncComponentSender, + _root: &Self::Root, + ) { + match msg { + MainScreenMsg::DaemonDisconnect => { + self.switch.emit(main::SwitchMsg::DaemonDisconnect); + } + MainScreenMsg::DaemonReconnect => { + self.switch.emit(main::SwitchMsg::DaemonReconnect); + } + _ => {} + } + } +} diff --git a/burrow-gtk/src/components/mod.rs b/burrow-gtk/src/components/mod.rs index 21c51e5d..39608de1 100644 --- a/burrow-gtk/src/components/mod.rs +++ b/burrow-gtk/src/components/mod.rs @@ -18,9 +18,11 @@ use burrow_rpc::tunnel_client; use tonic::transport::Channel; mod app; +mod main; +mod main_screen; mod settings; mod settings_screen; -mod switch_screen; +// mod switch_screen; pub use app::*; pub use settings::{DaemonGroupMsg, DiagGroupMsg}; diff --git a/burrow-gtk/src/components/template.rs b/burrow-gtk/src/components/template.rs new file mode 100644 index 00000000..800a5c95 --- /dev/null +++ b/burrow-gtk/src/components/template.rs @@ -0,0 +1,39 @@ +pub struct Template {} + +pub struct TemplateInit {} + +#[derive(Debug)] +pub enum TemplateMsg {} + +#[relm4::component(pub, async)] +impl AsyncComponent for Template { + type Init = TemplateInit; + type Input = TemplateMsg; + type Output = (); + type CommandOutput = (); + + view! { + gtk::Box { + } + } + + async fn init( + init: Self::Init, + root: Self::Root, + sender: AsyncComponentSender, + ) -> AsyncComponentParts { + let widgets = view_output!(); + + let model = Template {}; + + AsyncComponentParts { model, widgets } + } + + async fn update( + &mut self, + msg: Self::Input, + _: AsyncComponentSender, + _root: &Self::Root, + ) { + } +} From 54e9e0bc43d09d8744de6a9b7342a99eb521dabb Mon Sep 17 00:00:00 2001 From: dav Date: Wed, 14 Aug 2024 16:27:54 -0700 Subject: [PATCH 09/16] Connect network list to rpc --- burrow-gtk/src/components/main/networks.rs | 70 +++++++++++++++++++--- burrow-gtk/src/components/mod.rs | 2 +- 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/burrow-gtk/src/components/main/networks.rs b/burrow-gtk/src/components/main/networks.rs index 6372e65c..809c741c 100644 --- a/burrow-gtk/src/components/main/networks.rs +++ b/burrow-gtk/src/components/main/networks.rs @@ -1,8 +1,12 @@ use super::*; +use std::time::Duration; + +const RECONNECT_POLL_TIME: Duration = Duration::from_secs(3); pub struct Networks { daemon_client: Arc>>, - network_widgets: Vec>, + network_cards: Vec>, + networks_list_box: gtk::ListBox, } pub struct NetworksInit { @@ -12,6 +16,7 @@ pub struct NetworksInit { #[derive(Debug)] pub enum NetworksMsg { None, + NetworkList(Vec), } #[relm4::component(pub, async)] @@ -40,7 +45,7 @@ impl AsyncComponent for Networks { ) -> AsyncComponentParts { let widgets = view_output!(); - let network_widgets = vec![ + let network_cards = vec![ NetworkCard::builder() .launch(NetworkCardInit { name: "Hello".to_owned(), @@ -61,13 +66,10 @@ impl AsyncComponent for Networks { .forward(sender.input_sender(), |_| NetworksMsg::None), ]; - widgets.networks.append(network_widgets[0].widget()); - widgets.networks.append(network_widgets[1].widget()); - widgets.networks.append(network_widgets[2].widget()); - let model = Networks { daemon_client: init.daemon_client, - network_widgets, + network_cards, + networks_list_box: widgets.networks.clone(), }; AsyncComponentParts { model, widgets } @@ -76,8 +78,60 @@ impl AsyncComponent for Networks { async fn update( &mut self, msg: Self::Input, - _: AsyncComponentSender, + sender: AsyncComponentSender, _root: &Self::Root, ) { + if let NetworksMsg::NetworkList(networks) = msg { + for network_card in self.network_cards.iter() { + self.networks_list_box + .remove(&network_card.widget().clone()); + } + self.network_cards.clear(); + + for network in networks { + let network_card = NetworkCard::builder() + .launch(NetworkCardInit { + name: format!("ID: {}, TYPE: {}", network.id, network.r#type), + enabled: false, + }) + .forward(sender.input_sender(), |_| NetworksMsg::None); + self.networks_list_box.append(network_card.widget()); + self.network_cards.push(network_card); + } + } + } +} + +struct AsyncNetworkStateHandler; + +impl Worker for AsyncNetworkStateHandler { + type Init = (); + type Input = (); + type Output = NetworksMsg; + + fn init(_: Self::Init, _sender: ComponentSender) -> Self { + Self + } + + fn update(&mut self, _: (), sender: ComponentSender) { + let rt = tokio::runtime::Runtime::new().unwrap(); + let task = rt.spawn(async move { + loop { + let conn = daemon::daemon_connect().await; + if let Ok(conn) = conn { + let mut client = networks_client::NetworksClient::new(conn); + if let Ok(mut res) = client.network_list(burrow_rpc::Empty {}).await { + let stream = res.get_mut(); + while let Ok(Some(msg)) = stream.message().await { + sender + .output(NetworksMsg::NetworkList(msg.network)) + .unwrap(); + } + } + } + tokio::time::sleep(RECONNECT_POLL_TIME).await; + } + }); + rt.block_on(task).unwrap(); } } diff --git a/burrow-gtk/src/components/mod.rs b/burrow-gtk/src/components/mod.rs index 39608de1..cc9196b3 100644 --- a/burrow-gtk/src/components/mod.rs +++ b/burrow-gtk/src/components/mod.rs @@ -14,7 +14,7 @@ use tokio::sync::Mutex; pub mod burrow_rpc { tonic::include_proto!("burrow"); } -use burrow_rpc::tunnel_client; +use burrow_rpc::{networks_client, tunnel_client}; use tonic::transport::Channel; mod app; From fec725bc52f481a7e1e552215ae20aeabad8c3cc Mon Sep 17 00:00:00 2001 From: dav Date: Fri, 16 Aug 2024 16:01:28 -0700 Subject: [PATCH 10/16] Implement networks add delete and reoder --- .../src/components/main/network_card.rs | 89 ++++++++++++++++++- burrow-gtk/src/components/main/networks.rs | 70 +++++++++++---- burrow-gtk/src/components/main_screen.rs | 3 +- 3 files changed, 142 insertions(+), 20 deletions(-) diff --git a/burrow-gtk/src/components/main/network_card.rs b/burrow-gtk/src/components/main/network_card.rs index be75066e..41a1aa2c 100644 --- a/burrow-gtk/src/components/main/network_card.rs +++ b/burrow-gtk/src/components/main/network_card.rs @@ -1,14 +1,27 @@ use super::*; -pub struct NetworkCard {} +pub struct NetworkCard { + id: i32, + index: usize, + index_max: usize, + daemon_client: Arc>>, +} pub struct NetworkCardInit { + pub id: i32, + pub index: usize, + pub index_max: usize, pub name: String, pub enabled: bool, + pub daemon_client: Arc>>, } #[derive(Debug)] -pub enum NetworkCardMsg {} +pub enum NetworkCardMsg { + NetworkDelete, + MoveUp, + MoveDown, +} #[relm4::component(pub, async)] impl AsyncComponent for NetworkCard { @@ -31,6 +44,24 @@ impl AsyncComponent for NetworkCard { set_vexpand: false, set_state: init.enabled, }, + gtk::Button { + set_icon_name: "list-remove", + set_margin_all: 12, + + connect_clicked => NetworkCardMsg::NetworkDelete, + }, + gtk::Button { + set_icon_name: "pan-up-symbolic", + set_margin_all: 12, + + connect_clicked => NetworkCardMsg::MoveUp, + }, + gtk::Button { + set_icon_name: "pan-down-symbolic", + set_margin_all: 12, + + connect_clicked => NetworkCardMsg::MoveDown, + }, } } } @@ -42,8 +73,60 @@ impl AsyncComponent for NetworkCard { ) -> AsyncComponentParts { let widgets = view_output!(); - let model = NetworkCard {}; + let model = NetworkCard { + id: init.id, + index: init.index, + index_max: init.index_max, + daemon_client: init.daemon_client, + }; AsyncComponentParts { model, widgets } } + + async fn update( + &mut self, + msg: Self::Input, + sender: AsyncComponentSender, + _root: &Self::Root, + ) { + match msg { + NetworkCardMsg::NetworkDelete => { + if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { + let mut client = networks_client::NetworksClient::new(daemon_client); + client + .network_delete(burrow_rpc::NetworkDeleteRequest { id: self.id }) + .await + .unwrap(); + } + } + NetworkCardMsg::MoveUp => { + if self.index.checked_sub(1).is_some() { + if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { + let mut client = networks_client::NetworksClient::new(daemon_client); + client + .network_reorder(burrow_rpc::NetworkReorderRequest { + id: self.id, + index: self.index as i32 - 1, + }) + .await + .unwrap(); + } + } + } + NetworkCardMsg::MoveDown => { + if self.index + 1 < self.index_max { + if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { + let mut client = networks_client::NetworksClient::new(daemon_client); + client + .network_reorder(burrow_rpc::NetworkReorderRequest { + id: self.id, + index: self.index as i32 + 1, + }) + .await + .unwrap(); + } + } + } + } + } } diff --git a/burrow-gtk/src/components/main/networks.rs b/burrow-gtk/src/components/main/networks.rs index 809c741c..5c63b944 100644 --- a/burrow-gtk/src/components/main/networks.rs +++ b/burrow-gtk/src/components/main/networks.rs @@ -17,6 +17,7 @@ pub struct NetworksInit { pub enum NetworksMsg { None, NetworkList(Vec), + NetworkAdd, } #[relm4::component(pub, async)] @@ -34,7 +35,14 @@ impl AsyncComponent for Networks { set_valign: Align::Start, #[name = "networks"] - gtk::ListBox {} + gtk::ListBox {}, + + gtk::Button { + set_icon_name: "list-add", + set_margin_all: 12, + + connect_clicked => NetworksMsg::NetworkAdd, + }, } } @@ -48,23 +56,39 @@ impl AsyncComponent for Networks { let network_cards = vec![ NetworkCard::builder() .launch(NetworkCardInit { + id: 0, + index: 0, + index_max: 3, + daemon_client: Arc::clone(&init.daemon_client), name: "Hello".to_owned(), enabled: true, }) .forward(sender.input_sender(), |_| NetworksMsg::None), NetworkCard::builder() .launch(NetworkCardInit { + id: 1, + index: 1, + index_max: 3, + daemon_client: Arc::clone(&init.daemon_client), name: "World".to_owned(), enabled: false, }) .forward(sender.input_sender(), |_| NetworksMsg::None), NetworkCard::builder() .launch(NetworkCardInit { + id: 2, + index: 2, + index_max: 3, + daemon_client: Arc::clone(&init.daemon_client), name: "Yay".to_owned(), enabled: false, }) .forward(sender.input_sender(), |_| NetworksMsg::None), ]; + widgets.networks.append(network_cards[0].widget()); + widgets.networks.append(network_cards[1].widget()); + widgets.networks.append(network_cards[2].widget()); + // let network_cards = vec![]; let model = Networks { daemon_client: init.daemon_client, @@ -81,23 +105,37 @@ impl AsyncComponent for Networks { sender: AsyncComponentSender, _root: &Self::Root, ) { - if let NetworksMsg::NetworkList(networks) = msg { - for network_card in self.network_cards.iter() { - self.networks_list_box - .remove(&network_card.widget().clone()); + match msg { + NetworksMsg::NetworkList(networks) => { + for network_card in self.network_cards.iter() { + self.networks_list_box + .remove(&network_card.widget().clone()); + } + self.network_cards.clear(); + + let index_max = networks.len(); + for (index, network) in networks.iter().enumerate() { + let network_card = NetworkCard::builder() + .launch(NetworkCardInit { + id: network.id, + index, + index_max, + daemon_client: Arc::clone(&self.daemon_client), + name: format!("ID: {}, TYPE: {}", network.id, network.r#type), + enabled: false, + }) + .forward(sender.input_sender(), |_| NetworksMsg::None); + self.networks_list_box.append(network_card.widget()); + self.network_cards.push(network_card); + } } - self.network_cards.clear(); - - for network in networks { - let network_card = NetworkCard::builder() - .launch(NetworkCardInit { - name: format!("ID: {}, TYPE: {}", network.id, network.r#type), - enabled: false, - }) - .forward(sender.input_sender(), |_| NetworksMsg::None); - self.networks_list_box.append(network_card.widget()); - self.network_cards.push(network_card); + NetworksMsg::NetworkAdd => { + if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { + let mut client = networks_client::NetworksClient::new(daemon_client); + client.network_add(burrow_rpc::Empty {}).await.unwrap(); + } } + _ => {} } } } diff --git a/burrow-gtk/src/components/main_screen.rs b/burrow-gtk/src/components/main_screen.rs index 52dd98a7..973fe78c 100644 --- a/burrow-gtk/src/components/main_screen.rs +++ b/burrow-gtk/src/components/main_screen.rs @@ -2,6 +2,7 @@ use super::*; pub struct MainScreen { switch: AsyncController, + networks: AsyncController, } pub struct MainScreenInit { @@ -85,7 +86,7 @@ impl AsyncComponent for MainScreen { widgets.content.append(networks.widget()); widgets.content.append(switch.widget()); - let model = MainScreen { switch }; + let model = MainScreen { switch, networks }; AsyncComponentParts { model, widgets } } From c455c1fbbea3f6703b8278f1f7f727413f4dbd9f Mon Sep 17 00:00:00 2001 From: dav Date: Fri, 16 Aug 2024 17:32:18 -0700 Subject: [PATCH 11/16] Test against mock rpc server --- burrow-gtk/src/components/app.rs | 45 +++- burrow-gtk/src/components/main/mod.rs | 2 +- .../src/components/main/network_card.rs | 17 +- burrow-gtk/src/components/main/networks.rs | 11 +- burrow-gtk/src/components/main/switch.rs | 58 +---- burrow-gtk/src/components/main_screen.rs | 39 ++-- burrow-gtk/src/components/switch_screen.rs | 199 ------------------ 7 files changed, 82 insertions(+), 289 deletions(-) delete mode 100644 burrow-gtk/src/components/switch_screen.rs diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index 0fa587c0..97a3f79b 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -2,7 +2,7 @@ use super::*; use anyhow::Context; use std::time::Duration; -const RECONNECT_POLL_TIME: Duration = Duration::from_secs(5); +const RECONNECT_POLL_TIME: Duration = Duration::from_secs(3); pub struct App { daemon_client: Arc>>, @@ -58,7 +58,16 @@ impl AsyncComponent for App { root: Self::Root, sender: AsyncComponentSender, ) -> AsyncComponentParts { - let daemon_client = Arc::new(Mutex::new(daemon::daemon_connect().await.ok())); + // TODO: RPC REFACTOR (Handle Error) + let mut daemon_client_connected = false; + let daemon_client = Arc::new(Mutex::new( + daemon::daemon_connect() + .await + .inspect(|_| { + daemon_client_connected = true; + }) + .ok(), + )); let main_screen = main_screen::MainScreen::builder() .launch(main_screen::MainScreenInit { @@ -72,6 +81,17 @@ impl AsyncComponent for App { }) .forward(sender.input_sender(), |_| AppMsg::None); + if !daemon_client_connected { + main_screen + .sender() + .send(main_screen::MainScreenMsg::DaemonDisconnect) + .unwrap(); + settings_screen + .sender() + .send(settings_screen::SettingsScreenMsg::DaemonStateChange) + .unwrap(); + } + let widgets = view_output!(); let view_stack = adw::ViewStack::new(); @@ -126,15 +146,20 @@ impl AsyncComponent for App { let mut daemon_client = self.daemon_client.lock().await; let mut disconnected_daemon_client = false; - if let Some(daemon_client) = daemon_client.as_mut() { - let mut client = tunnel_client::TunnelClient::new(daemon_client); - if let Err(_e) = client.tunnel_status(burrow_rpc::Empty {}).await { - disconnected_daemon_client = true; - self.main_screen - .emit(main_screen::MainScreenMsg::DaemonDisconnect); - self.settings_screen - .emit(settings_screen::SettingsScreenMsg::DaemonStateChange) + if let Some(client) = daemon_client.as_mut() { + let mut client = tunnel_client::TunnelClient::new(client); + + if let Ok(mut res) = client.tunnel_status(burrow_rpc::Empty {}).await { + let stream = res.get_mut(); + while let Ok(Some(_)) = stream.message().await {} } + + *daemon_client = None; + disconnected_daemon_client = true; + self.main_screen + .emit(main_screen::MainScreenMsg::DaemonDisconnect); + self.settings_screen + .emit(settings_screen::SettingsScreenMsg::DaemonStateChange) } if disconnected_daemon_client || daemon_client.is_none() { diff --git a/burrow-gtk/src/components/main/mod.rs b/burrow-gtk/src/components/main/mod.rs index 8e03b41e..903bfba0 100644 --- a/burrow-gtk/src/components/main/mod.rs +++ b/burrow-gtk/src/components/main/mod.rs @@ -6,4 +6,4 @@ mod switch; pub use network_card::{NetworkCard, NetworkCardInit}; pub use networks::{Networks, NetworksInit}; -pub use switch::{Switch, SwitchInit, SwitchMsg}; +pub use switch::{Switch, SwitchInit}; diff --git a/burrow-gtk/src/components/main/network_card.rs b/burrow-gtk/src/components/main/network_card.rs index 41a1aa2c..b002cd1b 100644 --- a/burrow-gtk/src/components/main/network_card.rs +++ b/burrow-gtk/src/components/main/network_card.rs @@ -86,30 +86,28 @@ impl AsyncComponent for NetworkCard { async fn update( &mut self, msg: Self::Input, - sender: AsyncComponentSender, + _: AsyncComponentSender, _root: &Self::Root, ) { match msg { NetworkCardMsg::NetworkDelete => { if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { let mut client = networks_client::NetworksClient::new(daemon_client); - client + let _ = client .network_delete(burrow_rpc::NetworkDeleteRequest { id: self.id }) - .await - .unwrap(); + .await; } } NetworkCardMsg::MoveUp => { if self.index.checked_sub(1).is_some() { if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { let mut client = networks_client::NetworksClient::new(daemon_client); - client + let _ = client .network_reorder(burrow_rpc::NetworkReorderRequest { id: self.id, index: self.index as i32 - 1, }) - .await - .unwrap(); + .await; } } } @@ -117,13 +115,12 @@ impl AsyncComponent for NetworkCard { if self.index + 1 < self.index_max { if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { let mut client = networks_client::NetworksClient::new(daemon_client); - client + let _ = client .network_reorder(burrow_rpc::NetworkReorderRequest { id: self.id, index: self.index as i32 + 1, }) - .await - .unwrap(); + .await; } } } diff --git a/burrow-gtk/src/components/main/networks.rs b/burrow-gtk/src/components/main/networks.rs index 5c63b944..aabd480f 100644 --- a/burrow-gtk/src/components/main/networks.rs +++ b/burrow-gtk/src/components/main/networks.rs @@ -7,6 +7,8 @@ pub struct Networks { daemon_client: Arc>>, network_cards: Vec>, networks_list_box: gtk::ListBox, + + _network_state_worker: WorkerController, } pub struct NetworksInit { @@ -94,6 +96,10 @@ impl AsyncComponent for Networks { daemon_client: init.daemon_client, network_cards, networks_list_box: widgets.networks.clone(), + + _network_state_worker: AsyncNetworkStateHandler::builder() + .detach_worker(()) + .forward(sender.input_sender(), |msg| msg), }; AsyncComponentParts { model, widgets } @@ -132,7 +138,7 @@ impl AsyncComponent for Networks { NetworksMsg::NetworkAdd => { if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { let mut client = networks_client::NetworksClient::new(daemon_client); - client.network_add(burrow_rpc::Empty {}).await.unwrap(); + let _ = client.network_add(burrow_rpc::Empty {}).await; } } _ => {} @@ -147,7 +153,8 @@ impl Worker for AsyncNetworkStateHandler { type Input = (); type Output = NetworksMsg; - fn init(_: Self::Init, _sender: ComponentSender) -> Self { + fn init(_: Self::Init, sender: ComponentSender) -> Self { + sender.input(()); Self } diff --git a/burrow-gtk/src/components/main/switch.rs b/burrow-gtk/src/components/main/switch.rs index 5958e834..0b812ca4 100644 --- a/burrow-gtk/src/components/main/switch.rs +++ b/burrow-gtk/src/components/main/switch.rs @@ -6,8 +6,6 @@ const RECONNECT_POLL_TIME: Duration = Duration::from_secs(3); pub struct Switch { daemon_client: Arc>>, switch: gtk::Switch, - switch_screen: gtk::Box, - disconnected_banner: adw::Banner, _tunnel_state_worker: WorkerController, } @@ -19,8 +17,6 @@ pub struct SwitchInit { #[derive(Debug, PartialEq, Eq)] pub enum SwitchMsg { None, - DaemonReconnect, - DaemonDisconnect, Start, Stop, SwitchSetStart, @@ -51,7 +47,6 @@ impl AsyncComponent for Switch { }, }, - #[name(switch_screen)] gtk::Box { set_orientation: gtk::Orientation::Vertical, set_spacing: 10, @@ -80,37 +75,12 @@ impl AsyncComponent for Switch { root: Self::Root, sender: AsyncComponentSender, ) -> AsyncComponentParts { - let mut initial_daemon_server_down = false; - - if let Some(daemon_client) = init.daemon_client.lock().await.as_mut() { - let mut client = tunnel_client::TunnelClient::new(daemon_client); - if client - .tunnel_status(burrow_rpc::Empty {}) - .await - .as_mut() - .is_err() - { - initial_daemon_server_down = true; - } - } else { - initial_daemon_server_down = true; - } - let switch_sender = sender.clone(); let widgets = view_output!(); - if initial_daemon_server_down { - *init.daemon_client.lock().await = None; - widgets.switch.set_active(false); - widgets.switch_screen.set_sensitive(false); - widgets.setup_banner.set_revealed(true); - } - let model = Switch { daemon_client: init.daemon_client, switch: widgets.switch.clone(), - switch_screen: widgets.switch_screen.clone(), - disconnected_banner: widgets.setup_banner.clone(), _tunnel_state_worker: AsyncTunnelStateHandler::builder() .detach_worker(()) .forward(sender.input_sender(), |_| SwitchMsg::None), @@ -127,20 +97,16 @@ impl AsyncComponent for Switch { _: AsyncComponentSender, _root: &Self::Root, ) { - let mut disconnected_daemon_client = false; - if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { let mut client = tunnel_client::TunnelClient::new(daemon_client); match msg { Self::Input::Start => { - if let Err(_e) = client.tunnel_start(burrow_rpc::Empty {}).await { - disconnected_daemon_client = true; - } + // TODO: Figure out best way for error handling. + let _ = client.tunnel_start(burrow_rpc::Empty {}).await; } Self::Input::Stop => { - if let Err(_e) = client.tunnel_stop(burrow_rpc::Empty {}).await { - disconnected_daemon_client = true; - } + // TODO: Figure out best way for error handling. + let _ = client.tunnel_stop(burrow_rpc::Empty {}).await; } Self::Input::SwitchSetStart => { self.switch.set_active(true); @@ -150,19 +116,6 @@ impl AsyncComponent for Switch { } _ => {} } - } else { - disconnected_daemon_client = true; - } - - if msg == Self::Input::DaemonReconnect { - self.disconnected_banner.set_revealed(false); - self.switch_screen.set_sensitive(true); - } - - if disconnected_daemon_client || msg == Self::Input::DaemonDisconnect { - *self.daemon_client.lock().await = None; - self.switch_screen.set_sensitive(false); - self.disconnected_banner.set_revealed(true); } } } @@ -174,7 +127,8 @@ impl Worker for AsyncTunnelStateHandler { type Input = (); type Output = SwitchMsg; - fn init(_: Self::Init, _sender: ComponentSender) -> Self { + fn init(_: Self::Init, sender: ComponentSender) -> Self { + sender.input(()); Self } diff --git a/burrow-gtk/src/components/main_screen.rs b/burrow-gtk/src/components/main_screen.rs index 973fe78c..fc55a127 100644 --- a/burrow-gtk/src/components/main_screen.rs +++ b/burrow-gtk/src/components/main_screen.rs @@ -1,8 +1,10 @@ use super::*; pub struct MainScreen { - switch: AsyncController, - networks: AsyncController, + _switch: AsyncController, + _networks: AsyncController, + content_box: gtk::Box, + daemon_status_banner: adw::Banner, } pub struct MainScreenInit { @@ -29,17 +31,17 @@ impl AsyncComponent for MainScreen { set_valign: Align::Fill, set_valign: Align::Center, - // gtk::Box { - // set_orientation: gtk::Orientation::Vertical, - // set_spacing: 5, - // set_margin_all: 5, - // set_valign: Align::Start, + gtk::Box { + set_orientation: gtk::Orientation::Vertical, + set_spacing: 5, + set_margin_all: 5, + set_valign: Align::Start, - // #[name(setup_banner)] - // adw::Banner { - // set_title: "Burrow is not running!", - // }, - // }, + #[name(daemon_status_banner)] + adw::Banner { + set_title: "Burrow is not running!", + }, + }, gtk::Box { set_orientation: gtk::Orientation::Vertical, @@ -86,7 +88,12 @@ impl AsyncComponent for MainScreen { widgets.content.append(networks.widget()); widgets.content.append(switch.widget()); - let model = MainScreen { switch, networks }; + let model = MainScreen { + _switch: switch, + _networks: networks, + content_box: widgets.content.clone(), + daemon_status_banner: widgets.daemon_status_banner.clone(), + }; AsyncComponentParts { model, widgets } } @@ -99,10 +106,12 @@ impl AsyncComponent for MainScreen { ) { match msg { MainScreenMsg::DaemonDisconnect => { - self.switch.emit(main::SwitchMsg::DaemonDisconnect); + self.daemon_status_banner.set_revealed(true); + self.content_box.set_sensitive(false); } MainScreenMsg::DaemonReconnect => { - self.switch.emit(main::SwitchMsg::DaemonReconnect); + self.daemon_status_banner.set_revealed(false); + self.content_box.set_sensitive(true); } _ => {} } diff --git a/burrow-gtk/src/components/switch_screen.rs b/burrow-gtk/src/components/switch_screen.rs deleted file mode 100644 index 9af3ba60..00000000 --- a/burrow-gtk/src/components/switch_screen.rs +++ /dev/null @@ -1,199 +0,0 @@ -use super::*; -use std::{ - thread::{self, JoinHandle}, - time::Duration, -}; - -const RECONNECT_POLL_TIME: Duration = Duration::from_secs(3); - -pub struct SwitchScreen { - daemon_client: Arc>>, - switch: gtk::Switch, - switch_screen: gtk::Box, - disconnected_banner: adw::Banner, - tunnel_state_worker: JoinHandle<()>, -} - -pub struct SwitchScreenInit { - pub daemon_client: Arc>>, -} - -#[derive(Debug, PartialEq, Eq)] -pub enum SwitchScreenMsg { - DaemonReconnect, - DaemonDisconnect, - Start, - Stop, - TunnelStateStopped, - TunnelStateRunning, -} - -#[relm4::component(pub, async)] -impl AsyncComponent for SwitchScreen { - type Init = SwitchScreenInit; - type Input = SwitchScreenMsg; - type Output = (); - type CommandOutput = SwitchScreenMsg; - - view! { - gtk::Box { - set_orientation: gtk::Orientation::Vertical, - set_valign: Align::Fill, - - gtk::Box { - set_orientation: gtk::Orientation::Vertical, - set_spacing: 5, - set_margin_all: 5, - set_valign: Align::Start, - - #[name(setup_banner)] - adw::Banner { - set_title: "Burrow is not running!", - }, - }, - - #[name(switch_screen)] - gtk::Box { - set_orientation: gtk::Orientation::Vertical, - set_spacing: 10, - set_margin_all: 5, - set_valign: Align::Center, - set_vexpand: true, - - gtk::Label { - set_label: "Burrow Switch", - }, - - #[name(switch)] - gtk::Switch { - set_halign: Align::Center, - set_hexpand: false, - set_vexpand: false, - connect_active_notify => move |switch| - switch_sender.input(if switch.is_active() { SwitchScreenMsg::Start } else { SwitchScreenMsg::Stop }) - }, - } - } - } - - async fn init( - init: Self::Init, - root: Self::Root, - sender: AsyncComponentSender, - ) -> AsyncComponentParts { - let mut initial_daemon_server_down = false; - - if let Some(daemon_client) = init.daemon_client.lock().await.as_mut() { - let mut client = tunnel_client::TunnelClient::new(daemon_client); - if client - .tunnel_status(burrow_rpc::Empty {}) - .await - .as_mut() - .is_err() - { - initial_daemon_server_down = true; - } - } else { - initial_daemon_server_down = true; - } - - let switch_sender = sender.clone(); - let tunnel_state_sender = sender.clone(); - let widgets = view_output!(); - - if initial_daemon_server_down { - *init.daemon_client.lock().await = None; - widgets.switch.set_active(false); - widgets.switch_screen.set_sensitive(false); - widgets.setup_banner.set_revealed(true); - } - - let model = SwitchScreen { - daemon_client: init.daemon_client, - switch: widgets.switch.clone(), - switch_screen: widgets.switch_screen.clone(), - disconnected_banner: widgets.setup_banner.clone(), - tunnel_state_worker: thread::spawn(move || { - tunnel_state_worker(tunnel_state_sender); - }), - }; - - widgets.switch.set_active(false); - - AsyncComponentParts { model, widgets } - } - - async fn update( - &mut self, - msg: Self::Input, - _: AsyncComponentSender, - _root: &Self::Root, - ) { - let mut disconnected_daemon_client = false; - - if let Some(daemon_client) = self.daemon_client.lock().await.as_mut() { - let mut client = tunnel_client::TunnelClient::new(daemon_client); - match msg { - Self::Input::Start => { - if let Err(e) = client.tunnel_start(burrow_rpc::Empty {}).await { - disconnected_daemon_client = true; - } - } - Self::Input::Stop => { - if let Err(e) = client.tunnel_stop(burrow_rpc::Empty {}).await { - disconnected_daemon_client = true; - } - } - Self::Input::TunnelStateStopped => { - self.switch.set_active(false); - } - Self::Input::TunnelStateRunning => { - self.switch.set_active(true); - } - _ => {} - } - } else { - disconnected_daemon_client = true; - } - - if msg == Self::Input::DaemonReconnect { - self.disconnected_banner.set_revealed(false); - self.switch_screen.set_sensitive(true); - } - - if disconnected_daemon_client || msg == Self::Input::DaemonDisconnect { - *self.daemon_client.lock().await = None; - self.switch_screen.set_sensitive(false); - self.disconnected_banner.set_revealed(true); - } - } -} - -fn tunnel_state_worker(sender: AsyncComponentSender) { - let rt = tokio::runtime::Runtime::new().unwrap(); - let task = rt.spawn(async move { - loop { - let sender = sender.input_sender(); - let conn = daemon::daemon_connect().await; - if let Ok(conn) = conn { - let mut client = tunnel_client::TunnelClient::new(conn); - if let Ok(mut res) = client.tunnel_status(burrow_rpc::Empty {}).await { - let stream = res.get_mut(); - while let Ok(Some(msg)) = stream.message().await { - match msg.state() { - burrow_rpc::State::Stopped => { - sender.send(SwitchScreenMsg::TunnelStateStopped) - } - burrow_rpc::State::Running => { - sender.send(SwitchScreenMsg::TunnelStateRunning) - } - } - .unwrap(); - } - } - } - tokio::time::sleep(RECONNECT_POLL_TIME).await; - } - }); - rt.block_on(task).unwrap(); -} From 0ba1ea92373cdb7250b106ed2ac15c6e0e163d6e Mon Sep 17 00:00:00 2001 From: dav Date: Fri, 16 Aug 2024 18:06:11 -0700 Subject: [PATCH 12/16] Missing import --- burrow-gtk/src/components/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/burrow-gtk/src/components/mod.rs b/burrow-gtk/src/components/mod.rs index cc9196b3..49f89718 100644 --- a/burrow-gtk/src/components/mod.rs +++ b/burrow-gtk/src/components/mod.rs @@ -7,6 +7,7 @@ use relm4::{ AsyncController, }, prelude::*, + Worker, WorkerController, }; use std::sync::Arc; use tokio::sync::Mutex; From 5088ab9a0e950527a45f33154739a75fef60867f Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 17 Aug 2024 12:26:12 -0700 Subject: [PATCH 13/16] Prettier UI --- burrow-gtk/src/components/app.rs | 2 +- .../src/components/main/network_card.rs | 64 ++++++++++------- burrow-gtk/src/components/main/networks.rs | 68 +++++++++++++++---- burrow-gtk/src/components/main/switch.rs | 7 +- burrow-gtk/src/components/main_screen.rs | 18 +---- 5 files changed, 104 insertions(+), 55 deletions(-) diff --git a/burrow-gtk/src/components/app.rs b/burrow-gtk/src/components/app.rs index 97a3f79b..03bd8c0f 100644 --- a/burrow-gtk/src/components/app.rs +++ b/burrow-gtk/src/components/app.rs @@ -49,7 +49,7 @@ impl AsyncComponent for App { view! { adw::Window { set_title: Some("Burrow"), - set_default_size: (640, 480), + set_default_size: (640, 800), } } diff --git a/burrow-gtk/src/components/main/network_card.rs b/burrow-gtk/src/components/main/network_card.rs index b002cd1b..3ade9f96 100644 --- a/burrow-gtk/src/components/main/network_card.rs +++ b/burrow-gtk/src/components/main/network_card.rs @@ -32,36 +32,54 @@ impl AsyncComponent for NetworkCard { view! { gtk::ListBoxRow { + set_halign: Align::Fill, + set_margin_vertical: 5, + set_margin_horizontal: 25, set_hexpand: true, - set_halign: Align::Center, + gtk::Box { - gtk::Label { - set_label: &init.name + set_halign: Align::Fill, + set_hexpand: true, + set_spacing: 10, + + gtk::Box { + set_halign: Align::Start, + + gtk::Switch { + set_active: init.enabled, + }, }, - gtk::Switch { + + gtk::Box { set_halign: Align::Center, - set_hexpand: false, - set_vexpand: false, - set_state: init.enabled, - }, - gtk::Button { - set_icon_name: "list-remove", - set_margin_all: 12, + set_hexpand: true, - connect_clicked => NetworkCardMsg::NetworkDelete, + gtk::Label { + set_label: &init.name + }, }, - gtk::Button { - set_icon_name: "pan-up-symbolic", - set_margin_all: 12, - connect_clicked => NetworkCardMsg::MoveUp, - }, - gtk::Button { - set_icon_name: "pan-down-symbolic", - set_margin_all: 12, - connect_clicked => NetworkCardMsg::MoveDown, - }, + gtk::Box { + set_halign: Align::End, + set_spacing: 5, + + gtk::Button { + set_icon_name: "list-remove", + + connect_clicked => NetworkCardMsg::NetworkDelete, + }, + gtk::Button { + set_icon_name: "pan-up-symbolic", + + connect_clicked => NetworkCardMsg::MoveUp, + }, + gtk::Button { + set_icon_name: "pan-down-symbolic", + + connect_clicked => NetworkCardMsg::MoveDown, + }, + } } } } @@ -86,7 +104,7 @@ impl AsyncComponent for NetworkCard { async fn update( &mut self, msg: Self::Input, - _: AsyncComponentSender, + _sender: AsyncComponentSender, _root: &Self::Root, ) { match msg { diff --git a/burrow-gtk/src/components/main/networks.rs b/burrow-gtk/src/components/main/networks.rs index aabd480f..3b8cadb7 100644 --- a/burrow-gtk/src/components/main/networks.rs +++ b/burrow-gtk/src/components/main/networks.rs @@ -32,19 +32,43 @@ impl AsyncComponent for Networks { view! { gtk::Box { set_orientation: gtk::Orientation::Vertical, - set_spacing: 5, + set_spacing: 20, set_margin_all: 5, - set_valign: Align::Start, + set_valign: Align::Fill, + set_vexpand: true, + + gtk::Box { + set_orientation: gtk::Orientation::Horizontal, + set_spacing: 10, + set_margin_all: 5, + set_valign: Align::Start, + set_halign: Align::Center, + + gtk::Label { + set_label: "Add Network", + }, + + gtk::Button { + set_icon_name: "list-add", + set_margin_all: 12, + + connect_clicked => NetworksMsg::NetworkAdd, + }, + }, - #[name = "networks"] - gtk::ListBox {}, - gtk::Button { - set_icon_name: "list-add", - set_margin_all: 12, + gtk::ScrolledWindow { + set_valign: Align::Fill, + set_vexpand: true, + set_margin_bottom: 50, + set_margin_start: 50, + set_margin_end: 50, - connect_clicked => NetworksMsg::NetworkAdd, - }, + #[name = "networks"] + gtk::ListBox { + set_vexpand: true, + }, + } } } @@ -86,10 +110,30 @@ impl AsyncComponent for Networks { enabled: false, }) .forward(sender.input_sender(), |_| NetworksMsg::None), + NetworkCard::builder() + .launch(NetworkCardInit { + id: 2, + index: 2, + index_max: 3, + daemon_client: Arc::clone(&init.daemon_client), + name: "Yay".to_owned(), + enabled: false, + }) + .forward(sender.input_sender(), |_| NetworksMsg::None), + NetworkCard::builder() + .launch(NetworkCardInit { + id: 2, + index: 2, + index_max: 3, + daemon_client: Arc::clone(&init.daemon_client), + name: "Yay".to_owned(), + enabled: false, + }) + .forward(sender.input_sender(), |_| NetworksMsg::None), ]; - widgets.networks.append(network_cards[0].widget()); - widgets.networks.append(network_cards[1].widget()); - widgets.networks.append(network_cards[2].widget()); + for network_card in network_cards.iter() { + widgets.networks.append(network_card.widget()); + } // let network_cards = vec![]; let model = Networks { diff --git a/burrow-gtk/src/components/main/switch.rs b/burrow-gtk/src/components/main/switch.rs index 0b812ca4..ec78f2f2 100644 --- a/burrow-gtk/src/components/main/switch.rs +++ b/burrow-gtk/src/components/main/switch.rs @@ -48,14 +48,13 @@ impl AsyncComponent for Switch { }, gtk::Box { - set_orientation: gtk::Orientation::Vertical, + set_orientation: gtk::Orientation::Horizontal, set_spacing: 10, set_margin_all: 5, - set_valign: Align::Center, - set_vexpand: true, + set_halign: Align::Center, gtk::Label { - set_label: "Burrow Switch", + set_label: "Burrow Tunnel", }, #[name(switch)] diff --git a/burrow-gtk/src/components/main_screen.rs b/burrow-gtk/src/components/main_screen.rs index fc55a127..8843cfcb 100644 --- a/burrow-gtk/src/components/main_screen.rs +++ b/burrow-gtk/src/components/main_screen.rs @@ -29,7 +29,7 @@ impl AsyncComponent for MainScreen { gtk::Box { set_orientation: gtk::Orientation::Vertical, set_valign: Align::Fill, - set_valign: Align::Center, + set_vexpand: true, gtk::Box { set_orientation: gtk::Orientation::Vertical, @@ -43,25 +43,13 @@ impl AsyncComponent for MainScreen { }, }, - gtk::Box { - set_orientation: gtk::Orientation::Vertical, - set_spacing: 10, - set_margin_all: 5, - set_valign: Align::Center, - set_vexpand: true, - }, - #[name(content)] gtk::Box { set_orientation: gtk::Orientation::Vertical, set_spacing: 10, set_margin_all: 5, - set_valign: Align::Center, + set_valign: Align::Fill, set_vexpand: true, - - gtk::Label { - set_label: "Main Screen", - }, } } } @@ -85,8 +73,8 @@ impl AsyncComponent for MainScreen { let widgets = view_output!(); - widgets.content.append(networks.widget()); widgets.content.append(switch.widget()); + widgets.content.append(networks.widget()); let model = MainScreen { _switch: switch, From 21e0df60a845a22e64e29bb693f60af262469113 Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 17 Aug 2024 12:33:54 -0700 Subject: [PATCH 14/16] Fix appimage build --- burrow-gtk/build-aux/build_appimage.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/burrow-gtk/build-aux/build_appimage.sh b/burrow-gtk/build-aux/build_appimage.sh index ef88e575..f054cd98 100755 --- a/burrow-gtk/build-aux/build_appimage.sh +++ b/burrow-gtk/build-aux/build_appimage.sh @@ -27,5 +27,6 @@ CFLAGS="-I/usr/local/include -I/usr/include/$MUSL_TARGET -fPIE" meson setup $BURROW_GTK_BUILD --bindir bin --prefix /usr --buildtype $BURROW_BUILD_TYPE meson compile -C $BURROW_GTK_BUILD DESTDIR=AppDir meson install -C $BURROW_GTK_BUILD +cargo b --$BURROW_BUILD_TYPE --manifest-path=../Cargo.toml /tmp/linuxdeploy --appimage-extract-and-run --appdir $BURROW_GTK_BUILD/AppDir -e $BURROW_GTK_BUILD/../../target/$BURROW_BUILD_TYPE/burrow --output appimage mv *.AppImage $BURROW_GTK_BUILD From dd8cd03036a318d73c222c6927bd9cf48c3ade67 Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 7 Sep 2024 16:43:51 -0700 Subject: [PATCH 15/16] Better error handling --- burrow-gtk/Cargo.lock | 123 +++++++++++++++++- burrow-gtk/Cargo.toml | 2 + .../src/components/settings/daemon_group.rs | 89 +++++++------ .../src/components/settings/diag_group.rs | 16 +-- burrow-gtk/src/diag.rs | 39 +++--- burrow-gtk/src/main.rs | 6 +- 6 files changed, 207 insertions(+), 68 deletions(-) diff --git a/burrow-gtk/Cargo.lock b/burrow-gtk/Cargo.lock index fce2a3b9..93ff94ab 100644 --- a/burrow-gtk/Cargo.lock +++ b/burrow-gtk/Cargo.lock @@ -26,6 +26,55 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.79" @@ -174,9 +223,11 @@ name = "burrow-gtk" version = "0.1.0" dependencies = [ "anyhow", + "colog", "gettext-rs", "glib-build-tools", "hyper-util", + "log", "prost", "prost-types", "relm4", @@ -242,12 +293,62 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "colog" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c426b7af8d5e0ad79de6713996632ce31f0d68ba84068fb0d654b396e519df0" +dependencies = [ + "colored", + "env_logger", + "log", +] + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -797,6 +898,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "1.4.1" @@ -871,6 +978,12 @@ dependencies = [ "hashbrown 0.14.3", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.13.0" @@ -971,9 +1084,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "malloc_buf" @@ -1816,6 +1929,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "version-compare" version = "0.1.1" diff --git a/burrow-gtk/Cargo.toml b/burrow-gtk/Cargo.toml index b73d936f..abeffc4d 100644 --- a/burrow-gtk/Cargo.toml +++ b/burrow-gtk/Cargo.toml @@ -15,6 +15,8 @@ prost = "0.13" prost-types = "0.13" hyper-util = "0.1.6" tower = "0.4.13" +log = "0.4.22" +colog = "1.3.0" [build-dependencies] anyhow = "1.0" diff --git a/burrow-gtk/src/components/settings/daemon_group.rs b/burrow-gtk/src/components/settings/daemon_group.rs index 73f647b3..4436d6e0 100644 --- a/burrow-gtk/src/components/settings/daemon_group.rs +++ b/burrow-gtk/src/components/settings/daemon_group.rs @@ -48,7 +48,6 @@ impl AsyncComponent for DaemonGroup { root: Self::Root, sender: AsyncComponentSender, ) -> AsyncComponentParts { - // Should be impossible to panic here let model = DaemonGroup { system_setup: init.system_setup, daemon_client: init.daemon_client.clone(), @@ -68,45 +67,9 @@ impl AsyncComponent for DaemonGroup { ) { match msg { DaemonGroupMsg::LaunchLocal => { - // TODO: Handle error condition - - const BURROW_LOCAL_DAEMON_PATH: &str = "/tmp/burrow-detached-daemon"; - - let burrow_original_bin = std::env::vars() - .find(|(k, _)| k == "APPDIR") - .map(|(_, v)| v + "/usr/bin/burrow") - .unwrap_or("/usr/bin/burrow".to_owned()); - - Command::new("cp") - .arg(&burrow_original_bin) - .arg(BURROW_LOCAL_DAEMON_PATH) - .output() - .unwrap(); - - let mut burrow_bin = - String::from_utf8(Command::new("mktemp").output().unwrap().stdout).unwrap(); - burrow_bin.pop(); - - let privileged_spawn_script = format!( - r#"chmod +x {} -setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN+eip {}"#, - BURROW_LOCAL_DAEMON_PATH, BURROW_LOCAL_DAEMON_PATH - ) - .replace('\n', "&&"); - - Command::new("pkexec") - .arg("sh") - .arg("-c") - .arg(privileged_spawn_script) - .arg(&burrow_bin) - .output() - .unwrap(); - - Command::new(BURROW_LOCAL_DAEMON_PATH) - .env("RUST_LOG", "debug") - .arg("daemon") - .spawn() - .unwrap(); + if let Err(e) = launch_local() { + error!("Failed to launch local daemon at: {}", e); + }; } DaemonGroupMsg::DaemonStateChange => { self.already_running = self.daemon_client.lock().await.is_some(); @@ -114,3 +77,49 @@ setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN+eip {}"#, } } } + +fn launch_local() -> Result<()> { + const BURROW_LOCAL_DAEMON_PATH: &str = "/tmp/burrow-detached-daemon"; + + let burrow_original_bin = std::env::vars() + .find(|(k, _)| k == "APPDIR") + .map(|(_, v)| v + "/usr/bin/burrow") + .unwrap_or("/usr/bin/burrow".to_owned()); + + Command::new("cp") + .arg(&burrow_original_bin) + .arg(BURROW_LOCAL_DAEMON_PATH) + .output() + .with_context(|| { + format!( + "Copying {} to {}", + burrow_original_bin, BURROW_LOCAL_DAEMON_PATH + ) + })?; + + let mut burrow_bin = String::from_utf8(Command::new("mktemp").output()?.stdout)?; + burrow_bin.pop(); + + let privileged_spawn_script = format!( + r#"chmod +x {} +setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN+eip {}"#, + BURROW_LOCAL_DAEMON_PATH, BURROW_LOCAL_DAEMON_PATH + ) + .replace('\n', "&&"); + + // Need to be more careful here. + Command::new("pkexec") + .arg("sh") + .arg("-c") + .arg(privileged_spawn_script) + .arg(&burrow_bin) + .output() + .with_context(|| format!("Priviledged call to {}", burrow_bin))?; + + Command::new(BURROW_LOCAL_DAEMON_PATH) + .env("RUST_LOG", "debug") + .arg("daemon") + .spawn()?; + + Ok(()) +} diff --git a/burrow-gtk/src/components/settings/diag_group.rs b/burrow-gtk/src/components/settings/diag_group.rs index 9e1bcff8..28cbc9cc 100644 --- a/burrow-gtk/src/components/settings/diag_group.rs +++ b/burrow-gtk/src/components/settings/diag_group.rs @@ -17,18 +17,18 @@ pub struct DiagGroupInit { } impl DiagGroup { - async fn new(daemon_client: Arc>>) -> Result { + async fn new(daemon_client: Arc>>) -> Self { let system_setup = SystemSetup::new(); let daemon_running = daemon_client.lock().await.is_some(); - Ok(Self { - service_installed: system_setup.is_service_installed()?, - socket_installed: system_setup.is_socket_installed()?, - socket_enabled: system_setup.is_socket_enabled()?, + Self { + service_installed: system_setup.is_service_installed(), + socket_installed: system_setup.is_socket_installed(), + socket_enabled: system_setup.is_socket_enabled(), daemon_running, system_setup, daemon_client, - }) + } } } @@ -95,7 +95,7 @@ impl AsyncComponent for DiagGroup { sender: AsyncComponentSender, ) -> AsyncComponentParts { // Should be impossible to panic here - let model = DiagGroup::new(init.daemon_client).await.unwrap(); + let model = DiagGroup::new(init.daemon_client).await; let widgets = view_output!(); @@ -111,7 +111,7 @@ impl AsyncComponent for DiagGroup { match msg { DiagGroupMsg::Refresh => { // Should be impossible to panic here - *self = Self::new(Arc::clone(&self.daemon_client)).await.unwrap(); + *self = Self::new(Arc::clone(&self.daemon_client)).await; } } } diff --git a/burrow-gtk/src/diag.rs b/burrow-gtk/src/diag.rs index ab4757e2..94a29e17 100644 --- a/burrow-gtk/src/diag.rs +++ b/burrow-gtk/src/diag.rs @@ -4,7 +4,6 @@ use std::{fmt::Display, fs, process::Command}; const SYSTEMD_SOCKET_LOC: &str = "/etc/systemd/system/burrow.socket"; const SYSTEMD_SERVICE_LOC: &str = "/etc/systemd/system/burrow.service"; -// I don't like this type very much. #[derive(Debug, Clone, Copy)] pub enum StatusTernary { True, @@ -33,35 +32,41 @@ impl SystemSetup { } } - pub fn is_service_installed(&self) -> Result { + pub fn is_service_installed(&self) -> StatusTernary { match self { - SystemSetup::Systemd => Ok(fs::metadata(SYSTEMD_SERVICE_LOC).is_ok().into()), - SystemSetup::AppImage => Ok(StatusTernary::NA), - SystemSetup::Other => Ok(StatusTernary::NA), + SystemSetup::Systemd => fs::metadata(SYSTEMD_SERVICE_LOC).is_ok().into(), + SystemSetup::AppImage => StatusTernary::NA, + SystemSetup::Other => StatusTernary::NA, } } - pub fn is_socket_installed(&self) -> Result { + pub fn is_socket_installed(&self) -> StatusTernary { match self { - SystemSetup::Systemd => Ok(fs::metadata(SYSTEMD_SOCKET_LOC).is_ok().into()), - SystemSetup::AppImage => Ok(StatusTernary::NA), - SystemSetup::Other => Ok(StatusTernary::NA), + SystemSetup::Systemd => fs::metadata(SYSTEMD_SOCKET_LOC).is_ok().into(), + SystemSetup::AppImage => StatusTernary::NA, + SystemSetup::Other => StatusTernary::NA, } } - pub fn is_socket_enabled(&self) -> Result { + pub fn is_socket_enabled(&self) -> StatusTernary { match self { SystemSetup::Systemd => { - let output = Command::new("systemctl") + let Ok(output) = Command::new("systemctl") .arg("is-enabled") .arg("burrow.socket") - .output()? - .stdout; - let output = String::from_utf8(output)?; - Ok((output == "enabled\n").into()) + .output() + .map(|o| o.stdout) + .inspect_err(|e| { + error!("Failed to run `systemctl is-enabled burrow.socket` {}", e) + }) + else { + return StatusTernary::NA; + }; + let output = String::from_utf8(output).unwrap(); + (output == "enabled\n").into() } - SystemSetup::AppImage => Ok(StatusTernary::NA), - SystemSetup::Other => Ok(StatusTernary::NA), + SystemSetup::AppImage => StatusTernary::NA, + SystemSetup::Other => StatusTernary::NA, } } } diff --git a/burrow-gtk/src/main.rs b/burrow-gtk/src/main.rs index 66e6b36a..202b930c 100644 --- a/burrow-gtk/src/main.rs +++ b/burrow-gtk/src/main.rs @@ -1,4 +1,5 @@ -use anyhow::Result; +use anyhow::{Context, Result}; +use log::error; pub mod components; mod daemon; @@ -8,5 +9,8 @@ mod diag; mod config; fn main() { + colog::default_builder() + .filter(None, log::LevelFilter::Error) + .init(); components::App::run(); } From aaabca99571615585912d3dc035eadd320157c9f Mon Sep 17 00:00:00 2001 From: dav Date: Sat, 7 Sep 2024 17:11:55 -0700 Subject: [PATCH 16/16] Update docs and CI --- burrow-gtk/build-aux/Dockerfile | 2 +- docs/GTK_APP.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/burrow-gtk/build-aux/Dockerfile b/burrow-gtk/build-aux/Dockerfile index 4e71c059..d5d015af 100644 --- a/burrow-gtk/build-aux/Dockerfile +++ b/burrow-gtk/build-aux/Dockerfile @@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN set -eux && \ dnf update -y && \ - dnf install -y clang ninja-build cmake meson gtk4-devel glib2-devel libadwaita-devel desktop-file-utils libappstream-glib util-linux wget fuse fuse-libs file sqlite sqlite-devel + dnf install -y clang ninja-build cmake meson gtk4-devel glib2-devel libadwaita-devel desktop-file-utils libappstream-glib util-linux wget fuse fuse-libs file sqlite-devel protobuf-compiler protobuf-devel RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal ENV PATH="/root/.cargo/bin:${PATH}" diff --git a/docs/GTK_APP.md b/docs/GTK_APP.md index ef73d2b8..4e1be754 100644 --- a/docs/GTK_APP.md +++ b/docs/GTK_APP.md @@ -15,7 +15,7 @@ Note that the flatpak version can compile but will not run properly! 1. Install build dependencies ``` - sudo apt install -y clang meson cmake pkg-config libgtk-4-dev libadwaita-1-dev gettext desktop-file-utils + sudo apt install -y clang meson cmake pkg-config libgtk-4-dev libadwaita-1-dev gettext desktop-file-utils libsqlite3-dev protobuf-compiler libprotobuf-dev ``` 2. Install flatpak builder (Optional) @@ -38,7 +38,7 @@ Note that the flatpak version can compile but will not run properly! 1. Install build dependencies ``` - sudo dnf install -y clang ninja-build cmake meson gtk4-devel glib2-devel libadwaita-devel desktop-file-utils libappstream-glib + sudo dnf install -y clang ninja-build cmake meson gtk4-devel glib2-devel libadwaita-devel desktop-file-utils libappstream-glib sqlite-devel protobuf-compiler protobuf-devel ``` 2. Install flatpak builder (Optional) @@ -50,7 +50,7 @@ Note that the flatpak version can compile but will not run properly! 3. Install AppImage build tools (Optional) ``` - sudo dnf install -y util-linux wget fuse fuse-libs file + sudo dnf install -y util-linux wget fuse fuse-libs file ``` @@ -61,7 +61,7 @@ Note that the flatpak version can compile but will not run properly! 1. Install build dependencies ``` - sudo xbps-install -Sy gcc clang meson cmake pkg-config gtk4-devel gettext desktop-file-utils gtk4-update-icon-cache appstream-glib + sudo xbps-install -Sy gcc clang meson cmake pkg-config gtk4-devel gettext desktop-file-utils gtk4-update-icon-cache appstream-glib sqlite-devel protobuf protobuf-devel ``` 2. Install flatpak builder (Optional)