diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-02 18:36:06 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-02 18:36:06 -0600 |
| commit | 8cdfa445d6629ffef4cb84967ff7017654045bc2 (patch) | |
| tree | 22f0b0907c024c78d26a731e2e1f5219407d8102 /vendor/tonic-reflection | |
| parent | 4351c74c7c5f97156bc94d3a8549b9940ac80e3f (diff) | |
chore: add vendor directory
Diffstat (limited to 'vendor/tonic-reflection')
| -rw-r--r-- | vendor/tonic-reflection/.cargo-checksum.json | 1 | ||||
| -rw-r--r-- | vendor/tonic-reflection/Cargo.lock | 728 | ||||
| -rw-r--r-- | vendor/tonic-reflection/Cargo.toml | 128 | ||||
| -rw-r--r-- | vendor/tonic-reflection/LICENSE | 19 | ||||
| -rw-r--r-- | vendor/tonic-reflection/README.md | 3 | ||||
| -rw-r--r-- | vendor/tonic-reflection/proto/reflection_v1.proto | 147 | ||||
| -rw-r--r-- | vendor/tonic-reflection/proto/reflection_v1alpha.proto | 136 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/generated/grpc_reflection_v1.rs | 461 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs | 461 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/generated/reflection_v1_fds.rs | 161 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/generated/reflection_v1alpha1_fds.rs | 153 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/lib.rs | 66 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/server/mod.rs | 326 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/server/v1.rs | 138 | ||||
| -rw-r--r-- | vendor/tonic-reflection/src/server/v1alpha.rs | 138 | ||||
| -rw-r--r-- | vendor/tonic-reflection/tests/server.rs | 151 | ||||
| -rw-r--r-- | vendor/tonic-reflection/tests/versions.rs | 172 |
17 files changed, 3389 insertions, 0 deletions
diff --git a/vendor/tonic-reflection/.cargo-checksum.json b/vendor/tonic-reflection/.cargo-checksum.json new file mode 100644 index 00000000..9884b454 --- /dev/null +++ b/vendor/tonic-reflection/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.lock":"207196be6696256b109f40ef4a45a13e92c8369fffb15a7316759e5b831b6b61","Cargo.toml":"4ad6d66e3d73a3dca6be6450ee077aba3e350cfb7da7e029e4c300b342f47575","LICENSE":"e24a56698aa6feaf3a02272b3624f9dc255d982970c5ed97ac4525a95056a5b3","README.md":"86e302aa22d4df05f4f4272d25679741c59da3e4399fd51578b45924643eb1d2","proto/reflection_v1.proto":"92fe8aab9378b0b9807b081de1fc743f847262c1fb6d1ca16501f9e91d450b19","proto/reflection_v1alpha.proto":"7834b214ac40e2466295b7c4ddfa738e7e57f4f4cc7a3ee50033f408ea2176fa","src/generated/grpc_reflection_v1.rs":"8a4c51b467d887a406afa7bffd188bb6f11bc1865337e4650f1b17330c3c94ae","src/generated/grpc_reflection_v1alpha.rs":"4c0002b761f7ce7fd23d70dd91238993cd82d456d519eb8b39fa1d789f131323","src/generated/reflection_v1_fds.rs":"24fddd44c7a402972a75c7ebc4699a70d11deacd8938654b343024d6f7f1beec","src/generated/reflection_v1alpha1_fds.rs":"5ecb4122fb0b95322ced972ef57772655b364fcf3ece8f8576ac24e7030daf10","src/lib.rs":"56492411bf72bfe486d6455f0501df2ff7c092f19a52209e11dc5b81140fda01","src/server/mod.rs":"f121a12ec78c78fa40bccf82c376a6fe944adb5d92c56991f2c6f1038eec1e2f","src/server/v1.rs":"7425c63a1ef4aaa52445a4c57a44b8127ae0ba8446f0f8c9c09c016a4eb2c6e9","src/server/v1alpha.rs":"80a8fd0acec7d255a76872e616fe533ff4e898ee01a717265b58244f0c0e3f41","tests/server.rs":"5b237bfe3819b874a09d6466af00ce118eb307c5e000102b66e3608661fa7e61","tests/versions.rs":"c2e031afe3379df11bfaad151f4c11daebc5493b1ffc8624c3edf9052961de11"},"package":"f9687bd5bfeafebdded2356950f278bba8226f0b32109537c4253406e09aafe1"}
\ No newline at end of file diff --git a/vendor/tonic-reflection/Cargo.lock b/vendor/tonic-reflection/Cargo.lock new file mode 100644 index 00000000..49e3543a --- /dev/null +++ b/vendor/tonic-reflection/Cargo.lock @@ -0,0 +1,728 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "async-trait" +version = "0.1.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "h2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" +dependencies = [ + "prost", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" + +[[package]] +name = "socket2" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "tokio" +version = "1.44.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e581ba15a835f4d9ea06c55ab1bd4dce26fc53752c69a04aac00703bfb49ba9" +dependencies = [ + "async-trait", + "base64", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "prost", + "socket2", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-reflection" +version = "0.13.1" +dependencies = [ + "prost", + "prost-types", + "tokio", + "tokio-stream", + "tonic", +] + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project-lite", + "slab", + "sync_wrapper", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/vendor/tonic-reflection/Cargo.toml b/vendor/tonic-reflection/Cargo.toml new file mode 100644 index 00000000..3d0ab5c2 --- /dev/null +++ b/vendor/tonic-reflection/Cargo.toml @@ -0,0 +1,128 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.75" +name = "tonic-reflection" +version = "0.13.1" +authors = [ + "James Nugent <james@jen20.com>", + "Samani G. Gikandi <samani@gojulas.com>", +] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = """ +Server Reflection module of `tonic` gRPC implementation. +""" +homepage = "https://github.com/hyperium/tonic" +readme = "README.md" +keywords = [ + "rpc", + "grpc", + "async", + "reflection", +] +categories = [ + "network-programming", + "asynchronous", +] +license = "MIT" +repository = "https://github.com/hyperium/tonic" + +[package.metadata.cargo_check_external_types] +allowed_external_types = [ + "tonic::*", + "bytes::*", + "http::*", + "http_body::*", + "prost::*", + "prost_types::*", + "futures_core::stream::Stream", + "tower_service::Service", +] + +[package.metadata.docs.rs] +all-features = true + +[features] +default = ["server"] +server = [ + "dep:prost-types", + "dep:tokio", + "dep:tokio-stream", +] + +[lib] +name = "tonic_reflection" +path = "src/lib.rs" + +[[test]] +name = "server" +path = "tests/server.rs" + +[[test]] +name = "versions" +path = "tests/versions.rs" + +[dependencies.prost] +version = "0.13" + +[dependencies.prost-types] +version = "0.13" +optional = true + +[dependencies.tokio] +version = "1.0" +features = [ + "sync", + "rt", +] +optional = true + +[dependencies.tokio-stream] +version = "0.1" +optional = true +default-features = false + +[dependencies.tonic] +version = "0.13.0" +features = [ + "codegen", + "prost", +] +default-features = false + +[dev-dependencies.tokio-stream] +version = "0.1" +features = ["net"] +default-features = false + +[dev-dependencies.tonic] +version = "0.13.0" +features = ["transport"] +default-features = false + +[lints.clippy] +uninlined_format_args = "deny" + +[lints.rust] +missing_debug_implementations = "warn" +missing_docs = "warn" +rust_2018_idioms = "warn" +unreachable_pub = "warn" + +[lints.rustdoc] +broken_intra_doc_links = "deny" diff --git a/vendor/tonic-reflection/LICENSE b/vendor/tonic-reflection/LICENSE new file mode 100644 index 00000000..c7f571db --- /dev/null +++ b/vendor/tonic-reflection/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2025 Lucio Franco + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/tonic-reflection/README.md b/vendor/tonic-reflection/README.md new file mode 100644 index 00000000..b4f29f59 --- /dev/null +++ b/vendor/tonic-reflection/README.md @@ -0,0 +1,3 @@ +# tonic-reflection + +A `tonic` based gRPC reflection implementation. diff --git a/vendor/tonic-reflection/proto/reflection_v1.proto b/vendor/tonic-reflection/proto/reflection_v1.proto new file mode 100644 index 00000000..1a2ceedc --- /dev/null +++ b/vendor/tonic-reflection/proto/reflection_v1.proto @@ -0,0 +1,147 @@ +// Copyright 2016 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Service exported by server reflection. A more complete description of how +// server reflection works can be found at +// https://github.com/grpc/grpc/blob/master/doc/server-reflection.md +// +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto + +syntax = "proto3"; + +package grpc.reflection.v1; + +option go_package = "google.golang.org/grpc/reflection/grpc_reflection_v1"; +option java_multiple_files = true; +option java_package = "io.grpc.reflection.v1"; +option java_outer_classname = "ServerReflectionProto"; + +service ServerReflection { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + rpc ServerReflectionInfo(stream ServerReflectionRequest) + returns (stream ServerReflectionResponse); +} + +// The message sent by the client when calling ServerReflectionInfo method. +message ServerReflectionRequest { + string host = 1; + // To use reflection service, the client should set one of the following + // fields in message_request. The server distinguishes requests by their + // defined field and then handles them using corresponding methods. + oneof message_request { + // Find a proto file by the file name. + string file_by_filename = 3; + + // Find the proto file that declares the given fully-qualified symbol name. + // This field should be a fully-qualified symbol name + // (e.g. <package>.<service>[.<method>] or <package>.<type>). + string file_containing_symbol = 4; + + // Find the proto file which defines an extension extending the given + // message type with the given field number. + ExtensionRequest file_containing_extension = 5; + + // Finds the tag numbers used by all known extensions of the given message + // type, and appends them to ExtensionNumberResponse in an undefined order. + // Its corresponding method is best-effort: it's not guaranteed that the + // reflection service will implement this method, and it's not guaranteed + // that this method will provide all extensions. Returns + // StatusCode::UNIMPLEMENTED if it's not implemented. + // This field should be a fully-qualified type name. The format is + // <package>.<type> + string all_extension_numbers_of_type = 6; + + // List the full names of registered services. The content will not be + // checked. + string list_services = 7; + } +} + +// The type name and extension number sent by the client when requesting +// file_containing_extension. +message ExtensionRequest { + // Fully-qualified type name. The format should be <package>.<type> + string containing_type = 1; + int32 extension_number = 2; +} + +// The message sent by the server to answer ServerReflectionInfo method. +message ServerReflectionResponse { + string valid_host = 1; + ServerReflectionRequest original_request = 2; + // The server sets one of the following fields according to the message_request + // in the request. + oneof message_response { + // This message is used to answer file_by_filename, file_containing_symbol, + // file_containing_extension requests with transitive dependencies. + // As the repeated label is not allowed in oneof fields, we use a + // FileDescriptorResponse message to encapsulate the repeated fields. + // The reflection service is allowed to avoid sending FileDescriptorProtos + // that were previously sent in response to earlier requests in the stream. + FileDescriptorResponse file_descriptor_response = 4; + + // This message is used to answer all_extension_numbers_of_type requests. + ExtensionNumberResponse all_extension_numbers_response = 5; + + // This message is used to answer list_services requests. + ListServiceResponse list_services_response = 6; + + // This message is used when an error occurs. + ErrorResponse error_response = 7; + } +} + +// Serialized FileDescriptorProto messages sent by the server answering +// a file_by_filename, file_containing_symbol, or file_containing_extension +// request. +message FileDescriptorResponse { + // Serialized FileDescriptorProto messages. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. + repeated bytes file_descriptor_proto = 1; +} + +// A list of extension numbers sent by the server answering +// all_extension_numbers_of_type request. +message ExtensionNumberResponse { + // Full name of the base type, including the package name. The format + // is <package>.<type> + string base_type_name = 1; + repeated int32 extension_number = 2; +} + +// A list of ServiceResponse sent by the server answering list_services request. +message ListServiceResponse { + // The information of each service may be expanded in the future, so we use + // ServiceResponse message to encapsulate it. + repeated ServiceResponse service = 1; +} + +// The information of a single service used by ListServiceResponse to answer +// list_services request. +message ServiceResponse { + // Full name of a registered service, including its package name. The format + // is <package>.<service> + string name = 1; +} + +// The error code and error message sent by the server when an error occurs. +message ErrorResponse { + // This field uses the error codes defined in grpc::StatusCode. + int32 error_code = 1; + string error_message = 2; +} + diff --git a/vendor/tonic-reflection/proto/reflection_v1alpha.proto b/vendor/tonic-reflection/proto/reflection_v1alpha.proto new file mode 100644 index 00000000..c2da3146 --- /dev/null +++ b/vendor/tonic-reflection/proto/reflection_v1alpha.proto @@ -0,0 +1,136 @@ +// Copyright 2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Service exported by server reflection + +syntax = "proto3"; + +package grpc.reflection.v1alpha; + +service ServerReflection { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + rpc ServerReflectionInfo(stream ServerReflectionRequest) + returns (stream ServerReflectionResponse); +} + +// The message sent by the client when calling ServerReflectionInfo method. +message ServerReflectionRequest { + string host = 1; + // To use reflection service, the client should set one of the following + // fields in message_request. The server distinguishes requests by their + // defined field and then handles them using corresponding methods. + oneof message_request { + // Find a proto file by the file name. + string file_by_filename = 3; + + // Find the proto file that declares the given fully-qualified symbol name. + // This field should be a fully-qualified symbol name + // (e.g. <package>.<service>[.<method>] or <package>.<type>). + string file_containing_symbol = 4; + + // Find the proto file which defines an extension extending the given + // message type with the given field number. + ExtensionRequest file_containing_extension = 5; + + // Finds the tag numbers used by all known extensions of extendee_type, and + // appends them to ExtensionNumberResponse in an undefined order. + // Its corresponding method is best-effort: it's not guaranteed that the + // reflection service will implement this method, and it's not guaranteed + // that this method will provide all extensions. Returns + // StatusCode::UNIMPLEMENTED if it's not implemented. + // This field should be a fully-qualified type name. The format is + // <package>.<type> + string all_extension_numbers_of_type = 6; + + // List the full names of registered services. The content will not be + // checked. + string list_services = 7; + } +} + +// The type name and extension number sent by the client when requesting +// file_containing_extension. +message ExtensionRequest { + // Fully-qualified type name. The format should be <package>.<type> + string containing_type = 1; + int32 extension_number = 2; +} + +// The message sent by the server to answer ServerReflectionInfo method. +message ServerReflectionResponse { + string valid_host = 1; + ServerReflectionRequest original_request = 2; + // The server sets one of the following fields according to the + // message_request in the request. + oneof message_response { + // This message is used to answer file_by_filename, file_containing_symbol, + // file_containing_extension requests with transitive dependencies. + // As the repeated label is not allowed in oneof fields, we use a + // FileDescriptorResponse message to encapsulate the repeated fields. + // The reflection service is allowed to avoid sending FileDescriptorProtos + // that were previously sent in response to earlier requests in the stream. + FileDescriptorResponse file_descriptor_response = 4; + + // This message is used to answer all_extension_numbers_of_type requests. + ExtensionNumberResponse all_extension_numbers_response = 5; + + // This message is used to answer list_services requests. + ListServiceResponse list_services_response = 6; + + // This message is used when an error occurs. + ErrorResponse error_response = 7; + } +} + +// Serialized FileDescriptorProto messages sent by the server answering +// a file_by_filename, file_containing_symbol, or file_containing_extension +// request. +message FileDescriptorResponse { + // Serialized FileDescriptorProto messages. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. + repeated bytes file_descriptor_proto = 1; +} + +// A list of extension numbers sent by the server answering +// all_extension_numbers_of_type request. +message ExtensionNumberResponse { + // Full name of the base type, including the package name. The format + // is <package>.<type> + string base_type_name = 1; + repeated int32 extension_number = 2; +} + +// A list of ServiceResponse sent by the server answering list_services request. +message ListServiceResponse { + // The information of each service may be expanded in the future, so we use + // ServiceResponse message to encapsulate it. + repeated ServiceResponse service = 1; +} + +// The information of a single service used by ListServiceResponse to answer +// list_services request. +message ServiceResponse { + // Full name of a registered service, including its package name. The format + // is <package>.<service> + string name = 1; +} + +// The error code and error message sent by the server when an error occurs. +message ErrorResponse { + // This field uses the error codes defined in grpc::StatusCode. + int32 error_code = 1; + string error_message = 2; +}
\ No newline at end of file diff --git a/vendor/tonic-reflection/src/generated/grpc_reflection_v1.rs b/vendor/tonic-reflection/src/generated/grpc_reflection_v1.rs new file mode 100644 index 00000000..569ee671 --- /dev/null +++ b/vendor/tonic-reflection/src/generated/grpc_reflection_v1.rs @@ -0,0 +1,461 @@ +// This file is @generated by prost-build. +/// The message sent by the client when calling ServerReflectionInfo method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerReflectionRequest { + #[prost(string, tag = "1")] + pub host: ::prost::alloc::string::String, + /// To use reflection service, the client should set one of the following + /// fields in message_request. The server distinguishes requests by their + /// defined field and then handles them using corresponding methods. + #[prost(oneof = "server_reflection_request::MessageRequest", tags = "3, 4, 5, 6, 7")] + pub message_request: ::core::option::Option< + server_reflection_request::MessageRequest, + >, +} +/// Nested message and enum types in `ServerReflectionRequest`. +pub mod server_reflection_request { + /// To use reflection service, the client should set one of the following + /// fields in message_request. The server distinguishes requests by their + /// defined field and then handles them using corresponding methods. + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum MessageRequest { + /// Find a proto file by the file name. + #[prost(string, tag = "3")] + FileByFilename(::prost::alloc::string::String), + /// Find the proto file that declares the given fully-qualified symbol name. + /// This field should be a fully-qualified symbol name + /// (e.g. <package>.<service>\[.<method>\] or <package>.<type>). + #[prost(string, tag = "4")] + FileContainingSymbol(::prost::alloc::string::String), + /// Find the proto file which defines an extension extending the given + /// message type with the given field number. + #[prost(message, tag = "5")] + FileContainingExtension(super::ExtensionRequest), + /// Finds the tag numbers used by all known extensions of the given message + /// type, and appends them to ExtensionNumberResponse in an undefined order. + /// Its corresponding method is best-effort: it's not guaranteed that the + /// reflection service will implement this method, and it's not guaranteed + /// that this method will provide all extensions. Returns + /// StatusCode::UNIMPLEMENTED if it's not implemented. + /// This field should be a fully-qualified type name. The format is + /// <package>.<type> + #[prost(string, tag = "6")] + AllExtensionNumbersOfType(::prost::alloc::string::String), + /// List the full names of registered services. The content will not be + /// checked. + #[prost(string, tag = "7")] + ListServices(::prost::alloc::string::String), + } +} +/// The type name and extension number sent by the client when requesting +/// file_containing_extension. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExtensionRequest { + /// Fully-qualified type name. The format should be <package>.<type> + #[prost(string, tag = "1")] + pub containing_type: ::prost::alloc::string::String, + #[prost(int32, tag = "2")] + pub extension_number: i32, +} +/// The message sent by the server to answer ServerReflectionInfo method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerReflectionResponse { + #[prost(string, tag = "1")] + pub valid_host: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub original_request: ::core::option::Option<ServerReflectionRequest>, + /// The server sets one of the following fields according to the message_request + /// in the request. + #[prost(oneof = "server_reflection_response::MessageResponse", tags = "4, 5, 6, 7")] + pub message_response: ::core::option::Option< + server_reflection_response::MessageResponse, + >, +} +/// Nested message and enum types in `ServerReflectionResponse`. +pub mod server_reflection_response { + /// The server sets one of the following fields according to the message_request + /// in the request. + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum MessageResponse { + /// This message is used to answer file_by_filename, file_containing_symbol, + /// file_containing_extension requests with transitive dependencies. + /// As the repeated label is not allowed in oneof fields, we use a + /// FileDescriptorResponse message to encapsulate the repeated fields. + /// The reflection service is allowed to avoid sending FileDescriptorProtos + /// that were previously sent in response to earlier requests in the stream. + #[prost(message, tag = "4")] + FileDescriptorResponse(super::FileDescriptorResponse), + /// This message is used to answer all_extension_numbers_of_type requests. + #[prost(message, tag = "5")] + AllExtensionNumbersResponse(super::ExtensionNumberResponse), + /// This message is used to answer list_services requests. + #[prost(message, tag = "6")] + ListServicesResponse(super::ListServiceResponse), + /// This message is used when an error occurs. + #[prost(message, tag = "7")] + ErrorResponse(super::ErrorResponse), + } +} +/// Serialized FileDescriptorProto messages sent by the server answering +/// a file_by_filename, file_containing_symbol, or file_containing_extension +/// request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FileDescriptorResponse { + /// Serialized FileDescriptorProto messages. We avoid taking a dependency on + /// descriptor.proto, which uses proto2 only features, by making them opaque + /// bytes instead. + #[prost(bytes = "vec", repeated, tag = "1")] + pub file_descriptor_proto: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>, +} +/// A list of extension numbers sent by the server answering +/// all_extension_numbers_of_type request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExtensionNumberResponse { + /// Full name of the base type, including the package name. The format + /// is <package>.<type> + #[prost(string, tag = "1")] + pub base_type_name: ::prost::alloc::string::String, + #[prost(int32, repeated, tag = "2")] + pub extension_number: ::prost::alloc::vec::Vec<i32>, +} +/// A list of ServiceResponse sent by the server answering list_services request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListServiceResponse { + /// The information of each service may be expanded in the future, so we use + /// ServiceResponse message to encapsulate it. + #[prost(message, repeated, tag = "1")] + pub service: ::prost::alloc::vec::Vec<ServiceResponse>, +} +/// The information of a single service used by ListServiceResponse to answer +/// list_services request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServiceResponse { + /// Full name of a registered service, including its package name. The format + /// is <package>.<service> + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +/// The error code and error message sent by the server when an error occurs. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ErrorResponse { + /// This field uses the error codes defined in grpc::StatusCode. + #[prost(int32, tag = "1")] + pub error_code: i32, + #[prost(string, tag = "2")] + pub error_message: ::prost::alloc::string::String, +} +/// Generated client implementations. +pub mod server_reflection_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct ServerReflectionClient<T> { + inner: tonic::client::Grpc<T>, + } + impl<T> ServerReflectionClient<T> + where + T: tonic::client::GrpcService<tonic::body::Body>, + T::Error: Into<StdError>, + T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static, + <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor<F>( + inner: T, + interceptor: F, + ) -> ServerReflectionClient<InterceptedService<T, F>> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request<tonic::body::Body>, + Response = http::Response< + <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody, + >, + >, + <T as tonic::codegen::Service< + http::Request<tonic::body::Body>, + >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync, + { + ServerReflectionClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// The reflection service is structured as a bidirectional stream, ensuring + /// all related requests go to a single server. + pub async fn server_reflection_info( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::ServerReflectionRequest, + >, + ) -> std::result::Result< + tonic::Response<tonic::codec::Streaming<super::ServerReflectionResponse>>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "grpc.reflection.v1.ServerReflection", + "ServerReflectionInfo", + ), + ); + self.inner.streaming(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod server_reflection_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ServerReflectionServer. + #[async_trait] + pub trait ServerReflection: std::marker::Send + std::marker::Sync + 'static { + /// Server streaming response type for the ServerReflectionInfo method. + type ServerReflectionInfoStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result< + super::ServerReflectionResponse, + tonic::Status, + >, + > + + std::marker::Send + + 'static; + /// The reflection service is structured as a bidirectional stream, ensuring + /// all related requests go to a single server. + async fn server_reflection_info( + &self, + request: tonic::Request<tonic::Streaming<super::ServerReflectionRequest>>, + ) -> std::result::Result< + tonic::Response<Self::ServerReflectionInfoStream>, + tonic::Status, + >; + } + #[derive(Debug)] + pub struct ServerReflectionServer<T> { + inner: Arc<T>, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option<usize>, + max_encoding_message_size: Option<usize>, + } + impl<T> ServerReflectionServer<T> { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc<T>) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor<F>( + inner: T, + interceptor: F, + ) -> InterceptedService<Self, F> + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl<T, B> tonic::codegen::Service<http::Request<B>> for ServerReflectionServer<T> + where + T: ServerReflection, + B: Body + std::marker::Send + 'static, + B::Error: Into<StdError> + std::marker::Send + 'static, + { + type Response = http::Response<tonic::body::Body>; + type Error = std::convert::Infallible; + type Future = BoxFuture<Self::Response, Self::Error>; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll<std::result::Result<(), Self::Error>> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request<B>) -> Self::Future { + match req.uri().path() { + "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo" => { + #[allow(non_camel_case_types)] + struct ServerReflectionInfoSvc<T: ServerReflection>(pub Arc<T>); + impl< + T: ServerReflection, + > tonic::server::StreamingService<super::ServerReflectionRequest> + for ServerReflectionInfoSvc<T> { + type Response = super::ServerReflectionResponse; + type ResponseStream = T::ServerReflectionInfoStream; + type Future = BoxFuture< + tonic::Response<Self::ResponseStream>, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming<super::ServerReflectionRequest>, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + <T as ServerReflection>::server_reflection_info( + &inner, + request, + ) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = ServerReflectionInfoSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl<T> Clone for ServerReflectionServer<T> { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "grpc.reflection.v1.ServerReflection"; + impl<T> tonic::server::NamedService for ServerReflectionServer<T> { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/vendor/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs b/vendor/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs new file mode 100644 index 00000000..685d9b0a --- /dev/null +++ b/vendor/tonic-reflection/src/generated/grpc_reflection_v1alpha.rs @@ -0,0 +1,461 @@ +// This file is @generated by prost-build. +/// The message sent by the client when calling ServerReflectionInfo method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerReflectionRequest { + #[prost(string, tag = "1")] + pub host: ::prost::alloc::string::String, + /// To use reflection service, the client should set one of the following + /// fields in message_request. The server distinguishes requests by their + /// defined field and then handles them using corresponding methods. + #[prost(oneof = "server_reflection_request::MessageRequest", tags = "3, 4, 5, 6, 7")] + pub message_request: ::core::option::Option< + server_reflection_request::MessageRequest, + >, +} +/// Nested message and enum types in `ServerReflectionRequest`. +pub mod server_reflection_request { + /// To use reflection service, the client should set one of the following + /// fields in message_request. The server distinguishes requests by their + /// defined field and then handles them using corresponding methods. + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum MessageRequest { + /// Find a proto file by the file name. + #[prost(string, tag = "3")] + FileByFilename(::prost::alloc::string::String), + /// Find the proto file that declares the given fully-qualified symbol name. + /// This field should be a fully-qualified symbol name + /// (e.g. <package>.<service>\[.<method>\] or <package>.<type>). + #[prost(string, tag = "4")] + FileContainingSymbol(::prost::alloc::string::String), + /// Find the proto file which defines an extension extending the given + /// message type with the given field number. + #[prost(message, tag = "5")] + FileContainingExtension(super::ExtensionRequest), + /// Finds the tag numbers used by all known extensions of extendee_type, and + /// appends them to ExtensionNumberResponse in an undefined order. + /// Its corresponding method is best-effort: it's not guaranteed that the + /// reflection service will implement this method, and it's not guaranteed + /// that this method will provide all extensions. Returns + /// StatusCode::UNIMPLEMENTED if it's not implemented. + /// This field should be a fully-qualified type name. The format is + /// <package>.<type> + #[prost(string, tag = "6")] + AllExtensionNumbersOfType(::prost::alloc::string::String), + /// List the full names of registered services. The content will not be + /// checked. + #[prost(string, tag = "7")] + ListServices(::prost::alloc::string::String), + } +} +/// The type name and extension number sent by the client when requesting +/// file_containing_extension. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExtensionRequest { + /// Fully-qualified type name. The format should be <package>.<type> + #[prost(string, tag = "1")] + pub containing_type: ::prost::alloc::string::String, + #[prost(int32, tag = "2")] + pub extension_number: i32, +} +/// The message sent by the server to answer ServerReflectionInfo method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerReflectionResponse { + #[prost(string, tag = "1")] + pub valid_host: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub original_request: ::core::option::Option<ServerReflectionRequest>, + /// The server sets one of the following fields according to the + /// message_request in the request. + #[prost(oneof = "server_reflection_response::MessageResponse", tags = "4, 5, 6, 7")] + pub message_response: ::core::option::Option< + server_reflection_response::MessageResponse, + >, +} +/// Nested message and enum types in `ServerReflectionResponse`. +pub mod server_reflection_response { + /// The server sets one of the following fields according to the + /// message_request in the request. + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum MessageResponse { + /// This message is used to answer file_by_filename, file_containing_symbol, + /// file_containing_extension requests with transitive dependencies. + /// As the repeated label is not allowed in oneof fields, we use a + /// FileDescriptorResponse message to encapsulate the repeated fields. + /// The reflection service is allowed to avoid sending FileDescriptorProtos + /// that were previously sent in response to earlier requests in the stream. + #[prost(message, tag = "4")] + FileDescriptorResponse(super::FileDescriptorResponse), + /// This message is used to answer all_extension_numbers_of_type requests. + #[prost(message, tag = "5")] + AllExtensionNumbersResponse(super::ExtensionNumberResponse), + /// This message is used to answer list_services requests. + #[prost(message, tag = "6")] + ListServicesResponse(super::ListServiceResponse), + /// This message is used when an error occurs. + #[prost(message, tag = "7")] + ErrorResponse(super::ErrorResponse), + } +} +/// Serialized FileDescriptorProto messages sent by the server answering +/// a file_by_filename, file_containing_symbol, or file_containing_extension +/// request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FileDescriptorResponse { + /// Serialized FileDescriptorProto messages. We avoid taking a dependency on + /// descriptor.proto, which uses proto2 only features, by making them opaque + /// bytes instead. + #[prost(bytes = "vec", repeated, tag = "1")] + pub file_descriptor_proto: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>, +} +/// A list of extension numbers sent by the server answering +/// all_extension_numbers_of_type request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExtensionNumberResponse { + /// Full name of the base type, including the package name. The format + /// is <package>.<type> + #[prost(string, tag = "1")] + pub base_type_name: ::prost::alloc::string::String, + #[prost(int32, repeated, tag = "2")] + pub extension_number: ::prost::alloc::vec::Vec<i32>, +} +/// A list of ServiceResponse sent by the server answering list_services request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListServiceResponse { + /// The information of each service may be expanded in the future, so we use + /// ServiceResponse message to encapsulate it. + #[prost(message, repeated, tag = "1")] + pub service: ::prost::alloc::vec::Vec<ServiceResponse>, +} +/// The information of a single service used by ListServiceResponse to answer +/// list_services request. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServiceResponse { + /// Full name of a registered service, including its package name. The format + /// is <package>.<service> + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +/// The error code and error message sent by the server when an error occurs. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ErrorResponse { + /// This field uses the error codes defined in grpc::StatusCode. + #[prost(int32, tag = "1")] + pub error_code: i32, + #[prost(string, tag = "2")] + pub error_message: ::prost::alloc::string::String, +} +/// Generated client implementations. +pub mod server_reflection_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct ServerReflectionClient<T> { + inner: tonic::client::Grpc<T>, + } + impl<T> ServerReflectionClient<T> + where + T: tonic::client::GrpcService<tonic::body::Body>, + T::Error: Into<StdError>, + T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static, + <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor<F>( + inner: T, + interceptor: F, + ) -> ServerReflectionClient<InterceptedService<T, F>> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request<tonic::body::Body>, + Response = http::Response< + <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody, + >, + >, + <T as tonic::codegen::Service< + http::Request<tonic::body::Body>, + >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync, + { + ServerReflectionClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// The reflection service is structured as a bidirectional stream, ensuring + /// all related requests go to a single server. + pub async fn server_reflection_info( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::ServerReflectionRequest, + >, + ) -> std::result::Result< + tonic::Response<tonic::codec::Streaming<super::ServerReflectionResponse>>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "grpc.reflection.v1alpha.ServerReflection", + "ServerReflectionInfo", + ), + ); + self.inner.streaming(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod server_reflection_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ServerReflectionServer. + #[async_trait] + pub trait ServerReflection: std::marker::Send + std::marker::Sync + 'static { + /// Server streaming response type for the ServerReflectionInfo method. + type ServerReflectionInfoStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result< + super::ServerReflectionResponse, + tonic::Status, + >, + > + + std::marker::Send + + 'static; + /// The reflection service is structured as a bidirectional stream, ensuring + /// all related requests go to a single server. + async fn server_reflection_info( + &self, + request: tonic::Request<tonic::Streaming<super::ServerReflectionRequest>>, + ) -> std::result::Result< + tonic::Response<Self::ServerReflectionInfoStream>, + tonic::Status, + >; + } + #[derive(Debug)] + pub struct ServerReflectionServer<T> { + inner: Arc<T>, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option<usize>, + max_encoding_message_size: Option<usize>, + } + impl<T> ServerReflectionServer<T> { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc<T>) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor<F>( + inner: T, + interceptor: F, + ) -> InterceptedService<Self, F> + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl<T, B> tonic::codegen::Service<http::Request<B>> for ServerReflectionServer<T> + where + T: ServerReflection, + B: Body + std::marker::Send + 'static, + B::Error: Into<StdError> + std::marker::Send + 'static, + { + type Response = http::Response<tonic::body::Body>; + type Error = std::convert::Infallible; + type Future = BoxFuture<Self::Response, Self::Error>; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll<std::result::Result<(), Self::Error>> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request<B>) -> Self::Future { + match req.uri().path() { + "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo" => { + #[allow(non_camel_case_types)] + struct ServerReflectionInfoSvc<T: ServerReflection>(pub Arc<T>); + impl< + T: ServerReflection, + > tonic::server::StreamingService<super::ServerReflectionRequest> + for ServerReflectionInfoSvc<T> { + type Response = super::ServerReflectionResponse; + type ResponseStream = T::ServerReflectionInfoStream; + type Future = BoxFuture< + tonic::Response<Self::ResponseStream>, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming<super::ServerReflectionRequest>, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + <T as ServerReflection>::server_reflection_info( + &inner, + request, + ) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = ServerReflectionInfoSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl<T> Clone for ServerReflectionServer<T> { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "grpc.reflection.v1alpha.ServerReflection"; + impl<T> tonic::server::NamedService for ServerReflectionServer<T> { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/vendor/tonic-reflection/src/generated/reflection_v1_fds.rs b/vendor/tonic-reflection/src/generated/reflection_v1_fds.rs new file mode 100644 index 00000000..4edd5c20 --- /dev/null +++ b/vendor/tonic-reflection/src/generated/reflection_v1_fds.rs @@ -0,0 +1,161 @@ +// This file is @generated by codegen. +// Copyright 2016 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// Service exported by server reflection. A more complete description of how +// server reflection works can be found at +// https://github.com/grpc/grpc/blob/master/doc/server-reflection.md +// +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto +// +/// Byte encoded FILE_DESCRIPTOR_SET. +pub const FILE_DESCRIPTOR_SET: &[u8] = &[ + 10u8, 192u8, 13u8, 10u8, 19u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 95u8, 118u8, 49u8, 46u8, 112u8, 114u8, 111u8, 116u8, 111u8, 18u8, 18u8, + 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, + 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 34u8, 243u8, 2u8, 10u8, 23u8, 83u8, 101u8, + 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 18u8, 18u8, 10u8, 4u8, + 104u8, 111u8, 115u8, 116u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, 82u8, 4u8, 104u8, 111u8, + 115u8, 116u8, 18u8, 42u8, 10u8, 16u8, 102u8, 105u8, 108u8, 101u8, 95u8, 98u8, 121u8, + 95u8, 102u8, 105u8, 108u8, 101u8, 110u8, 97u8, 109u8, 101u8, 24u8, 3u8, 32u8, 1u8, + 40u8, 9u8, 72u8, 0u8, 82u8, 14u8, 102u8, 105u8, 108u8, 101u8, 66u8, 121u8, 70u8, + 105u8, 108u8, 101u8, 110u8, 97u8, 109u8, 101u8, 18u8, 54u8, 10u8, 22u8, 102u8, 105u8, + 108u8, 101u8, 95u8, 99u8, 111u8, 110u8, 116u8, 97u8, 105u8, 110u8, 105u8, 110u8, + 103u8, 95u8, 115u8, 121u8, 109u8, 98u8, 111u8, 108u8, 24u8, 4u8, 32u8, 1u8, 40u8, + 9u8, 72u8, 0u8, 82u8, 20u8, 102u8, 105u8, 108u8, 101u8, 67u8, 111u8, 110u8, 116u8, + 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 83u8, 121u8, 109u8, 98u8, 111u8, 108u8, + 18u8, 98u8, 10u8, 25u8, 102u8, 105u8, 108u8, 101u8, 95u8, 99u8, 111u8, 110u8, 116u8, + 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 95u8, 101u8, 120u8, 116u8, 101u8, 110u8, + 115u8, 105u8, 111u8, 110u8, 24u8, 5u8, 32u8, 1u8, 40u8, 11u8, 50u8, 36u8, 46u8, + 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, + 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 46u8, 69u8, 120u8, 116u8, 101u8, 110u8, + 115u8, 105u8, 111u8, 110u8, 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 72u8, + 0u8, 82u8, 23u8, 102u8, 105u8, 108u8, 101u8, 67u8, 111u8, 110u8, 116u8, 97u8, 105u8, + 110u8, 105u8, 110u8, 103u8, 69u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, + 110u8, 18u8, 66u8, 10u8, 29u8, 97u8, 108u8, 108u8, 95u8, 101u8, 120u8, 116u8, 101u8, + 110u8, 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, 117u8, 109u8, 98u8, 101u8, 114u8, + 115u8, 95u8, 111u8, 102u8, 95u8, 116u8, 121u8, 112u8, 101u8, 24u8, 6u8, 32u8, 1u8, + 40u8, 9u8, 72u8, 0u8, 82u8, 25u8, 97u8, 108u8, 108u8, 69u8, 120u8, 116u8, 101u8, + 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 115u8, + 79u8, 102u8, 84u8, 121u8, 112u8, 101u8, 18u8, 37u8, 10u8, 13u8, 108u8, 105u8, 115u8, + 116u8, 95u8, 115u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 115u8, 24u8, 7u8, 32u8, + 1u8, 40u8, 9u8, 72u8, 0u8, 82u8, 12u8, 108u8, 105u8, 115u8, 116u8, 83u8, 101u8, + 114u8, 118u8, 105u8, 99u8, 101u8, 115u8, 66u8, 17u8, 10u8, 15u8, 109u8, 101u8, 115u8, + 115u8, 97u8, 103u8, 101u8, 95u8, 114u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, + 34u8, 102u8, 10u8, 16u8, 69u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, + 110u8, 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 18u8, 39u8, 10u8, 15u8, 99u8, + 111u8, 110u8, 116u8, 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 95u8, 116u8, 121u8, + 112u8, 101u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, 82u8, 14u8, 99u8, 111u8, 110u8, 116u8, + 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 84u8, 121u8, 112u8, 101u8, 18u8, 41u8, 10u8, + 16u8, 101u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, + 117u8, 109u8, 98u8, 101u8, 114u8, 24u8, 2u8, 32u8, 1u8, 40u8, 5u8, 82u8, 15u8, 101u8, + 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, + 101u8, 114u8, 34u8, 174u8, 4u8, 10u8, 24u8, 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, + 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 82u8, 101u8, + 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 29u8, 10u8, 10u8, 118u8, 97u8, 108u8, + 105u8, 100u8, 95u8, 104u8, 111u8, 115u8, 116u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, + 82u8, 9u8, 118u8, 97u8, 108u8, 105u8, 100u8, 72u8, 111u8, 115u8, 116u8, 18u8, 86u8, + 10u8, 16u8, 111u8, 114u8, 105u8, 103u8, 105u8, 110u8, 97u8, 108u8, 95u8, 114u8, + 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 24u8, 2u8, 32u8, 1u8, 40u8, 11u8, 50u8, + 43u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, + 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 46u8, 83u8, 101u8, 114u8, 118u8, + 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, + 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 82u8, 15u8, 111u8, 114u8, 105u8, + 103u8, 105u8, 110u8, 97u8, 108u8, 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, + 18u8, 102u8, 10u8, 24u8, 102u8, 105u8, 108u8, 101u8, 95u8, 100u8, 101u8, 115u8, 99u8, + 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, + 110u8, 115u8, 101u8, 24u8, 4u8, 32u8, 1u8, 40u8, 11u8, 50u8, 42u8, 46u8, 103u8, + 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 46u8, 118u8, 49u8, 46u8, 70u8, 105u8, 108u8, 101u8, 68u8, 101u8, 115u8, + 99u8, 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, + 110u8, 115u8, 101u8, 72u8, 0u8, 82u8, 22u8, 102u8, 105u8, 108u8, 101u8, 68u8, 101u8, + 115u8, 99u8, 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, + 111u8, 110u8, 115u8, 101u8, 18u8, 114u8, 10u8, 30u8, 97u8, 108u8, 108u8, 95u8, 101u8, + 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, 117u8, 109u8, + 98u8, 101u8, 114u8, 115u8, 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, + 101u8, 24u8, 5u8, 32u8, 1u8, 40u8, 11u8, 50u8, 43u8, 46u8, 103u8, 114u8, 112u8, 99u8, + 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, + 118u8, 49u8, 46u8, 69u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, + 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, + 115u8, 101u8, 72u8, 0u8, 82u8, 27u8, 97u8, 108u8, 108u8, 69u8, 120u8, 116u8, 101u8, + 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 115u8, + 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 95u8, 10u8, 22u8, 108u8, + 105u8, 115u8, 116u8, 95u8, 115u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 115u8, + 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 24u8, 6u8, 32u8, 1u8, + 40u8, 11u8, 50u8, 39u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, + 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 46u8, 76u8, 105u8, + 115u8, 116u8, 83u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 82u8, 101u8, 115u8, + 112u8, 111u8, 110u8, 115u8, 101u8, 72u8, 0u8, 82u8, 20u8, 108u8, 105u8, 115u8, 116u8, + 83u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 115u8, 82u8, 101u8, 115u8, 112u8, + 111u8, 110u8, 115u8, 101u8, 18u8, 74u8, 10u8, 14u8, 101u8, 114u8, 114u8, 111u8, + 114u8, 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 24u8, 7u8, 32u8, + 1u8, 40u8, 11u8, 50u8, 33u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, + 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 46u8, 69u8, + 114u8, 114u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, + 72u8, 0u8, 82u8, 13u8, 101u8, 114u8, 114u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, + 111u8, 110u8, 115u8, 101u8, 66u8, 18u8, 10u8, 16u8, 109u8, 101u8, 115u8, 115u8, 97u8, + 103u8, 101u8, 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 34u8, + 76u8, 10u8, 22u8, 70u8, 105u8, 108u8, 101u8, 68u8, 101u8, 115u8, 99u8, 114u8, 105u8, + 112u8, 116u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, + 18u8, 50u8, 10u8, 21u8, 102u8, 105u8, 108u8, 101u8, 95u8, 100u8, 101u8, 115u8, 99u8, + 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 95u8, 112u8, 114u8, 111u8, 116u8, 111u8, + 24u8, 1u8, 32u8, 3u8, 40u8, 12u8, 82u8, 19u8, 102u8, 105u8, 108u8, 101u8, 68u8, + 101u8, 115u8, 99u8, 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 80u8, 114u8, 111u8, + 116u8, 111u8, 34u8, 106u8, 10u8, 23u8, 69u8, 120u8, 116u8, 101u8, 110u8, 115u8, + 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 82u8, 101u8, 115u8, + 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 36u8, 10u8, 14u8, 98u8, 97u8, 115u8, 101u8, + 95u8, 116u8, 121u8, 112u8, 101u8, 95u8, 110u8, 97u8, 109u8, 101u8, 24u8, 1u8, 32u8, + 1u8, 40u8, 9u8, 82u8, 12u8, 98u8, 97u8, 115u8, 101u8, 84u8, 121u8, 112u8, 101u8, + 78u8, 97u8, 109u8, 101u8, 18u8, 41u8, 10u8, 16u8, 101u8, 120u8, 116u8, 101u8, 110u8, + 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, 117u8, 109u8, 98u8, 101u8, 114u8, 24u8, 2u8, + 32u8, 3u8, 40u8, 5u8, 82u8, 15u8, 101u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, + 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 34u8, 84u8, 10u8, 19u8, 76u8, + 105u8, 115u8, 116u8, 83u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 82u8, 101u8, + 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 61u8, 10u8, 7u8, 115u8, 101u8, 114u8, + 118u8, 105u8, 99u8, 101u8, 24u8, 1u8, 32u8, 3u8, 40u8, 11u8, 50u8, 35u8, 46u8, 103u8, + 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 46u8, 118u8, 49u8, 46u8, 83u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, + 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 82u8, 7u8, 115u8, 101u8, + 114u8, 118u8, 105u8, 99u8, 101u8, 34u8, 37u8, 10u8, 15u8, 83u8, 101u8, 114u8, 118u8, + 105u8, 99u8, 101u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, + 18u8, 10u8, 4u8, 110u8, 97u8, 109u8, 101u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, 82u8, + 4u8, 110u8, 97u8, 109u8, 101u8, 34u8, 83u8, 10u8, 13u8, 69u8, 114u8, 114u8, 111u8, + 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 29u8, 10u8, 10u8, + 101u8, 114u8, 114u8, 111u8, 114u8, 95u8, 99u8, 111u8, 100u8, 101u8, 24u8, 1u8, 32u8, + 1u8, 40u8, 5u8, 82u8, 9u8, 101u8, 114u8, 114u8, 111u8, 114u8, 67u8, 111u8, 100u8, + 101u8, 18u8, 35u8, 10u8, 13u8, 101u8, 114u8, 114u8, 111u8, 114u8, 95u8, 109u8, 101u8, + 115u8, 115u8, 97u8, 103u8, 101u8, 24u8, 2u8, 32u8, 1u8, 40u8, 9u8, 82u8, 12u8, 101u8, + 114u8, 114u8, 111u8, 114u8, 77u8, 101u8, 115u8, 115u8, 97u8, 103u8, 101u8, 50u8, + 137u8, 1u8, 10u8, 16u8, 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, + 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 18u8, 117u8, 10u8, 20u8, 83u8, 101u8, + 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 73u8, 110u8, 102u8, 111u8, 18u8, 43u8, 46u8, 103u8, 114u8, 112u8, 99u8, + 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, + 118u8, 49u8, 46u8, 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, + 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 82u8, 101u8, 113u8, 117u8, 101u8, + 115u8, 116u8, 26u8, 44u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, + 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 46u8, 83u8, 101u8, + 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 40u8, 1u8, 48u8, + 1u8, 66u8, 102u8, 10u8, 21u8, 105u8, 111u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, + 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, + 49u8, 66u8, 21u8, 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, + 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 80u8, 114u8, 111u8, 116u8, 111u8, 80u8, 1u8, + 90u8, 52u8, 103u8, 111u8, 111u8, 103u8, 108u8, 101u8, 46u8, 103u8, 111u8, 108u8, + 97u8, 110u8, 103u8, 46u8, 111u8, 114u8, 103u8, 47u8, 103u8, 114u8, 112u8, 99u8, 47u8, + 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 47u8, 103u8, + 114u8, 112u8, 99u8, 95u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 95u8, 118u8, 49u8, 98u8, 6u8, 112u8, 114u8, 111u8, 116u8, 111u8, 51u8, +]; diff --git a/vendor/tonic-reflection/src/generated/reflection_v1alpha1_fds.rs b/vendor/tonic-reflection/src/generated/reflection_v1alpha1_fds.rs new file mode 100644 index 00000000..240b4cb0 --- /dev/null +++ b/vendor/tonic-reflection/src/generated/reflection_v1alpha1_fds.rs @@ -0,0 +1,153 @@ +// This file is @generated by codegen. +// Copyright 2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// Service exported by server reflection +// +/// Byte encoded FILE_DESCRIPTOR_SET. +pub const FILE_DESCRIPTOR_SET: &[u8] = &[ + 10u8, 143u8, 13u8, 10u8, 24u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, + 111u8, 110u8, 95u8, 118u8, 49u8, 97u8, 108u8, 112u8, 104u8, 97u8, 46u8, 112u8, 114u8, + 111u8, 116u8, 111u8, 18u8, 23u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, + 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 97u8, + 108u8, 112u8, 104u8, 97u8, 34u8, 248u8, 2u8, 10u8, 23u8, 83u8, 101u8, 114u8, 118u8, + 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, + 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 18u8, 18u8, 10u8, 4u8, 104u8, 111u8, + 115u8, 116u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, 82u8, 4u8, 104u8, 111u8, 115u8, 116u8, + 18u8, 42u8, 10u8, 16u8, 102u8, 105u8, 108u8, 101u8, 95u8, 98u8, 121u8, 95u8, 102u8, + 105u8, 108u8, 101u8, 110u8, 97u8, 109u8, 101u8, 24u8, 3u8, 32u8, 1u8, 40u8, 9u8, + 72u8, 0u8, 82u8, 14u8, 102u8, 105u8, 108u8, 101u8, 66u8, 121u8, 70u8, 105u8, 108u8, + 101u8, 110u8, 97u8, 109u8, 101u8, 18u8, 54u8, 10u8, 22u8, 102u8, 105u8, 108u8, 101u8, + 95u8, 99u8, 111u8, 110u8, 116u8, 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 95u8, + 115u8, 121u8, 109u8, 98u8, 111u8, 108u8, 24u8, 4u8, 32u8, 1u8, 40u8, 9u8, 72u8, 0u8, + 82u8, 20u8, 102u8, 105u8, 108u8, 101u8, 67u8, 111u8, 110u8, 116u8, 97u8, 105u8, + 110u8, 105u8, 110u8, 103u8, 83u8, 121u8, 109u8, 98u8, 111u8, 108u8, 18u8, 103u8, + 10u8, 25u8, 102u8, 105u8, 108u8, 101u8, 95u8, 99u8, 111u8, 110u8, 116u8, 97u8, 105u8, + 110u8, 105u8, 110u8, 103u8, 95u8, 101u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, + 111u8, 110u8, 24u8, 5u8, 32u8, 1u8, 40u8, 11u8, 50u8, 41u8, 46u8, 103u8, 114u8, + 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, + 110u8, 46u8, 118u8, 49u8, 97u8, 108u8, 112u8, 104u8, 97u8, 46u8, 69u8, 120u8, 116u8, + 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, + 116u8, 72u8, 0u8, 82u8, 23u8, 102u8, 105u8, 108u8, 101u8, 67u8, 111u8, 110u8, 116u8, + 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 69u8, 120u8, 116u8, 101u8, 110u8, 115u8, + 105u8, 111u8, 110u8, 18u8, 66u8, 10u8, 29u8, 97u8, 108u8, 108u8, 95u8, 101u8, 120u8, + 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, 117u8, 109u8, 98u8, + 101u8, 114u8, 115u8, 95u8, 111u8, 102u8, 95u8, 116u8, 121u8, 112u8, 101u8, 24u8, 6u8, + 32u8, 1u8, 40u8, 9u8, 72u8, 0u8, 82u8, 25u8, 97u8, 108u8, 108u8, 69u8, 120u8, 116u8, + 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, + 115u8, 79u8, 102u8, 84u8, 121u8, 112u8, 101u8, 18u8, 37u8, 10u8, 13u8, 108u8, 105u8, + 115u8, 116u8, 95u8, 115u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 115u8, 24u8, 7u8, + 32u8, 1u8, 40u8, 9u8, 72u8, 0u8, 82u8, 12u8, 108u8, 105u8, 115u8, 116u8, 83u8, 101u8, + 114u8, 118u8, 105u8, 99u8, 101u8, 115u8, 66u8, 17u8, 10u8, 15u8, 109u8, 101u8, 115u8, + 115u8, 97u8, 103u8, 101u8, 95u8, 114u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, + 34u8, 102u8, 10u8, 16u8, 69u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, + 110u8, 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 18u8, 39u8, 10u8, 15u8, 99u8, + 111u8, 110u8, 116u8, 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 95u8, 116u8, 121u8, + 112u8, 101u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, 82u8, 14u8, 99u8, 111u8, 110u8, 116u8, + 97u8, 105u8, 110u8, 105u8, 110u8, 103u8, 84u8, 121u8, 112u8, 101u8, 18u8, 41u8, 10u8, + 16u8, 101u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, + 117u8, 109u8, 98u8, 101u8, 114u8, 24u8, 2u8, 32u8, 1u8, 40u8, 5u8, 82u8, 15u8, 101u8, + 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, + 101u8, 114u8, 34u8, 199u8, 4u8, 10u8, 24u8, 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, + 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 82u8, 101u8, + 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 29u8, 10u8, 10u8, 118u8, 97u8, 108u8, + 105u8, 100u8, 95u8, 104u8, 111u8, 115u8, 116u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, + 82u8, 9u8, 118u8, 97u8, 108u8, 105u8, 100u8, 72u8, 111u8, 115u8, 116u8, 18u8, 91u8, + 10u8, 16u8, 111u8, 114u8, 105u8, 103u8, 105u8, 110u8, 97u8, 108u8, 95u8, 114u8, + 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 24u8, 2u8, 32u8, 1u8, 40u8, 11u8, 50u8, + 48u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, + 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 97u8, 108u8, 112u8, 104u8, 97u8, 46u8, + 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, + 116u8, 105u8, 111u8, 110u8, 82u8, 101u8, 113u8, 117u8, 101u8, 115u8, 116u8, 82u8, + 15u8, 111u8, 114u8, 105u8, 103u8, 105u8, 110u8, 97u8, 108u8, 82u8, 101u8, 113u8, + 117u8, 101u8, 115u8, 116u8, 18u8, 107u8, 10u8, 24u8, 102u8, 105u8, 108u8, 101u8, + 95u8, 100u8, 101u8, 115u8, 99u8, 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 95u8, + 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 24u8, 4u8, 32u8, 1u8, 40u8, + 11u8, 50u8, 47u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, + 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 97u8, 108u8, 112u8, + 104u8, 97u8, 46u8, 70u8, 105u8, 108u8, 101u8, 68u8, 101u8, 115u8, 99u8, 114u8, 105u8, + 112u8, 116u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, + 72u8, 0u8, 82u8, 22u8, 102u8, 105u8, 108u8, 101u8, 68u8, 101u8, 115u8, 99u8, 114u8, + 105u8, 112u8, 116u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, + 101u8, 18u8, 119u8, 10u8, 30u8, 97u8, 108u8, 108u8, 95u8, 101u8, 120u8, 116u8, 101u8, + 110u8, 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, 117u8, 109u8, 98u8, 101u8, 114u8, + 115u8, 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 24u8, 5u8, 32u8, + 1u8, 40u8, 11u8, 50u8, 48u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, + 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 97u8, + 108u8, 112u8, 104u8, 97u8, 46u8, 69u8, 120u8, 116u8, 101u8, 110u8, 115u8, 105u8, + 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 82u8, 101u8, 115u8, 112u8, + 111u8, 110u8, 115u8, 101u8, 72u8, 0u8, 82u8, 27u8, 97u8, 108u8, 108u8, 69u8, 120u8, + 116u8, 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, + 114u8, 115u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 100u8, + 10u8, 22u8, 108u8, 105u8, 115u8, 116u8, 95u8, 115u8, 101u8, 114u8, 118u8, 105u8, + 99u8, 101u8, 115u8, 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, + 24u8, 6u8, 32u8, 1u8, 40u8, 11u8, 50u8, 44u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, + 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, + 49u8, 97u8, 108u8, 112u8, 104u8, 97u8, 46u8, 76u8, 105u8, 115u8, 116u8, 83u8, 101u8, + 114u8, 118u8, 105u8, 99u8, 101u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, + 101u8, 72u8, 0u8, 82u8, 20u8, 108u8, 105u8, 115u8, 116u8, 83u8, 101u8, 114u8, 118u8, + 105u8, 99u8, 101u8, 115u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, + 18u8, 79u8, 10u8, 14u8, 101u8, 114u8, 114u8, 111u8, 114u8, 95u8, 114u8, 101u8, 115u8, + 112u8, 111u8, 110u8, 115u8, 101u8, 24u8, 7u8, 32u8, 1u8, 40u8, 11u8, 50u8, 38u8, + 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, 99u8, + 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 97u8, 108u8, 112u8, 104u8, 97u8, 46u8, + 69u8, 114u8, 114u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, + 101u8, 72u8, 0u8, 82u8, 13u8, 101u8, 114u8, 114u8, 111u8, 114u8, 82u8, 101u8, 115u8, + 112u8, 111u8, 110u8, 115u8, 101u8, 66u8, 18u8, 10u8, 16u8, 109u8, 101u8, 115u8, + 115u8, 97u8, 103u8, 101u8, 95u8, 114u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, + 101u8, 34u8, 76u8, 10u8, 22u8, 70u8, 105u8, 108u8, 101u8, 68u8, 101u8, 115u8, 99u8, + 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, + 115u8, 101u8, 18u8, 50u8, 10u8, 21u8, 102u8, 105u8, 108u8, 101u8, 95u8, 100u8, 101u8, + 115u8, 99u8, 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 95u8, 112u8, 114u8, 111u8, + 116u8, 111u8, 24u8, 1u8, 32u8, 3u8, 40u8, 12u8, 82u8, 19u8, 102u8, 105u8, 108u8, + 101u8, 68u8, 101u8, 115u8, 99u8, 114u8, 105u8, 112u8, 116u8, 111u8, 114u8, 80u8, + 114u8, 111u8, 116u8, 111u8, 34u8, 106u8, 10u8, 23u8, 69u8, 120u8, 116u8, 101u8, + 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 82u8, + 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 36u8, 10u8, 14u8, 98u8, 97u8, + 115u8, 101u8, 95u8, 116u8, 121u8, 112u8, 101u8, 95u8, 110u8, 97u8, 109u8, 101u8, + 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, 82u8, 12u8, 98u8, 97u8, 115u8, 101u8, 84u8, 121u8, + 112u8, 101u8, 78u8, 97u8, 109u8, 101u8, 18u8, 41u8, 10u8, 16u8, 101u8, 120u8, 116u8, + 101u8, 110u8, 115u8, 105u8, 111u8, 110u8, 95u8, 110u8, 117u8, 109u8, 98u8, 101u8, + 114u8, 24u8, 2u8, 32u8, 3u8, 40u8, 5u8, 82u8, 15u8, 101u8, 120u8, 116u8, 101u8, + 110u8, 115u8, 105u8, 111u8, 110u8, 78u8, 117u8, 109u8, 98u8, 101u8, 114u8, 34u8, + 89u8, 10u8, 19u8, 76u8, 105u8, 115u8, 116u8, 83u8, 101u8, 114u8, 118u8, 105u8, 99u8, + 101u8, 82u8, 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 66u8, 10u8, 7u8, + 115u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 24u8, 1u8, 32u8, 3u8, 40u8, 11u8, + 50u8, 40u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, 101u8, 102u8, 108u8, 101u8, + 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, 97u8, 108u8, 112u8, 104u8, 97u8, + 46u8, 83u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 82u8, 101u8, 115u8, 112u8, + 111u8, 110u8, 115u8, 101u8, 82u8, 7u8, 115u8, 101u8, 114u8, 118u8, 105u8, 99u8, + 101u8, 34u8, 37u8, 10u8, 15u8, 83u8, 101u8, 114u8, 118u8, 105u8, 99u8, 101u8, 82u8, + 101u8, 115u8, 112u8, 111u8, 110u8, 115u8, 101u8, 18u8, 18u8, 10u8, 4u8, 110u8, 97u8, + 109u8, 101u8, 24u8, 1u8, 32u8, 1u8, 40u8, 9u8, 82u8, 4u8, 110u8, 97u8, 109u8, 101u8, + 34u8, 83u8, 10u8, 13u8, 69u8, 114u8, 114u8, 111u8, 114u8, 82u8, 101u8, 115u8, 112u8, + 111u8, 110u8, 115u8, 101u8, 18u8, 29u8, 10u8, 10u8, 101u8, 114u8, 114u8, 111u8, + 114u8, 95u8, 99u8, 111u8, 100u8, 101u8, 24u8, 1u8, 32u8, 1u8, 40u8, 5u8, 82u8, 9u8, + 101u8, 114u8, 114u8, 111u8, 114u8, 67u8, 111u8, 100u8, 101u8, 18u8, 35u8, 10u8, 13u8, + 101u8, 114u8, 114u8, 111u8, 114u8, 95u8, 109u8, 101u8, 115u8, 115u8, 97u8, 103u8, + 101u8, 24u8, 2u8, 32u8, 1u8, 40u8, 9u8, 82u8, 12u8, 101u8, 114u8, 114u8, 111u8, + 114u8, 77u8, 101u8, 115u8, 115u8, 97u8, 103u8, 101u8, 50u8, 147u8, 1u8, 10u8, 16u8, + 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, + 116u8, 105u8, 111u8, 110u8, 18u8, 127u8, 10u8, 20u8, 83u8, 101u8, 114u8, 118u8, + 101u8, 114u8, 82u8, 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, + 73u8, 110u8, 102u8, 111u8, 18u8, 48u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, + 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, + 97u8, 108u8, 112u8, 104u8, 97u8, 46u8, 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, 82u8, + 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 82u8, 101u8, 113u8, + 117u8, 101u8, 115u8, 116u8, 26u8, 49u8, 46u8, 103u8, 114u8, 112u8, 99u8, 46u8, 114u8, + 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 46u8, 118u8, 49u8, + 97u8, 108u8, 112u8, 104u8, 97u8, 46u8, 83u8, 101u8, 114u8, 118u8, 101u8, 114u8, 82u8, + 101u8, 102u8, 108u8, 101u8, 99u8, 116u8, 105u8, 111u8, 110u8, 82u8, 101u8, 115u8, + 112u8, 111u8, 110u8, 115u8, 101u8, 40u8, 1u8, 48u8, 1u8, 98u8, 6u8, 112u8, 114u8, + 111u8, 116u8, 111u8, 51u8, +]; diff --git a/vendor/tonic-reflection/src/lib.rs b/vendor/tonic-reflection/src/lib.rs new file mode 100644 index 00000000..97ea3165 --- /dev/null +++ b/vendor/tonic-reflection/src/lib.rs @@ -0,0 +1,66 @@ +//! A `tonic` based gRPC Server Reflection implementation. + +#![doc( + html_logo_url = "https://github.com/hyperium/tonic/raw/master/.github/assets/tonic-docs.png" +)] +#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")] +#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] + +mod generated { + #![allow(unreachable_pub)] + #![allow(missing_docs)] + #![allow(rustdoc::invalid_html_tags)] + + #[rustfmt::skip] + pub mod grpc_reflection_v1alpha; + + #[rustfmt::skip] + pub mod grpc_reflection_v1; + + #[rustfmt::skip] + pub mod reflection_v1_fds; + + #[rustfmt::skip] + pub mod reflection_v1alpha1_fds; + + pub use reflection_v1_fds::FILE_DESCRIPTOR_SET as FILE_DESCRIPTOR_SET_V1; + pub use reflection_v1alpha1_fds::FILE_DESCRIPTOR_SET as FILE_DESCRIPTOR_SET_V1ALPHA; + + #[cfg(test)] + mod tests { + use super::{FILE_DESCRIPTOR_SET_V1, FILE_DESCRIPTOR_SET_V1ALPHA}; + use prost::Message as _; + + #[test] + fn v1alpha_file_descriptor_set_is_valid() { + prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET_V1ALPHA).unwrap(); + } + + #[test] + fn v1_file_descriptor_set_is_valid() { + prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET_V1).unwrap(); + } + } +} + +/// Generated protobuf types from the `grpc.reflection` namespace. +pub mod pb { + /// Generated protobuf types from the `grpc.reflection.v1` package. + pub mod v1 { + pub use crate::generated::{ + grpc_reflection_v1::*, FILE_DESCRIPTOR_SET_V1 as FILE_DESCRIPTOR_SET, + }; + } + + /// Generated protobuf types from the `grpc.reflection.v1alpha` package. + pub mod v1alpha { + pub use crate::generated::{ + grpc_reflection_v1alpha::*, FILE_DESCRIPTOR_SET_V1ALPHA as FILE_DESCRIPTOR_SET, + }; + } +} + +/// Implementation of the server component of gRPC Server Reflection. +#[cfg(feature = "server")] +pub mod server; diff --git a/vendor/tonic-reflection/src/server/mod.rs b/vendor/tonic-reflection/src/server/mod.rs new file mode 100644 index 00000000..2b1a806a --- /dev/null +++ b/vendor/tonic-reflection/src/server/mod.rs @@ -0,0 +1,326 @@ +use std::collections::HashMap; +use std::fmt::{Display, Formatter}; +use std::sync::Arc; + +use prost::{DecodeError, Message}; +use prost_types::{ + DescriptorProto, EnumDescriptorProto, FieldDescriptorProto, FileDescriptorProto, + FileDescriptorSet, +}; +use tonic::Status; + +/// v1 interface for the gRPC Reflection Service server. +pub mod v1; +/// v1alpha interface for the gRPC Reflection Service server. +pub mod v1alpha; + +/// A builder used to construct a gRPC Reflection Service. +#[derive(Debug)] +pub struct Builder<'b> { + file_descriptor_sets: Vec<FileDescriptorSet>, + encoded_file_descriptor_sets: Vec<&'b [u8]>, + include_reflection_service: bool, + + service_names: Vec<String>, + use_all_service_names: bool, +} + +impl<'b> Builder<'b> { + /// Create a new builder that can configure a gRPC Reflection Service. + pub fn configure() -> Self { + Builder { + file_descriptor_sets: Vec::new(), + encoded_file_descriptor_sets: Vec::new(), + include_reflection_service: true, + + service_names: Vec::new(), + use_all_service_names: true, + } + } + + /// Registers an instance of `prost_types::FileDescriptorSet` with the gRPC Reflection + /// Service builder. + pub fn register_file_descriptor_set(mut self, file_descriptor_set: FileDescriptorSet) -> Self { + self.file_descriptor_sets.push(file_descriptor_set); + self + } + + /// Registers a byte slice containing an encoded `prost_types::FileDescriptorSet` with + /// the gRPC Reflection Service builder. + pub fn register_encoded_file_descriptor_set( + mut self, + encoded_file_descriptor_set: &'b [u8], + ) -> Self { + self.encoded_file_descriptor_sets + .push(encoded_file_descriptor_set); + self + } + + /// Serve the gRPC Reflection Service descriptor via the Reflection Service. This is enabled + /// by default - set `include` to false to disable. + pub fn include_reflection_service(mut self, include: bool) -> Self { + self.include_reflection_service = include; + self + } + + /// Advertise a fully-qualified gRPC service name. + /// + /// If not called, then all services present in the registered file descriptor sets + /// will be advertised. + pub fn with_service_name(mut self, name: impl Into<String>) -> Self { + self.use_all_service_names = false; + self.service_names.push(name.into()); + self + } + + /// Build a v1 gRPC Reflection Service to be served via Tonic. + pub fn build_v1( + mut self, + ) -> Result<v1::ServerReflectionServer<impl v1::ServerReflection>, Error> { + if self.include_reflection_service { + self = self.register_encoded_file_descriptor_set(crate::pb::v1::FILE_DESCRIPTOR_SET); + } + + Ok(v1::ServerReflectionServer::new( + v1::ReflectionService::from(ReflectionServiceState::new( + self.service_names, + self.encoded_file_descriptor_sets, + self.file_descriptor_sets, + self.use_all_service_names, + )?), + )) + } + + /// Build a v1alpha gRPC Reflection Service to be served via Tonic. + pub fn build_v1alpha( + mut self, + ) -> Result<v1alpha::ServerReflectionServer<impl v1alpha::ServerReflection>, Error> { + if self.include_reflection_service { + self = + self.register_encoded_file_descriptor_set(crate::pb::v1alpha::FILE_DESCRIPTOR_SET); + } + + Ok(v1alpha::ServerReflectionServer::new( + v1alpha::ReflectionService::from(ReflectionServiceState::new( + self.service_names, + self.encoded_file_descriptor_sets, + self.file_descriptor_sets, + self.use_all_service_names, + )?), + )) + } +} + +#[derive(Debug)] +struct ReflectionServiceState { + service_names: Vec<String>, + files: HashMap<String, Arc<FileDescriptorProto>>, + symbols: HashMap<String, Arc<FileDescriptorProto>>, +} + +impl ReflectionServiceState { + fn new( + service_names: Vec<String>, + encoded_file_descriptor_sets: Vec<&[u8]>, + mut file_descriptor_sets: Vec<FileDescriptorSet>, + use_all_service_names: bool, + ) -> Result<Self, Error> { + for encoded in encoded_file_descriptor_sets { + file_descriptor_sets.push(FileDescriptorSet::decode(encoded)?); + } + + let mut state = ReflectionServiceState { + service_names, + files: HashMap::new(), + symbols: HashMap::new(), + }; + + for fds in file_descriptor_sets { + for fd in fds.file { + let name = match fd.name.clone() { + None => { + return Err(Error::InvalidFileDescriptorSet("missing name".to_string())); + } + Some(n) => n, + }; + + if state.files.contains_key(&name) { + continue; + } + + let fd = Arc::new(fd); + state.files.insert(name, fd.clone()); + state.process_file(fd, use_all_service_names)?; + } + } + + Ok(state) + } + + fn process_file( + &mut self, + fd: Arc<FileDescriptorProto>, + use_all_service_names: bool, + ) -> Result<(), Error> { + let prefix = &fd.package.clone().unwrap_or_default(); + + for msg in &fd.message_type { + self.process_message(fd.clone(), prefix, msg)?; + } + + for en in &fd.enum_type { + self.process_enum(fd.clone(), prefix, en)?; + } + + for service in &fd.service { + let service_name = extract_name(prefix, "service", service.name.as_ref())?; + if use_all_service_names { + self.service_names.push(service_name.clone()); + } + self.symbols.insert(service_name.clone(), fd.clone()); + + for method in &service.method { + let method_name = extract_name(&service_name, "method", method.name.as_ref())?; + self.symbols.insert(method_name, fd.clone()); + } + } + + Ok(()) + } + + fn process_message( + &mut self, + fd: Arc<FileDescriptorProto>, + prefix: &str, + msg: &DescriptorProto, + ) -> Result<(), Error> { + let message_name = extract_name(prefix, "message", msg.name.as_ref())?; + self.symbols.insert(message_name.clone(), fd.clone()); + + for nested in &msg.nested_type { + self.process_message(fd.clone(), &message_name, nested)?; + } + + for en in &msg.enum_type { + self.process_enum(fd.clone(), &message_name, en)?; + } + + for field in &msg.field { + self.process_field(fd.clone(), &message_name, field)?; + } + + for oneof in &msg.oneof_decl { + let oneof_name = extract_name(&message_name, "oneof", oneof.name.as_ref())?; + self.symbols.insert(oneof_name, fd.clone()); + } + + Ok(()) + } + + fn process_enum( + &mut self, + fd: Arc<FileDescriptorProto>, + prefix: &str, + en: &EnumDescriptorProto, + ) -> Result<(), Error> { + let enum_name = extract_name(prefix, "enum", en.name.as_ref())?; + self.symbols.insert(enum_name.clone(), fd.clone()); + + for value in &en.value { + let value_name = extract_name(&enum_name, "enum value", value.name.as_ref())?; + self.symbols.insert(value_name, fd.clone()); + } + + Ok(()) + } + + fn process_field( + &mut self, + fd: Arc<FileDescriptorProto>, + prefix: &str, + field: &FieldDescriptorProto, + ) -> Result<(), Error> { + let field_name = extract_name(prefix, "field", field.name.as_ref())?; + self.symbols.insert(field_name, fd); + Ok(()) + } + + fn list_services(&self) -> &[String] { + &self.service_names + } + + fn symbol_by_name(&self, symbol: &str) -> Result<Vec<u8>, Status> { + match self.symbols.get(symbol) { + None => Err(Status::not_found(format!("symbol '{symbol}' not found"))), + Some(fd) => { + let mut encoded_fd = Vec::new(); + if fd.clone().encode(&mut encoded_fd).is_err() { + return Err(Status::internal("encoding error")); + }; + + Ok(encoded_fd) + } + } + } + + fn file_by_filename(&self, filename: &str) -> Result<Vec<u8>, Status> { + match self.files.get(filename) { + None => Err(Status::not_found(format!("file '{filename}' not found"))), + Some(fd) => { + let mut encoded_fd = Vec::new(); + if fd.clone().encode(&mut encoded_fd).is_err() { + return Err(Status::internal("encoding error")); + } + + Ok(encoded_fd) + } + } + } +} + +fn extract_name( + prefix: &str, + name_type: &str, + maybe_name: Option<&String>, +) -> Result<String, Error> { + match maybe_name { + None => Err(Error::InvalidFileDescriptorSet(format!( + "missing {name_type} name" + ))), + Some(name) => { + if prefix.is_empty() { + Ok(name.to_string()) + } else { + Ok(format!("{prefix}.{name}")) + } + } + } +} + +/// Represents an error in the construction of a gRPC Reflection Service. +#[derive(Debug)] +pub enum Error { + /// An error was encountered decoding a `prost_types::FileDescriptorSet` from a buffer. + DecodeError(prost::DecodeError), + /// An invalid `prost_types::FileDescriptorProto` was encountered. + InvalidFileDescriptorSet(String), +} + +impl From<DecodeError> for Error { + fn from(e: DecodeError) -> Self { + Error::DecodeError(e) + } +} + +impl std::error::Error for Error {} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Error::DecodeError(_) => f.write_str("error decoding FileDescriptorSet from buffer"), + Error::InvalidFileDescriptorSet(s) => { + write!(f, "invalid FileDescriptorSet - {s}") + } + } + } +} diff --git a/vendor/tonic-reflection/src/server/v1.rs b/vendor/tonic-reflection/src/server/v1.rs new file mode 100644 index 00000000..6a5054f9 --- /dev/null +++ b/vendor/tonic-reflection/src/server/v1.rs @@ -0,0 +1,138 @@ +use std::{fmt, sync::Arc}; + +use tokio::sync::mpsc; +use tokio_stream::{Stream, StreamExt}; +use tonic::{Request, Response, Status, Streaming}; + +use super::ReflectionServiceState; +use crate::pb::v1::server_reflection_request::MessageRequest; +use crate::pb::v1::server_reflection_response::MessageResponse; +pub use crate::pb::v1::server_reflection_server::{ServerReflection, ServerReflectionServer}; +use crate::pb::v1::{ + ExtensionNumberResponse, FileDescriptorResponse, ListServiceResponse, ServerReflectionRequest, + ServerReflectionResponse, ServiceResponse, +}; + +/// An implementation for `ServerReflection`. +#[derive(Debug)] +pub struct ReflectionService { + state: Arc<ReflectionServiceState>, +} + +#[tonic::async_trait] +impl ServerReflection for ReflectionService { + type ServerReflectionInfoStream = ServerReflectionInfoStream; + + async fn server_reflection_info( + &self, + req: Request<Streaming<ServerReflectionRequest>>, + ) -> Result<Response<Self::ServerReflectionInfoStream>, Status> { + let mut req_rx = req.into_inner(); + let (resp_tx, resp_rx) = mpsc::channel::<Result<ServerReflectionResponse, Status>>(1); + + let state = self.state.clone(); + + tokio::spawn(async move { + while let Some(req) = req_rx.next().await { + let Ok(req) = req else { + return; + }; + + let resp_msg = match req.message_request.clone() { + None => Err(Status::invalid_argument("invalid MessageRequest")), + Some(msg) => match msg { + MessageRequest::FileByFilename(s) => state.file_by_filename(&s).map(|fd| { + MessageResponse::FileDescriptorResponse(FileDescriptorResponse { + file_descriptor_proto: vec![fd], + }) + }), + MessageRequest::FileContainingSymbol(s) => { + state.symbol_by_name(&s).map(|fd| { + MessageResponse::FileDescriptorResponse(FileDescriptorResponse { + file_descriptor_proto: vec![fd], + }) + }) + } + MessageRequest::FileContainingExtension(_) => { + Err(Status::not_found("extensions are not supported")) + } + MessageRequest::AllExtensionNumbersOfType(_) => { + // NOTE: Workaround. Some grpc clients (e.g. grpcurl) expect this method not to fail. + // https://github.com/hyperium/tonic/issues/1077 + Ok(MessageResponse::AllExtensionNumbersResponse( + ExtensionNumberResponse::default(), + )) + } + MessageRequest::ListServices(_) => { + Ok(MessageResponse::ListServicesResponse(ListServiceResponse { + service: state + .list_services() + .iter() + .map(|s| ServiceResponse { name: s.clone() }) + .collect(), + })) + } + }, + }; + + match resp_msg { + Ok(resp_msg) => { + let resp = ServerReflectionResponse { + valid_host: req.host.clone(), + original_request: Some(req.clone()), + message_response: Some(resp_msg), + }; + resp_tx.send(Ok(resp)).await.expect("send"); + } + Err(status) => { + resp_tx.send(Err(status)).await.expect("send"); + return; + } + } + } + }); + + Ok(Response::new(ServerReflectionInfoStream::new(resp_rx))) + } +} + +impl From<ReflectionServiceState> for ReflectionService { + fn from(state: ReflectionServiceState) -> Self { + Self { + state: Arc::new(state), + } + } +} + +/// A response stream. +pub struct ServerReflectionInfoStream { + inner: tokio_stream::wrappers::ReceiverStream<Result<ServerReflectionResponse, Status>>, +} + +impl ServerReflectionInfoStream { + fn new(resp_rx: mpsc::Receiver<Result<ServerReflectionResponse, Status>>) -> Self { + let inner = tokio_stream::wrappers::ReceiverStream::new(resp_rx); + Self { inner } + } +} + +impl Stream for ServerReflectionInfoStream { + type Item = Result<ServerReflectionResponse, Status>; + + fn poll_next( + mut self: std::pin::Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> std::task::Poll<Option<Self::Item>> { + std::pin::Pin::new(&mut self.inner).poll_next(cx) + } + + fn size_hint(&self) -> (usize, Option<usize>) { + self.inner.size_hint() + } +} + +impl fmt::Debug for ServerReflectionInfoStream { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_tuple("ServerReflectionInfoStream").finish() + } +} diff --git a/vendor/tonic-reflection/src/server/v1alpha.rs b/vendor/tonic-reflection/src/server/v1alpha.rs new file mode 100644 index 00000000..b21d8d91 --- /dev/null +++ b/vendor/tonic-reflection/src/server/v1alpha.rs @@ -0,0 +1,138 @@ +use std::{fmt, sync::Arc}; + +use tokio::sync::mpsc; +use tokio_stream::{Stream, StreamExt}; +use tonic::{Request, Response, Status, Streaming}; + +use super::ReflectionServiceState; +use crate::pb::v1alpha::server_reflection_request::MessageRequest; +use crate::pb::v1alpha::server_reflection_response::MessageResponse; +pub use crate::pb::v1alpha::server_reflection_server::{ServerReflection, ServerReflectionServer}; +use crate::pb::v1alpha::{ + ExtensionNumberResponse, FileDescriptorResponse, ListServiceResponse, ServerReflectionRequest, + ServerReflectionResponse, ServiceResponse, +}; + +/// An implementation for `ServerReflection`. +#[derive(Debug)] +pub struct ReflectionService { + state: Arc<ReflectionServiceState>, +} + +#[tonic::async_trait] +impl ServerReflection for ReflectionService { + type ServerReflectionInfoStream = ServerReflectionInfoStream; + + async fn server_reflection_info( + &self, + req: Request<Streaming<ServerReflectionRequest>>, + ) -> Result<Response<Self::ServerReflectionInfoStream>, Status> { + let mut req_rx = req.into_inner(); + let (resp_tx, resp_rx) = mpsc::channel::<Result<ServerReflectionResponse, Status>>(1); + + let state = self.state.clone(); + + tokio::spawn(async move { + while let Some(req) = req_rx.next().await { + let Ok(req) = req else { + return; + }; + + let resp_msg = match req.message_request.clone() { + None => Err(Status::invalid_argument("invalid MessageRequest")), + Some(msg) => match msg { + MessageRequest::FileByFilename(s) => state.file_by_filename(&s).map(|fd| { + MessageResponse::FileDescriptorResponse(FileDescriptorResponse { + file_descriptor_proto: vec![fd], + }) + }), + MessageRequest::FileContainingSymbol(s) => { + state.symbol_by_name(&s).map(|fd| { + MessageResponse::FileDescriptorResponse(FileDescriptorResponse { + file_descriptor_proto: vec![fd], + }) + }) + } + MessageRequest::FileContainingExtension(_) => { + Err(Status::not_found("extensions are not supported")) + } + MessageRequest::AllExtensionNumbersOfType(_) => { + // NOTE: Workaround. Some grpc clients (e.g. grpcurl) expect this method not to fail. + // https://github.com/hyperium/tonic/issues/1077 + Ok(MessageResponse::AllExtensionNumbersResponse( + ExtensionNumberResponse::default(), + )) + } + MessageRequest::ListServices(_) => { + Ok(MessageResponse::ListServicesResponse(ListServiceResponse { + service: state + .list_services() + .iter() + .map(|s| ServiceResponse { name: s.clone() }) + .collect(), + })) + } + }, + }; + + match resp_msg { + Ok(resp_msg) => { + let resp = ServerReflectionResponse { + valid_host: req.host.clone(), + original_request: Some(req.clone()), + message_response: Some(resp_msg), + }; + resp_tx.send(Ok(resp)).await.expect("send"); + } + Err(status) => { + resp_tx.send(Err(status)).await.expect("send"); + return; + } + } + } + }); + + Ok(Response::new(ServerReflectionInfoStream::new(resp_rx))) + } +} + +impl From<ReflectionServiceState> for ReflectionService { + fn from(state: ReflectionServiceState) -> Self { + Self { + state: Arc::new(state), + } + } +} + +/// A response stream. +pub struct ServerReflectionInfoStream { + inner: tokio_stream::wrappers::ReceiverStream<Result<ServerReflectionResponse, Status>>, +} + +impl ServerReflectionInfoStream { + fn new(resp_rx: mpsc::Receiver<Result<ServerReflectionResponse, Status>>) -> Self { + let inner = tokio_stream::wrappers::ReceiverStream::new(resp_rx); + Self { inner } + } +} + +impl Stream for ServerReflectionInfoStream { + type Item = Result<ServerReflectionResponse, Status>; + + fn poll_next( + mut self: std::pin::Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> std::task::Poll<Option<Self::Item>> { + std::pin::Pin::new(&mut self.inner).poll_next(cx) + } + + fn size_hint(&self) -> (usize, Option<usize>) { + self.inner.size_hint() + } +} + +impl fmt::Debug for ServerReflectionInfoStream { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_tuple("ServerReflectionInfoStream").finish() + } +} diff --git a/vendor/tonic-reflection/tests/server.rs b/vendor/tonic-reflection/tests/server.rs new file mode 100644 index 00000000..778e887e --- /dev/null +++ b/vendor/tonic-reflection/tests/server.rs @@ -0,0 +1,151 @@ +#![allow(missing_docs)] + +use prost::Message; +use std::net::SocketAddr; +use tokio::sync::oneshot; +use tokio_stream::{wrappers::TcpListenerStream, StreamExt}; +use tonic::{transport::Server, Request}; +use tonic_reflection::{ + pb::v1::{ + server_reflection_client::ServerReflectionClient, + server_reflection_request::MessageRequest, server_reflection_response::MessageResponse, + ServerReflectionRequest, ServiceResponse, FILE_DESCRIPTOR_SET, + }, + server::Builder, +}; + +pub(crate) fn get_encoded_reflection_service_fd() -> Vec<u8> { + let mut expected = Vec::new(); + prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET) + .expect("decode reflection service file descriptor set") + .file[0] + .encode(&mut expected) + .expect("encode reflection service file descriptor"); + expected +} + +#[tokio::test] +async fn test_list_services() { + let response = make_test_reflection_request(ServerReflectionRequest { + host: "".to_string(), + message_request: Some(MessageRequest::ListServices(String::new())), + }) + .await; + + if let MessageResponse::ListServicesResponse(services) = response { + assert_eq!( + services.service, + vec![ServiceResponse { + name: String::from("grpc.reflection.v1.ServerReflection") + }] + ); + } else { + panic!("Expected a ListServicesResponse variant"); + } +} + +#[tokio::test] +async fn test_file_by_filename() { + let response = make_test_reflection_request(ServerReflectionRequest { + host: "".to_string(), + message_request: Some(MessageRequest::FileByFilename(String::from( + "reflection_v1.proto", + ))), + }) + .await; + + if let MessageResponse::FileDescriptorResponse(descriptor) = response { + let file_descriptor_proto = descriptor + .file_descriptor_proto + .first() + .expect("descriptor"); + assert_eq!( + file_descriptor_proto.as_ref(), + get_encoded_reflection_service_fd() + ); + } else { + panic!("Expected a FileDescriptorResponse variant"); + } +} + +#[tokio::test] +async fn test_file_containing_symbol() { + let response = make_test_reflection_request(ServerReflectionRequest { + host: "".to_string(), + message_request: Some(MessageRequest::FileContainingSymbol(String::from( + "grpc.reflection.v1.ServerReflection", + ))), + }) + .await; + + if let MessageResponse::FileDescriptorResponse(descriptor) = response { + let file_descriptor_proto = descriptor + .file_descriptor_proto + .first() + .expect("descriptor"); + assert_eq!( + file_descriptor_proto.as_ref(), + get_encoded_reflection_service_fd() + ); + } else { + panic!("Expected a FileDescriptorResponse variant"); + } +} + +async fn make_test_reflection_request(request: ServerReflectionRequest) -> MessageResponse { + // Run a test server + let (shutdown_tx, shutdown_rx) = oneshot::channel(); + + let addr: SocketAddr = "127.0.0.1:0".parse().expect("SocketAddr parse"); + let listener = tokio::net::TcpListener::bind(addr).await.expect("bind"); + let local_addr = format!("http://{}", listener.local_addr().expect("local address")); + let jh = tokio::spawn(async move { + let service = Builder::configure() + .register_encoded_file_descriptor_set(FILE_DESCRIPTOR_SET) + .build_v1() + .unwrap(); + + Server::builder() + .add_service(service) + .serve_with_incoming_shutdown(TcpListenerStream::new(listener), async { + drop(shutdown_rx.await) + }) + .await + .unwrap(); + }); + + // Give the test server a few ms to become available + tokio::time::sleep(std::time::Duration::from_millis(100)).await; + + // Construct client and send request, extract response + let conn = tonic::transport::Endpoint::new(local_addr) + .unwrap() + .connect() + .await + .unwrap(); + let mut client = ServerReflectionClient::new(conn); + + let request = Request::new(tokio_stream::once(request)); + let mut inbound = client + .server_reflection_info(request) + .await + .expect("request") + .into_inner(); + + let response = inbound + .next() + .await + .expect("steamed response") + .expect("successful response") + .message_response + .expect("some MessageResponse"); + + // We only expect one response per request + assert!(inbound.next().await.is_none()); + + // Shut down test server + shutdown_tx.send(()).expect("send shutdown"); + jh.await.expect("server shutdown"); + + response +} diff --git a/vendor/tonic-reflection/tests/versions.rs b/vendor/tonic-reflection/tests/versions.rs new file mode 100644 index 00000000..9ab0858e --- /dev/null +++ b/vendor/tonic-reflection/tests/versions.rs @@ -0,0 +1,172 @@ +#![allow(missing_docs)] + +use std::net::SocketAddr; + +use tokio::sync::oneshot; +use tokio_stream::{wrappers::TcpListenerStream, StreamExt}; +use tonic::{transport::Server, Request}; + +use tonic_reflection::pb::{v1, v1alpha}; +use tonic_reflection::server::Builder; + +#[tokio::test] +async fn test_v1() { + let response = make_v1_request(v1::ServerReflectionRequest { + host: "".to_string(), + message_request: Some(v1::server_reflection_request::MessageRequest::ListServices( + String::new(), + )), + }) + .await; + + if let v1::server_reflection_response::MessageResponse::ListServicesResponse(services) = + response + { + assert_eq!( + services.service, + vec![v1::ServiceResponse { + name: String::from("grpc.reflection.v1.ServerReflection") + }] + ); + } else { + panic!("Expected a ListServicesResponse variant"); + } +} + +#[tokio::test] +async fn test_v1alpha() { + let response = make_v1alpha_request(v1alpha::ServerReflectionRequest { + host: "".to_string(), + message_request: Some( + v1alpha::server_reflection_request::MessageRequest::ListServices(String::new()), + ), + }) + .await; + + if let v1alpha::server_reflection_response::MessageResponse::ListServicesResponse(services) = + response + { + assert_eq!( + services.service, + vec![v1alpha::ServiceResponse { + name: String::from("grpc.reflection.v1alpha.ServerReflection") + }] + ); + } else { + panic!("Expected a ListServicesResponse variant"); + } +} + +async fn make_v1_request( + request: v1::ServerReflectionRequest, +) -> v1::server_reflection_response::MessageResponse { + // Run a test server + let (shutdown_tx, shutdown_rx) = oneshot::channel(); + + let addr: SocketAddr = "127.0.0.1:0".parse().expect("SocketAddr parse"); + let listener = tokio::net::TcpListener::bind(addr).await.expect("bind"); + let local_addr = format!("http://{}", listener.local_addr().expect("local address")); + let jh = tokio::spawn(async move { + let service = Builder::configure().build_v1().unwrap(); + + Server::builder() + .add_service(service) + .serve_with_incoming_shutdown(TcpListenerStream::new(listener), async { + drop(shutdown_rx.await) + }) + .await + .unwrap(); + }); + + // Give the test server a few ms to become available + tokio::time::sleep(std::time::Duration::from_millis(100)).await; + + // Construct client and send request, extract response + let conn = tonic::transport::Endpoint::new(local_addr) + .unwrap() + .connect() + .await + .unwrap(); + let mut client = v1::server_reflection_client::ServerReflectionClient::new(conn); + + let request = Request::new(tokio_stream::once(request)); + let mut inbound = client + .server_reflection_info(request) + .await + .expect("request") + .into_inner(); + + let response = inbound + .next() + .await + .expect("steamed response") + .expect("successful response") + .message_response + .expect("some MessageResponse"); + + // We only expect one response per request + assert!(inbound.next().await.is_none()); + + // Shut down test server + shutdown_tx.send(()).expect("send shutdown"); + jh.await.expect("server shutdown"); + + response +} + +async fn make_v1alpha_request( + request: v1alpha::ServerReflectionRequest, +) -> v1alpha::server_reflection_response::MessageResponse { + // Run a test server + let (shutdown_tx, shutdown_rx) = oneshot::channel(); + + let addr: SocketAddr = "127.0.0.1:0".parse().expect("SocketAddr parse"); + let listener = tokio::net::TcpListener::bind(addr).await.expect("bind"); + let local_addr = format!("http://{}", listener.local_addr().expect("local address")); + let jh = tokio::spawn(async move { + let service = Builder::configure().build_v1alpha().unwrap(); + + Server::builder() + .add_service(service) + .serve_with_incoming_shutdown(TcpListenerStream::new(listener), async { + drop(shutdown_rx.await) + }) + .await + .unwrap(); + }); + + // Give the test server a few ms to become available + tokio::time::sleep(std::time::Duration::from_millis(100)).await; + + // Construct client and send request, extract response + let conn = tonic::transport::Endpoint::new(local_addr) + .unwrap() + .connect() + .await + .unwrap(); + let mut client = v1alpha::server_reflection_client::ServerReflectionClient::new(conn); + + let request = Request::new(tokio_stream::once(request)); + let mut inbound = client + .server_reflection_info(request) + .await + .expect("request") + .into_inner(); + + let response = inbound + .next() + .await + .expect("steamed response") + .expect("successful response") + .message_response + .expect("some MessageResponse"); + + // We only expect one response per request + assert!(inbound.next().await.is_none()); + + // Shut down test server + shutdown_tx.send(()).expect("send shutdown"); + jh.await.expect("server shutdown"); + + response +} |
