diff --git a/Cargo.lock b/Cargo.lock index ee5ffe3..d9b5a31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,6 +110,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + [[package]] name = "aralez" version = "0.9.2" @@ -139,12 +145,12 @@ dependencies = [ "port_check", "privdrop", "prometheus 0.14.0", - "rand 0.10.0-rc.5", + "rand 0.10.0-rc.9", "reqwest", "rustls-pemfile", "serde", "serde_json", - "serde_yaml 0.9.34+deprecated", + "serde_yaml", "sha2", "tokio", "tonic", @@ -155,9 +161,12 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.7.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +checksum = "9ded5f9a03ac8f24d1b8a25101ee812cd32cdc8c50a4c50237de2c4915850e73" +dependencies = [ + "rustversion", +] [[package]] name = "arrayvec" @@ -243,17 +252,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.4.0" @@ -416,9 +414,9 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.11.0-rc.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9ef36a6fcdb072aa548f3da057640ec10859eb4e91ddf526ee648d50c76a949" +checksum = "96eb4cdd6cf1b31d671e9efe75c5d1ec614776856cefbe109ca373554a6d514f" dependencies = [ "hybrid-array", ] @@ -453,6 +451,17 @@ dependencies = [ "alloc-stdlib", ] +[[package]] +name = "bstr" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -531,13 +540,13 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chacha20" -version = "0.10.0-rc.5" +version = "0.10.0-rc.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cbf41c6ec3c4b9eaf7f8f5c11a72cd7d3aa0428125c20d5ef4d09907a0f019" +checksum = "c536927023d1c432e6e23a25ef45f6756094eac2ab460db5fb17a772acdfd312" dependencies = [ "cfg-if", "cpufeatures", - "rand_core 0.10.0-rc-2", + "rand_core 0.10.0", ] [[package]] @@ -551,42 +560,43 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.25" +version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a" dependencies = [ - "atty", - "bitflags 1.3.2", + "clap_builder", "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238" +dependencies = [ + "anstream", + "anstyle", "clap_lex", - "indexmap 1.9.3", - "once_cell", "strsim", - "termcolor", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.25" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ - "heck 0.4.1", - "proc-macro-error", + "heck", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" [[package]] name = "cmake" @@ -684,9 +694,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.2.0-rc.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919bd05924682a5480aec713596b9e2aabed3a0a6022fab6847f85a99e5f190a" +checksum = "211f05e03c7d03754740fd9e585de910a095d6b99f8bcfffdef8319fa02a8331" dependencies = [ "hybrid-array", ] @@ -778,12 +788,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.11.0-rc.4" +version = "0.11.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea390c940e465846d64775e55e3115d5dc934acb953de6f6e6360bc232fe2bf7" +checksum = "02b42f1d9edf5207c137646b568a0168ca0ec25b7f9eaf7f9961da51a3d91cea" dependencies = [ - "block-buffer 0.11.0-rc.5", - "crypto-common 0.2.0-rc.5", + "block-buffer 0.11.0", + "crypto-common 0.2.0", ] [[package]] @@ -884,9 +894,15 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "foreign-types" @@ -1054,6 +1070,20 @@ dependencies = [ "windows-targets 0.52.6", ] +[[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 0.10.0", + "wasip2", + "wasip3", +] + [[package]] name = "gimli" version = "0.31.1" @@ -1091,16 +1121,19 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", + "foldhash 0.1.5", ] [[package]] -name = "heck" -version = "0.4.1" +name = "hashbrown" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] [[package]] name = "heck" @@ -1108,15 +1141,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hex" version = "0.4.3" @@ -1187,9 +1211,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hybrid-array" -version = "0.4.1" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7116c472cf19838450b1d421b4e842569f52b519d640aee9ace1ebcf5b21051" +checksum = "e1b229d73f5803b562cc26e4da0396c8610a4ee209f4fac8fa4f8d709166dc45" dependencies = [ "typenum", ] @@ -1391,6 +1415,12 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "1.0.3" @@ -1430,6 +1460,7 @@ checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown 0.15.2", + "serde", ] [[package]] @@ -1588,6 +1619,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.174" @@ -1614,12 +1651,6 @@ dependencies = [ "libc", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "litemap" version = "0.7.4" @@ -1656,11 +1687,11 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lru" -version = "0.14.0" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f8cc7106155f10bdf99a6f379688f543ad6596a415375b36a59a054ceda1198" +checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593" dependencies = [ - "hashbrown 0.15.2", + "hashbrown 0.16.1", ] [[package]] @@ -1987,12 +2018,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - [[package]] name = "parking_lot" version = "0.12.3" @@ -2072,9 +2097,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pingora" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a1f02a6347e81953ab831fdcf090a028db12d67ec3badf47831d1299dac6e20" +checksum = "01e8f7e45ee3a0c90e154ba7f2ec12ea33c398913d45d23b01429e90e1b394c7" dependencies = [ "pingora-cache", "pingora-core", @@ -2086,13 +2111,14 @@ dependencies = [ [[package]] name = "pingora-cache" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef622051fbb2cb98a524df3a8112f02d0919ccda600a44d705ec550f1a28fe2" +checksum = "bcea698ba4fef0863caf2feaf0f699ee29d82c19f9c54bc55c8f29e8609c773c" dependencies = [ "ahash", "async-trait", "blake2", + "bstr", "bytes", "cf-rustracing", "cf-rustracing-jaeger", @@ -2122,13 +2148,14 @@ dependencies = [ [[package]] name = "pingora-core" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f63d3f67d99c95a1f85623fc43242fd644dd12ccbaa18c38a54e1580c6846a" +checksum = "5aced35d346b7c6559234b5ec493d638471d3234b0152f18c59390bbdafac2a7" dependencies = [ "ahash", "async-trait", "brotli", + "bstr", "bytes", "chrono", "clap", @@ -2157,12 +2184,13 @@ dependencies = [ "rand 0.8.5", "regex", "serde", - "serde_yaml 0.8.26", + "serde_yaml", "sfv", "socket2", "strum", "strum_macros", "tokio", + "tokio-stream", "tokio-test", "unicase", "windows-sys 0.59.0", @@ -2171,15 +2199,15 @@ dependencies = [ [[package]] name = "pingora-error" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52119570d3f4644e09654ad24df2b7d851bf12eaa8c4148b4674c7f90916598e" +checksum = "1b761e30ae329162ddddbbb41d2bf8a3e48d52c70a0d5ff51ccb964acf0bd505" [[package]] name = "pingora-header-serde" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "252a16def05c7adbbdda776e87b2be36e9481c8a77249207a2f3b563e8933b35" +checksum = "640aa945c00ad51c7d06a434c41dbad560bf51dbf6f00e5d614102e7794aae67" dependencies = [ "bytes", "http", @@ -2193,9 +2221,9 @@ dependencies = [ [[package]] name = "pingora-http" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3542fd0fd0a83212882c5066ae739ba51804f20d624ff7e12ec85113c5c89a" +checksum = "fbf2ce52fefeb2ed795a3d5fa4b556cfa33a7592691677e8837c6a58d0358215" dependencies = [ "bytes", "http", @@ -2204,27 +2232,27 @@ dependencies = [ [[package]] name = "pingora-ketama" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f5dd8546b1874d5cfca594375c1cfb852c3dffd4f060428fa031a6e790dea18" +checksum = "5566ee2f3ca3ba478792d765d6b28aaf1ebae4a7f302c7eb814c83f4d793c1f1" dependencies = [ "crc32fast", ] [[package]] name = "pingora-limits" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93c897e8cc04ff0d077ee2a655142910618222aeefc83f7f99f5b9fc59ccb13" +checksum = "c952fa1c197d5cecae4a6df55a198a41118a8f68fe6ee45edbbe365b65e70a29" dependencies = [ "ahash", ] [[package]] name = "pingora-load-balancing" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b5bb0314830a64b73b50b3782f3089f87947b61b4324c804d6f8d4ff9ce1c70" +checksum = "3e7ff0d87ab5924c1af03fc1b766aef398e75cfe0273019f68b7c2978002ca97" dependencies = [ "arc-swap", "async-trait", @@ -2244,21 +2272,21 @@ dependencies = [ [[package]] name = "pingora-lru" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba89e4400cb978f0d7be1c14bd7ab4168c8e2c00d97ff19f964fc0048780237c" +checksum = "3aa964c4e12e6328388b7059c93aac37b052be7962bbb70dd239b515532be4bf" dependencies = [ "arrayvec", - "hashbrown 0.15.2", + "hashbrown 0.16.1", "parking_lot", "rand 0.8.5", ] [[package]] name = "pingora-openssl" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d390f21024c6c8e171fd9ee82aee0cacdd324d079535d1b47011acabed87673b" +checksum = "92713d25950fd4bf4fdca86dc3603884d13282242fdb436dac4f8389a7105556" dependencies = [ "foreign-types", "libc", @@ -2269,9 +2297,9 @@ dependencies = [ [[package]] name = "pingora-pool" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "996c574f30a6e1ad10b47ac1626a86e0e47d5075953dd049d60df16ba5f7076e" +checksum = "a1a89f8d8d48caadb7f711227e0754bac6495dd2d4ee03137cc2c6d46c3b0a9d" dependencies = [ "crossbeam-queue", "log", @@ -2284,9 +2312,9 @@ dependencies = [ [[package]] name = "pingora-proxy" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c4097fd2639905bf5b81f3618551cd826d5e03aac063e17fd7a4137f19c1a5b" +checksum = "f0884d6158a828f53f4069861493a4225ed2a26c8d739a875350fa0c97109edf" dependencies = [ "async-trait", "bytes", @@ -2307,9 +2335,9 @@ dependencies = [ [[package]] name = "pingora-runtime" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccc165021cf55a39b9e760121b22c4260b17a0b2c530d5b93092fc5bc765b94" +checksum = "c107d6eaf57c98285b91c487a1972bcb08405f39f9e73a5c28525620f7010956" dependencies = [ "once_cell", "rand 0.8.5", @@ -2319,9 +2347,9 @@ dependencies = [ [[package]] name = "pingora-timeout" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "548cd21d41611c725827677937e68f2cd008bbfa09f3416d3fbad07e1e42f6d7" +checksum = "64451dc4613770411814209b8c1659945682f0258305bae51c1e44cb9b887d30" dependencies = [ "once_cell", "parking_lot", @@ -2372,6 +2400,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55" +dependencies = [ + "proc-macro2", + "syn 2.0.100", +] + [[package]] name = "privdrop" version = "0.5.6" @@ -2382,30 +2420,6 @@ dependencies = [ "nix 0.30.1", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.93" @@ -2536,6 +2550,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "rand" version = "0.8.5" @@ -2559,13 +2579,13 @@ dependencies = [ [[package]] name = "rand" -version = "0.10.0-rc.5" +version = "0.10.0-rc.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be866deebbade98028b705499827ad6967c8bb1e21f96a2609913c8c076e9307" +checksum = "9a8cd8be2e7e2fd2ee3e09045798e65c906682ec9f16293defc4790dd775d5a3" dependencies = [ "chacha20", - "getrandom 0.3.1", - "rand_core 0.10.0-rc-2", + "getrandom 0.4.1", + "rand_core 0.10.0", ] [[package]] @@ -2608,9 +2628,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.10.0-rc-2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a23e4e8b77312a823b6b5613edbac78397e2f34320bc7ac4277013ec4478e" +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" [[package]] name = "redox_syscall" @@ -2902,6 +2922,12 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + [[package]] name = "serde" version = "1.0.228" @@ -2967,18 +2993,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_yaml" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" -dependencies = [ - "indexmap 1.9.3", - "ryu", - "serde", - "yaml-rust", -] - [[package]] name = "serde_yaml" version = "0.9.34+deprecated" @@ -3005,13 +3019,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.11.0-rc.3" +version = "0.11.0-rc.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d43dc0354d88b791216bb5c1bfbb60c0814460cc653ae0ebd71f286d0bd927" +checksum = "7c5f3b1e2dc8aad28310d8410bd4d7e180eca65fca176c52ab00d364475d0024" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.11.0-rc.4", + "digest 0.11.0-rc.11", ] [[package]] @@ -3083,9 +3097,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" @@ -3102,7 +3116,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", @@ -3178,21 +3192,6 @@ dependencies = [ "libc", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" - [[package]] name = "thiserror" version = "1.0.69" @@ -3311,9 +3310,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.48.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" dependencies = [ "bytes", "libc", @@ -3397,9 +3396,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb7613188ce9f7df5bfe185db26c5814347d110db17920415cf2fbcad85e7203" +checksum = "a286e33f82f8a1ee2df63f4fa35c0becf4a85a0cb03091a15fd7bf0b402dc94a" dependencies = [ "async-trait", "axum", @@ -3558,6 +3557,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11cd88e12b17c6494200a9c1b683a04fcac9573ed74cd1b62aeb2727c5592243" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -3657,6 +3662,24 @@ dependencies = [ "wit-bindgen-rt", ] +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.100" @@ -3728,6 +3751,28 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.7.1", + "wasm-encoder", + "wasmparser", +] + [[package]] name = "wasm-streams" version = "0.4.2" @@ -3741,6 +3786,18 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.8.0", + "hashbrown 0.15.2", + "indexmap 2.7.1", + "semver", +] + [[package]] name = "web-sys" version = "0.3.77" @@ -4139,6 +4196,26 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + [[package]] name = "wit-bindgen-rt" version = "0.33.0" @@ -4148,6 +4225,74 @@ dependencies = [ "bitflags 2.8.0", ] +[[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 2.7.1", + "prettyplease", + "syn 2.0.100", + "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 2.0.100", + "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 2.8.0", + "indexmap 2.7.1", + "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 2.7.1", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "write16" version = "1.0.0" @@ -4177,15 +4322,6 @@ dependencies = [ "time", ] -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "yoke" version = "0.7.5" diff --git a/Cargo.toml b/Cargo.toml index c8ceb85..e95c74a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,14 +11,14 @@ panic = "abort" strip = true [dependencies] -tokio = { version = "1.48.0", features = ["full"] } -pingora = { version = "0.6.0", features = ["lb", "openssl"] } # openssl, rustls, boringssl +tokio = { version = "1.49.0", features = ["full"] } +pingora = { version = "0.7.0", features = ["lb", "openssl"] } # openssl, rustls, boringssl serde = { version = "1.0.228", features = ["derive"] } dashmap = "7.0.0-rc2" -pingora-core = "0.6.0" -pingora-proxy = "0.6.0" -pingora-http = "0.6.0" -pingora-limits = "0.6.0" +pingora-core = "0.7.0" +pingora-proxy = "0.7.0" +pingora-http = "0.7.0" +pingora-limits = "0.7.0" async-trait = "0.1.89" env_logger = "0.11.8" log = "0.4.29" @@ -27,18 +27,15 @@ notify = "9.0.0-rc.1" axum = { version = "0.8.8" } axum-server = { version = "0.8.0", features = ["tls-openssl"] } reqwest = { version = "0.13.1", features = ["json", "stream"] } -#reqwest = { version = "0.12.15", features = ["json", "rustls-tls"] } -#reqwest = { version = "0.12.15", default-features = false, features = ["rustls-tls", "json"] } - serde_yaml = "0.9.34-deprecated" -rand = "0.10.0-rc.5" +rand = "0.10.0-rc.8" base64 = "0.22.1" jsonwebtoken = { version = "10.3.0", features = ["aws_lc_rs"] } -tonic = "0.14.2" -sha2 = { version = "0.11.0-rc.3", default-features = false } +tonic = "0.14.3" +sha2 = { version = "0.11.0-rc.5", default-features = false } base16ct = { version = "1.0.0", features = ["alloc"] } urlencoding = "2.1.3" -arc-swap = "1.7.1" +arc-swap = "1.8.1" mimalloc = { version = "0.1.48", default-features = false } prometheus = "0.14.0" lazy_static = "1.5.0" @@ -51,7 +48,3 @@ ctrlc = "3.5.1" port_check = "0.3.0" serde_json = "1.0.149" http = "1.4.0" -#moka = { version = "0.12.12", features = ["sync"] } -#rustls = { version = "0.23.27", features = ["ring"] } -#hickory-client = { version = "0.25.2" } -#openssl = "0.10.73" diff --git a/src/utils.rs b/src/utils.rs index 9e3eff6..a3566fe 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -2,6 +2,7 @@ pub mod auth; pub mod discovery; pub mod dnsclient; mod filewatch; +pub mod fordebug; pub mod healthcheck; pub mod httpclient; pub mod jwt; diff --git a/src/utils/fordebug.rs b/src/utils/fordebug.rs new file mode 100644 index 0000000..65f0706 --- /dev/null +++ b/src/utils/fordebug.rs @@ -0,0 +1,31 @@ +use std::alloc::{GlobalAlloc, Layout, System}; +use std::sync::atomic::{AtomicUsize, Ordering}; + +pub struct CountingAllocator; + +pub static ALLOC_COUNT: AtomicUsize = AtomicUsize::new(0); +pub static DEALLOC_COUNT: AtomicUsize = AtomicUsize::new(0); +pub static ALLOC_BYTES: AtomicUsize = AtomicUsize::new(0); +#[allow(dead_code)] +unsafe impl GlobalAlloc for CountingAllocator { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + ALLOC_COUNT.fetch_add(1, Ordering::Relaxed); + ALLOC_BYTES.fetch_add(layout.size(), Ordering::Relaxed); + System.alloc(layout) + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + DEALLOC_COUNT.fetch_add(1, Ordering::Relaxed); + System.dealloc(ptr, layout) + } +} + +// Uncomment following lines and comment allocator in main.rs +// #[global_allocator] +// pub static A: CountingAllocator = CountingAllocator; +#[allow(dead_code)] +fn for_example() { + let before = crate::utils::fordebug::ALLOC_COUNT.load(Ordering::Relaxed); + let after = crate::utils::fordebug::ALLOC_COUNT.load(Ordering::Relaxed); + println!("Allocations : {}", after - before); +} diff --git a/src/utils/kuberconsul.rs b/src/utils/kuberconsul.rs index 5ccb5ad..7aef457 100644 --- a/src/utils/kuberconsul.rs +++ b/src/utils/kuberconsul.rs @@ -7,7 +7,7 @@ use dashmap::DashMap; use futures::channel::mpsc::Sender; use futures::SinkExt; use pingora::prelude::sleep; -use rand::Rng; +use rand::RngExt; use serde::Deserialize; use std::collections::HashMap; use std::env; @@ -19,10 +19,6 @@ use std::time::Duration; use tokio::fs::File; use tokio::io::AsyncReadExt; -// #[derive(Debug, Deserialize)] -// pub struct KubeEndpointsList { -// pub items: Vec, -// } #[derive(Debug, serde::Deserialize)] pub struct KubeEndpoints { pub subsets: Option>, diff --git a/src/utils/metrics.rs b/src/utils/metrics.rs index a7d9ca0..3545ed7 100644 --- a/src/utils/metrics.rs +++ b/src/utils/metrics.rs @@ -1,4 +1,5 @@ use http::method::Method; +use http::StatusCode; use pingora_http::Version; use prometheus::{register_histogram, register_int_counter, register_int_counter_vec, Histogram, IntCounter, IntCounterVec}; use std::sync::Arc; @@ -7,7 +8,7 @@ use std::time::Duration; pub struct MetricTypes { pub method: Method, pub upstream: Arc, - pub code: String, + pub code: Option, pub latency: Duration, pub version: Version, } @@ -65,7 +66,7 @@ pub fn calc_metrics(metric_types: &MetricTypes) { _ => "Unknown", }; REQUESTS_BY_VERSION.with_label_values(&[&version_str]).inc(); - RESPONSE_CODES.with_label_values(&[&metric_types.code]).inc(); + RESPONSE_CODES.with_label_values(&[metric_types.code.unwrap_or(http::StatusCode::GONE).as_str()]).inc(); REQUESTS_BY_METHOD.with_label_values(&[&metric_types.method]).inc(); REQUESTS_BY_UPSTREAM.with_label_values(&[metric_types.upstream.as_ref()]).inc(); RESPONSE_LATENCY.observe(metric_types.latency.as_secs_f64()); diff --git a/src/web/proxyhttp.rs b/src/web/proxyhttp.rs index 218021e..53f5883 100644 --- a/src/web/proxyhttp.rs +++ b/src/web/proxyhttp.rs @@ -14,7 +14,6 @@ use pingora_core::listeners::ALPN; use pingora_core::prelude::HttpPeer; use pingora_limits::rate::Rate; use pingora_proxy::{ProxyHttp, Session}; -// use std::net::{IpAddr, Ipv4Addr}; use std::sync::Arc; use std::time::Duration; use tokio::time::Instant; @@ -72,8 +71,8 @@ impl ProxyHttp for LB { }; let hostname = return_header_host_from_upstream(session, &self.ump_upst); - _ctx.hostname = hostname; + _ctx.hostname = hostname; let mut backend_id = None; if ep.sticky_sessions { @@ -93,8 +92,8 @@ impl ProxyHttp for LB { match _ctx.hostname.as_ref() { None => return Ok(false), Some(host) => { - // let optioninnermap = self.get_host(host.as_str(), host.as_str(), backend_id); let optioninnermap = self.get_host(host, session.req_header().uri.path(), backend_id); + match optioninnermap { None => return Ok(false), Some(ref innermap) => { @@ -118,6 +117,7 @@ impl ProxyHttp for LB { _ctx.upstream_peer = optioninnermap; } } + Ok(false) } async fn upstream_peer(&self, session: &mut Session, ctx: &mut Self::CTX) -> Result> { @@ -230,8 +230,7 @@ impl ProxyHttp for LB { debug!("{}, response code: {response_code}", self.request_summary(session, ctx)); let m = &MetricTypes { method: session.req_header().method.clone(), - // method: Arc::from(session.req_header().method.as_str()), - code: session.response_written().map(|resp| resp.status.as_str().to_owned()).unwrap_or("0".to_string()), + code: session.response_written().map(|resp| resp.status), latency: ctx.start_time.elapsed(), version: session.req_header().version, upstream: ctx.hostname.clone().unwrap_or(Arc::from("localhost")), @@ -240,50 +239,6 @@ impl ProxyHttp for LB { } } -// use moka::sync::Cache; -// Using Moka for a high-concurrency, size-limited cache -// static HOST_CACHE: Lazy>> = Lazy::new(|| { -// Cache::builder() -// .max_capacity(10_000) // Limits memory usage if attacked -// .build() -// }); -// fn return_header_host_cached(session: &Session) -> Option> { -// let host_str = if session.is_http2() { -// session.req_header().uri.host()? -// } else { -// let h = session.req_header().headers.get("host")?.to_str().ok()?; -// h.split_once(':').map_or(h, |(host, _)| host) -// }; -// HOST_CACHE -// .get_with(host_str.to_string(), || { -// Arc::from(host_str) -// }) -// .into() -// } - -// use dashmap::DashMap; -// A simple cache to reuse Arcs for common hostnames -// static HOST_CACHE: Lazy>> = Lazy::new(|| DashMap::with_capacity(200)); -// -// fn return_header_host_cached(session: &Session) -> Option> { -// let host_str = if session.is_http2() { -// session.req_header().uri.host()? -// } else { -// let h = session.req_header().headers.get("host")?.to_str().ok()?; -// h.split_once(':').map_or(h, |(host, _)| host) -// }; -// -// // Fast path: check if we already have an Arc for this host -// if let Some(arc) = HOST_CACHE.get(host_str) { -// return Some(arc.clone()); // Only an atomic increment! -// } -// -// // Slow path: create new Arc and cache it -// let new_arc: Arc = Arc::from(host_str); -// HOST_CACHE.insert(host_str.to_string(), new_arc.clone()); -// Some(new_arc) -// } - fn return_header_host_from_upstream(session: &Session, ump_upst: &UpstreamsDashMap) -> Option> { let host_str = if session.is_http2() { session.req_header().uri.host()?