diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3fb58524c..4d45f81a8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "linkerd2-proxy-api", - "image": "ghcr.io/linkerd/dev:v39", + "image": "ghcr.io/linkerd/dev:v42", "customizations": { "vscode": { "extensions": [ diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 6c4a67f40..ae77b3833 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -14,13 +14,13 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: linkerd/dev/actions/setup-tools@v39 - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: linkerd/dev/actions/setup-tools@v42 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just-dev lint-actions devcontainer-versions: runs-on: ubuntu-latest steps: - - uses: linkerd/dev/actions/setup-tools@v39 - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: linkerd/dev/actions/setup-tools@v42 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just-dev check-action-images diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 06d7a3c58..ab8ffcd66 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,9 +16,9 @@ jobs: go: timeout-minutes: 5 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-go + container: docker://ghcr.io/linkerd/dev:v42-go steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just go-mod-check - run: just go-gen-check - run: just go-build diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index ad9399e0c..2b2721dd4 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -14,8 +14,8 @@ jobs: timeout-minutes: 5 runs-on: ubuntu-latest steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: DavidAnson/markdownlint-cli2-action@5b7c9f74fec47e6b15667b2cc23c63dff11e449e + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: DavidAnson/markdownlint-cli2-action@455b6612a7b7a80f28be9e019b70abdd11696e4e with: globs: | **/*.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da6db8186..11de83b23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,9 +40,9 @@ jobs: test: timeout-minutes: 5 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-rust + container: docker://ghcr.io/linkerd/dev:v42-rust steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just rs-fetch - run: just rs-gen-check - run: just rs-test-build @@ -55,10 +55,10 @@ jobs: contents: write timeout-minutes: 5 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-rust + container: docker://ghcr.io/linkerd/dev:v42-rust steps: - if: needs.meta.outputs.publish - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - if: needs.meta.outputs.publish shell: bash run: | @@ -79,9 +79,9 @@ jobs: needs: [meta, release] timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-rust + container: docker://ghcr.io/linkerd/dev:v42-rust steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - if: '!needs.meta.outputs.publish' run: just rs-publish --dry-run - if: needs.meta.outputs.publish diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 440d8cc37..68a2b8e2e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,36 +22,36 @@ jobs: gen-check: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-rust + container: docker://ghcr.io/linkerd/dev:v42-rust steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just rs-fetch - run: just rs-gen-check rust-clippy: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-rust + container: docker://ghcr.io/linkerd/dev:v42-rust steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just rs-fetch - run: just rs-clippy rust-docs: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-rust + container: docker://ghcr.io/linkerd/dev:v42-rust steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just rs-fetch - run: just rs-docs rust-test: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v39-rust + container: docker://ghcr.io/linkerd/dev:v42-rust steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: just rs-fetch - run: just rs-test-build - run: just rs-test @@ -67,7 +67,7 @@ jobs: # Prevent sudden announcement of a new advisory from failing Ci. continue-on-error: ${{ matrix.checks == 'advisories' }} steps: - - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: EmbarkStudios/cargo-deny-action@8a8607bd8e2b3a514d5a40174cc7c55b229d9ba7 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: EmbarkStudios/cargo-deny-action@1e59595bed8fc55c969333d08d7817b36888f0c5 with: command: check ${{ matrix.checks }} diff --git a/Cargo.lock b/Cargo.lock index aec607510..02cf49220 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,32 +3,19 @@ version = 3 [[package]] -name = "anyhow" -version = "1.0.69" +name = "aho-corasick" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" - -[[package]] -name = "async-stream" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", + "memchr", ] [[package]] -name = "async-stream-impl" -version = "0.3.4" +name = "anyhow" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "async-trait" @@ -38,7 +25,7 @@ checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -49,9 +36,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.13.1" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "bitflags" @@ -65,12 +52,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,23 +66,12 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "errno" -version = "0.2.8" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] @@ -250,9 +220,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.7.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" @@ -269,12 +239,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "libc" version = "0.2.139" @@ -283,7 +247,7 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "linkerd2-proxy-api" -version = "0.11.0" +version = "0.12.0" dependencies = [ "h2", "http", @@ -313,9 +277,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "multimap" @@ -362,7 +326,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -379,28 +343,28 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "prettyplease" -version = "0.1.24" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebcd279d20a4a0a2404a33056388e950504d891c855c7975b9a8fef75f3bf04" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.39", ] [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", "prost-derive", @@ -408,44 +372,44 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.8" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c828f93f5ca4826f97fedcbd3f9a536c16b12cff3dbbb4a007f932bbad95b12" +checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ "bytes", "heck", "itertools", - "lazy_static", "log", "multimap", + "once_cell", "petgraph", "prettyplease", "prost", "prost-types", "regex", - "syn", + "syn 2.0.39", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] name = "prost-types" -version = "0.11.8" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379119666929a1afd7a043aa6cf96fa67a6dce9af60c88095a4686dbce4c9c88" +checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ "prost", ] @@ -461,9 +425,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.23" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -497,24 +461,38 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rustix" -version = "0.36.9" +version = "0.36.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" dependencies = [ "bitflags", "errno", @@ -544,6 +522,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.4.0" @@ -559,22 +548,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.39" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.39" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -617,24 +606,20 @@ dependencies = [ [[package]] name = "tonic" -version = "0.8.3" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ - "async-stream", "async-trait", "base64", "bytes", - "futures-core", - "futures-util", "http", "http-body", "percent-encoding", "pin-project", "prost", - "prost-derive", + "tokio", "tokio-stream", - "tokio-util", "tower-layer", "tower-service", "tracing", @@ -642,15 +627,15 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.8.4" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" +checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -685,7 +670,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -721,49 +706,36 @@ dependencies = [ ] [[package]] -name = "winapi" -version = "0.3.9" +name = "windows-sys" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "windows_aarch64_gnullvm 0.42.1", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm 0.42.1", + "windows_x86_64_msvc 0.42.1", ] -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows-targets 0.42.1", ] [[package]] name = "windows-sys" -version = "0.45.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.0", ] [[package]] @@ -772,13 +744,28 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.1", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm 0.42.1", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -787,38 +774,80 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/Cargo.toml b/Cargo.toml index e651fff55..64b40a15b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "linkerd2-proxy-api" -version = "0.11.0" +version = "0.12.0" authors = ["Linkerd Developers "] license = "Apache-2.0" edition = "2021" @@ -19,8 +19,23 @@ grpc-route = ["http-route"] http-route = ["http-types"] http-types = ["http", "thiserror"] identity = ["prost-types", "tonic/codegen"] -inbound = ["grpc-route", "http-route", "meta", "net", "prost-types", "tonic/codegen"] -outbound = ["grpc-route", "destination", "http-route", "meta", "net", "prost-types", "tonic/codegen"] +inbound = [ + "grpc-route", + "http-route", + "meta", + "net", + "prost-types", + "tonic/codegen", +] +outbound = [ + "grpc-route", + "destination", + "http-route", + "meta", + "net", + "prost-types", + "tonic/codegen", +] meta = [] net = ["ipnet", "thiserror"] tap = ["h2", "http-types", "net", "prost-types", "tonic/codegen"] @@ -33,17 +48,17 @@ all-features = true h2 = { version = "0.3", optional = true } http = { version = "0.2", optional = true } ipnet = { version = "2", optional = true } -prost = "0.11" -prost-types = { version = "0.11", optional = true } +prost = "0.12" +prost-types = { version = "0.12", optional = true } quickcheck = { version = "1", default-features = false, optional = true } thiserror = { version = "1", optional = true } [dependencies.tonic] -version = "0.8" +version = "0.10" default-features = false features = ["prost"] [dev-dependencies.tonic-build] -version = "0.8" +version = "0.10" default-features = false features = ["prost"] diff --git a/deny.toml b/deny.toml index cc4b87204..a2fa66914 100644 --- a/deny.toml +++ b/deny.toml @@ -43,7 +43,9 @@ multiple-versions = "deny" wildcards = "allow" highlight = "all" deny = [] -skip = [] +skip = [ + { name = "syn" }, +] skip-tree = [] [sources] diff --git a/examples/gen.rs b/examples/gen.rs index 7e952de38..357ac0a04 100644 --- a/examples/gen.rs +++ b/examples/gen.rs @@ -21,7 +21,7 @@ fn main() -> Result<(), Box> { .build_client(true) .build_server(true) .out_dir(out_dir) - .compile(&*proto_files, &[proto_dir]) + .compile(&proto_files, &[proto_dir]) { eprintln!("{}", e.to_string().replace("\\n", "\n").trim_end()); std::process::exit(1); diff --git a/go.mod b/go.mod index 885f833ab..c707a243b 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,17 @@ module github.com/linkerd/linkerd2-proxy-api -go 1.19 +go 1.21 require ( github.com/golang/protobuf v1.5.3 - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.59.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.31.0 ) require ( - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect ) diff --git a/go.sum b/go.sum index f59224b54..6f98dd1c2 100644 --- a/go.sum +++ b/go.sum @@ -3,20 +3,21 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/go/destination/destination.pb.go b/go/destination/destination.pb.go index 962ff1f49..3a50479f0 100644 --- a/go/destination/destination.pb.go +++ b/go/destination/destination.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: destination.proto diff --git a/go/grpc_route/grpc_route.pb.go b/go/grpc_route/grpc_route.pb.go index 92cb57d0d..a86d6a24a 100644 --- a/go/grpc_route/grpc_route.pb.go +++ b/go/grpc_route/grpc_route.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: grpc_route.proto diff --git a/go/http_route/http_route.pb.go b/go/http_route/http_route.pb.go index a2a411eb4..47db3eb68 100644 --- a/go/http_route/http_route.pb.go +++ b/go/http_route/http_route.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: http_route.proto diff --git a/go/http_types/http_types.pb.go b/go/http_types/http_types.pb.go index ef30d8813..994a27c87 100644 --- a/go/http_types/http_types.pb.go +++ b/go/http_types/http_types.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: http_types.proto diff --git a/go/identity/identity.pb.go b/go/identity/identity.pb.go index e1edd2f9f..6f4384053 100644 --- a/go/identity/identity.pb.go +++ b/go/identity/identity.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: identity.proto diff --git a/go/inbound/inbound.pb.go b/go/inbound/inbound.pb.go index 40c527fba..17a71f78d 100644 --- a/go/inbound/inbound.pb.go +++ b/go/inbound/inbound.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: inbound.proto diff --git a/go/meta/meta.pb.go b/go/meta/meta.pb.go index ce281f6d8..888ff0271 100644 --- a/go/meta/meta.pb.go +++ b/go/meta/meta.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: meta.proto diff --git a/go/net/net.pb.go b/go/net/net.pb.go index 04a717769..030a87ce9 100644 --- a/go/net/net.pb.go +++ b/go/net/net.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: net.proto diff --git a/go/outbound/outbound.pb.go b/go/outbound/outbound.pb.go index bb89b3edf..faf92892d 100644 --- a/go/outbound/outbound.pb.go +++ b/go/outbound/outbound.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: outbound.proto diff --git a/go/tap/tap.pb.go b/go/tap/tap.pb.go index 7193abcbb..a3e8f54e2 100644 --- a/go/tap/tap.pb.go +++ b/go/tap/tap.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.31.0 // protoc v3.20.3 // source: tap.proto diff --git a/proto/inbound.proto b/proto/inbound.proto index 3a1538f02..afde04301 100644 --- a/proto/inbound.proto +++ b/proto/inbound.proto @@ -178,9 +178,8 @@ message Identity { string name = 1; } // "bar"]` is equivalent to "foo.bar." (matching `*.foo.bar`), etc. message IdentitySuffix { repeated string parts = 1; } -// Inbound-specific HTTP route configuration (based on the [Gateway API][api]). -// -// [api]: https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRoute +// Inbound-specific HTTP route configuration (based on the +// [Gateway API](https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRoute)). message HttpRoute { io.linkerd.proxy.meta.Metadata metadata = 1; diff --git a/proto/outbound.proto b/proto/outbound.proto index a8528b2b6..fd2df06d4 100644 --- a/proto/outbound.proto +++ b/proto/outbound.proto @@ -95,9 +95,8 @@ message ProxyProtocol { } } -// Outbound-specific HTTP route configuration (based on the [Gateway API][api]). -// -// [api]: https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRoute +// Outbound-specific HTTP route configuration (based on the +// [Gateway API](https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRoute)). message HttpRoute { io.linkerd.proxy.meta.Metadata metadata = 1; diff --git a/src/gen/io.linkerd.proxy.destination.rs b/src/gen/io.linkerd.proxy.destination.rs index fbd917cb2..4630a6ee9 100644 --- a/src/gen/io.linkerd.proxy.destination.rs +++ b/src/gen/io.linkerd.proxy.destination.rs @@ -410,12 +410,28 @@ pub mod destination_client { 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 + } /// Given a destination, return all addresses in that destination as a long- /// running stream of updates. pub async fn get( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -432,14 +448,19 @@ pub mod destination_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.destination.Destination/Get", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("io.linkerd.proxy.destination.Destination", "Get"), + ); + self.inner.server_streaming(req, path, codec).await } /// Given a destination, return that destination's profile and send an update /// whenever it changes. pub async fn get_profile( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -456,7 +477,15 @@ pub mod destination_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.destination.Destination/GetProfile", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "io.linkerd.proxy.destination.Destination", + "GetProfile", + ), + ); + self.inner.server_streaming(req, path, codec).await } } } @@ -468,7 +497,9 @@ pub mod destination_server { #[async_trait] pub trait Destination: Send + Sync + 'static { /// Server streaming response type for the Get method. - type GetStream: futures_core::Stream> + type GetStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + Send + 'static; /// Given a destination, return all addresses in that destination as a long- @@ -476,10 +507,10 @@ pub mod destination_server { async fn get( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the GetProfile method. - type GetProfileStream: futures_core::Stream< - Item = Result, + type GetProfileStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, > + Send + 'static; @@ -488,13 +519,15 @@ pub mod destination_server { async fn get_profile( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct DestinationServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl DestinationServer { @@ -507,6 +540,8 @@ pub mod destination_server { 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( @@ -530,6 +565,22 @@ pub mod destination_server { 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 tonic::codegen::Service> for DestinationServer where @@ -543,7 +594,7 @@ pub mod destination_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -566,13 +617,17 @@ pub mod destination_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).get(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::get(&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 inner = inner.0; @@ -582,6 +637,10 @@ pub mod destination_server { .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.server_streaming(method, req).await; Ok(res) @@ -605,13 +664,17 @@ pub mod destination_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).get_profile(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_profile(&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 inner = inner.0; @@ -621,6 +684,10 @@ pub mod destination_server { .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.server_streaming(method, req).await; Ok(res) @@ -649,12 +716,14 @@ pub mod destination_server { 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, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/src/gen/io.linkerd.proxy.http_route.rs b/src/gen/io.linkerd.proxy.http_route.rs index 687f72962..626158284 100644 --- a/src/gen/io.linkerd.proxy.http_route.rs +++ b/src/gen/io.linkerd.proxy.http_route.rs @@ -7,7 +7,7 @@ pub struct HostMatch { } /// Nested message and enum types in `HostMatch`. pub mod host_match { - /// A match like `*.example.com` is encoded as [com, example]. + /// A match like `*.example.com` is encoded as \[com, example\]. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Suffix { @@ -212,7 +212,7 @@ pub struct HttpFailureInjector { } /// A ratio (i.e., of requests) to which an filter should be applied. /// -/// Represents fractional values on [0, 1]. +/// Represents fractional values on \[0, 1\]. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Ratio { diff --git a/src/gen/io.linkerd.proxy.identity.rs b/src/gen/io.linkerd.proxy.identity.rs index fcaf980ee..091122e39 100644 --- a/src/gen/io.linkerd.proxy.identity.rs +++ b/src/gen/io.linkerd.proxy.identity.rs @@ -86,6 +86,22 @@ pub mod identity_client { 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 + } /// Requests that a time-bounded certificate be signed. /// /// The requester must provide a token that verifies the client's identity and @@ -96,7 +112,10 @@ pub mod identity_client { pub async fn certify( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { self.inner .ready() .await @@ -110,7 +129,12 @@ pub mod identity_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.identity.Identity/Certify", ); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("io.linkerd.proxy.identity.Identity", "Certify"), + ); + self.inner.unary(req, path, codec).await } } } @@ -131,13 +155,15 @@ pub mod identity_server { async fn certify( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct IdentityServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl IdentityServer { @@ -150,6 +176,8 @@ pub mod identity_server { 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( @@ -173,6 +201,22 @@ pub mod identity_server { 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 tonic::codegen::Service> for IdentityServer where @@ -186,7 +230,7 @@ pub mod identity_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -206,13 +250,17 @@ pub mod identity_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).certify(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::certify(&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 inner = inner.0; @@ -222,6 +270,10 @@ pub mod identity_server { .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.unary(method, req).await; Ok(res) @@ -250,12 +302,14 @@ pub mod identity_server { 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, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/src/gen/io.linkerd.proxy.inbound.rs b/src/gen/io.linkerd.proxy.inbound.rs index 880010808..312ab3de8 100644 --- a/src/gen/io.linkerd.proxy.inbound.rs +++ b/src/gen/io.linkerd.proxy.inbound.rs @@ -101,7 +101,7 @@ pub struct Authz { /// /// Must have at least one network, otherwise the authorization must be /// ignored. An authorization matches all clients by including an explicit - /// match on, i.e., `[0.0.0.0/0, 0::/0]``. + /// match on, i.e., `\[0.0.0.0/0, 0::/0\]``. #[prost(message, repeated, tag = "1")] pub networks: ::prost::alloc::vec::Vec, /// Must be set. @@ -203,9 +203,8 @@ pub struct IdentitySuffix { #[prost(string, repeated, tag = "1")] pub parts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } -/// Inbound-specific HTTP route configuration (based on the [Gateway API]\[api\]). -/// -/// \[api\]: +/// Inbound-specific HTTP route configuration (based on the +/// [Gateway API]()). #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HttpRoute { @@ -366,11 +365,27 @@ pub mod inbound_server_policies_client { 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 + } /// / Gets the inbound server policy for a given workload port. pub async fn get_port( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await @@ -384,13 +399,21 @@ pub mod inbound_server_policies_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort", ); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "io.linkerd.proxy.inbound.InboundServerPolicies", + "GetPort", + ), + ); + self.inner.unary(req, path, codec).await } /// / Watches the inbound server policy for a given workload port. pub async fn watch_port( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -407,7 +430,15 @@ pub mod inbound_server_policies_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "io.linkerd.proxy.inbound.InboundServerPolicies", + "WatchPort", + ), + ); + self.inner.server_streaming(req, path, codec).await } } } @@ -422,10 +453,10 @@ pub mod inbound_server_policies_server { async fn get_port( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the WatchPort method. - type WatchPortStream: futures_core::Stream< - Item = Result, + type WatchPortStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, > + Send + 'static; @@ -433,7 +464,7 @@ pub mod inbound_server_policies_server { async fn watch_port( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } /// / An API exposed to the linkerd2-proxy to configure the inbound proxy with per-port configuration /// / @@ -447,6 +478,8 @@ pub mod inbound_server_policies_server { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl InboundServerPoliciesServer { @@ -459,6 +492,8 @@ pub mod inbound_server_policies_server { 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( @@ -482,6 +517,22 @@ pub mod inbound_server_policies_server { 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 tonic::codegen::Service> for InboundServerPoliciesServer @@ -496,7 +547,7 @@ pub mod inbound_server_policies_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -517,13 +568,18 @@ pub mod inbound_server_policies_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).get_port(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_port(&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 inner = inner.0; @@ -533,6 +589,10 @@ pub mod inbound_server_policies_server { .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.unary(method, req).await; Ok(res) @@ -556,13 +616,18 @@ pub mod inbound_server_policies_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).watch_port(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::watch_port(&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 inner = inner.0; @@ -572,6 +637,10 @@ pub mod inbound_server_policies_server { .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.server_streaming(method, req).await; Ok(res) @@ -600,12 +669,14 @@ pub mod inbound_server_policies_server { 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, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/src/gen/io.linkerd.proxy.outbound.rs b/src/gen/io.linkerd.proxy.outbound.rs index a0d4f723b..e5c62e4e0 100644 --- a/src/gen/io.linkerd.proxy.outbound.rs +++ b/src/gen/io.linkerd.proxy.outbound.rs @@ -110,9 +110,8 @@ pub mod proxy_protocol { Grpc(Grpc), } } -/// Outbound-specific HTTP route configuration (based on the [Gateway API]\[api\]). -/// -/// \[api\]: +/// Outbound-specific HTTP route configuration (based on the +/// [Gateway API]()). #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct HttpRoute { @@ -596,10 +595,26 @@ pub mod outbound_policies_client { 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 + } pub async fn get( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await @@ -613,12 +628,17 @@ pub mod outbound_policies_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.outbound.OutboundPolicies/Get", ); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("io.linkerd.proxy.outbound.OutboundPolicies", "Get"), + ); + self.inner.unary(req, path, codec).await } pub async fn watch( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -635,7 +655,15 @@ pub mod outbound_policies_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.outbound.OutboundPolicies/Watch", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "io.linkerd.proxy.outbound.OutboundPolicies", + "Watch", + ), + ); + self.inner.server_streaming(req, path, codec).await } } } @@ -649,23 +677,25 @@ pub mod outbound_policies_server { async fn get( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; /// Server streaming response type for the Watch method. - type WatchStream: futures_core::Stream< - Item = Result, + type WatchStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, > + Send + 'static; async fn watch( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } #[derive(Debug)] pub struct OutboundPoliciesServer { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl OutboundPoliciesServer { @@ -678,6 +708,8 @@ pub mod outbound_policies_server { 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( @@ -701,6 +733,22 @@ pub mod outbound_policies_server { 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 tonic::codegen::Service> for OutboundPoliciesServer where @@ -714,7 +762,7 @@ pub mod outbound_policies_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -735,13 +783,17 @@ pub mod outbound_policies_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).get(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::get(&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 inner = inner.0; @@ -751,6 +803,10 @@ pub mod outbound_policies_server { .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.unary(method, req).await; Ok(res) @@ -774,13 +830,17 @@ pub mod outbound_policies_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).watch(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::watch(&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 inner = inner.0; @@ -790,6 +850,10 @@ pub mod outbound_policies_server { .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.server_streaming(method, req).await; Ok(res) @@ -818,12 +882,14 @@ pub mod outbound_policies_server { 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, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/src/gen/io.linkerd.proxy.tap.rs b/src/gen/io.linkerd.proxy.tap.rs index a106a7f0f..3e40715d4 100644 --- a/src/gen/io.linkerd.proxy.tap.rs +++ b/src/gen/io.linkerd.proxy.tap.rs @@ -410,10 +410,26 @@ pub mod tap_client { 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 + } pub async fn observe( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -430,7 +446,10 @@ pub mod tap_client { let path = http::uri::PathAndQuery::from_static( "/io.linkerd.proxy.tap.Tap/Observe", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("io.linkerd.proxy.tap.Tap", "Observe")); + self.inner.server_streaming(req, path, codec).await } } } @@ -442,15 +461,15 @@ pub mod tap_server { #[async_trait] pub trait Tap: Send + Sync + 'static { /// Server streaming response type for the Observe method. - type ObserveStream: futures_core::Stream< - Item = Result, + type ObserveStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, > + Send + 'static; async fn observe( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } /// A service exposed by proxy instances to setup #[derive(Debug)] @@ -458,6 +477,8 @@ pub mod tap_server { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl TapServer { @@ -470,6 +491,8 @@ pub mod tap_server { 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( @@ -493,6 +516,22 @@ pub mod tap_server { 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 tonic::codegen::Service> for TapServer where @@ -506,7 +545,7 @@ pub mod tap_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -529,13 +568,17 @@ pub mod tap_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); - let fut = async move { (*inner).observe(request).await }; + let inner = Arc::clone(&self.0); + let fut = async move { + ::observe(&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 inner = inner.0; @@ -545,6 +588,10 @@ pub mod tap_server { .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.server_streaming(method, req).await; Ok(res) @@ -573,12 +620,14 @@ pub mod tap_server { 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, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner {