Compare commits

...

33 Commits

Author SHA1 Message Date
d4a922198c Update Rust crate tokio to 1.50.0
All checks were successful
continuous-integration/drone/push Build is passing
2026-03-04 00:19:50 +00:00
265620f883 Merge pull request 'Update Rust crate anyhow to 1.0.102' (#13) from renovate/anyhow-1.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-22 00:15:05 +00:00
6a75ad6382 Update Rust crate anyhow to 1.0.102
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-21 00:15:23 +00:00
d73f2774df Merge pull request 'Update Rust crate clap to 4.5.60' (#12) from renovate/clap-4.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-21 00:15:20 +00:00
5880d71172 Update Rust crate clap to 4.5.60
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-20 00:14:53 +00:00
055a4ecb12 Merge pull request 'Update Rust crate clap to 4.5.59' (#11) from renovate/clap-4.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-18 00:27:13 +00:00
d667b5f308 Update Rust crate clap to 4.5.59
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-17 00:27:21 +00:00
57f6cb9ab7 Merge pull request 'Update Rust crate env_logger to 0.11.9' (#10) from renovate/env_logger-0.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-15 00:27:30 +00:00
ee6809956c Update Rust crate env_logger to 0.11.9
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-14 00:27:09 +00:00
e95280e684 Merge pull request 'Update Rust crate clap to 4.5.58' (#9) from renovate/clap-4.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-14 00:27:05 +00:00
f21439060e Update Rust crate clap to 4.5.58
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-13 00:27:15 +00:00
836909a844 Merge pull request 'Update Rust crate rand to 0.10.0' (#8) from renovate/rand-0.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-10 00:26:37 +00:00
ec10a54f18 Update Rust crate rand to 0.10.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-09 00:26:43 +00:00
5c9952e007 Merge pull request 'Update Rust crate anyhow to 1.0.101' (#7) from renovate/anyhow-1.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-07 00:26:56 +00:00
fdd38507a0 Update Rust crate anyhow to 1.0.101
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-06 00:26:31 +00:00
244949c111 Merge pull request 'Update Rust crate clap to 4.5.57' (#6) from renovate/clap-4.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-02-05 00:26:39 +00:00
7c85a03d6f Update Rust crate clap to 4.5.57
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-02-04 00:26:17 +00:00
e18c2aa981 Merge pull request 'Update Rust crate clap to 4.5.56' (#5) from renovate/clap-4.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-31 00:25:52 +00:00
5ecb9ec2a4 Update Rust crate clap to 4.5.56
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-01-30 00:26:33 +00:00
e8e29b29ad Merge pull request 'Update Rust crate clap to 4.5.55' (#4) from renovate/clap-4.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-29 00:26:24 +00:00
0e907f4a7b Update Rust crate clap to 4.5.55
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-01-28 00:26:23 +00:00
eb334170d8 Merge pull request 'Update Rust crate tokio to 1.49.0' (#3) from renovate/tokio-1.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-07 00:21:55 +00:00
94e9ee8ab3 Update Rust crate tokio to 1.49.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-01-06 00:22:05 +00:00
dd76599744 Merge pull request 'Update Rust crate clap to 4.5.54' (#2) from renovate/clap-4.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-06 00:22:02 +00:00
e1f4dde529 Update Rust crate clap to 4.5.54
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-01-05 00:22:18 +00:00
2104f519eb Merge pull request 'Update Rust crate log to 0.4.29' (#1) from renovate/log-0.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-04 00:15:23 +00:00
aba1121d18 Update Rust crate log to 0.4.29
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-12-03 00:14:40 +00:00
21fab535d4 Update
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-26 12:20:10 +01:00
8b613a1b6f update
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-26 12:02:30 +01:00
a26ff16bfb Minor fix 2025-11-26 11:58:53 +01:00
d8ea9db3c2 Add release files
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-26 11:52:58 +01:00
72c167dcd5 Initial release
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-26 11:11:32 +01:00
952dd052bd WIP adaptations
Some checks failed
continuous-integration/drone/push Build is failing
2025-11-26 10:39:29 +01:00
5 changed files with 447 additions and 122 deletions

335
Cargo.lock generated
View File

@@ -61,6 +61,12 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "anyhow"
version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "bitflags"
version = "2.10.0"
@@ -80,10 +86,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "clap"
version = "4.5.53"
name = "chacha20"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8"
checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601"
dependencies = [
"cfg-if",
"cpufeatures",
"rand_core",
]
[[package]]
name = "clap"
version = "4.5.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a"
dependencies = [
"clap_builder",
"clap_derive",
@@ -91,9 +108,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.53"
version = "4.5.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00"
checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876"
dependencies = [
"anstream",
"anstyle",
@@ -103,9 +120,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.49"
version = "4.5.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5"
dependencies = [
"heck",
"proc-macro2",
@@ -115,9 +132,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.7.6"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
[[package]]
name = "colorchoice"
@@ -126,10 +143,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
name = "env_filter"
version = "0.1.4"
name = "cpufeatures"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2"
checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
dependencies = [
"libc",
]
[[package]]
name = "env_filter"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f"
dependencies = [
"log",
"regex",
@@ -137,9 +163,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.11.8"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d"
dependencies = [
"anstream",
"anstyle",
@@ -149,23 +175,54 @@ dependencies = [
]
[[package]]
name = "getrandom"
version = "0.3.4"
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "foldhash"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "getrandom"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
dependencies = [
"cfg-if",
"libc",
"r-efi",
"rand_core",
"wasip2",
"wasip3",
]
[[package]]
name = "hashbrown"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
"foldhash",
]
[[package]]
name = "hashbrown"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
[[package]]
name = "header_proxy"
version = "0.1.0"
dependencies = [
"anyhow",
"clap",
"env_logger",
"httparse",
"lazy_static",
"log",
"rand",
@@ -178,12 +235,42 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "httparse"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
[[package]]
name = "id-arena"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
[[package]]
name = "indexmap"
version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
dependencies = [
"equivalent",
"hashbrown 0.16.1",
"serde",
"serde_core",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "itoa"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
[[package]]
name = "jiff"
version = "0.2.16"
@@ -214,6 +301,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "leb128fmt"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "libc"
version = "0.2.177"
@@ -231,9 +324,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 = "memchr"
@@ -303,12 +396,13 @@ dependencies = [
]
[[package]]
name = "ppv-lite86"
version = "0.2.21"
name = "prettyplease"
version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"zerocopy",
"proc-macro2",
"syn",
]
[[package]]
@@ -337,32 +431,20 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "rand"
version = "0.9.2"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8"
dependencies = [
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"chacha20",
"getrandom",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.9.3"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
"getrandom",
]
checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba"
[[package]]
name = "redox_syscall"
@@ -408,6 +490,21 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
[[package]]
name = "serde"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
]
[[package]]
name = "serde_core"
version = "1.0.228"
@@ -428,6 +525,19 @@ dependencies = [
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
dependencies = [
"itoa",
"memchr",
"serde",
"serde_core",
"zmij",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.7"
@@ -472,9 +582,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.48.0"
version = "1.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408"
checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d"
dependencies = [
"bytes",
"libc",
@@ -504,6 +614,12 @@ version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
[[package]]
name = "unicode-xid"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "utf8parse"
version = "0.2.2"
@@ -522,7 +638,50 @@ version = "1.0.1+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
dependencies = [
"wit-bindgen",
"wit-bindgen 0.46.0",
]
[[package]]
name = "wasip3"
version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
dependencies = [
"wit-bindgen 0.51.0",
]
[[package]]
name = "wasm-encoder"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
dependencies = [
"leb128fmt",
"wasmparser",
]
[[package]]
name = "wasm-metadata"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
dependencies = [
"anyhow",
"indexmap",
"wasm-encoder",
"wasmparser",
]
[[package]]
name = "wasmparser"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
dependencies = [
"bitflags",
"hashbrown 0.15.5",
"indexmap",
"semver",
]
[[package]]
@@ -621,21 +780,95 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
[[package]]
name = "zerocopy"
version = "0.8.30"
name = "wit-bindgen"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ea879c944afe8a2b25fef16bb4ba234f47c694565e97383b36f3a878219065c"
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
dependencies = [
"zerocopy-derive",
"wit-bindgen-rust-macro",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.30"
name = "wit-bindgen-core"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf955aa904d6040f70dc8e9384444cb1030aed272ba3cb09bbc4ab9e7c1f34f5"
checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
dependencies = [
"anyhow",
"heck",
"wit-parser",
]
[[package]]
name = "wit-bindgen-rust"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
dependencies = [
"anyhow",
"heck",
"indexmap",
"prettyplease",
"syn",
"wasm-metadata",
"wit-bindgen-core",
"wit-component",
]
[[package]]
name = "wit-bindgen-rust-macro"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
dependencies = [
"anyhow",
"prettyplease",
"proc-macro2",
"quote",
"syn",
"wit-bindgen-core",
"wit-bindgen-rust",
]
[[package]]
name = "wit-component"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
dependencies = [
"anyhow",
"bitflags",
"indexmap",
"log",
"serde",
"serde_derive",
"serde_json",
"wasm-encoder",
"wasm-metadata",
"wasmparser",
"wit-parser",
]
[[package]]
name = "wit-parser"
version = "0.244.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
dependencies = [
"anyhow",
"id-arena",
"indexmap",
"log",
"semver",
"serde",
"serde_derive",
"serde_json",
"unicode-xid",
"wasmparser",
]
[[package]]
name = "zmij"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4de98dfa5d5b7fef4ee834d0073d560c9ca7b6c46a71d058c48db7960f8cfaf7"

View File

@@ -4,9 +4,11 @@ version = "0.1.0"
edition = "2024"
[dependencies]
log = "0.4.28"
env_logger = "0.11.8"
clap = { version = "4.5.53", features = ["env", "derive"] }
tokio = { version = "1.48.0", features = ["full"] }
rand = "0.9.2"
log = "0.4.29"
env_logger = "0.11.9"
clap = { version = "4.5.60", features = ["env", "derive"] }
tokio = { version = "1.50.0", features = ["full"] }
rand = "0.10.0"
lazy_static = "1.5.0"
httparse = "1.10.1"
anyhow = "1.0.102"

10
Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y libcurl4 \
&& rm -rf /var/lib/apt/lists/*
COPY header_proxy /usr/local/bin/header_proxy
ENTRYPOINT ["/usr/local/bin/header_proxy"]

10
build_docker_image.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
cargo build --release
TEMP_DIR=$(mktemp -d)
cp target/release/header_proxy "$TEMP_DIR"
docker build -f Dockerfile "$TEMP_DIR" -t pierre42100/header_proxy
rm -r $TEMP_DIR

View File

@@ -1,33 +1,28 @@
use clap::Parser;
use rand::distr::{Alphanumeric, SampleString};
use rustls_pki_types::ServerName;
use std::error::Error;
use std::fs::OpenOptions;
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
use tokio::net::TcpStream;
use tokio_rustls::TlsConnector;
use tokio_rustls::rustls::{ClientConfig, RootCertStore};
/// Simple program that redirect requests to a given server in request
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// The address the server will listen to
#[arg(short, long, default_value = "0.0.0.0:8000")]
#[arg(short, long, env, default_value = "0.0.0.0:8000")]
listen_address: String,
/// The name of the header that contain target host and port
#[arg(short, long, default_value = "x-target-host")]
#[arg(short, long, env, default_value = "x-target-host")]
target_host_port_header: String,
/// Name of optional header that contains path to add to the request
#[arg(short, long, default_value = "x-path-prefix")]
path_prefix_heder: String,
/// Name of optional header that contains path to add to the request.
///
/// If this value is defined, all clients packets are inspected in research for path to
/// manipulate
#[arg(short, long, env)]
path_prefix_header: Option<String>,
}
lazy_static::lazy_static! {
@@ -56,61 +51,95 @@ async fn main() -> Result<(), Box<dyn Error>> {
tokio::spawn(async move {
let conn_id = rand_str(5);
log::debug!(
"Handle new connection from {}",
log::info!(
"[{conn_id}] Handle new connection from {}",
client_socket.peer_addr().unwrap()
);
let stream = TcpStream::connect(TODO)
.await
.expect("Failed to connect to upstream");
let mut upstream = connector
.connect(dnsname, stream)
.await
.expect("Failed to establish TLS connection");
let (mut client_read, mut client_write) = client_socket.split();
let mut buf_client = [0u8; 1024];
let mut buf_client = [0u8; 10000];
let mut buf_server = [0u8; 1024];
let mut modified_headers = false;
// Perform first read operation manually to manipulate path and determine target server
let mut total = 0;
let headers_processed = loop {
let count = match client_read.read(&mut buf_client[total..]).await {
Ok(count) => count,
Err(e) => {
log::error!(
"[{conn_id}] Failed to read initial data from client, closing connection! {e}"
);
return;
}
};
if count == 0 {
log::error!("[{conn_id}] read from client count is null, cannot continue!");
let _ = client_write.write_all(ERR_NOT_PROXIFIALBE).await;
return;
}
total += count;
match process_headers(&buf_client[..total]) {
Ok(None) => {
log::debug!("[{conn_id}] Insufficient amount of data, need to continue");
continue;
}
Ok(Some(res)) => break res,
Err(e) => {
log::error!("[{conn_id}] failed to parse initial request headers! {e}");
let _ = client_write.write_all(ERR_NOT_PROXIFIALBE).await;
return;
}
}
};
// Connect to upstream
let mut upstream = match TcpStream::connect(headers_processed.target_host).await {
Ok(upstream) => upstream,
Err(e) => {
log::error!("[{conn_id}] Could not connect to upstream! {e}");
let _ = client_write.write_all(ERR_NOT_PROXIFIALBE).await;
return;
}
};
// Transfer modified headers to upstream
if let Err(e) = upstream.write_all(&headers_processed.buff).await {
log::error!("[{conn_id}] Could not forward initial bytes to upstream! {e}");
let _ = client_write.write_all(ERR_NOT_PROXIFIALBE).await;
return;
}
// Enter in loop to forward remaining data
loop {
tokio::select! {
count = client_read.read(&mut buf_client) => {
let count = match count{ Ok(count) => count, Err(e) => {
log::error!("[{conn_id}] Failed to read data from client, closing connection! {e}");
return;
break;
}};
log::info!("[{conn_id}] Got a new client read {count} - {base_file_name}");
log::debug!("[{conn_id}] Got a new client read {count}");
if count == 0 {
log::warn!("[{conn_id}] infinite loop (client), closing connection");
drop(upstream);
return;
break;
}
// We need to modify some headers (if not done already) to adapt the request to the server
let buff = if !modified_headers {
// Check for URL prefix
if let Some(prefix) = &args.prefix
&& !String::from_utf8_lossy(&buf_client[..count]).split_once('\n').map(|l|l.0).unwrap_or("").contains(&format!(" {prefix}")) {
client_write.write_all(ERR_NOT_PROXIFIABLE).await.expect("Failed to respond to client");
client_write.flush().await.expect("Failed to flush response to client!");
return;
}
modified_headers = true;
manipulate_headers(&buf_client[..count], &args.upstream_dns)
// In case of connection reuse, we need to reanalyze data
if ARGS.path_prefix_header.is_some() &&
let Ok(Some(res))= process_headers(&buf_client[..count])
&& let Err(e) = upstream.write_all(&res.buff).await {
log::error!("[{conn_id}] Failed to write to upstream! {e}");
break;
}
else {
buf_client[..count].to_vec()
};
upstream.write_all(&buff).await.unwrap_or_else(|_| panic!("[{conn_id}] Failed to write to upstream"));
if let Err(e)=upstream.write_all(&buf_client[..count]).await {
log::error!("[{conn_id}] Failed to write to upstream! {e}");
break;
}
}
count = upstream.read(&mut buf_server) => {
@@ -118,47 +147,88 @@ async fn main() -> Result<(), Box<dyn Error>> {
Ok(count) => count,
Err(e) => {
log::error!("[{conn_id}] Failed to read from upstream! {e}");
return;
break;
}
};
if count == 0 {
log::warn!("[{conn_id}] infinite loop (upstream), closing connection");
drop(upstream);
return;
break;
}
log::info!("[{conn_id}] Got a new upstream read {count} - {base_file_name}");
client_write.write_all(&buf_server[..count]).await.expect("Failed to write to client");
log::debug!("[{conn_id}] Got a new upstream read {count}");
if let Err(e) = client_write.write_all(&buf_server[..count]).await {
log::error!("Failed to write to upstream! {e}");
break;
};
}
}
}
log::info!("[{conn_id}] Connection finished.");
});
}
}
fn manipulate_headers(buff: &[u8], host: &str) -> Vec<u8> {
let mut out = Vec::with_capacity(buff.len());
struct ProcessHeadersResult {
buff: Vec<u8>,
target_host: String,
}
let mut i = 0;
while i < buff.len() {
if buff[i] != b'\n' || i + 1 == buff.len() || !buff[i + 1..].starts_with(b"Host:") {
out.push(buff[i]);
i += 1;
continue;
fn process_headers(buff: &[u8]) -> anyhow::Result<Option<ProcessHeadersResult>> {
let mut headers = [httparse::EMPTY_HEADER; 64];
let mut req = httparse::Request::new(&mut headers);
let parsing_res = req.parse(buff)?;
let target_host = headers
.iter()
.find(|h| h.name.eq_ignore_ascii_case(&ARGS.target_host_port_header))
.map(|h| String::from_utf8_lossy(h.value));
log::debug!("Request headers: {:?}", headers);
let Some(target_host) = target_host else {
if parsing_res.is_partial() {
return Ok(None);
} else {
anyhow::bail!(
"Request is complete without header {}",
ARGS.target_host_port_header
)
}
};
i += 1;
out.push(b'\n');
// Check if path needs to be prefixed
let prefix_path = if let Some(hname) = &ARGS.path_prefix_header {
headers
.iter()
.find(|h| h.name.eq_ignore_ascii_case(hname))
.map(|h| String::from_utf8_lossy(h.value).replace(['\n', '\r', '\t', ' '], ""))
} else {
None
};
out.append(&mut format!("Host: {host}").as_bytes().to_vec());
while buff[i] != b'\r' && buff[i] != b'\n' {
i += 1;
// Perform prefix injection
let mut buff = buff.to_vec();
if let Some(prefix) = prefix_path {
let pos = buff.iter().position(|c| c == &b' ');
log::debug!("Add path prefix to request {prefix}");
if let Some(pos) = pos {
for (num, c) in prefix.as_bytes().iter().enumerate() {
buff.insert(pos + 1 + num, *c);
}
} else {
log::warn!("Unable to inject prefix!");
}
}
out
log::trace!("Final request: {}", String::from_utf8_lossy(&buff));
Ok(Some(ProcessHeadersResult {
target_host: target_host.to_string(),
buff,
}))
}
#[cfg(test)]