diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 84a60267..8af2aa9e 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true env: - MSRV: "1.86" # Minimum Supported Rust Version + MSRV: "1.88" # Minimum Supported Rust Version jobs: protobuf: @@ -21,10 +21,11 @@ jobs: # FIXME: https://github.com/mitmproxy/mitmproxy/issues/7877 - bump SwiftProtobuf and then re-add this here. # - run: brew install swift-protobuf - run: brew install protobuf - - run: cargo install protoc-gen-prost + - run: cargo install --locked protoc-gen-prost@0.5.0 - run: protoc --proto_path=./src/ipc/ mitmproxy_ipc.proto --prost_out=./src/ipc/ --prost_opt="bytes=data" + --prost_opt="flat_output_dir=true" # --swift_out=./mitmproxy-macos/redirector/ipc - run: cargo fmt --all - uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9050a2e5..d2470887 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,13 +22,13 @@ jobs: matrix: include: - os: windows-latest - rust: "1.86" # MSRV - can't use variables here. + rust: "1.88" # MSRV - can't use variables here. args: --exclude mitmproxy-linux-ebpf - os: macos-latest - rust: "1.86" # MSRV - can't use variables here. + rust: "1.88" # MSRV - can't use variables here. args: --exclude mitmproxy-linux-ebpf - os: ubuntu-22.04 - rust: "1.86" # MSRV - can't use variables here. + rust: "1.88" # MSRV - can't use variables here. args: --exclude mitmproxy-linux-ebpf - os: ubuntu-latest rust: stable diff --git a/Cargo.lock b/Cargo.lock index b19088bc..d3e05974 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,6 +36,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloca" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4" +dependencies = [ + "cc", +] + [[package]] name = "allocator-api2" version = "0.2.21" @@ -206,14 +215,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.4.5", "bytes", "futures-util", "http", "http-body", "http-body-util", "itoa", - "matchit", + "matchit 0.7.3", "memchr", "mime", "percent-encoding", @@ -226,6 +235,31 @@ dependencies = [ "tower-service", ] +[[package]] +name = "axum" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" +dependencies = [ + "axum-core 0.5.6", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "itoa", + "matchit 0.8.4", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "sync_wrapper", + "tower 0.5.2", + "tower-layer", + "tower-service", +] + [[package]] name = "axum-core" version = "0.4.5" @@ -246,6 +280,24 @@ dependencies = [ "tower-service", ] +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + [[package]] name = "aya" version = "0.13.1" @@ -266,9 +318,9 @@ dependencies = [ [[package]] name = "aya-build" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765c92c523541cbf5e3a94c7a6ff4068a4d9537f98a2eeb136461c0537ded8c1" +checksum = "59bc42f3c5ddacc34eca28a420b47e3cbb3f0f484137cb2bf1ad2153d0eae52a" dependencies = [ "anyhow", "cargo_metadata", @@ -540,27 +592,28 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.9" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" dependencies = [ - "serde", + "serde_core", ] [[package]] name = "cargo-platform" -version = "0.1.9" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +checksum = "87a0c0e6148f11f01f32650a2ea02d532b2ad4e81d8bd41e6e565b5adc5e6082" dependencies = [ "serde", + "serde_core", ] [[package]] name = "cargo_metadata" -version = "0.19.2" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" dependencies = [ "camino", "cargo-platform", @@ -739,8 +792,22 @@ checksum = "8030735ecb0d128428b64cd379809817e620a40e5001c54465b99ec5feec2857" dependencies = [ "futures-core", "prost 0.13.5", - "prost-types", - "tonic", + "prost-types 0.13.5", + "tonic 0.12.3", + "tracing-core", +] + +[[package]] +name = "console-api" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8599749b6667e2f0c910c1d0dff6901163ff698a52d5a39720f61b5be4b20d3" +dependencies = [ + "futures-core", + "prost 0.14.1", + "prost-types 0.14.1", + "tonic 0.14.2", + "tonic-prost", "tracing-core", ] @@ -750,7 +817,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6539aa9c6a4cd31f4b1c040f860a1eac9aa80e7df6b05d506a6e7179936d6a01" dependencies = [ - "console-api", + "console-api 0.8.1", "crossbeam-channel", "crossbeam-utils", "futures-task", @@ -758,13 +825,39 @@ dependencies = [ "humantime", "hyper-util", "prost 0.13.5", - "prost-types", + "prost-types 0.13.5", "serde", "serde_json", "thread_local", "tokio", "tokio-stream", - "tonic", + "tonic 0.12.3", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "console-subscriber" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4915b7d8dd960457a1b6c380114c2944f728e7c65294ab247ae6b6f1f37592" +dependencies = [ + "console-api 0.9.0", + "crossbeam-channel", + "crossbeam-utils", + "futures-task", + "hdrhistogram", + "humantime", + "hyper-util", + "prost 0.14.1", + "prost-types 0.14.1", + "serde", + "serde_json", + "thread_local", + "tokio", + "tokio-stream", + "tonic 0.14.2", "tracing", "tracing-core", "tracing-subscriber", @@ -866,10 +959,35 @@ dependencies = [ "cast", "ciborium", "clap", - "criterion-plot", + "criterion-plot 0.6.0", + "itertools 0.13.0", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d883447757bb0ee46f233e9dc22eb84d93a9508c9b868687b274fc431d886bf" +dependencies = [ + "alloca", + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot 0.8.1", "itertools 0.13.0", "num-traits", "oorandom", + "page_size", "plotters", "rayon", "regex", @@ -889,6 +1007,16 @@ dependencies = [ "itertools 0.13.0", ] +[[package]] +name = "criterion-plot" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed943f81ea2faa8dcecbbfa50164acf95d555afec96a27871663b300e387b2e4" +dependencies = [ + "cast", + "itertools 0.13.0", +] + [[package]] name = "critical-section" version = "1.2.0" @@ -1198,9 +1326,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.1.2" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", "miniz_oxide", @@ -1593,7 +1721,7 @@ checksum = "a56f203cd1c76362b69e3863fd987520ac36cf70a8c92627449b2f64a8cf7d65" dependencies = [ "cfg-if", "libc", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -1843,9 +1971,9 @@ dependencies = [ [[package]] name = "image" -version = "0.25.8" +version = "0.25.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529feb3e6769d234375c4cf1ee2ce713682b8e76538cb13f9fc23e1400a591e7" +checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a" dependencies = [ "bytemuck", "byteorder-lite", @@ -1915,17 +2043,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "io-uring" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" -dependencies = [ - "bitflags 2.9.0", - "cfg-if", - "libc", -] - [[package]] name = "ip_network" version = "0.4.1" @@ -2041,9 +2158,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.176" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libloading" @@ -2074,9 +2191,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.4" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litemap" @@ -2096,9 +2213,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "loom" @@ -2156,6 +2273,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "memchr" version = "2.7.4" @@ -2222,10 +2345,10 @@ dependencies = [ "anyhow", "boringtun", "cocoa", - "console-subscriber", + "console-subscriber 0.4.1", "core-foundation", "core-graphics 0.25.0", - "criterion", + "criterion 0.7.0", "data-encoding", "env_logger", "futures-util", @@ -2242,7 +2365,7 @@ dependencies = [ "rand 0.9.2", "security-framework", "smoltcp", - "socket2 0.6.0", + "socket2 0.6.1", "sysinfo", "tempfile", "tokio", @@ -2256,7 +2379,7 @@ name = "mitmproxy-contentviews" version = "0.13.0-dev" dependencies = [ "anyhow", - "criterion", + "criterion 0.8.1", "data-encoding", "flate2", "log", @@ -2275,7 +2398,7 @@ name = "mitmproxy-highlight" version = "0.13.0-dev" dependencies = [ "anyhow", - "criterion", + "criterion 0.8.1", "tree-sitter", "tree-sitter-css", "tree-sitter-highlight", @@ -2292,6 +2415,7 @@ dependencies = [ "aya", "aya-build", "aya-log", + "cargo_metadata", "const-sha1", "env_logger", "hex", @@ -2329,7 +2453,7 @@ version = "0.13.0-dev" dependencies = [ "anyhow", "boringtun", - "console-subscriber", + "console-subscriber 0.5.0", "data-encoding", "env_logger", "log", @@ -2530,6 +2654,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "parking" version = "2.2.1" @@ -2821,6 +2955,15 @@ dependencies = [ "prost 0.13.5", ] +[[package]] +name = "prost-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72" +dependencies = [ + "prost 0.14.1", +] + [[package]] name = "protobuf" version = "3.7.2" @@ -3078,13 +3221,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.3" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.11", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -3099,9 +3242,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -3156,11 +3299,10 @@ dependencies = [ [[package]] name = "rmp-serde" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db" +checksum = "72f81bee8c8ef9b577d1681a70ebbc962c232461e397b22c208c43c04b67a155" dependencies = [ - "byteorder", "rmp", "serde", ] @@ -3195,15 +3337,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.5" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags 2.9.0", "errno", "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", ] [[package]] @@ -3303,15 +3445,16 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" dependencies = [ "indexmap 2.9.0", "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] @@ -3400,12 +3543,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -3510,15 +3653,15 @@ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "tempfile" -version = "3.23.0" +version = "3.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", - "rustix 1.0.5", - "windows-sys 0.59.0", + "rustix 1.1.3", + "windows-sys 0.61.2", ] [[package]] @@ -3641,29 +3784,26 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.47.1" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", - "io-uring", "libc", "mio", "pin-project-lite", "signal-hook-registry", - "slab", - "socket2 0.6.0", + "socket2 0.6.1", "tokio-macros", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", @@ -3683,9 +3823,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.16" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", @@ -3711,7 +3851,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.7.9", "base64 0.22.1", "bytes", "h2", @@ -3733,6 +3873,46 @@ dependencies = [ "tracing", ] +[[package]] +name = "tonic" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb7613188ce9f7df5bfe185db26c5814347d110db17920415cf2fbcad85e7203" +dependencies = [ + "async-trait", + "axum 0.8.8", + "base64 0.22.1", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "socket2 0.6.1", + "sync_wrapper", + "tokio", + "tokio-stream", + "tower 0.5.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-prost" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66bd50ad6ce1252d87ef024b3d64fe4c3cf54a86fb9ef4c631fdd0ded7aeaa67" +dependencies = [ + "bytes", + "prost 0.14.1", + "tonic 0.14.2", +] + [[package]] name = "tower" version = "0.4.13" @@ -3761,10 +3941,15 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", + "indexmap 2.9.0", "pin-project-lite", + "slab", "sync_wrapper", + "tokio", + "tokio-util", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -3904,9 +4089,9 @@ dependencies = [ [[package]] name = "tree-sitter-yaml" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d5893f2a05e57c86a2338aa3aed167a1e5c68b8fdff3bf4a460941f2d8fc944" +checksum = "53c223db85f05e34794f065454843b0668ebc15d240ada63e2b5939f43ce7c97" dependencies = [ "cc", "tree-sitter-language", @@ -3920,9 +4105,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tun" -version = "0.7.22" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7904c94104239657089d14bccbf23fd6d363e30639ce49af21ef008a445baf97" +checksum = "b35f176015650e3bd849e85808d809e5b54da2ba7df983c5c3b601a2a8f1095e" dependencies = [ "bytes", "cfg-if", @@ -3935,7 +4120,7 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tokio-util", - "windows-sys 0.59.0", + "windows-sys 0.61.2", "wintun-bindings", ] @@ -4157,7 +4342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fabb953106c3c8eea8306e4393700d7657561cb43122571b172bbfb7c7ba1d" dependencies = [ "env_home", - "rustix 1.0.5", + "rustix 1.1.3", "winsafe", ] @@ -4249,7 +4434,7 @@ dependencies = [ "windows-collections", "windows-core 0.61.2", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -4283,7 +4468,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement 0.60.2", "windows-interface 0.59.3", - "windows-link", + "windows-link 0.1.3", "windows-result 0.3.4", "windows-strings 0.4.2", ] @@ -4295,7 +4480,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core 0.61.2", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -4349,6 +4534,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -4356,7 +4547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core 0.61.2", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4391,7 +4582,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4410,7 +4601,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4440,6 +4631,24 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -4464,20 +4673,37 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + [[package]] name = "windows-threading" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -4492,6 +4718,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -4504,6 +4736,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -4516,12 +4754,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -4534,6 +4784,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -4546,6 +4802,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -4558,6 +4820,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -4570,6 +4838,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + [[package]] name = "winreg" version = "0.50.0" @@ -4661,7 +4935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d65cbf2f12c15564212d48f4e3dfb87923d25d611f2aed18f4cb23f0413d89e" dependencies = [ "libc", - "rustix 1.0.5", + "rustix 1.1.3", ] [[package]] @@ -4771,6 +5045,12 @@ dependencies = [ "syn 2.0.101", ] +[[package]] +name = "zmij" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac060176f7020d62c3bcc1cdbcec619d54f48b07ad1963a3f80ce7a0c17755f" + [[package]] name = "zune-core" version = "0.4.12" diff --git a/Cargo.toml b/Cargo.toml index 7c99422d..07eac710 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,14 +32,14 @@ version = "0.13.0-dev" publish = false repository = "https://github.com/mitmproxy/mitmproxy-rs" edition = "2021" -rust-version = "1.86" # MSRV +rust-version = "1.88" # MSRV [workspace.dependencies] aya = { version = "0.13.0", default-features = false } aya-ebpf = { version = "0.1.1", default-features = false } aya-log = { version = "0.2.1", default-features = false } aya-log-ebpf = { version = "0.1.1", default-features = false } -tun = { version = "0.7.22" } +tun = { version = "0.8.5" } [workspace.lints.clippy] large_futures = "deny" @@ -123,3 +123,6 @@ opt-level = 3 [features] tracing = ["console-subscriber"] +# This feature solely exists to silence warnings caused by objc 0.2.7, +# see https://github.com/SSheldon/rust-objc/issues/125 +cargo-clippy = [] \ No newline at end of file diff --git a/mitmproxy-contentviews/Cargo.toml b/mitmproxy-contentviews/Cargo.toml index 6d27ed1a..c11cefa9 100644 --- a/mitmproxy-contentviews/Cargo.toml +++ b/mitmproxy-contentviews/Cargo.toml @@ -13,20 +13,20 @@ workspace = true [dependencies] anyhow = { version = "1.0.100", features = ["backtrace"] } -log = "0.4.28" +log = "0.4.29" data-encoding = "2.8.0" pretty-hex = "0.4.1" mitmproxy-highlight = { path = "../mitmproxy-highlight" } serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9" -rmp-serde = "1.1" +rmp-serde = "1.3" protobuf = "3.7.2" -regex = "1.11.3" +regex = "1.12.2" flate2 = "1.1" protobuf-parse = "3.7" [dev-dependencies] -criterion = "0.7.0" +criterion = "0.8.1" [[bench]] name = "contentviews" diff --git a/mitmproxy-contentviews/src/hex_stream.rs b/mitmproxy-contentviews/src/hex_stream.rs index 5bc643c2..8a1b57e7 100644 --- a/mitmproxy-contentviews/src/hex_stream.rs +++ b/mitmproxy-contentviews/src/hex_stream.rs @@ -38,7 +38,7 @@ impl Prettify for HexStream { impl Reencode for HexStream { fn reencode(&self, data: &str, _metadata: &dyn Metadata) -> Result> { let data = data.trim_end_matches(['\n', '\r']); - if data.len() % 2 != 0 { + if !data.len().is_multiple_of(2) { anyhow::bail!("Invalid hex string: uneven number of characters"); } data_encoding::HEXLOWER_PERMISSIVE diff --git a/mitmproxy-contentviews/src/protobuf/view_grpc.rs b/mitmproxy-contentviews/src/protobuf/view_grpc.rs index 2021f91b..efaf13f5 100644 --- a/mitmproxy-contentviews/src/protobuf/view_grpc.rs +++ b/mitmproxy-contentviews/src/protobuf/view_grpc.rs @@ -81,7 +81,7 @@ impl GRPC { &decompressed } "identity" => proto, - _ => bail!("unsupported compression: {}", encoding), + _ => bail!("unsupported compression: {encoding}"), } } else { proto diff --git a/mitmproxy-highlight/Cargo.toml b/mitmproxy-highlight/Cargo.toml index ca33c2e8..3422de0e 100644 --- a/mitmproxy-highlight/Cargo.toml +++ b/mitmproxy-highlight/Cargo.toml @@ -18,10 +18,10 @@ tree-sitter-css = "0.25.0" tree-sitter-highlight = "0.25.10" tree-sitter-javascript = "0.25.0" tree-sitter-xml = "0.7.0" -tree-sitter-yaml = "0.7.1" +tree-sitter-yaml = "0.7.2" [dev-dependencies] -criterion = "0.7.0" +criterion = "0.8.1" [[bench]] name = "syntax_highlight" diff --git a/mitmproxy-linux/Cargo.toml b/mitmproxy-linux/Cargo.toml index c36b201a..adf7e3ec 100644 --- a/mitmproxy-linux/Cargo.toml +++ b/mitmproxy-linux/Cargo.toml @@ -21,9 +21,9 @@ mitmproxy-linux-ebpf-common = { path = "../mitmproxy-linux-ebpf-common"} tun = { workspace = true, features = ["async"] } aya = { workspace = true } aya-log = { workspace = true } -tokio = { version = "1.47", features = ["macros", "net", "rt-multi-thread", "sync", "io-util", "signal"] } +tokio = { version = "1.48", features = ["macros", "net", "rt-multi-thread", "sync", "io-util", "signal"] } anyhow = { version = "1.0.100", features = ["backtrace"] } -log = "0.4.28" +log = "0.4.29" env_logger = "0.11.5" prost = "0.14.1" internet-packet = { version = "0.2.0", features = ["checksums"] } @@ -32,8 +32,9 @@ const-sha1 = "0.3.0" [target.'cfg(target_os = "linux")'.build-dependencies] anyhow = { version = "1.0.100", features = ["backtrace"] } -aya-build = "0.1.2" +aya-build = "0.1.3" mitmproxy-linux-ebpf = { path = "../mitmproxy-linux-ebpf" } +cargo_metadata = { version = "0.23.1", default-features = false } [target.'cfg(target_os = "linux")'.dev-dependencies] hex = "0.4.3" diff --git a/mitmproxy-linux/build.rs b/mitmproxy-linux/build.rs index 9a2dbd53..c6924dc2 100644 --- a/mitmproxy-linux/build.rs +++ b/mitmproxy-linux/build.rs @@ -2,7 +2,7 @@ use anyhow::{anyhow, Context as _}; #[cfg(target_os = "linux")] -use aya_build::cargo_metadata; +use aya_build::Toolchain; #[cfg(not(target_os = "linux"))] fn main() {} @@ -16,7 +16,20 @@ fn main() -> anyhow::Result<()> { .context("MetadataCommand::exec")?; let ebpf_package = packages .into_iter() - .find(|cargo_metadata::Package { name, .. }| name == "mitmproxy-linux-ebpf") + .find(|cargo_metadata::Package { name, .. }| *name == "mitmproxy-linux-ebpf") .ok_or_else(|| anyhow!("mitmproxy-linux-ebpf package not found"))?; - aya_build::build_ebpf([ebpf_package]) + let cargo_metadata::Package { + name, + manifest_path, + .. + } = ebpf_package; + let ebpf_package = aya_build::Package { + name: name.as_str(), + root_dir: manifest_path + .parent() + .ok_or_else(|| anyhow!("no parent for {manifest_path}"))? + .as_str(), + ..Default::default() + }; + aya_build::build_ebpf([ebpf_package], Toolchain::default()) } diff --git a/mitmproxy-linux/src/main2.rs b/mitmproxy-linux/src/main2.rs index b1fb09f7..dcf38a1a 100644 --- a/mitmproxy-linux/src/main2.rs +++ b/mitmproxy-linux/src/main2.rs @@ -43,7 +43,7 @@ fn load_bpf(device_index: u32) -> Result { .context("failed to load eBPF program")?; if let Err(e) = aya_log::EbpfLogger::init(&mut ebpf) { // This can happen if you remove all log statements from your eBPF program. - warn!("failed to initialize eBPF logger: {}", e); + warn!("failed to initialize eBPF logger: {e}"); } debug!("Attaching BPF_CGROUP_INET_SOCK_CREATE program..."); @@ -181,7 +181,7 @@ fn bump_memlock_rlimit() { }; let ret = unsafe { libc::setrlimit(libc::RLIMIT_MEMLOCK, &rlim) }; if ret != 0 { - info!("remove limit on locked memory failed, ret is: {}", ret); + info!("remove limit on locked memory failed, ret is: {ret}"); } } diff --git a/mitmproxy-rs/Cargo.toml b/mitmproxy-rs/Cargo.toml index edb56d2a..96b0a724 100644 --- a/mitmproxy-rs/Cargo.toml +++ b/mitmproxy-rs/Cargo.toml @@ -21,15 +21,15 @@ mitmproxy-highlight = { path = "../mitmproxy-highlight" } mitmproxy-contentviews = { path = "../mitmproxy-contentviews" } anyhow = { version = "1.0.100", features = ["backtrace"] } data-encoding = "2.8.0" -log = "0.4.28" +log = "0.4.29" pyo3 = { version = "0.25", features = ["abi3", "abi3-py312", "anyhow"] } pyo3-async-runtimes = { version = "0.25", features = ["tokio-runtime", "testing", "attributes"] } pyo3-log = "0.12" rand_core = { version = "0.6.4", features = ["getrandom"] } # https://github.com/dalek-cryptography/curve25519-dalek/issues/731 -tokio = { version = "1.47", features = ["macros", "net", "rt-multi-thread", "sync"] } +tokio = { version = "1.48", features = ["macros", "net", "rt-multi-thread", "sync"] } boringtun = "0.6" tar = "0.4.44" -console-subscriber = { version = "0.4.1", optional = true } +console-subscriber = { version = "0.5.0", optional = true } [target.'cfg(target_os = "linux")'.dependencies] nix = { version = "0.30.1", features = ["user"] } diff --git a/mitmproxy-rs/src/server/local_redirector.rs b/mitmproxy-rs/src/server/local_redirector.rs index a2697f5a..2abec2cd 100644 --- a/mitmproxy-rs/src/server/local_redirector.rs +++ b/mitmproxy-rs/src/server/local_redirector.rs @@ -100,7 +100,7 @@ pub fn start_local_redirector( py: Python<'_>, handle_tcp_stream: PyObject, handle_udp_stream: PyObject, -) -> PyResult> { +) -> PyResult> { #[cfg(windows)] { let executable_path: std::path::PathBuf = py @@ -143,7 +143,7 @@ pub fn start_local_redirector( if let Some(copy_task) = copy_task { tokio::task::spawn_blocking(copy_task) .await - .map_err(|e| anyhow::anyhow!("failed to copy: {}", e))??; + .map_err(|e| anyhow::anyhow!("failed to copy: {e}"))??; } let (server, conf_tx) = Server::init(conf, handle_tcp_stream, handle_udp_stream).await?; diff --git a/mitmproxy-rs/src/server/tun.rs b/mitmproxy-rs/src/server/tun.rs index 71350556..01f7b02e 100644 --- a/mitmproxy-rs/src/server/tun.rs +++ b/mitmproxy-rs/src/server/tun.rs @@ -67,7 +67,7 @@ pub fn create_tun_interface( handle_tcp_stream: PyObject, handle_udp_stream: PyObject, tun_name: Option, -) -> PyResult> { +) -> PyResult> { #[cfg(target_os = "linux")] { let conf = mitmproxy::packet_sources::tun::TunConf { tun_name }; diff --git a/mitmproxy-rs/src/server/udp.rs b/mitmproxy-rs/src/server/udp.rs index b7b3c6ba..54dc08e3 100644 --- a/mitmproxy-rs/src/server/udp.rs +++ b/mitmproxy-rs/src/server/udp.rs @@ -58,7 +58,7 @@ pub fn start_udp_server( host: IpAddr, port: u16, handle_udp_stream: PyObject, -) -> PyResult> { +) -> PyResult> { let conf = UdpConf { listen_addr: SocketAddr::from((host, port)), }; diff --git a/mitmproxy-rs/src/server/wireguard.rs b/mitmproxy-rs/src/server/wireguard.rs index c54ee384..42ae57f8 100644 --- a/mitmproxy-rs/src/server/wireguard.rs +++ b/mitmproxy-rs/src/server/wireguard.rs @@ -69,7 +69,7 @@ pub fn start_wireguard_server( peer_public_keys: Vec, handle_tcp_stream: PyObject, handle_udp_stream: PyObject, -) -> PyResult> { +) -> PyResult> { let private_key = string_to_key(private_key)?; let peer_public_keys = peer_public_keys .into_iter() diff --git a/mitmproxy-rs/src/udp_client.rs b/mitmproxy-rs/src/udp_client.rs index 0f26aca0..64cab7e2 100644 --- a/mitmproxy-rs/src/udp_client.rs +++ b/mitmproxy-rs/src/udp_client.rs @@ -25,7 +25,7 @@ pub fn open_udp_connection( host: String, port: u16, local_addr: Option<(String, u16)>, -) -> PyResult> { +) -> PyResult> { pyo3_async_runtimes::tokio::future_into_py(py, async move { let socket = udp_connect(host, port, local_addr).await?; diff --git a/mitmproxy-windows/redirector/Cargo.toml b/mitmproxy-windows/redirector/Cargo.toml index dfcac1e6..0c6ceb62 100644 --- a/mitmproxy-windows/redirector/Cargo.toml +++ b/mitmproxy-windows/redirector/Cargo.toml @@ -15,11 +15,11 @@ workspace = true [target.'cfg(windows)'.dependencies] mitmproxy = { path = "../../" } -tokio = { version = "1.47", features = ["macros", "net", "rt-multi-thread", "sync", "io-util"] } +tokio = { version = "1.48", features = ["macros", "net", "rt-multi-thread", "sync", "io-util"] } anyhow = { version = "1.0.100", features = ["backtrace"] } windivert = "0.6.0" lru_time_cache = "0.11.11" -log = "0.4.28" +log = "0.4.29" env_logger = "0.11.5" prost = "0.14.1" internet-packet = { version = "0.2.2", features = ["checksums"] } diff --git a/mitmproxy-windows/redirector/src/main2.rs b/mitmproxy-windows/redirector/src/main2.rs index 315e4034..6395383b 100644 --- a/mitmproxy-windows/redirector/src/main2.rs +++ b/mitmproxy-windows/redirector/src/main2.rs @@ -129,7 +129,7 @@ async fn main() -> Result<()> { tokio::spawn(async move { if let Err(e) = handle_ipc(ipc_client, ipc_rx, event_tx).await { - error!("Error handling IPC: {}", e); + error!("Error handling IPC: {e}"); std::process::exit(1); } }); @@ -148,7 +148,7 @@ async fn main() -> Result<()> { let packet = match InternetPacket::try_from(data) { Ok(p) => p, Err(e) => { - debug!("Error parsing packet: {:?}", e); + debug!("Error parsing packet: {e:?}"); continue; } }; @@ -165,8 +165,7 @@ async fn main() -> Result<()> { packet.src_ip().is_loopback() && packet.dst_ip().is_loopback(); if is_multicast || is_loopback_only { debug!( - "skipping multicast={} loopback={}", - is_multicast, is_loopback_only + "skipping multicast={is_multicast} loopback={is_loopback_only}" ); inject_handle.send(&WinDivertPacket { address, @@ -333,7 +332,7 @@ async fn main() -> Result<()> { let packet = match InternetPacket::try_from(buf.to_vec()) { Ok(p) => p, Err(e) => { - info!("Error parsing packet: {:?}", e); + info!("Error parsing packet: {e:?}"); continue; } }; diff --git a/src/intercept_conf.rs b/src/intercept_conf.rs index f9ea8b3a..40cfd192 100755 --- a/src/intercept_conf.rs +++ b/src/intercept_conf.rs @@ -49,7 +49,7 @@ impl TryFrom<&str> for InterceptConf { return Ok(InterceptConf::new(vec![])); } let actions: Vec<&str> = val.split(',').collect(); - InterceptConf::try_from(actions).map_err(|_| anyhow!("invalid intercept spec: {}", value)) + InterceptConf::try_from(actions).map_err(|_| anyhow!("invalid intercept spec: {value}")) } } diff --git a/src/ipc/mitmproxy_ipc.rs b/src/ipc/mitmproxy_ipc.rs index 3f785970..3f3ab86e 100644 --- a/src/ipc/mitmproxy_ipc.rs +++ b/src/ipc/mitmproxy_ipc.rs @@ -6,14 +6,14 @@ // or file a PR and let CI handle it. /// Packet with associated tunnel info (Windows pipe to mitmproxy) -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct PacketWithMeta { #[prost(bytes = "bytes", tag = "1")] pub data: ::prost::bytes::Bytes, #[prost(message, optional, tag = "2")] pub tunnel_info: ::core::option::Option, } -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct TunnelInfo { #[prost(uint32, optional, tag = "1")] pub pid: ::core::option::Option, @@ -21,14 +21,14 @@ pub struct TunnelInfo { pub process_name: ::core::option::Option<::prost::alloc::string::String>, } /// Packet or intercept spec (Windows pipe to redirector) -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct FromProxy { #[prost(oneof = "from_proxy::Message", tags = "1, 2")] pub message: ::core::option::Option, } /// Nested message and enum types in `FromProxy`. pub mod from_proxy { - #[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Message { #[prost(message, tag = "1")] Packet(super::Packet), @@ -38,28 +38,28 @@ pub mod from_proxy { } /// Packet (macOS UDP Stream) /// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct Packet { #[prost(bytes = "bytes", tag = "1")] pub data: ::prost::bytes::Bytes, } /// Intercept conf (macOS Control Stream) /// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct InterceptConf { #[prost(string, repeated, tag = "1")] pub actions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// New flow (macOS TCP/UDP Stream) /// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct NewFlow { #[prost(oneof = "new_flow::Message", tags = "1, 2")] pub message: ::core::option::Option, } /// Nested message and enum types in `NewFlow`. pub mod new_flow { - #[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Message { #[prost(message, tag = "1")] Tcp(super::TcpFlow), @@ -68,7 +68,7 @@ pub mod new_flow { } } /// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct TcpFlow { #[prost(message, optional, tag = "1")] pub remote_address: ::core::option::Option
, @@ -76,21 +76,21 @@ pub struct TcpFlow { pub tunnel_info: ::core::option::Option, } /// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct UdpFlow { #[prost(message, optional, tag = "1")] pub local_address: ::core::option::Option
, #[prost(message, optional, tag = "3")] pub tunnel_info: ::core::option::Option, } -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct UdpPacket { #[prost(bytes = "bytes", tag = "1")] pub data: ::prost::bytes::Bytes, #[prost(message, optional, tag = "2")] pub remote_address: ::core::option::Option
, } -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct Address { #[prost(string, tag = "1")] pub host: ::prost::alloc::string::String, diff --git a/src/ipc/mitmproxy_ipc/mitmproxy_ipc.rs b/src/ipc/mitmproxy_ipc/mitmproxy_ipc.rs deleted file mode 100644 index 2f2ac653..00000000 --- a/src/ipc/mitmproxy_ipc/mitmproxy_ipc.rs +++ /dev/null @@ -1,100 +0,0 @@ -// @generated -// This file is @generated by prost-build. -// Note: The protobuf definition is shared between the Rust and Swift parts. -// We are not using prost-build because providing protoc is a hassle on many platforms. -// See .github/workflows/autofix.yml for how to update the respective files, -// or file a PR and let CI handle it. - -/// Packet with associated tunnel info (Windows pipe to mitmproxy) -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct PacketWithMeta { - #[prost(bytes="bytes", tag="1")] - pub data: ::prost::bytes::Bytes, - #[prost(message, optional, tag="2")] - pub tunnel_info: ::core::option::Option, -} -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct TunnelInfo { - #[prost(uint32, optional, tag="1")] - pub pid: ::core::option::Option, - #[prost(string, optional, tag="2")] - pub process_name: ::core::option::Option<::prost::alloc::string::String>, -} -/// Packet or intercept spec (Windows pipe to redirector) -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct FromProxy { - #[prost(oneof="from_proxy::Message", tags="1, 2")] - pub message: ::core::option::Option, -} -/// Nested message and enum types in `FromProxy`. -pub mod from_proxy { - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum Message { - #[prost(message, tag="1")] - Packet(super::Packet), - #[prost(message, tag="2")] - InterceptConf(super::InterceptConf), - } -} -/// Packet (macOS UDP Stream) -/// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct Packet { - #[prost(bytes="bytes", tag="1")] - pub data: ::prost::bytes::Bytes, -} -/// Intercept conf (macOS Control Stream) -/// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct InterceptConf { - #[prost(string, repeated, tag="1")] - pub actions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// New flow (macOS TCP/UDP Stream) -/// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct NewFlow { - #[prost(oneof="new_flow::Message", tags="1, 2")] - pub message: ::core::option::Option, -} -/// Nested message and enum types in `NewFlow`. -pub mod new_flow { - #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] - pub enum Message { - #[prost(message, tag="1")] - Tcp(super::TcpFlow), - #[prost(message, tag="2")] - Udp(super::UdpFlow), - } -} -/// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct TcpFlow { - #[prost(message, optional, tag="1")] - pub remote_address: ::core::option::Option
, - #[prost(message, optional, tag="2")] - pub tunnel_info: ::core::option::Option, -} -/// ⚠️ Bump network extension version on changes, -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct UdpFlow { - #[prost(message, optional, tag="1")] - pub local_address: ::core::option::Option
, - #[prost(message, optional, tag="3")] - pub tunnel_info: ::core::option::Option, -} -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct UdpPacket { - #[prost(bytes="bytes", tag="1")] - pub data: ::prost::bytes::Bytes, - #[prost(message, optional, tag="2")] - pub remote_address: ::core::option::Option
, -} -#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] -pub struct Address { - #[prost(string, tag="1")] - pub host: ::prost::alloc::string::String, - #[prost(uint32, tag="2")] - pub port: u32, -} -// @@protoc_insertion_point(module) diff --git a/src/messages.rs b/src/messages.rs index 5c778d72..1e025c95 100755 --- a/src/messages.rs +++ b/src/messages.rs @@ -176,7 +176,7 @@ impl TryFrom> for SmolPacket { match value[0] >> 4 { 4 => Ok(SmolPacket::V4(Ipv4Packet::new_checked(value)?)), 6 => Ok(SmolPacket::V6(Ipv6Packet::new_checked(value)?)), - _ => Err(anyhow!("Not an IP packet: {:?}", value)), + _ => Err(anyhow!("Not an IP packet: {value:?}")), } } } diff --git a/src/network/tests.rs b/src/network/tests.rs index 70b79270..35ff3e2d 100755 --- a/src/network/tests.rs +++ b/src/network/tests.rs @@ -805,7 +805,7 @@ async fn receive_icmp4_echo() -> Result<()> { let mut input_icmpv4_packet = match Icmpv4Packet::new_checked(response.payload_mut()) { Ok(p) => p, Err(e) => { - return Err(anyhow!("Invalid ICMPv4 packet emitted: {}", e)); + return Err(anyhow!("Invalid ICMPv4 packet emitted: {e}")); } }; @@ -843,7 +843,7 @@ async fn receive_icmp6_echo() -> Result<()> { let mut input_icmpv6_packet = match Icmpv6Packet::new_checked(response.payload_mut()) { Ok(p) => p, Err(e) => { - return Err(anyhow!("Invalid ICMPv6 packet emitted: {}", e)); + return Err(anyhow!("Invalid ICMPv6 packet emitted: {e}")); } }; diff --git a/src/packet_sources/linux.rs b/src/packet_sources/linux.rs index 6030dfe0..15727b44 100755 --- a/src/packet_sources/linux.rs +++ b/src/packet_sources/linux.rs @@ -61,7 +61,7 @@ async fn start_redirector( while let Ok(Some(line)) = stderr.next_line().await { if shutdown2.is_shutting_down() { // We don't want to log during exit, https://github.com/vorner/pyo3-log/issues/30 - eprintln!("{}", line); + eprintln!("{line}"); continue; } @@ -92,9 +92,9 @@ async fn start_redirector( } other => { if shutdown.is_shutting_down() { - eprintln!("[linux-redirector] exited during shutdown: {:?}", other) + eprintln!("[linux-redirector] exited during shutdown: {other:?}") } else { - error!("[linux-redirector] exited: {:?}", other) + error!("[linux-redirector] exited: {other:?}") } } } diff --git a/src/packet_sources/macos.rs b/src/packet_sources/macos.rs index 00b1fff3..5b6bff7e 100644 --- a/src/packet_sources/macos.rs +++ b/src/packet_sources/macos.rs @@ -209,7 +209,7 @@ impl ConnectionTask { .handle_udp(udp_flow) .await .context("failed to handle UDP stream"), - _ => bail!("Received invalid IPC message: {:?}", new_flow), + _ => bail!("Received invalid IPC message: {new_flow:?}"), } } diff --git a/src/packet_sources/windows.rs b/src/packet_sources/windows.rs index b970e27e..84997cef 100755 --- a/src/packet_sources/windows.rs +++ b/src/packet_sources/windows.rs @@ -81,7 +81,7 @@ impl PacketSourceConf for WindowsConf { if cfg!(debug_assertions) { if result.0 as u32 <= 32 { let err = windows::core::Error::from_win32(); - log::warn!("Failed to start child process: {}", err); + log::warn!("Failed to start child process: {err}"); } } else if result.0 as u32 == SE_ERR_ACCESSDENIED { return Err(anyhow!( @@ -89,7 +89,7 @@ impl PacketSourceConf for WindowsConf { )); } else if result.0 as u32 <= 32 { let err = windows::core::Error::from_win32(); - return Err(anyhow!("Failed to start the executable: {}", err)); + return Err(anyhow!("Failed to start the executable: {err}")); } let (conf_tx, conf_rx) = unbounded_channel(); diff --git a/src/processes/macos_icons.rs b/src/processes/macos_icons.rs index fb6252e0..b5f6e7d0 100644 --- a/src/processes/macos_icons.rs +++ b/src/processes/macos_icons.rs @@ -68,19 +68,14 @@ pub fn tiff_data_for_executable(executable: &Path) -> Result> { if executable == path.to_path_buf() { let pid = pid.as_u32(); unsafe { - #[allow(unexpected_cfgs)] let app: id = msg_send![ class!(NSRunningApplication), runningApplicationWithProcessIdentifier: pid ]; if !app.is_null() { - #[allow(unexpected_cfgs)] let img: id = msg_send![app, icon]; - #[allow(unexpected_cfgs)] let tiff: id = msg_send![img, TIFFRepresentation]; - #[allow(unexpected_cfgs)] let length: usize = msg_send![tiff, length]; - #[allow(unexpected_cfgs)] let bytes: *const u8 = msg_send![tiff, bytes]; let data = std::slice::from_raw_parts(bytes, length).to_vec(); return Ok(data); diff --git a/src/processes/windows_list.rs b/src/processes/windows_list.rs index ba536595..746ec50d 100644 --- a/src/processes/windows_list.rs +++ b/src/processes/windows_list.rs @@ -245,7 +245,7 @@ pub fn visible_windows() -> Result> { &mut cloaked as *mut BOOL as *mut _, size_of::() as u32, ) { - log::debug!("DwmGetWindowAttribute failed: {:#}", e); + log::debug!("DwmGetWindowAttribute failed: {e:#}"); false } else { cloaked.as_bool() @@ -298,9 +298,9 @@ mod tests { for pid in pids { let procname = super::get_process_name(pid) .map(|p| p.display().to_string()) - .unwrap_or_else(|e| format!("<{:?}>", e)); + .unwrap_or_else(|e| format!("<{e:?}>")); - println!("{: >6} {}", pid, procname); + println!("{pid: >6} {procname}"); } } diff --git a/wireguard-test-client/src/main.rs b/wireguard-test-client/src/main.rs index f45db09a..97dd7304 100755 --- a/wireguard-test-client/src/main.rs +++ b/wireguard-test-client/src/main.rs @@ -138,7 +138,7 @@ cafe0050123456790000000050100204FFFF0000\ } } TunnResult::Done => (), - _ => bail!("Unexpected decapsulatation result: {:?}", result), + _ => bail!("Unexpected decapsulatation result: {result:?}"), } } println!("All set!");