diff --git a/LICENSES/github.com/envoyproxy/go-control-plane/pkg/LICENSE b/LICENSES/github.com/envoyproxy/go-control-plane/pkg/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/LICENSES/github.com/envoyproxy/go-control-plane/pkg/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/LICENSES/github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3/LICENSE b/LICENSES/github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/LICENSES/github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/Makefile b/Makefile index c68dbd3ea..9f424b239 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ build-atenet: .PHONY: build-demos build-demos: - $(KO) build --ldflags="$(LDFLAGS)" ./demos/counter + $(KO) build --ldflags="$(LDFLAGS)" ./demos/counter ./demos/egress .PHONY: test test: diff --git a/README.md b/README.md index 0f3d9d2fa..0ed3b2698 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ kubectl ate create atespace demo kubectl ate create actor my-counter-1 -a demo --template ate-demo-counter/counter # port-forward the network router to bind to local port `8000` -kubectl port-forward -n ate-system svc/atenet-router 8000:80 +kubectl port-forward -n ate-system svc/ateway-ingress 8000:80 ``` 3. In a **separate terminal**, send an HTTP request to increment the counter: @@ -215,7 +215,7 @@ We provide several sample applications demonstrating Agent Substrate's capabilit * `cmd/ateapi`: The core control plane API server exposing gRPC endpoints to manage actor and worker lifecycles. * `cmd/atelet`: A node-level DaemonSet that supervises physical worker pods, coordinates snapshotting, and manages state transfers. * `cmd/atecontroller`: A Kubernetes controller that reconciles WorkerPool and ActorTemplate custom resources. -* `cmd/atenet`: A combined networking controller providing DNS, Envoy routing, and proxy sidecars. +* `cmd/atenet`: The controller for Actor DNS resolution. * `cmd/ateom-gvisor`: An interior-pod helper running inside sandboxed worker pods to execute `runsc` checkpoint and restore commands. * `cmd/podcertcontroller`: A "polyfill" that provides Pod Certificate signers that will eventually ship in upstream Kubernetes (with different names). diff --git a/benchmarking/locust/tests/counter_demo.py b/benchmarking/locust/tests/counter_demo.py index e89a70ed6..fce03c670 100644 --- a/benchmarking/locust/tests/counter_demo.py +++ b/benchmarking/locust/tests/counter_demo.py @@ -50,7 +50,7 @@ # Atenet router fronts all actor traffic. Actors are addressed by setting # the HTTP Host header to ..actors.resources.substrate.ate.dev; # the router resolves that to the actor's current worker pod. -ROUTER_URL = "http://atenet-router.ate-system.svc.cluster.local" +ROUTER_URL = "http://ateway-ingress.ate-system.svc.cluster.local" ACTOR_DOMAIN = "actors.resources.substrate.ate.dev" @@ -137,7 +137,7 @@ def run_and_suspend(self) -> None: except Exception: pass - # 2. Run/Increment (HTTP via atenet-router) + # 2. Run/Increment (HTTP via ateway-ingress) start_time = time.time() with tracer.start_as_current_span("RunCounter") as span: headers = {"Host": self.host_header} diff --git a/cmd/ateapi/internal/controlapi/functional_test.go b/cmd/ateapi/internal/controlapi/functional_test.go index 51ac51022..a1b9f6e9a 100644 --- a/cmd/ateapi/internal/controlapi/functional_test.go +++ b/cmd/ateapi/internal/controlapi/functional_test.go @@ -1154,6 +1154,13 @@ func TestResumeActor(t *testing.T) { if !tc.fakeAtelet.RestoreCalled { t.Errorf("expected Restore to be called") } + restoreReq := tc.fakeAtelet.lastRestoreRequest() + if restoreReq == nil || restoreReq.GetActorVersion() < 1 { + t.Fatalf("Restore actor_version = %v, want a positive version", restoreReq) + } + if restoreReq.EgressGatewayAddress != nil { + t.Fatalf("Restore egress_gateway_address = %q, want absent until the Actor egress API is available", restoreReq.GetEgressGatewayAddress()) + } getResp, err := tc.client.GetActor(context.Background(), &ateapipb.GetActorRequest{ Actor: &ateapipb.ObjectRef{Atespace: testAtespace, Name: name}, @@ -1161,6 +1168,9 @@ func TestResumeActor(t *testing.T) { if err != nil { t.Fatalf("GetActor failed: %v", err) } + if restoreReq.GetActorVersion() >= getResp.GetMetadata().GetVersion() { + t.Errorf("Restore actor_version = %d, final Actor version = %d; want the assignment version to precede finalization", restoreReq.GetActorVersion(), getResp.GetMetadata().GetVersion()) + } want := &ateapipb.Actor{ Metadata: &ateapipb.ResourceMetadata{Name: name, Atespace: testAtespace}, ActorTemplateNamespace: ns, diff --git a/cmd/ateapi/internal/controlapi/workflow_resume.go b/cmd/ateapi/internal/controlapi/workflow_resume.go index 2ebaa9fe5..7e5954659 100644 --- a/cmd/ateapi/internal/controlapi/workflow_resume.go +++ b/cmd/ateapi/internal/controlapi/workflow_resume.go @@ -275,6 +275,7 @@ func (s *CallAteletRestoreStep) Execute(ctx context.Context, input *ResumeInput, ActorName: state.Actor.GetMetadata().GetName(), ActorTemplateNamespace: state.Actor.GetActorTemplateNamespace(), ActorTemplateName: state.Actor.GetActorTemplateName(), + ActorVersion: state.Actor.GetMetadata().GetVersion(), Spec: workloadSpec, ActorUid: state.Actor.GetMetadata().Uid, } @@ -312,6 +313,7 @@ func (s *CallAteletRestoreStep) Execute(ctx context.Context, input *ResumeInput, ActorName: state.Actor.GetMetadata().GetName(), ActorTemplateNamespace: state.Actor.GetActorTemplateNamespace(), ActorTemplateName: state.Actor.GetActorTemplateName(), + ActorVersion: state.Actor.GetMetadata().GetVersion(), Spec: workloadSpec, Type: ateletpb.CheckpointType_CHECKPOINT_TYPE_EXTERNAL, Config: &ateletpb.RestoreRequest_ExternalConfig{ @@ -341,6 +343,7 @@ func (s *CallAteletRestoreStep) Execute(ctx context.Context, input *ResumeInput, ActorName: state.Actor.GetMetadata().GetName(), ActorTemplateNamespace: state.Actor.GetActorTemplateNamespace(), ActorTemplateName: state.Actor.GetActorTemplateName(), + ActorVersion: state.Actor.GetMetadata().GetVersion(), SandboxAssets: sandboxAssets, Spec: workloadSpec, ActorUid: state.Actor.GetMetadata().Uid, diff --git a/cmd/atecontroller/internal/controllers/workerpool_apply.go b/cmd/atecontroller/internal/controllers/workerpool_apply.go index 5b35a291a..8308c2b22 100644 --- a/cmd/atecontroller/internal/controllers/workerpool_apply.go +++ b/cmd/atecontroller/internal/controllers/workerpool_apply.go @@ -24,6 +24,13 @@ import ( atev1alpha1 "github.com/agent-substrate/substrate/pkg/api/v1alpha1" ) +const ( + atunnelIdentityVolume = "atunnel-identity" + atunnelIdentityMountPath = "/run/podidentity.podcert.ate.dev" + atunnelEgressTrustVolume = "atunnel-egress-trust" + atunnelEgressTrustMountPath = "/run/servicedns.podcert.ate.dev" +) + // buildDeploymentApplyConfig constructs the SSA apply configuration for the // Deployment managed by a WorkerPool. Only fields owned by this controller // are declared here. @@ -33,7 +40,16 @@ func buildDeploymentApplyConfig(wp *atev1alpha1.WorkerPool) *appsv1ac.Deployment WithImage(wp.Spec.AteomImage). WithArgs( "--pod-uid=$(POD_UID)", + "--atunnel-listen-address=0.0.0.0:443", + "--atunnel-credential-bundle="+atunnelIdentityMountPath+"/credential-bundle.pem", + "--atunnel-trust-bundle="+atunnelIdentityMountPath+"/trust-bundle.pem", + "--atunnel-egress-listen-address=0.0.0.0:15001", + "--atunnel-egress-trust-bundle="+atunnelEgressTrustMountPath+"/trust-bundle.pem", ). + WithPorts(corev1ac.ContainerPort(). + WithName("https"). + WithContainerPort(443). + WithProtocol(corev1.ProtocolTCP)). WithSecurityContext(corev1ac.SecurityContext(). WithPrivileged(true). WithRunAsUser(0). @@ -45,19 +61,60 @@ func buildDeploymentApplyConfig(wp *atev1alpha1.WorkerPool) *appsv1ac.Deployment WithFieldRef(corev1ac.ObjectFieldSelector(). WithFieldPath("metadata.uid"))), ). - WithVolumeMounts(corev1ac.VolumeMount(). - WithName("run-ateom"). - WithMountPath(ateompath.BasePath)) + WithVolumeMounts( + corev1ac.VolumeMount(). + WithName("run-ateom"). + WithMountPath(ateompath.BasePath), + corev1ac.VolumeMount(). + WithName(atunnelIdentityVolume). + WithMountPath(atunnelIdentityMountPath). + WithReadOnly(true), + corev1ac.VolumeMount(). + WithName(atunnelEgressTrustVolume). + WithMountPath(atunnelEgressTrustMountPath). + WithReadOnly(true), + ) podSpecAC := corev1ac.PodSpec(). WithSecurityContext(corev1ac.PodSecurityContext(). WithRunAsUser(0). WithRunAsGroup(0)). - WithVolumes(corev1ac.Volume(). - WithName("run-ateom"). - WithHostPath(corev1ac.HostPathVolumeSource(). - WithPath(ateompath.BasePath). - WithType(corev1.HostPathDirectoryOrCreate))) + WithVolumes( + corev1ac.Volume(). + WithName("run-ateom"). + WithHostPath(corev1ac.HostPathVolumeSource(). + WithPath(ateompath.BasePath). + WithType(corev1.HostPathDirectoryOrCreate)), + corev1ac.Volume(). + WithName(atunnelIdentityVolume). + WithProjected(corev1ac.ProjectedVolumeSource(). + WithSources( + corev1ac.VolumeProjection(). + WithPodCertificate(corev1ac.PodCertificateProjection(). + WithSignerName("podidentity.podcert.ate.dev/identity"). + WithKeyType("ECDSAP256"). + WithCredentialBundlePath("credential-bundle.pem")), + corev1ac.VolumeProjection(). + WithClusterTrustBundle(corev1ac.ClusterTrustBundleProjection(). + WithSignerName("podidentity.podcert.ate.dev/identity"). + WithLabelSelector(metav1ac.LabelSelector(). + WithMatchLabels(map[string]string{"podcert.ate.dev/canarying": "live"})). + WithPath("trust-bundle.pem")), + ), + ), + corev1ac.Volume(). + WithName(atunnelEgressTrustVolume). + WithProjected(corev1ac.ProjectedVolumeSource(). + WithSources( + corev1ac.VolumeProjection(). + WithClusterTrustBundle(corev1ac.ClusterTrustBundleProjection(). + WithSignerName("servicedns.podcert.ate.dev/identity"). + WithLabelSelector(metav1ac.LabelSelector(). + WithMatchLabels(map[string]string{"podcert.ate.dev/canarying": "live"})). + WithPath("trust-bundle.pem")), + ), + ), + ) applyWorkerPoolPodTemplate(podSpecAC, containerAC, wp.Spec.Template) maybeApplyMicroVMPodShape(podSpecAC, containerAC, wp.Spec.SandboxClass) diff --git a/cmd/atecontroller/internal/controllers/workerpool_apply_test.go b/cmd/atecontroller/internal/controllers/workerpool_apply_test.go index 19f6d44d9..baf001dca 100644 --- a/cmd/atecontroller/internal/controllers/workerpool_apply_test.go +++ b/cmd/atecontroller/internal/controllers/workerpool_apply_test.go @@ -279,15 +279,57 @@ func expectedDeploymentApplyConfig(mutatePodSpec func(*corev1ac.PodSpecApplyConf WithSecurityContext(corev1ac.PodSecurityContext(). WithRunAsUser(0). WithRunAsGroup(0)). - WithVolumes(corev1ac.Volume(). - WithName("run-ateom"). - WithHostPath(corev1ac.HostPathVolumeSource(). - WithPath(ateompath.BasePath). - WithType(corev1.HostPathDirectoryOrCreate))). + WithVolumes( + corev1ac.Volume(). + WithName("run-ateom"). + WithHostPath(corev1ac.HostPathVolumeSource(). + WithPath(ateompath.BasePath). + WithType(corev1.HostPathDirectoryOrCreate)), + corev1ac.Volume(). + WithName(atunnelIdentityVolume). + WithProjected(corev1ac.ProjectedVolumeSource(). + WithSources( + corev1ac.VolumeProjection(). + WithPodCertificate(corev1ac.PodCertificateProjection(). + WithSignerName("podidentity.podcert.ate.dev/identity"). + WithKeyType("ECDSAP256"). + WithCredentialBundlePath("credential-bundle.pem")), + corev1ac.VolumeProjection(). + WithClusterTrustBundle(corev1ac.ClusterTrustBundleProjection(). + WithSignerName("podidentity.podcert.ate.dev/identity"). + WithLabelSelector(metav1ac.LabelSelector(). + WithMatchLabels(map[string]string{"podcert.ate.dev/canarying": "live"})). + WithPath("trust-bundle.pem")), + ), + ), + corev1ac.Volume(). + WithName(atunnelEgressTrustVolume). + WithProjected(corev1ac.ProjectedVolumeSource(). + WithSources( + corev1ac.VolumeProjection(). + WithClusterTrustBundle(corev1ac.ClusterTrustBundleProjection(). + WithSignerName("servicedns.podcert.ate.dev/identity"). + WithLabelSelector(metav1ac.LabelSelector(). + WithMatchLabels(map[string]string{"podcert.ate.dev/canarying": "live"})). + WithPath("trust-bundle.pem")), + ), + ), + ). WithContainers(corev1ac.Container(). WithName("ateom"). WithImage(wp.Spec.AteomImage). - WithArgs("--pod-uid=$(POD_UID)"). + WithArgs( + "--pod-uid=$(POD_UID)", + "--atunnel-listen-address=0.0.0.0:443", + "--atunnel-credential-bundle="+atunnelIdentityMountPath+"/credential-bundle.pem", + "--atunnel-trust-bundle="+atunnelIdentityMountPath+"/trust-bundle.pem", + "--atunnel-egress-listen-address=0.0.0.0:15001", + "--atunnel-egress-trust-bundle="+atunnelEgressTrustMountPath+"/trust-bundle.pem", + ). + WithPorts(corev1ac.ContainerPort(). + WithName("https"). + WithContainerPort(443). + WithProtocol(corev1.ProtocolTCP)). WithSecurityContext(corev1ac.SecurityContext(). WithPrivileged(true). WithRunAsUser(0). @@ -297,9 +339,19 @@ func expectedDeploymentApplyConfig(mutatePodSpec func(*corev1ac.PodSpecApplyConf WithValueFrom(corev1ac.EnvVarSource(). WithFieldRef(corev1ac.ObjectFieldSelector(). WithFieldPath("metadata.uid")))). - WithVolumeMounts(corev1ac.VolumeMount(). - WithName("run-ateom"). - WithMountPath(ateompath.BasePath)). + WithVolumeMounts( + corev1ac.VolumeMount(). + WithName("run-ateom"). + WithMountPath(ateompath.BasePath), + corev1ac.VolumeMount(). + WithName(atunnelIdentityVolume). + WithMountPath(atunnelIdentityMountPath). + WithReadOnly(true), + corev1ac.VolumeMount(). + WithName(atunnelEgressTrustVolume). + WithMountPath(atunnelEgressTrustMountPath). + WithReadOnly(true), + ). WithResources(corev1ac.ResourceRequirements())) podSpecAC.NodeSelector = map[string]string{} diff --git a/cmd/atecontroller/internal/controllers/workerpool_controller_test.go b/cmd/atecontroller/internal/controllers/workerpool_controller_test.go index 5acad6714..b5a691648 100644 --- a/cmd/atecontroller/internal/controllers/workerpool_controller_test.go +++ b/cmd/atecontroller/internal/controllers/workerpool_controller_test.go @@ -138,8 +138,10 @@ func TestWorkerPoolCreatesDeployment(t *testing.T) { if len(dep.OwnerReferences) == 0 || dep.OwnerReferences[0].Name != wp.Name { return false, nil } - return len(dep.Spec.Template.Spec.Volumes) == 1 && - dep.Spec.Template.Spec.Volumes[0].Name == "run-ateom", nil + return len(dep.Spec.Template.Spec.Volumes) == 3 && + dep.Spec.Template.Spec.Volumes[0].Name == "run-ateom" && + dep.Spec.Template.Spec.Volumes[1].Name == atunnelIdentityVolume && + dep.Spec.Template.Spec.Volumes[2].Name == atunnelEgressTrustVolume, nil }) } diff --git a/cmd/atelet/main.go b/cmd/atelet/main.go index e99e42815..24b8502da 100644 --- a/cmd/atelet/main.go +++ b/cmd/atelet/main.go @@ -259,6 +259,8 @@ func (s *AteomHerder) Run(ctx context.Context, req *ateletpb.RunRequest) (*atele ActorName: actorName, ActorTemplateNamespace: req.GetActorTemplateNamespace(), ActorTemplateName: req.GetActorTemplateName(), + ActorVersion: req.GetActorVersion(), + EgressGatewayAddress: req.EgressGatewayAddress, RunscPath: runscPathFor(assetPaths), RuntimeAssetPaths: assetPaths, Spec: buildAteomWorkloadSpec(req.GetSpec()), @@ -556,6 +558,8 @@ func (s *AteomHerder) Restore(ctx context.Context, req *ateletpb.RestoreRequest) ActorName: actorName, ActorTemplateNamespace: req.GetActorTemplateNamespace(), ActorTemplateName: req.GetActorTemplateName(), + ActorVersion: req.GetActorVersion(), + EgressGatewayAddress: req.EgressGatewayAddress, RunscPath: runscPathFor(assetPaths), RuntimeAssetPaths: assetPaths, Spec: buildAteomWorkloadSpec(req.GetSpec()), @@ -840,6 +844,9 @@ func (d *AteomDialer) DialAteomPod(ctx context.Context, podUID string) (*grpc.Cl // internal/resources so other components can apply them at their boundaries. func validateRunRequest(req *ateletpb.RunRequest) error { var errs field.ErrorList + if req.GetActorVersion() < 1 { + errs = append(errs, field.Invalid(field.NewPath("actor_version"), req.GetActorVersion(), "must be positive")) + } errs = append(errs, resources.ValidateResourceName(req.GetAtespace(), field.NewPath("atespace"))...) errs = append(errs, resources.ValidateResourceName(req.GetActorName(), field.NewPath("actor_name"))...) errs = append(errs, resources.ValidateResourceName(req.GetActorUid(), field.NewPath("actor_uid"))...) @@ -910,6 +917,9 @@ func validateCheckpointRequest(req *ateletpb.CheckpointRequest) error { func validateRestoreRequest(req *ateletpb.RestoreRequest) error { var errs field.ErrorList + if req.GetActorVersion() < 1 { + errs = append(errs, field.Invalid(field.NewPath("actor_version"), req.GetActorVersion(), "must be positive")) + } errs = append(errs, resources.ValidateResourceName(req.GetAtespace(), field.NewPath("atespace"))...) errs = append(errs, resources.ValidateResourceName(req.GetActorName(), field.NewPath("actor_name"))...) errs = append(errs, resources.ValidateResourceName(req.GetActorUid(), field.NewPath("actor_uid"))...) diff --git a/cmd/atelet/main_test.go b/cmd/atelet/main_test.go index ad0785f7b..02f3b4a85 100644 --- a/cmd/atelet/main_test.go +++ b/cmd/atelet/main_test.go @@ -97,6 +97,7 @@ func validRunRequest() *ateletpb.RunRequest { ActorTemplateName: "counter", TargetAteomUid: "422938ba-8860-4983-a25d-d6bcb0a69d4e", ActorUid: "123e4567-e89b-12d3-a456-426614174000", + ActorVersion: 7, Spec: &ateletpb.WorkloadSpec{Containers: []*ateletpb.Container{{Name: "worker"}}}, } } @@ -128,6 +129,7 @@ func validRestoreRequest() *ateletpb.RestoreRequest { ActorTemplateName: "counter", TargetAteomUid: "422938ba-8860-4983-a25d-d6bcb0a69d4e", ActorUid: "123e4567-e89b-12d3-a456-426614174000", + ActorVersion: 7, Spec: &ateletpb.WorkloadSpec{Containers: []*ateletpb.Container{{Name: "worker"}}}, Type: ateletpb.CheckpointType_CHECKPOINT_TYPE_EXTERNAL, Config: &ateletpb.RestoreRequest_ExternalConfig{ @@ -152,6 +154,7 @@ func TestValidateRunRequest(t *testing.T) { {"invalid actor uid", func(r *ateletpb.RunRequest) { r.ActorUid = "../escape" }, true}, {"invalid actor template namespace", func(r *ateletpb.RunRequest) { r.ActorTemplateNamespace = "Not_Valid" }, true}, {"invalid actor template name", func(r *ateletpb.RunRequest) { r.ActorTemplateName = "Not_Valid" }, true}, + {"invalid actor version", func(r *ateletpb.RunRequest) { r.ActorVersion = 0 }, true}, {"invalid container name", func(r *ateletpb.RunRequest) { r.Spec.Containers = []*ateletpb.Container{{Name: "../escape"}} }, true}, @@ -235,6 +238,7 @@ func TestValidateRestoreRequest(t *testing.T) { {"invalid actor uid", makeReq(func(r *ateletpb.RestoreRequest) { r.ActorUid = "../escape" }), true}, {"invalid actor template namespace", makeReq(func(r *ateletpb.RestoreRequest) { r.ActorTemplateNamespace = "Not_Valid" }), true}, {"invalid actor template name", makeReq(func(r *ateletpb.RestoreRequest) { r.ActorTemplateName = "Not_Valid" }), true}, + {"invalid actor version", makeReq(func(r *ateletpb.RestoreRequest) { r.ActorVersion = 0 }), true}, {"invalid container name", makeReq(func(r *ateletpb.RestoreRequest) { r.Spec.Containers = []*ateletpb.Container{{Name: "../escape"}} }), true}, diff --git a/cmd/atenet/README.md b/cmd/atenet/README.md index 9200e0f9c..d62e1aa23 100644 --- a/cmd/atenet/README.md +++ b/cmd/atenet/README.md @@ -1,30 +1,6 @@ # atenet -atenet is a combined daemon for all networking functionality. - -* DNS server for ATE Actor resolution: `atenet dns` -* Envoy control plane for programming ATE resolution. `atenet router` - -This is built as a single binary for convenience in the prototyping. - -## Cluster deployment - -![atenet diagram](atenet-diagram.png) - -### router - -(Note: this deployment model combines Envoy dataplane with the router. This will -likely be split in the future for better scalability.) - -* `atenet router` will be deployed as Deployment and Service -* Deployment will contain: - * Envoy - * atenet router -* Service will expose: - * Envoy port 80 and 443. - -RBAC permissions: -* read, list on ActorTemplate +atenet currently runs the DNS server for ATE Actor resolution: `atenet dns`. ### dns @@ -37,5 +13,4 @@ RBAC permissions: ## testing -Run the package tests with `go test ./cmd/atenet/...`. Cluster e2e -tests use the shared `hack/run-e2e.sh` runner. +Run the package tests with `go test ./cmd/atenet/...`. diff --git a/cmd/atenet/atenet-diagram.png b/cmd/atenet/atenet-diagram.png deleted file mode 100644 index c77c5baad..000000000 Binary files a/cmd/atenet/atenet-diagram.png and /dev/null differ diff --git a/cmd/atenet/internal/dns/README.md b/cmd/atenet/internal/dns/README.md index 90196b7ba..d3be400e9 100644 --- a/cmd/atenet/internal/dns/README.md +++ b/cmd/atenet/internal/dns/README.md @@ -2,9 +2,9 @@ The DNS Controller orchestrates the configuration needed to setup the ATE routing. -We want to resolve requests for ..actors.resources.substrate.ate.dev to the router service address. +We want to resolve requests for ..actors.resources.substrate.ate.dev to the `ateway-ingress` service address. -* Stub resolver mode: orchestrate running a CoreDNS instance with the actor name mapped to the router service address. +* Stub resolver mode: orchestrate running a CoreDNS instance with the actor name mapped to the ingress service address. Cluster resources: @@ -26,7 +26,7 @@ ConfigMap `ate-system:dns`: # Match any 'A' query for an actor name + atespace pattern under actors.resources.substrate.ate.dev template IN A actors.resources.substrate.ate.dev { match "^[a-z0-9]([-a-z0-9]*[a-z0-9])?\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?\\.actors\\.resources\\.substrate\\.ate\\.dev\\.$" - answer "{{ .Name }} 60 IN A " + answer "{{ .Name }} 60 IN A " } ``` diff --git a/cmd/atenet/internal/dns/corefile.go b/cmd/atenet/internal/dns/corefile.go index 0b301e7e2..ee11b3693 100644 --- a/cmd/atenet/internal/dns/corefile.go +++ b/cmd/atenet/internal/dns/corefile.go @@ -45,7 +45,7 @@ func buildTemplate() string { // Escape the suffix's dots so they match literally; the final \. matches the FQDN's trailing dot. escapedSuffix := strings.ReplaceAll(resources.ActorDNSSuffix, ".", `\.`) directives = append(directives, fmt.Sprintf(` match "^%s\.%s\.%s\.$"`, resources.ResourceNameRegexPattern, resources.ResourceNameRegexPattern, escapedSuffix)) - // Note the %s -- this will be filled with the router IP. + // Note the %s -- this will be filled with the ingress gateway IP. directives = append(directives, ` answer "{{ .Name }} 60 IN A %s"`) directives = append(directives, "}") @@ -59,6 +59,6 @@ func buildTemplate() string { return b.String() } -func makeCoreFile(routerIP string) string { - return fmt.Sprintf(corefileTemplate, routerIP) +func makeCoreFile(ingressIP string) string { + return fmt.Sprintf(corefileTemplate, ingressIP) } diff --git a/cmd/atenet/internal/dns/corefile_test.go b/cmd/atenet/internal/dns/corefile_test.go index f13429e47..5c2f15f10 100644 --- a/cmd/atenet/internal/dns/corefile_test.go +++ b/cmd/atenet/internal/dns/corefile_test.go @@ -23,13 +23,13 @@ import ( func TestMakeCoreFile(t *testing.T) { tests := []struct { - name string - routerIP string - expected []string + name string + ingressIP string + expected []string }{ { - name: "standard local IP", - routerIP: "10.240.0.10", + name: "standard local IP", + ingressIP: "10.240.0.10", expected: []string{ "actors.resources.substrate.ate.dev:53 {", "log", @@ -43,8 +43,8 @@ func TestMakeCoreFile(t *testing.T) { }, }, { - name: "different IP", - routerIP: "192.168.1.1", + name: "different IP", + ingressIP: "192.168.1.1", expected: []string{ "actors.resources.substrate.ate.dev:53 {", `answer "{{ .Name }} 60 IN A 192.168.1.1"`, @@ -54,10 +54,10 @@ func TestMakeCoreFile(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - got := makeCoreFile(tc.routerIP) + got := makeCoreFile(tc.ingressIP) for _, exp := range tc.expected { if !strings.Contains(got, exp) { - t.Errorf("makeCoreFile(%q) missing expected substring %q\nGot:\n%s", tc.routerIP, exp, got) + t.Errorf("makeCoreFile(%q) missing expected substring %q\nGot:\n%s", tc.ingressIP, exp, got) } } }) diff --git a/cmd/atenet/internal/dns/dns.go b/cmd/atenet/internal/dns/dns.go index cf2db99b6..bd431f256 100644 --- a/cmd/atenet/internal/dns/dns.go +++ b/cmd/atenet/internal/dns/dns.go @@ -35,8 +35,9 @@ import ( const ( // serviceName is the name of the CoreDNS service. - serviceName = "dns" - systemNamespace = "ate-system" + serviceName = "dns" + ingressServiceName = "ateway-ingress" + systemNamespace = "ate-system" ) // Controller manages the DNS configuration for the ATE. @@ -71,19 +72,19 @@ func (c *Controller) Run(ctx context.Context) error { func (c *Controller) reconcile(ctx context.Context) error { slog.DebugContext(ctx, "Reconciling DNS orchestration configuration...") - // 1. Get the ClusterIP of atenet-router in ate-system namespace - routerSvc := &corev1.Service{} - if err := c.Client.Get(ctx, types.NamespacedName{Name: "atenet-router", Namespace: systemNamespace}, routerSvc); err != nil { + // 1. Get the ClusterIP of ateway-ingress in ate-system namespace. + ingressSvc := &corev1.Service{} + if err := c.Client.Get(ctx, types.NamespacedName{Name: ingressServiceName, Namespace: systemNamespace}, ingressSvc); err != nil { if errors.IsNotFound(err) { - slog.WarnContext(ctx, "atenet-router service not found, skipping until it is available") + slog.WarnContext(ctx, "ateway-ingress service not found, skipping until it is available") return nil } - return fmt.Errorf("failed to get atenet-router service: %w", err) + return fmt.Errorf("failed to get ateway-ingress service: %w", err) } - routerIP := routerSvc.Spec.ClusterIP - if routerIP == "" || routerIP == "None" { - slog.WarnContext(ctx, "atenet-router service has no ClusterIP yet, waiting...") + ingressIP := ingressSvc.Spec.ClusterIP + if ingressIP == "" || ingressIP == "None" { + slog.WarnContext(ctx, "ateway-ingress service has no ClusterIP yet, waiting...") return nil } @@ -104,7 +105,7 @@ func (c *Controller) reconcile(ctx context.Context) error { } // 3. Reconcile CoreDNS Corefile on shared volume - if err := c.reconcileCoreDNSConfig(ctx, routerIP); err != nil { + if err := c.reconcileCoreDNSConfig(ctx, ingressIP); err != nil { return fmt.Errorf("failed to reconcile CoreDNS config file: %w", err) } @@ -116,13 +117,13 @@ func (c *Controller) reconcile(ctx context.Context) error { return nil } -func (c *Controller) reconcileCoreDNSConfig(ctx context.Context, routerIP string) error { - expectedCorefile := makeCoreFile(routerIP) +func (c *Controller) reconcileCoreDNSConfig(ctx context.Context, ingressIP string) error { + expectedCorefile := makeCoreFile(ingressIP) // Read Corefile from local shared volume path to see if it needs updating corefileBytes, err := os.ReadFile(c.CorefilePath) if err == nil && string(corefileBytes) == expectedCorefile { - slog.DebugContext(ctx, "CoreDNS Corefile is up-to-date", slog.String("routerIP", routerIP)) + slog.DebugContext(ctx, "CoreDNS Corefile is up-to-date", slog.String("ingressIP", ingressIP)) return nil } @@ -130,7 +131,7 @@ func (c *Controller) reconcileCoreDNSConfig(ctx context.Context, routerIP string if err := os.WriteFile(c.CorefilePath, []byte(expectedCorefile), 0644); err != nil { return fmt.Errorf("failed to write updated Corefile to %s: %w", c.CorefilePath, err) } - slog.InfoContext(ctx, "CoreDNS Corefile updated", slog.String("routerIP", routerIP)) + slog.InfoContext(ctx, "CoreDNS Corefile updated", slog.String("ingressIP", ingressIP)) // Signal CoreDNS process to reload if err := c.Reloader.Reload(ctx); err != nil { diff --git a/cmd/atenet/internal/dns/dns_test.go b/cmd/atenet/internal/dns/dns_test.go index 34116db28..2572b98af 100644 --- a/cmd/atenet/internal/dns/dns_test.go +++ b/cmd/atenet/internal/dns/dns_test.go @@ -44,9 +44,9 @@ func TestReconcile(t *testing.T) { _ = corev1.AddToScheme(scheme) // 1. Create mock services - routerSvc := &corev1.Service{ + ingressSvc := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: "atenet-router", + Name: "ateway-ingress", Namespace: "ate-system", }, Spec: corev1.ServiceSpec{ @@ -89,7 +89,7 @@ func TestReconcile(t *testing.T) { client := fake.NewClientBuilder(). WithScheme(scheme). - WithObjects(routerSvc, dnsSvc, kubeDNSCM). + WithObjects(ingressSvc, dnsSvc, kubeDNSCM). Build() reloader := &mockConfigReloader{} @@ -149,9 +149,9 @@ func TestReconcileKubeDNSNotFound(t *testing.T) { scheme := runtime.NewScheme() _ = corev1.AddToScheme(scheme) - routerSvc := &corev1.Service{ + ingressSvc := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: "atenet-router", + Name: "ateway-ingress", Namespace: "ate-system", }, Spec: corev1.ServiceSpec{ @@ -172,7 +172,7 @@ func TestReconcileKubeDNSNotFound(t *testing.T) { // Set up local Corefile on disk tempDir := t.TempDir() corefilePath := filepath.Join(tempDir, "Corefile") - initialCorefile := `answer "{{ .Name }} 60 IN A "` + initialCorefile := `answer "{{ .Name }} 60 IN A "` if err := os.WriteFile(corefilePath, []byte(initialCorefile), 0644); err != nil { t.Fatalf("failed to write initial Corefile: %v", err) } @@ -181,7 +181,7 @@ func TestReconcileKubeDNSNotFound(t *testing.T) { client := fake.NewClientBuilder(). WithScheme(scheme). - WithObjects(routerSvc, dnsSvc). + WithObjects(ingressSvc, dnsSvc). Build() controller := &Controller{ diff --git a/cmd/atenet/internal/root.go b/cmd/atenet/internal/root.go index 7c7e66806..f617fb077 100644 --- a/cmd/atenet/internal/root.go +++ b/cmd/atenet/internal/root.go @@ -24,8 +24,8 @@ import ( var rootCmd = &cobra.Command{ Use: "atenet", - Short: "atenet is a combined daemon for all networking functionality.", - Long: `atenet is a combined daemon for all networking functionality.`, + Short: "atenet manages Actor DNS resolution.", + Long: `atenet manages Actor DNS resolution.`, Version: version.String(), } @@ -37,6 +37,5 @@ func Execute() { } func init() { - rootCmd.AddCommand(NewRouterCmd()) rootCmd.AddCommand(NewDnsCmd()) } diff --git a/cmd/atenet/internal/router.go b/cmd/atenet/internal/router.go deleted file mode 100644 index c58f31a7e..000000000 --- a/cmd/atenet/internal/router.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package internal - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - - "github.com/agent-substrate/substrate/cmd/atenet/internal/router" - "github.com/agent-substrate/substrate/internal/ateapiauth" -) - -func NewRouterCmd() *cobra.Command { - var cfg router.RouterConfig - - cmd := &cobra.Command{ - Use: "router", - Short: "Router components including xDS server and Envoy ExtProc gateway processing server", - RunE: func(cmd *cobra.Command, args []string) error { - srv, err := router.NewRouterServer(cfg) - if err != nil { - return fmt.Errorf("failed to create router server: %w", err) - } - srv.Cmd = cmd - - return srv.Run(cmd.Context()) - }, - } - - cmd.Flags().StringVar(&cfg.LogLevel, "log-level", "info", "Log level: debug, info, warn, error") - cmd.Flags().StringVar(&cfg.MetricsAddr, "metrics-listen-addr", ":9090", "Address and port the prometheus metrics server should listen on.") - cmd.Flags().BoolVar(&cfg.Standalone, "standalone", false, "Run in standalone mode, bypassing creation of managed deployment and services in Kubernetes cluster") - cmd.Flags().StringVar(&cfg.Namespace, "namespace", "default", "Target operations namespace") - cmd.Flags().StringVar(&cfg.Kubeconfig, "kubeconfig", "", "Absolute path to the kubeconfig configuration file") - cmd.Flags().StringVar(&cfg.AteapiAddr, "ateapi-address", "api.ate-system.svc:443", "gRPC host address of the cluster ateapi Control instance") - cmd.Flags().IntVar(&cfg.HttpPort, "port-http", 8080, "TCP port for workload traffic entering through the Envoy Router") - cmd.Flags().IntVar(&cfg.XdsPort, "port-xds", 18000, "TCP port listening for the xDS dynamic Envoy connections") - cmd.Flags().IntVar(&cfg.ExtprocPort, "port-extproc", 50051, "Listen port for the Envoy dynamic External Processing (ext_proc) server") - cmd.Flags().StringVar(&cfg.ExtprocAddr, "extproc-address", "127.0.0.1", "Host IP or address of the Envoy External Processing (ext_proc) server") - cmd.Flags().StringVar(&cfg.EnvoyImage, "envoy-image", "envoyproxy/envoy:v1.30-latest", "Image URI used for dynamically launched router instances") - cmd.Flags().StringVar(&cfg.TemplatesFile, "actor-templates-file", "", "Path to offline YAML configuration file listing ActorTemplates") - cmd.Flags().IntVar(&cfg.StatusPort, "status-port", 4040, "Port to serve /statusz on (set <= 0 to disable serving status)") - cmd.Flags().DurationVar(&cfg.HealthInterval, "health-interval", 1*time.Second, "Interval for checking health of dependent services") - cmd.Flags().IntVar(&cfg.HttpsPort, "port-https", 8443, "TCP port for HTTPS workload traffic entering through the Envoy Router") - cmd.Flags().StringVar(&cfg.EnvoyCertPath, "envoy-cert-path", "", "Path to the Envoy certificate file (if empty, a self-signed cert will be generated for testing)") - cmd.Flags().StringVar(&cfg.OtlpCollectorAddress, "otlp-collector-address", "", "host:port of the OTLP gRPC collector that Envoy reports tracing spans to (empty disables Envoy tracing)") - cmd.Flags().StringVar(&cfg.AteapiAuthMode, "ateapi-auth", "mtls", "Client auth to ateapi: mtls|jwt. 'mtls' (default) dials with insecure TLS and relies on pod-projected mTLS credentials for identity. 'jwt' verifies the server cert and sends a Bearer SA token.") - cmd.Flags().StringVar(&cfg.AteapiCAFile, "ateapi-ca-file", ateapiauth.DefaultServiceAccountCAFile, "PEM file with CAs trusted to verify the ateapi server cert. Required for jwt.") - cmd.Flags().StringVar(&cfg.AteapiServerName, "ateapi-server-name", "", "SNI / hostname expected on the ateapi server cert. Optional.") - cmd.Flags().StringVar(&cfg.AteapiTokenFile, "ateapi-token-file", ateapiauth.DefaultServiceAccountTokenFile, "Projected SA token file used as Bearer credential. Required for jwt.") - - return cmd -} diff --git a/cmd/atenet/internal/router/README.md b/cmd/atenet/internal/router/README.md deleted file mode 100644 index 4f05ae839..000000000 --- a/cmd/atenet/internal/router/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# router - -Router has several responsibilities: - -* (Optional) manages a Deployment of Envoy to function as a router for ATE requests. - * This is optional to enable testing the router component in a standalone mode without managing the Kubernetes objects. - * Envoy will be configured to send traffic to via xDS served by the Router. -* ext_proc server for the Envoy. To make the deployment and debugging easier, we will run this component together - with the router, but this will be split later into its own component. - * ext_proc will call into the ATE gRPC API to get the set of relevant backends (specific the worker IP) and - route the traffic accordingly - * Make sure the interface with ATE API is pluggable so that we can test with a mock ATE API. -* Runs an xDS server for the Envoy deployment that defines the Cluster information for the ATEs. - * the xDS configuration will configure Envoy to send traffic to ext_proc -* Watches the ActorTemplates to get out the definitions for how to route the session IDs. - -## status page - -Serve a `/statusz` page on port 8080. - -Contents: - -* Global flags values -* Command line args -* Last 100 queries served -* Build tag \ No newline at end of file diff --git a/cmd/atenet/internal/router/atstore.go b/cmd/atenet/internal/router/atstore.go deleted file mode 100644 index 62f7e0fd4..000000000 --- a/cmd/atenet/internal/router/atstore.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "fmt" - - v1alpha1 "github.com/agent-substrate/substrate/pkg/api/v1alpha1" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// atStore defines an interface for retrieving a collection of ActorTemplates. -type atStore interface { - readyTemplates(ctx context.Context) ([]*v1alpha1.ActorTemplate, error) -} - -// k8sATStore implements the atStore interface using a Kubernetes client. -type k8sATStore struct { - k8sClient client.Client -} - -func newk8sATStore(k8sClient client.Client) *k8sATStore { - return &k8sATStore{ - k8sClient: k8sClient, - } -} - -func (t *k8sATStore) readyTemplates(ctx context.Context) ([]*v1alpha1.ActorTemplate, error) { - var atList v1alpha1.ActorTemplateList - if err := t.k8sClient.List(ctx, &atList); err != nil { - return nil, fmt.Errorf("failed to list ActorTemplates: %w", err) - } - - var templates []*v1alpha1.ActorTemplate - for i := range atList.Items { - if atList.Items[i].Status.Phase != v1alpha1.PhaseReady { - continue - } - templates = append(templates, &atList.Items[i]) - } - return templates, nil -} diff --git a/cmd/atenet/internal/router/atstore_file.go b/cmd/atenet/internal/router/atstore_file.go deleted file mode 100644 index 760da68e4..000000000 --- a/cmd/atenet/internal/router/atstore_file.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "log/slog" - "os" - "strings" - - v1alpha1 "github.com/agent-substrate/substrate/pkg/api/v1alpha1" - "k8s.io/apimachinery/pkg/util/yaml" - sigsyaml "sigs.k8s.io/yaml" -) - -// fileATStore implements the atStore interface by reading and decoding YAML or JSON -// files containing ActorTemplates or ActorTemplateLists. -type fileATStore struct { - filePath string -} - -func newFileATStore(filePath string) *fileATStore { - return &fileATStore{ - filePath: filePath, - } -} - -func (t *fileATStore) readyTemplates(ctx context.Context) ([]*v1alpha1.ActorTemplate, error) { - data, err := os.ReadFile(t.filePath) - if err != nil { - return nil, fmt.Errorf("failed to read actor templates YAML file %q: %w", t.filePath, err) - } - - decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(data), 4096) - var templates []*v1alpha1.ActorTemplate - - for { - var obj map[string]interface{} - if err := decoder.Decode(&obj); err != nil { - if err == io.EOF { - break - } - return nil, fmt.Errorf("failed to decode YAML document: %w", err) - } - - if obj == nil { - continue - } - - // Check if it's a List (e.g., standard kubectl get -o yaml output) - if kind, ok := obj["kind"].(string); ok && strings.EqualFold(kind, "List") { - items, ok := obj["items"].([]interface{}) - if !ok { - continue - } - - for _, itemVal := range items { - itemMap, ok := itemVal.(map[string]interface{}) - if !ok { - continue - } - - itemBytes, err := json.Marshal(itemMap) - if err != nil { - return nil, fmt.Errorf("failed to marshal item to JSON: %w", err) - } - - var item v1alpha1.ActorTemplate - if err := sigsyaml.Unmarshal(itemBytes, &item); err != nil { - return nil, fmt.Errorf("failed to unmarshal ActorTemplate item: %w", err) - } - - templates = append(templates, &item) - } - continue - } - - // It's an ActorTemplateList structure - if kind, ok := obj["kind"].(string); ok && strings.EqualFold(kind, "ActorTemplateList") { - objBytes, err := json.Marshal(obj) - if err != nil { - return nil, fmt.Errorf("failed to marshal ActorTemplateList to JSON: %w", err) - } - - var list v1alpha1.ActorTemplateList - if err := sigsyaml.Unmarshal(objBytes, &list); err != nil { - return nil, fmt.Errorf("failed to unmarshal ActorTemplateList: %w", err) - } - - for i := range list.Items { - templates = append(templates, &list.Items[i]) - } - continue - } - - // Fallback: single ActorTemplate document - objBytes, err := json.Marshal(obj) - if err != nil { - return nil, fmt.Errorf("failed to marshal document to JSON: %w", err) - } - - var item v1alpha1.ActorTemplate - if err := sigsyaml.Unmarshal(objBytes, &item); err != nil { - return nil, fmt.Errorf("failed to unmarshal document as ActorTemplate: %w", err) - } - - templates = append(templates, &item) - } - - slog.InfoContext(ctx, "fileATStore parsed offline templates", - slog.String("filePath", t.filePath), - slog.Int("count", len(templates))) - return templates, nil -} diff --git a/cmd/atenet/internal/router/atstore_test.go b/cmd/atenet/internal/router/atstore_test.go deleted file mode 100644 index cb5a23ec5..000000000 --- a/cmd/atenet/internal/router/atstore_test.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "os" - "path/filepath" - "testing" -) - -func TestFileATStore(t *testing.T) { - tmpDir := t.TempDir() - - singleTmpl := ` -apiVersion: substrate.storage.ate.dev/v1alpha1 -kind: ActorTemplate -metadata: - name: single-actor - namespace: default -spec: - snapshotsConfig: - location: "gs://test-bucket/snapshots" - workerSelector: - matchLabels: - workload: pool-1 -` - - multiTmpl := ` -apiVersion: substrate.storage.ate.dev/v1alpha1 -kind: ActorTemplate -metadata: - name: actor-a - namespace: prod -spec: - snapshotsConfig: - location: "gs://prod-bucket/a" - workerSelector: - matchLabels: - workload: heavy-pool ---- -apiVersion: substrate.storage.ate.dev/v1alpha1 -kind: ActorTemplate -metadata: - name: actor-b - namespace: prod -spec: - snapshotsConfig: - location: "gs://prod-bucket/b" - workerSelector: - matchLabels: - workload: light-pool -` - - listTmpl := ` -apiVersion: v1 -kind: List -items: -- apiVersion: substrate.storage.ate.dev/v1alpha1 - kind: ActorTemplate - metadata: - name: list-a - namespace: dev - spec: - snapshotsConfig: - location: "gs://dev-bucket/a" - workerSelector: - matchLabels: - workload: dev-pool -- apiVersion: substrate.storage.ate.dev/v1alpha1 - kind: ActorTemplate - metadata: - name: list-b - namespace: dev - spec: - snapshotsConfig: - location: "gs://dev-bucket/b" - workerSelector: - matchLabels: - workload: dev-pool -` - - tests := []struct { - name string - yamlContent string - wantCount int - wantNames []string - }{ - { - name: "Single Document", - yamlContent: singleTmpl, - wantCount: 1, - wantNames: []string{"single-actor"}, - }, - { - name: "Multi Document Stream", - yamlContent: multiTmpl, - wantCount: 2, - wantNames: []string{"actor-a", "actor-b"}, - }, - { - name: "List structure", - yamlContent: listTmpl, - wantCount: 2, - wantNames: []string{"list-a", "list-b"}, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - filePath := filepath.Join(tmpDir, tt.name+".yaml") - if err := os.WriteFile(filePath, []byte(tt.yamlContent), 0644); err != nil { - t.Fatalf("failed to create test file: %v", err) - } - - store := newFileATStore(filePath) - templates, err := store.readyTemplates(context.Background()) - if err != nil { - t.Fatalf("Templates() error: %v", err) - } - - if len(templates) != tt.wantCount { - t.Errorf("got %d items, expected %d", len(templates), tt.wantCount) - } - - for i, wantName := range tt.wantNames { - if i >= len(templates) { - break - } - if templates[i].Name != wantName { - t.Errorf("item %d name = %q, expected %q", i, templates[i].Name, wantName) - } - } - }) - } -} diff --git a/cmd/atenet/internal/router/controller.go b/cmd/atenet/internal/router/controller.go deleted file mode 100644 index 1b0a1ed18..000000000 --- a/cmd/atenet/internal/router/controller.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "log/slog" - "time" - - "k8s.io/client-go/kubernetes" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// Controller monitors ActorTemplates and coordinates configuration updates -// for the Envoy xDS and external processing servers. -type Controller struct { - k8sClient client.Client - clientset kubernetes.Interface - cfg RouterConfig - xdsSrv *XdsServer - extprocSrv *ExtProcServer - - atStore atStore - envoyRunner *envoyrunner -} - -func NewController( - k8sClient client.Client, - clientset kubernetes.Interface, - cfg RouterConfig, - xdsSrv *XdsServer, - extprocSrv *ExtProcServer, -) *Controller { - xdsSrv.SetConfig(cfg.HttpPort, cfg.ExtprocPort, cfg.ExtprocAddr) - - var store atStore - if cfg.TemplatesFile != "" { - store = newFileATStore(cfg.TemplatesFile) - } else { - store = newk8sATStore(k8sClient) - } - - return &Controller{ - k8sClient: k8sClient, - clientset: clientset, - cfg: cfg, - xdsSrv: xdsSrv, - extprocSrv: extprocSrv, - - atStore: store, - envoyRunner: newEnvoyRunner(k8sClient, cfg), - } -} - -func (c *Controller) Start(ctx context.Context) error { - // Run first reconcile eagerly on startup - if err := c.reconcile(ctx); err != nil { - slog.ErrorContext(ctx, "Error during initial eager router reconciliation", slog.String("err", err.Error())) - } - - ticker := time.NewTicker(5 * time.Second) - defer ticker.Stop() - - for { - select { - case <-ctx.Done(): - return nil - case <-ticker.C: - if err := c.reconcile(ctx); err != nil { - slog.ErrorContext(ctx, "Error during router reconciliation", slog.String("err", err.Error())) - } - } - } -} - -func (c *Controller) reconcile(ctx context.Context) error { - _, err := c.atStore.readyTemplates(ctx) - if err != nil { - slog.ErrorContext(ctx, "Failed to get ActorTemplates", slog.String("err", err.Error())) - return err - } - - if err := c.xdsSrv.UpdateSnapshot(); err != nil { - slog.ErrorContext(ctx, "xDS Configuration generation problem", slog.String("err", err.Error())) - return err - } - - if !c.cfg.Standalone && c.cfg.TemplatesFile == "" { - // Reconcile Envoy router Deployment and Kubernetes cluster entities - err := c.envoyRunner.reconcile(ctx) - if err != nil { - slog.ErrorContext(ctx, "Error during Envoy router reconciliation", slog.String("err", err.Error())) - return err - } - } - - return nil -} diff --git a/cmd/atenet/internal/router/dashboard.html b/cmd/atenet/internal/router/dashboard.html deleted file mode 100644 index 41f3d93af..000000000 --- a/cmd/atenet/internal/router/dashboard.html +++ /dev/null @@ -1,458 +0,0 @@ - - - - - - - atenet Router Status Dashboard - - - - -
-
-
-
-

atenet Router Status

-
-
- - Build: {{ .BuildTag }} -
-
- -
-
-
Infrastructure details
- - -
- -
-
Component Network Allocation
- - - - -
- -
-
System Component Health Checks
- - - - - -
- - - - - -
- - - - -
- -
-
Global Arguments & Configuration
- - -
-
- -
-
-

Active Actor Templates

-
-
- - - - - - - - - {{ range .Templates }} - - - - - {{ else }} - - - - {{ end }} - -
NameNamespace
{{ .Name }}{{ .Namespace }}
No ActorTemplates are currently being handled.
-
-
- -
-
-

Recent 100 Processing Inquiries Served

- -
- -
- - - - - - - - - - - - - - {{ range .Queries }} - - - - - - - - - - {{ else }} - - - - {{ end }} - -
TimestampClient / AuthorityPath / RouteMethodMatching Action ResultSelected Target IPLatency
{{ .Timestamp }}{{ .Client }}{{ .Path }}{{ .Method }}{{ .Action }}{{ .Target }}{{ .Duration }}
No queries have been processed yet.
-
-
-
- - - - diff --git a/cmd/atenet/internal/router/envoyrunner.go b/cmd/atenet/internal/router/envoyrunner.go deleted file mode 100644 index df8765c62..000000000 --- a/cmd/atenet/internal/router/envoyrunner.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "fmt" - "log/slog" - - appsv1 "k8s.io/api/apps/v1" - corev1 "k8s.io/api/core/v1" - k8serrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -const ( - EnvoyDeploymentName = "atenet-router-envoy" - EnvoyServiceName = "atenet-router-envoy" - EnvoyConfigMapName = "atenet-router-envoy-config" -) - -// envoyrunner manages the dynamic deployment and lifecycle of the underlying -// Envoy proxy instance running inside Kubernetes. -type envoyrunner struct { - k8sClient client.Client - cfg RouterConfig -} - -func newEnvoyRunner(k8sClient client.Client, cfg RouterConfig) *envoyrunner { - return &envoyrunner{ - k8sClient: k8sClient, - cfg: cfg, - } -} - -func (r *envoyrunner) reconcile(ctx context.Context) error { - if err := r.reconcileEnvoyConfigMap(ctx); err != nil { - return fmt.Errorf("failed configmap reconciliation: %w", err) - } - - if err := r.reconcileEnvoyDeployment(ctx); err != nil { - return fmt.Errorf("failed deployment reconciliation: %w", err) - } - - if err := r.reconcileEnvoyService(ctx); err != nil { - return fmt.Errorf("failed service reconciliation: %w", err) - } - - return nil -} - -func (r *envoyrunner) reconcileEnvoyConfigMap(ctx context.Context) error { - envoyYaml := fmt.Sprintf(`admin: - address: - socket_address: - address: 0.0.0.0 - port_value: 9901 - -node: - id: %s - cluster: substrate-router-cluster - -dynamic_resources: - lds_config: - resource_api_version: V3 - ads: {} - cds_config: - resource_api_version: V3 - ads: {} - ads_config: - api_type: GRPC - transport_api_version: V3 - grpc_services: - - envoy_grpc: - cluster_name: xds_cluster - -static_resources: - clusters: - - name: xds_cluster - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - typed_extension_protocol_options: - envoy.extensions.upstreams.http.v3.HttpProtocolOptions: - "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions - explicit_http_config: - http2_protocol_options: {} - load_assignment: - cluster_name: xds_cluster - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: atenet-router - port_value: %d -`, NodeID, r.cfg.XdsPort) - - cm := &corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: EnvoyConfigMapName, - Namespace: r.cfg.Namespace, - }, - Data: map[string]string{ - "envoy.yaml": envoyYaml, - }, - } - - var existing corev1.ConfigMap - err := r.k8sClient.Get(ctx, client.ObjectKey{Namespace: r.cfg.Namespace, Name: EnvoyConfigMapName}, &existing) - if err != nil { - if k8serrors.IsNotFound(err) { - slog.InfoContext(ctx, "Creating Envoy bootstrap ConfigMap", - slog.String("namespace", r.cfg.Namespace), - slog.String("name", EnvoyConfigMapName)) - return r.k8sClient.Create(ctx, cm) - } - return err - } - - existing.Data = cm.Data - return r.k8sClient.Update(ctx, &existing) -} - -func (r *envoyrunner) reconcileEnvoyDeployment(ctx context.Context) error { - replicas := int32(1) - - dep := &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{ - Name: EnvoyDeploymentName, - Namespace: r.cfg.Namespace, - Labels: map[string]string{ - "app": "atenet-router-envoy", - }, - }, - Spec: appsv1.DeploymentSpec{ - Replicas: &replicas, - Selector: &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "app": "atenet-router-envoy", - }, - }, - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - "app": "atenet-router-envoy", - }, - }, - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "envoy", - Image: r.cfg.EnvoyImage, - Command: []string{ - "/usr/local/bin/envoy", - "-c", - "/etc/envoy/envoy.yaml", - "--component-log-level", - "upstream:debug,router:debug,ext_proc:debug", - }, - Ports: []corev1.ContainerPort{ - { - Name: "http", - ContainerPort: int32(r.cfg.HttpPort), - }, - { - Name: "admin", - ContainerPort: 9901, - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: "envoy-config", - MountPath: "/etc/envoy", - }, - }, - }, - }, - Volumes: []corev1.Volume{ - { - Name: "envoy-config", - VolumeSource: corev1.VolumeSource{ - ConfigMap: &corev1.ConfigMapVolumeSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: EnvoyConfigMapName, - }, - }, - }, - }, - }, - }, - }, - }, - } - - var existing appsv1.Deployment - err := r.k8sClient.Get(ctx, client.ObjectKey{Namespace: r.cfg.Namespace, Name: EnvoyDeploymentName}, &existing) - if err != nil { - if k8serrors.IsNotFound(err) { - slog.InfoContext(ctx, "Creating managed Envoy router Deployment", slog.String("namespace", r.cfg.Namespace)) - return r.k8sClient.Create(ctx, dep) - } - return err - } - - existing.Spec = dep.Spec - return r.k8sClient.Update(ctx, &existing) -} - -func (r *envoyrunner) reconcileEnvoyService(ctx context.Context) error { - svc := &corev1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: EnvoyServiceName, - Namespace: r.cfg.Namespace, - }, - Spec: corev1.ServiceSpec{ - Type: corev1.ServiceTypeClusterIP, - Selector: map[string]string{ - "app": "atenet-router-envoy", - }, - Ports: []corev1.ServicePort{ - { - Name: "http", - Port: int32(r.cfg.HttpPort), - TargetPort: intstr.FromString("http"), - }, - }, - }, - } - - var existing corev1.Service - err := r.k8sClient.Get(ctx, client.ObjectKey{Namespace: r.cfg.Namespace, Name: EnvoyServiceName}, &existing) - if err != nil { - if k8serrors.IsNotFound(err) { - slog.InfoContext(ctx, "Creating managed Envoy router ClusterIP service", slog.String("namespace", r.cfg.Namespace)) - return r.k8sClient.Create(ctx, svc) - } - return err - } - - existing.Spec.Ports = svc.Spec.Ports - existing.Spec.Selector = svc.Spec.Selector - return r.k8sClient.Update(ctx, &existing) -} diff --git a/cmd/atenet/internal/router/errors.go b/cmd/atenet/internal/router/errors.go deleted file mode 100644 index 3e80d0f03..000000000 --- a/cmd/atenet/internal/router/errors.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "fmt" - - envoy_type "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// newReqError builds a reqError whose body is the formatted message and no -// wrapped cause. Set the cause field directly when one is available. -func newReqError(code envoy_type.StatusCode, format string, args ...any) error { - return &reqError{ - msg: fmt.Sprintf(format, args...), - statusCode: int(code), - } -} - -// actorNotFoundErr returns a 404 reqError identifying the missing actor. -func actorNotFoundErr(actorName string) error { - return newReqError(envoy_type.StatusCode_NotFound, "actor %q not found", actorName) -} - -// invalidHostErr returns a 404 reqError explaining why the request host was -// rejected. The cause is preserved for log inspection via Unwrap. -func invalidHostErr(host string, cause error) error { - return &reqError{ - msg: fmt.Sprintf("invalid host %q: %v", host, cause), - cause: cause, - statusCode: int(envoy_type.StatusCode_NotFound), - } -} - -// mapResumeError translates an ActorResumer error into a client-facing -// reqError. It maps gRPC status codes to appropriate HTTP status codes and -// short, human-readable bodies. The original error is preserved via Unwrap -// so callers can still inspect it via errors.Is / errors.As when logging. -// -// Unrecognized errors collapse to 500 with a generic body to avoid leaking -// server-side detail (stack traces, internal IDs) to clients. -func mapResumeError(actorName string, err error) error { - if err == nil { - return nil - } - - re := &reqError{cause: err} - switch status.Code(err) { - case codes.NotFound: - re.statusCode = int(envoy_type.StatusCode_NotFound) - re.msg = fmt.Sprintf("actor %q not found", actorName) - case codes.FailedPrecondition: - // Preserve the gRPC description for FailedPrecondition only: it carries - // actionable client-facing context (e.g. "no free workers available") - // and is not security-sensitive. - re.statusCode = int(envoy_type.StatusCode_ServiceUnavailable) - re.msg = fmt.Sprintf("actor %q unavailable: %s", actorName, status.Convert(err).Message()) - case codes.Unavailable: - re.statusCode = int(envoy_type.StatusCode_ServiceUnavailable) - re.msg = fmt.Sprintf("actor %q unavailable", actorName) - case codes.DeadlineExceeded: - re.statusCode = int(envoy_type.StatusCode_GatewayTimeout) - re.msg = fmt.Sprintf("actor %q request timed out", actorName) - case codes.PermissionDenied: - re.statusCode = int(envoy_type.StatusCode_Forbidden) - re.msg = fmt.Sprintf("actor %q access denied", actorName) - case codes.Unauthenticated: - re.statusCode = int(envoy_type.StatusCode_Unauthorized) - re.msg = fmt.Sprintf("actor %q authentication required", actorName) - case codes.ResourceExhausted: - re.statusCode = int(envoy_type.StatusCode_TooManyRequests) - re.msg = fmt.Sprintf("actor %q rate limited", actorName) - default: - re.statusCode = int(envoy_type.StatusCode_InternalServerError) - re.msg = fmt.Sprintf("error resuming actor %q", actorName) - } - return re -} diff --git a/cmd/atenet/internal/router/errors_test.go b/cmd/atenet/internal/router/errors_test.go deleted file mode 100644 index 48635ae07..000000000 --- a/cmd/atenet/internal/router/errors_test.go +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "errors" - "testing" - - envoy_type "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func TestNewReqError(t *testing.T) { - t.Parallel() - - err := newReqError(envoy_type.StatusCode_BadRequest, "actor %q is %s", "abc", "bad") - if err == nil { - t.Fatal("newReqError returned nil") - } - var reqErr *reqError - if !errors.As(err, &reqErr) { - t.Fatalf("errors.As(*reqError) = false, want true; err type = %T", err) - } - if reqErr.statusCode != int(envoy_type.StatusCode_BadRequest) { - t.Errorf("statusCode = %d, want %d", reqErr.statusCode, envoy_type.StatusCode_BadRequest) - } - if got, want := err.Error(), `actor "abc" is bad`; got != want { - t.Errorf("Error() = %q, want %q", got, want) - } -} - -func TestActorNotFoundErr(t *testing.T) { - t.Parallel() - - err := actorNotFoundErr("ctr6") - var reqErr *reqError - if !errors.As(err, &reqErr) { - t.Fatalf("errors.As(*reqError) = false, want true; err type = %T", err) - } - if reqErr.statusCode != int(envoy_type.StatusCode_NotFound) { - t.Errorf("statusCode = %d, want %d", reqErr.statusCode, envoy_type.StatusCode_NotFound) - } - if got, want := err.Error(), `actor "ctr6" not found`; got != want { - t.Errorf("Error() = %q, want %q", got, want) - } -} - -func TestInvalidHostErr(t *testing.T) { - t.Parallel() - - cause := errors.New("missing suffix") - err := invalidHostErr("foo.example.com", cause) - - var reqErr *reqError - if !errors.As(err, &reqErr) { - t.Fatalf("errors.As(*reqError) = false, want true; err type = %T", err) - } - if reqErr.statusCode != int(envoy_type.StatusCode_NotFound) { - t.Errorf("statusCode = %d, want %d", reqErr.statusCode, envoy_type.StatusCode_NotFound) - } - if got, want := err.Error(), `invalid host "foo.example.com": missing suffix`; got != want { - t.Errorf("Error() = %q, want %q", got, want) - } - if !errors.Is(err, cause) { - t.Errorf("errors.Is(err, cause) = false, want true (cause should be wrapped for logging)") - } -} - -func TestMapResumeError(t *testing.T) { - t.Parallel() - - const actorName = "ctr6" - - tests := []struct { - name string - err error - wantCode envoy_type.StatusCode - wantBody string - }{ - { - name: "NotFound maps to 404", - err: status.Error(codes.NotFound, "actor not found"), - wantCode: envoy_type.StatusCode_NotFound, - wantBody: `actor "ctr6" not found`, - }, - { - name: "FailedPrecondition maps to 503 and preserves desc", - err: status.Error(codes.FailedPrecondition, "no free workers available"), - wantCode: envoy_type.StatusCode_ServiceUnavailable, - wantBody: `actor "ctr6" unavailable: no free workers available`, - }, - { - name: "Unavailable maps to 503", - err: status.Error(codes.Unavailable, "control-plane down"), - wantCode: envoy_type.StatusCode_ServiceUnavailable, - wantBody: `actor "ctr6" unavailable`, - }, - { - name: "DeadlineExceeded maps to 504", - err: status.Error(codes.DeadlineExceeded, "context deadline exceeded"), - wantCode: envoy_type.StatusCode_GatewayTimeout, - wantBody: `actor "ctr6" request timed out`, - }, - { - name: "PermissionDenied maps to 403", - err: status.Error(codes.PermissionDenied, "denied"), - wantCode: envoy_type.StatusCode_Forbidden, - wantBody: `actor "ctr6" access denied`, - }, - { - name: "Unauthenticated maps to 401", - err: status.Error(codes.Unauthenticated, "no creds"), - wantCode: envoy_type.StatusCode_Unauthorized, - wantBody: `actor "ctr6" authentication required`, - }, - { - name: "ResourceExhausted maps to 429", - err: status.Error(codes.ResourceExhausted, "quota"), - wantCode: envoy_type.StatusCode_TooManyRequests, - wantBody: `actor "ctr6" rate limited`, - }, - { - name: "unknown gRPC code maps to 500 without leaking desc", - err: status.Error(codes.Internal, "stack trace: foo bar"), - wantCode: envoy_type.StatusCode_InternalServerError, - wantBody: `error resuming actor "ctr6"`, - }, - { - name: "non-gRPC error maps to 500 without leaking message", - err: errors.New("raw error with secret"), - wantCode: envoy_type.StatusCode_InternalServerError, - wantBody: `error resuming actor "ctr6"`, - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - got := mapResumeError(actorName, tc.err) - if got == nil { - t.Fatal("mapResumeError returned nil") - } - var reqErr *reqError - if !errors.As(got, &reqErr) { - t.Fatalf("errors.As(*reqError) = false, want true; err type = %T", got) - } - if reqErr.statusCode != int(tc.wantCode) { - t.Errorf("statusCode = %d, want %d", reqErr.statusCode, tc.wantCode) - } - if got.Error() != tc.wantBody { - t.Errorf("Error() = %q, want %q", got.Error(), tc.wantBody) - } - if !errors.Is(got, tc.err) { - t.Errorf("errors.Is(result, original) = false, want true (original must be preserved for logs)") - } - }) - } -} - -func TestMapResumeError_NilError(t *testing.T) { - t.Parallel() - - // Guard against accidental nil-error calls. Returning nil keeps the - // happy path explicit at callsites instead of constructing a bogus 500. - if got := mapResumeError("ctr6", nil); got != nil { - t.Errorf("mapResumeError(_, nil) = %v, want nil", got) - } -} - -// Ensures mapResumeError result satisfies the reqError contract so the -// existing handleRequestHeaders branch (errors.As(err, &reqErr)) keeps working. -func TestMapResumeError_IsReqError(t *testing.T) { - t.Parallel() - - err := mapResumeError("x", status.Error(codes.NotFound, "x")) - var reqErr *reqError - if !errors.As(err, &reqErr) { - t.Fatalf("errors.As(*reqError) = false, want true; err type = %T", err) - } -} diff --git a/cmd/atenet/internal/router/extproc.go b/cmd/atenet/internal/router/extproc.go deleted file mode 100644 index 203c668d1..000000000 --- a/cmd/atenet/internal/router/extproc.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "errors" - "fmt" - "io" - "log/slog" - "net" - "time" - - extprocv3 "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - envoy_type "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/propagation" - "google.golang.org/grpc" - - "github.com/agent-substrate/substrate/pkg/proto/ateapipb" -) - -// ExtProcServer implements the Envoy external processing gRPC server -// to dynamically manage actor activations based on request traffic. -type ExtProcServer struct { - port int - apiClient ateapipb.ControlClient - recorder *QueryRecorder - resumer *ActorResumer - routeDuration metric.Float64Histogram -} - -func NewExtProcServer(port int, apiClient ateapipb.ControlClient, routeDuration metric.Float64Histogram) *ExtProcServer { - return &ExtProcServer{ - port: port, - apiClient: apiClient, - recorder: NewQueryRecorder(100), - resumer: NewActorResumer(apiClient), - routeDuration: routeDuration, - } -} - -func (s *ExtProcServer) Serve(ctx context.Context, lis net.Listener) error { - grpcServer := grpc.NewServer( - grpc.StatsHandler(otelgrpc.NewServerHandler()), - ) - extprocv3.RegisterExternalProcessorServer(grpcServer, s) - - errChan := make(chan error, 1) - go func() { - if err := grpcServer.Serve(lis); err != nil { - errChan <- err - } - }() - - select { - case <-ctx.Done(): - grpcServer.GracefulStop() - return nil - case err := <-errChan: - return err - } -} - -func (s *ExtProcServer) Process(stream extprocv3.ExternalProcessor_ProcessServer) error { - for { - req, err := stream.Recv() - if err == io.EOF { - return nil - } - if err != nil { - return err - } - - resp := &extprocv3.ProcessingResponse{} - - switch reqType := req.Request.(type) { - case *extprocv3.ProcessingRequest_RequestHeaders: - start := time.Now() - hResponse, rqm, target, tmplNs, tmplName, err := s.handleRequestHeaders(stream.Context(), reqType.RequestHeaders) - elapsed := time.Since(start) - if err != nil { - slog.ErrorContext(stream.Context(), "Error during ext_proc RequestHeaders processing", slog.String("err", err.Error())) - var reqErr *reqError - if errors.As(err, &reqErr) { - resp = immediateResponse(envoy_type.StatusCode(reqErr.statusCode), reqErr.Error()) - } else { - resp = immediateResponse(envoy_type.StatusCode_InternalServerError, err.Error()) - } - s.recordRouteDuration(stream.Context(), elapsed, tmplNs, tmplName, classifyOutcome(err)) - s.recorder.AddRouterRequest(start, elapsed, "Error", "-", rqm) - } else { - resp.Response = &extprocv3.ProcessingResponse_RequestHeaders{RequestHeaders: hResponse} - s.recordRouteDuration(stream.Context(), elapsed, tmplNs, tmplName, "ok") - s.recorder.AddRouterRequest(start, elapsed, "Route ok", target, rqm) - } - - default: - // No modification for other processing states, but log because this should - // not be called. - slog.Error("Unexpected request type", slog.String("reqType", fmt.Sprintf("%T", reqType))) - resp.Response = &extprocv3.ProcessingResponse_RequestHeaders{ - RequestHeaders: &extprocv3.HeadersResponse{ - Response: &extprocv3.CommonResponse{}, - }, - } - } - - if err := stream.Send(resp); err != nil { - return err - } - } -} - -func (s *ExtProcServer) handleRequestHeaders( - ctx context.Context, - reqHeaders *extprocv3.HttpHeaders, -) (*extprocv3.HeadersResponse, *requestMetadata, string, string, string, error) { - metadata := newRequestMetadata(reqHeaders.Headers.GetHeaders()) - slog.InfoContext(ctx, "Request", slog.String("host", metadata.host)) - - // Envoy doesn't propagate trace context into the ext_proc gRPC - // stream's metadata — the per-request traceparent arrives in the - // HTTP headers carried inside the ProcessingRequest payload. Extract - // from there so our span links to the Envoy ingress span. - ctx = otel.GetTextMapPropagator().Extract(ctx, propagation.MapCarrier(metadata.headers)) - ctx, span := otel.Tracer(routerServiceName).Start(ctx, "ExtProc.RequestHeaders") - defer span.End() - - atespace, actorName, err := parseActorRef(metadata.host) - if err != nil { - // Host is invalid, respond with 404. - return nil, metadata, "", "", "", invalidHostErr(metadata.host, err) - } - - slog.InfoContext(ctx, "ResumeActor", slog.String("atespace", atespace), slog.String("actor", actorName)) - actor, err := s.resumer.ResumeActor(ctx, atespace, actorName) - if err != nil { - return nil, metadata, "", "", "", mapResumeError(actorName, err) - } - - // Actor template identity, used as low-cardinality route-latency metric - // attributes (see recordRouteDuration). - tmplNs := actor.GetActorTemplateNamespace() - tmplName := actor.GetActorTemplateName() - - workerIP := actor.GetAteomPodIp() - slog.InfoContext(ctx, "ResumeActor result", - slog.String("atespace", atespace), - slog.String("actor", actorName), - slog.String("status", actor.GetStatus().String()), - slog.String("workerIP", workerIP)) - - if ip := net.ParseIP(workerIP); ip == nil { - return nil, metadata, "", tmplNs, tmplName, newReqError(envoy_type.StatusCode_InternalServerError, - "actor %q routing failed", actorName) - } - - // TODO(bowei) -- handle more than port 80 on the actor. - targetAddr := net.JoinHostPort(workerIP, "80") - - slog.InfoContext(ctx, "Route ok", slog.String("actor", actorName), slog.String("targetAddr", targetAddr)) - - // Route by rewriting the :authority header. - mutation := &extprocv3.HeaderMutation{} - addAuthorityMutation(targetAddr, mutation) - - return &extprocv3.HeadersResponse{ - Response: &extprocv3.CommonResponse{ - HeaderMutation: mutation, - }, - }, metadata, targetAddr, tmplNs, tmplName, nil -} - -func (s *ExtProcServer) recordRouteDuration(ctx context.Context, d time.Duration, tmplNs, tmplName, outcome string) { - if s.routeDuration == nil { - return - } - s.routeDuration.Record(ctx, d.Seconds(), metric.WithAttributes( - attribute.String("actor_template_namespace", tmplNs), - attribute.String("actor_template_name", tmplName), - attribute.String("outcome", outcome), - )) -} - -func classifyOutcome(err error) string { - switch { - case errors.Is(err, context.Canceled), errors.Is(err, context.DeadlineExceeded): - return "cancelled" - default: - var re *reqError - if errors.As(err, &re) && re.statusCode == int(envoy_type.StatusCode_NotFound) { - return "not_found" - } - return "error" - } -} diff --git a/cmd/atenet/internal/router/extproc_in.go b/cmd/atenet/internal/router/extproc_in.go deleted file mode 100644 index 5bfdb4974..000000000 --- a/cmd/atenet/internal/router/extproc_in.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "net" - "strings" - - "github.com/agent-substrate/substrate/internal/resources" - corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" -) - -type requestMetadata struct { - headers map[string]string - path string - host string -} - -func newRequestMetadata(headers []*corev3.HeaderValue) *requestMetadata { - headersMap := make(map[string]string) - var path string - var host string - - for _, h := range headers { - k := strings.ToLower(h.Key) - val := h.Value - if val == "" && len(h.RawValue) > 0 { - val = string(h.RawValue) - } - - headersMap[k] = val - if k == ":path" { - path = val - } - if k == ":authority" || k == "host" { - host = val - } - } - - return &requestMetadata{ - headers: headersMap, - path: path, - host: host, - } -} - -// parseActorRef extracts the (atespace, actor name) an incoming request is -// addressed to from its Host/:authority, which has the form -// "..actors.resources.substrate.ate.dev" (optionally with a -// port). The atespace is required because an actor name is only unique within its -// atespace. -func parseActorRef(host string) (atespace, actorName string, err error) { - if strings.Contains(host, ":") { - host, _, err = net.SplitHostPort(host) - if err != nil { - return "", "", err - } - } - return resources.ParseActorDNSName(host) -} diff --git a/cmd/atenet/internal/router/extproc_in_test.go b/cmd/atenet/internal/router/extproc_in_test.go deleted file mode 100644 index a23d47590..000000000 --- a/cmd/atenet/internal/router/extproc_in_test.go +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "reflect" - "testing" - - corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" -) - -func TestExtractMetadata(t *testing.T) { - tests := []struct { - name string - headers []*corev3.HeaderValue - wantHeaders map[string]string - wantPath string - wantHost string - }{ - { - name: "basic path and authority", - headers: []*corev3.HeaderValue{ - {Key: ":path", Value: "/api/v1/test"}, - {Key: ":authority", Value: "example.com"}, - {Key: "X-Request-ID", Value: "req-123"}, - }, - wantHeaders: map[string]string{ - ":path": "/api/v1/test", - ":authority": "example.com", - "x-request-id": "req-123", - }, - wantPath: "/api/v1/test", - wantHost: "example.com", - }, - { - name: "host header overrides empty or authority", - headers: []*corev3.HeaderValue{ - {Key: ":path", Value: "/api/v1/test"}, - {Key: ":authority", Value: "authority.com"}, - {Key: "Host", Value: "host.com"}, - }, - wantHeaders: map[string]string{ - ":path": "/api/v1/test", - ":authority": "authority.com", - "host": "host.com", - }, - wantPath: "/api/v1/test", - wantHost: "host.com", - }, - { - name: "authority header overrides host when it comes after", - headers: []*corev3.HeaderValue{ - {Key: ":path", Value: "/api/v1/test"}, - {Key: "Host", Value: "host.com"}, - {Key: ":authority", Value: "authority.com"}, - }, - wantHeaders: map[string]string{ - ":path": "/api/v1/test", - "host": "host.com", - ":authority": "authority.com", - }, - wantPath: "/api/v1/test", - wantHost: "authority.com", - }, - { - name: "no authority or host headers", - headers: []*corev3.HeaderValue{ - {Key: ":path", Value: "/api/v1/test"}, - {Key: "x-something-else", Value: "custom-value"}, - }, - wantHeaders: map[string]string{ - ":path": "/api/v1/test", - "x-something-else": "custom-value", - }, - wantPath: "/api/v1/test", - wantHost: "", - }, - { - name: "headers are lowercased", - headers: []*corev3.HeaderValue{ - {Key: "UPPER-KEY", Value: "UPPER-VALUE"}, - {Key: "camelCaseKey", Value: "camelValue"}, - }, - wantHeaders: map[string]string{ - "upper-key": "UPPER-VALUE", - "camelcasekey": "camelValue", - }, - wantPath: "", - wantHost: "", - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - got := newRequestMetadata(tc.headers) - - if !reflect.DeepEqual(got.headers, tc.wantHeaders) { - t.Errorf("extractMetadata() headersMap = %v, want %v", got.headers, tc.wantHeaders) - } - if got.path != tc.wantPath { - t.Errorf("extractMetadata() path = %v, want %v", got.path, tc.wantPath) - } - if got.host != tc.wantHost { - t.Errorf("extractMetadata() host = %v, want %v", got.host, tc.wantHost) - } - }) - } -} - -func TestParseActorRef(t *testing.T) { - tests := []struct { - name string - host string - wantAtespace string - wantID string - wantErr bool - }{ - { - name: "valid host without port", - host: "my-actor.team-a.actors.resources.substrate.ate.dev", - wantAtespace: "team-a", - wantID: "my-actor", - wantErr: false, - }, - { - name: "valid host with port", - host: "my-actor.team-a.actors.resources.substrate.ate.dev:8443", - wantAtespace: "team-a", - wantID: "my-actor", - wantErr: false, - }, - { - name: "valid host with trailing dot", - host: "my-actor.team-a.actors.resources.substrate.ate.dev.", - wantAtespace: "team-a", - wantID: "my-actor", - wantErr: false, - }, - { - name: "valid host with trailing dot and port", - host: "my-actor.team-a.actors.resources.substrate.ate.dev.:8080", - wantAtespace: "team-a", - wantID: "my-actor", - wantErr: false, - }, - { - name: "missing atespace label", - host: "my-actor.actors.resources.substrate.ate.dev", - wantErr: true, - }, - { - name: "invalid suffix", - host: "my-actor.team-a.example.com", - wantErr: true, - }, - { - name: "invalid host port format", - host: "my-actor.team-a.actors.resources.substrate.ate.dev:invalid:port", - wantErr: true, - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - gotAtespace, gotID, err := parseActorRef(tc.host) - if (err != nil) != tc.wantErr { - t.Errorf("parseActorRef(%q) error = %v, wantErr %v", tc.host, err, tc.wantErr) - return - } - if gotAtespace != tc.wantAtespace || gotID != tc.wantID { - t.Errorf("parseActorRef(%q) = (%q, %q), want (%q, %q)", tc.host, gotAtespace, gotID, tc.wantAtespace, tc.wantID) - } - }) - } -} diff --git a/cmd/atenet/internal/router/extproc_out.go b/cmd/atenet/internal/router/extproc_out.go deleted file mode 100644 index 98d21d93e..000000000 --- a/cmd/atenet/internal/router/extproc_out.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - extproc "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - envoy_type "github.com/envoyproxy/go-control-plane/envoy/type/v3" -) - -// reqError carries an HTTP-mappable status code and a client-safe message. -// The underlying cause (if any) is preserved via Unwrap so logs can inspect -// the full chain without leaking server-side detail into the response body. -type reqError struct { - msg string - cause error - statusCode int -} - -func (e *reqError) Error() string { return e.msg } -func (e *reqError) Unwrap() error { return e.cause } - -func addAuthorityMutation(auth string, mut *extproc.HeaderMutation) { - mut.SetHeaders = append(mut.SetHeaders, - &corev3.HeaderValueOption{ - Header: &corev3.HeaderValue{ - Key: ":authority", - RawValue: []byte(auth), - }, - }, - ) -} - -func immediateResponse(statusCode envoy_type.StatusCode, message string) *extproc.ProcessingResponse { - return &extproc.ProcessingResponse{ - Response: &extproc.ProcessingResponse_ImmediateResponse{ - ImmediateResponse: &extproc.ImmediateResponse{ - Status: &envoy_type.HttpStatus{ - Code: statusCode, - }, - Body: []byte(message), - Headers: &extproc.HeaderMutation{ - SetHeaders: []*corev3.HeaderValueOption{ - { - Header: &corev3.HeaderValue{ - Key: "content-type", - Value: "text/plain", - }, - }, - }, - }, - }, - }, - } -} diff --git a/cmd/atenet/internal/router/extproc_test.go b/cmd/atenet/internal/router/extproc_test.go deleted file mode 100644 index 81f97a944..000000000 --- a/cmd/atenet/internal/router/extproc_test.go +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "log/slog" - "strings" - "testing" - "time" - - "github.com/agent-substrate/substrate/pkg/proto/ateapipb" - corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - extprocv3 "github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3" - envoy_type "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type mockClient struct { - ateapipb.ControlClient - resumeFn func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) -} - -func (m *mockClient) ResumeActor(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - return m.resumeFn(ctx, in, opts...) -} - -func TestHandleRequestHeadersDoesNotLogSensitiveData(t *testing.T) { - const testUUID = "123e4567-e89b-12d3-a456-426614174000" - const secret = "do-not-log-me" - - var buf bytes.Buffer - prev := slog.Default() - slog.SetDefault(slog.New(slog.NewJSONHandler(&buf, nil))) - t.Cleanup(func() { slog.SetDefault(prev) }) - - s := NewExtProcServer(50051, &mockClient{ - resumeFn: func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - return &ateapipb.ResumeActorResponse{Actor: &ateapipb.Actor{AteomPodIp: "10.0.0.52"}}, nil - }, - }, nil) - - reqHeaders := &extprocv3.HttpHeaders{ - Headers: &corev3.HeaderMap{ - Headers: []*corev3.HeaderValue{ - {Key: ":path", Value: "/api/v1/reset?token=" + secret}, - {Key: ":authority", Value: testUUID + ".team-a.actors.resources.substrate.ate.dev"}, - {Key: ":method", Value: "POST"}, - {Key: "authorization", Value: "Bearer " + secret}, - {Key: "cookie", Value: "session=" + secret}, - }, - }, - } - - _, metadata, target, _, _, err := s.handleRequestHeaders(context.Background(), reqHeaders) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - - out := buf.String() - if strings.Contains(out, secret) { - t.Errorf("router log leaked sensitive value: %s", out) - } - if !strings.Contains(out, testUUID) { - t.Errorf("router log missing actor/host routing context: %s", out) - } - - s.recorder.AddRouterRequest(time.Now(), time.Millisecond, "Route ok", target, metadata) - for _, q := range s.recorder.Get() { - if blob, _ := json.Marshal(q); strings.Contains(string(blob), secret) { - t.Errorf("recorder/statusz retained sensitive value: %s", blob) - } - } -} - -func TestExtProcHeadersEvaluation(t *testing.T) { - const testUUID = "123e4567-e89b-12d3-a456-426614174000" - - tests := []struct { - name string - authority string - resumeResp *ateapipb.ResumeActorResponse - resumeErr error - expectErr bool - expectedErrStr string - expectedStatus envoy_type.StatusCode - expectedTarget string - }{ - { - name: "invalid host returns 404 identifying the host", - authority: "invalid-host.com", - expectErr: true, - expectedErrStr: `invalid host "invalid-host.com": invalid actor DNS name: must end with actors.resources.substrate.ate.dev, got "invalid-host.com"`, - expectedStatus: envoy_type.StatusCode_NotFound, - }, - { - name: "non-gRPC resume error collapses to 500 without leaking detail", - authority: testUUID + ".team-a.actors.resources.substrate.ate.dev", - resumeErr: errors.New("resume failed with sensitive detail"), - expectErr: true, - expectedErrStr: `error resuming actor "123e4567-e89b-12d3-a456-426614174000"`, - expectedStatus: envoy_type.StatusCode_InternalServerError, - }, - { - name: "FailedPrecondition maps to 503 with preserved desc", - authority: testUUID + ".team-a.actors.resources.substrate.ate.dev", - resumeErr: status.Error(codes.FailedPrecondition, "no free workers available"), - expectErr: true, - expectedErrStr: `actor "123e4567-e89b-12d3-a456-426614174000" unavailable: no free workers available`, - expectedStatus: envoy_type.StatusCode_ServiceUnavailable, - }, - { - name: "NotFound maps to 404", - authority: testUUID + ".team-a.actors.resources.substrate.ate.dev", - resumeErr: status.Error(codes.NotFound, "actor missing"), - expectErr: true, - expectedErrStr: `actor "123e4567-e89b-12d3-a456-426614174000" not found`, - expectedStatus: envoy_type.StatusCode_NotFound, - }, - { - name: "Unavailable maps to 503", - authority: testUUID + ".team-a.actors.resources.substrate.ate.dev", - resumeErr: status.Error(codes.Unavailable, "control-plane down"), - expectErr: true, - expectedErrStr: `actor "123e4567-e89b-12d3-a456-426614174000" unavailable`, - expectedStatus: envoy_type.StatusCode_ServiceUnavailable, - }, - { - name: "DeadlineExceeded maps to 504", - authority: testUUID + ".team-a.actors.resources.substrate.ate.dev", - resumeErr: status.Error(codes.DeadlineExceeded, "deadline"), - expectErr: true, - expectedErrStr: `actor "123e4567-e89b-12d3-a456-426614174000" request timed out`, - expectedStatus: envoy_type.StatusCode_GatewayTimeout, - }, - { - name: "Bad Actor IP from resume returns 500 without leaking IP", - authority: testUUID + ".team-a.actors.resources.substrate.ate.dev", - resumeResp: &ateapipb.ResumeActorResponse{ - Actor: &ateapipb.Actor{ - AteomPodIp: "invalid-ip", - }, - }, - expectErr: true, - expectedErrStr: `actor "123e4567-e89b-12d3-a456-426614174000" routing failed`, - expectedStatus: envoy_type.StatusCode_InternalServerError, - }, - { - name: "Successful resume", - authority: testUUID + ".team-a.actors.resources.substrate.ate.dev", - resumeResp: &ateapipb.ResumeActorResponse{ - Actor: &ateapipb.Actor{ - AteomPodIp: "10.0.0.52", - }, - }, - expectErr: false, - expectedTarget: "10.0.0.52:80", - }, - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - clientMock := &mockClient{ - resumeFn: func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - if in.GetActor().GetName() != testUUID { - t.Errorf("unexpected identifier parsed in test context: %s", in.GetActor().GetName()) - } - if tc.resumeErr != nil { - return nil, tc.resumeErr - } - return tc.resumeResp, nil - }, - } - - s := NewExtProcServer(50051, clientMock, nil) - - reqHeaders := &extprocv3.HttpHeaders{ - Headers: &corev3.HeaderMap{ - Headers: []*corev3.HeaderValue{ - {Key: ":path", Value: "/v1/actors/invoke"}, - {Key: ":authority", Value: tc.authority}, - {Key: ":method", Value: "POST"}, - }, - }, - } - - res, metadata, target, _, _, err := s.handleRequestHeaders(context.Background(), reqHeaders) - if tc.expectErr { - if err == nil { - t.Fatalf("expected error but got nil") - } - if tc.expectedErrStr != "" && err.Error() != tc.expectedErrStr { - t.Errorf("client body mismatch:\n got: %q\n want: %q", err.Error(), tc.expectedErrStr) - } - var reqErr *reqError - if !errors.As(err, &reqErr) { - t.Fatalf("expected *reqError, got %T (%v)", err, err) - } - if got, want := reqErr.statusCode, int(tc.expectedStatus); got != want { - t.Errorf("HTTP status code = %d, want %d", got, want) - } - if tc.resumeErr != nil && !errors.Is(err, tc.resumeErr) { - t.Errorf("original resume error must be preserved in chain for logs; errors.Is(err, resumeErr) = false") - } - return - } - - if err != nil { - t.Fatalf("ext_proc processing error: %v", err) - } - if target != tc.expectedTarget { - t.Errorf("expected target %q, got %q", tc.expectedTarget, target) - } - - mutation := res.Response.GetHeaderMutation() - if len(mutation.GetSetHeaders()) != 1 { - t.Fatalf("expected exactly one Header option set, found: %v", mutation.GetSetHeaders()) - } - - headerOption := mutation.GetSetHeaders()[0] - if strings.ToLower(headerOption.Header.Key) != ":authority" { - t.Errorf("invalid resulting dynamic parameter key: %s", headerOption.Header.Key) - } - - if string(headerOption.Header.RawValue) != tc.expectedTarget { - t.Errorf("invalid destination mapping found: %s, expected: %s", headerOption.Header.RawValue, tc.expectedTarget) - } - - // Confirm that query logs recorded metric trace details - s.recorder.AddRouterRequest(time.Now(), 10*time.Millisecond, "Route ok", tc.expectedTarget, metadata) - queries := s.recorder.Get() - if len(queries) != 1 { - t.Errorf("expected query trace entries, got: %v", queries) - } - }) - } -} diff --git a/cmd/atenet/internal/router/health.go b/cmd/atenet/internal/router/health.go deleted file mode 100644 index d9e1fddab..000000000 --- a/cmd/atenet/internal/router/health.go +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "fmt" - "io" - "log/slog" - "net/http" - "strings" - "sync" - "time" - - "github.com/agent-substrate/substrate/pkg/proto/ateapipb" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" - "k8s.io/client-go/kubernetes" -) - -type ComponentHealth struct { - Healthy bool `json:"healthy"` - Message string `json:"message,omitempty"` - LastSuccess time.Time `json:"last_success,omitempty"` - LastFailure time.Time `json:"last_failure,omitempty"` - SuccessCount int64 `json:"success_count"` - FailureCount int64 `json:"failure_count"` -} - -type RouterHealthReport struct { - Envoy ComponentHealth `json:"envoy"` - K8sAPI ComponentHealth `json:"k8s_api"` - AteAPI ComponentHealth `json:"ate_api"` -} - -// routerHealth periodically checks the dependent services of router to track health -// status of this component. -type routerHealth struct { - mu sync.RWMutex - - report RouterHealthReport - - interval time.Duration - clientset kubernetes.Interface - apiClient ateapipb.ControlClient - cfg RouterConfig - envoyClient *http.Client -} - -func newRouterHealth(interval time.Duration, clientset kubernetes.Interface, apiClient ateapipb.ControlClient, cfg RouterConfig) *routerHealth { - if interval <= 0 { - interval = time.Second - } - return &routerHealth{ - interval: interval, - clientset: clientset, - apiClient: apiClient, - cfg: cfg, - envoyClient: &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}, - } -} - -func (rh *routerHealth) Start(ctx context.Context) { - ticker := time.NewTicker(rh.interval) - defer ticker.Stop() - - // Trigger immediate check - rh.check(ctx) - - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - rh.check(ctx) - } - } -} - -func (rh *routerHealth) check(ctx context.Context) { - rh.mu.Lock() - defer rh.mu.Unlock() - - slog.InfoContext(ctx, "Checking health") - - // 1. Check Envoy - { - healthy, msg := rh.checkEnvoy(ctx) - if healthy { - rh.report.Envoy.Healthy = true - rh.report.Envoy.Message = msg - rh.report.Envoy.LastSuccess = time.Now() - rh.report.Envoy.SuccessCount++ - } else { - rh.report.Envoy.Healthy = false - rh.report.Envoy.Message = msg - rh.report.Envoy.LastFailure = time.Now() - rh.report.Envoy.FailureCount++ - slog.ErrorContext(ctx, "Envoy health check failed", slog.String("msg", msg)) - } - } - - // 2. Check Kubernetes API - { - healthy, msg := rh.checkK8s() - if healthy { - rh.report.K8sAPI.Healthy = true - rh.report.K8sAPI.Message = msg - rh.report.K8sAPI.LastSuccess = time.Now() - rh.report.K8sAPI.SuccessCount++ - } else { - rh.report.K8sAPI.Healthy = false - rh.report.K8sAPI.Message = msg - rh.report.K8sAPI.LastFailure = time.Now() - rh.report.K8sAPI.FailureCount++ - slog.ErrorContext(ctx, "Kubernetes API health check failed", slog.String("msg", msg)) - } - } - - // 3. Check ATE API gRPC - { - healthy, msg := rh.checkAteAPI(ctx) - if healthy { - rh.report.AteAPI.Healthy = true - rh.report.AteAPI.Message = msg - rh.report.AteAPI.LastSuccess = time.Now() - rh.report.AteAPI.SuccessCount++ - } else { - rh.report.AteAPI.Healthy = false - rh.report.AteAPI.Message = msg - rh.report.AteAPI.LastFailure = time.Now() - rh.report.AteAPI.FailureCount++ - slog.ErrorContext(ctx, "ATE API gRPC health check failed", slog.String("msg", msg)) - } - } -} - -func (rh *routerHealth) checkEnvoy(ctx context.Context) (bool, string) { - timeoutCtx, cancel := context.WithTimeout(ctx, 500*time.Millisecond) - defer cancel() - - req, err := http.NewRequestWithContext(timeoutCtx, "GET", "http://127.0.0.1:9901/ready", nil) - if err != nil { - return false, err.Error() - } - - resp, err := rh.envoyClient.Do(req) - if err != nil { - return false, err.Error() - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return false, fmt.Sprintf("unexpected status code %d", resp.StatusCode) - } - - bodyBytes, err := io.ReadAll(resp.Body) - if err != nil { - return false, err.Error() - } - - bodyStr := strings.TrimSpace(string(bodyBytes)) - if bodyStr != "LIVE" { - return false, fmt.Sprintf("expected LIVE but got %q", bodyStr) - } - - return true, "LIVE" -} - -func (rh *routerHealth) checkK8s() (bool, string) { - if rh.clientset == nil { - return true, "Skipped (standalone/file store)" - } - - ver, err := rh.clientset.Discovery().ServerVersion() - if err != nil { - return false, err.Error() - } - - return true, fmt.Sprintf("Version: %s", ver.GitVersion) -} - -func (rh *routerHealth) checkAteAPI(ctx context.Context) (bool, string) { - if rh.apiClient == nil { - return false, "No client" - } - - timeoutCtx, cancel := context.WithTimeout(ctx, 500*time.Millisecond) - defer cancel() - - _, err := rh.apiClient.ListActors(timeoutCtx, &ateapipb.ListActorsRequest{PageSize: 1}) - if err != nil { - return false, err.Error() - } - - return true, "Connected" -} - -func (rh *routerHealth) Report() RouterHealthReport { - if rh == nil { - return RouterHealthReport{} - } - rh.mu.RLock() - defer rh.mu.RUnlock() - return rh.report -} diff --git a/cmd/atenet/internal/router/metrics.go b/cmd/atenet/internal/router/metrics.go deleted file mode 100644 index 7da38807c..000000000 --- a/cmd/atenet/internal/router/metrics.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "fmt" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/metric" -) - -const ( - routerServiceName = "atenet-router" - - // atenet.router.route.duration measures the latency from when the ext_proc handler receives a request - // (Envoy -> EPP) until the target worker endpoint is resolved - routeDurationMetricName = "atenet.router.route.duration" -) - -// newRouteDurationHistogram creates the atenet.router.route.duration histogram from -// the global MeterProvider. -func newRouteDurationHistogram() (metric.Float64Histogram, error) { - h, err := otel.Meter(routerServiceName).Float64Histogram( - routeDurationMetricName, - metric.WithUnit("s"), - metric.WithDescription( - "latency between Substrate router receiving a request and resolving "+ - "the target worker endpoint, excluding actor execution and response", - ), - metric.WithExplicitBucketBoundaries( - 0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, - 0.075, 0.1, 0.15, 0.2, 0.25, 0.5, 1, 2.5, 5, 10, 15, 30, - ), - ) - if err != nil { - return nil, fmt.Errorf("create %s histogram: %w", routeDurationMetricName, err) - } - return h, nil -} diff --git a/cmd/atenet/internal/router/resumer.go b/cmd/atenet/internal/router/resumer.go deleted file mode 100644 index db2231c06..000000000 --- a/cmd/atenet/internal/router/resumer.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "time" - - "github.com/agent-substrate/substrate/pkg/proto/ateapipb" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/trace" - "golang.org/x/sync/singleflight" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "k8s.io/apimachinery/pkg/util/wait" -) - -// ActorResumer coordinates safe, deduplicated resumption of actors. -type ActorResumer struct { - apiClient ateapipb.ControlClient - flight singleflight.Group -} - -func NewActorResumer(apiClient ateapipb.ControlClient) *ActorResumer { - return &ActorResumer{ - apiClient: apiClient, - } -} - -// ResumeActor ensures the requested actor is running. It deduplicates concurrent -// requests within the process and retries when needed. The actor is addressed by -// (atespace, actorName) since an actor name is only unique within its atespace. -func (r *ActorResumer) ResumeActor(ctx context.Context, atespace, actorName string) (*ateapipb.Actor, error) { - ctx, span := otel.Tracer(routerServiceName).Start(ctx, "ResumeActor", - trace.WithAttributes( - attribute.String("atespace", atespace), - attribute.String("actor", actorName), - )) - defer span.End() - - ch := r.flight.DoChan(atespace+"/"+actorName, func() (interface{}, error) { - // We detach the context from the first caller using a fixed background timeout. - // This guarantees that if Caller 1 disconnects or times out, the underlying - // resume operation continues running for Caller 2 and Caller 3 without failing. - bgCtx, bgCancel := context.WithTimeout(context.Background(), 15*time.Second) - defer bgCancel() - - backoff := wait.Backoff{ - Steps: 7, - Duration: 200 * time.Millisecond, - Factor: 1.5, - Jitter: 0.2, - } - - var resumeResp *ateapipb.ResumeActorResponse - - err := wait.ExponentialBackoffWithContext(bgCtx, backoff, func(ctx context.Context) (bool, error) { - var err error - resumeResp, err = r.apiClient.ResumeActor(ctx, &ateapipb.ResumeActorRequest{ - Actor: &ateapipb.ObjectRef{Atespace: atespace, Name: actorName}, - }) - if err == nil { - return true, nil - } - - if status.Code(err) == codes.Aborted { - return false, nil // Concurrent resume call, retry. - } - // Other gRPC errors (NotFound, FailedPrecondition, Unavailable, - // DeadlineExceeded, ...) are returned to the caller unchanged so - // the HTTP boundary can map them with full fidelity. - return false, err - }) - - if err != nil { - return nil, err - } - - return resumeResp.GetActor(), nil - }) - - select { - case <-ctx.Done(): - return nil, ctx.Err() - case res := <-ch: - if res.Err != nil { - return nil, res.Err - } - return res.Val.(*ateapipb.Actor), nil - } -} diff --git a/cmd/atenet/internal/router/resumer_test.go b/cmd/atenet/internal/router/resumer_test.go deleted file mode 100644 index 149db9b0d..000000000 --- a/cmd/atenet/internal/router/resumer_test.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "sync" - "testing" - "time" - - "github.com/agent-substrate/substrate/pkg/proto/ateapipb" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type resumerMockClient struct { - ateapipb.ControlClient - resumeFn func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) -} - -func (m *resumerMockClient) ResumeActor(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - if m.resumeFn != nil { - return m.resumeFn(ctx, in, opts...) - } - return nil, status.Error(codes.Unimplemented, "unimplemented") -} - -func TestActorResumer_ResumeActor(t *testing.T) { - const testActorName = "actor-a" - const testAtespace = "team-a" - const expectedIP = "10.0.0.52" - - t.Run("SuspendedResumedSuccessfully", func(t *testing.T) { - var resumeCalled int - mock := &resumerMockClient{ - resumeFn: func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - resumeCalled++ - return &ateapipb.ResumeActorResponse{ - Actor: &ateapipb.Actor{ - Metadata: &ateapipb.ResourceMetadata{Name: testActorName}, - Status: ateapipb.Actor_STATUS_RUNNING, - AteomPodIp: expectedIP, - }, - }, nil - }, - } - - resumer := NewActorResumer(mock) - actor, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if actor.GetAteomPodIp() != expectedIP { - t.Errorf("expected IP %q, got %q", expectedIP, actor.GetAteomPodIp()) - } - if resumeCalled != 1 { - t.Errorf("expected ResumeActor called 1 time, got %d", resumeCalled) - } - }) - - t.Run("RetryOnAbortedConflict", func(t *testing.T) { - var resumeCalled int - mock := &resumerMockClient{ - resumeFn: func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - resumeCalled++ - if resumeCalled < 3 { - return nil, status.Error(codes.Aborted, "concurrent update conflict") - } - return &ateapipb.ResumeActorResponse{ - Actor: &ateapipb.Actor{ - Metadata: &ateapipb.ResourceMetadata{Name: testActorName}, - Status: ateapipb.Actor_STATUS_RUNNING, - AteomPodIp: expectedIP, - }, - }, nil - }, - } - - resumer := NewActorResumer(mock) - actor, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName) - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if actor.GetAteomPodIp() != expectedIP { - t.Errorf("expected IP %q, got %q", expectedIP, actor.GetAteomPodIp()) - } - if resumeCalled != 3 { - t.Errorf("expected ResumeActor called 3 times, got %d", resumeCalled) - } - }) - - t.Run("ActorNotFound", func(t *testing.T) { - mock := &resumerMockClient{ - resumeFn: func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - return nil, status.Error(codes.NotFound, "not found") - }, - } - - resumer := NewActorResumer(mock) - _, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName) - if got := status.Code(err); got != codes.NotFound { - t.Errorf("expected gRPC code NotFound, got %v (err=%v)", got, err) - } - }) - - t.Run("SingleflightDeduplication", func(t *testing.T) { - var resumeCalled int - var mu sync.Mutex - - mock := &resumerMockClient{ - resumeFn: func(ctx context.Context, in *ateapipb.ResumeActorRequest, opts ...grpc.CallOption) (*ateapipb.ResumeActorResponse, error) { - mu.Lock() - resumeCalled++ - mu.Unlock() - time.Sleep(20 * time.Millisecond) - return &ateapipb.ResumeActorResponse{ - Actor: &ateapipb.Actor{ - Metadata: &ateapipb.ResourceMetadata{Name: testActorName}, - Status: ateapipb.Actor_STATUS_RUNNING, - AteomPodIp: expectedIP, - }, - }, nil - }, - } - - resumer := NewActorResumer(mock) - - var wg sync.WaitGroup - const concurrentRequests = 10 - results := make([]*ateapipb.Actor, concurrentRequests) - errs := make([]error, concurrentRequests) - - wg.Add(concurrentRequests) - for i := 0; i < concurrentRequests; i++ { - go func(idx int) { - defer wg.Done() - results[idx], errs[idx] = resumer.ResumeActor(context.Background(), testAtespace, testActorName) - }(i) - } - wg.Wait() - - for i := 0; i < concurrentRequests; i++ { - if errs[i] != nil { - t.Fatalf("request %d failed: %v", i, errs[i]) - } - if results[i].GetAteomPodIp() != expectedIP { - t.Errorf("request %d expected IP %q, got %q", i, expectedIP, results[i].GetAteomPodIp()) - } - } - - mu.Lock() - defer mu.Unlock() - if resumeCalled != 1 { - t.Errorf("expected ResumeActor called exactly once by singleflight, got %d", resumeCalled) - } - }) -} diff --git a/cmd/atenet/internal/router/router.go b/cmd/atenet/internal/router/router.go deleted file mode 100644 index 7ed77df73..000000000 --- a/cmd/atenet/internal/router/router.go +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "errors" - "fmt" - "log/slog" - "math/big" - "net" - "net/http" - "os" - "os/signal" - "strings" - "syscall" - "time" - - "github.com/spf13/cobra" - "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - "golang.org/x/sync/errgroup" - "google.golang.org/grpc" - "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/client-go/kubernetes" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - "k8s.io/client-go/tools/clientcmd" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/config" - - "github.com/agent-substrate/substrate/internal/ateapiauth" - "github.com/agent-substrate/substrate/internal/serverboot" - v1alpha1 "github.com/agent-substrate/substrate/pkg/api/v1alpha1" - "github.com/agent-substrate/substrate/pkg/proto/ateapipb" -) - -var ( - scheme = runtime.NewScheme() -) - -func init() { - utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(v1alpha1.AddToScheme(scheme)) -} - -// RouterConfig holds deployment setup and endpoint options for the router node instance. -type RouterConfig struct { - Standalone bool - Namespace string - Kubeconfig string - AteapiAddr string - HttpPort int - XdsPort int - ExtprocPort int - ExtprocAddr string - EnvoyImage string - TemplatesFile string - StatusPort int - HealthInterval time.Duration - HttpsPort int - EnvoyCertPath string - LogLevel string - MetricsAddr string - // OtlpCollectorAddress is the host:port of the OTLP gRPC collector that - // Envoy reports tracing spans to. Empty disables Envoy-side tracing. - OtlpCollectorAddress string - - AteapiAuthMode string - AteapiCAFile string - AteapiServerName string - AteapiTokenFile string -} - -// RouterServer instantiates and coordinates runtime threads executing system modules. -type RouterServer struct { - cfg RouterConfig - - Cmd *cobra.Command - k8sClient client.Client - clientset kubernetes.Interface - apiClient ateapipb.ControlClient - extprocSrv *ExtProcServer - health *routerHealth - atStore atStore -} - -func NewRouterServer(cfg RouterConfig) (*RouterServer, error) { - var k8sClient client.Client - var clientset kubernetes.Interface - - if cfg.TemplatesFile == "" { - k8sCfg, err := config.GetConfig() - if err != nil { - if cfg.Kubeconfig != "" { - k8sCfg, err = clientcmd.BuildConfigFromFlags("", cfg.Kubeconfig) - if err != nil { - return nil, fmt.Errorf("failed to read config from path %s: %w", cfg.Kubeconfig, err) - } - } else { - return nil, fmt.Errorf("unable to establish Kubernetes configuration parameters: %w", err) - } - } - slog.Info("Connecting to Kubernetes API server", slog.String("host", k8sCfg.Host)) - - k8sClient, err = client.New(k8sCfg, client.Options{ - Scheme: scheme, - }) - if err != nil { - return nil, fmt.Errorf("failed to initialize cluster client: %w", err) - } - - clientset, err = kubernetes.NewForConfig(k8sCfg) - if err != nil { - return nil, fmt.Errorf("failed to initialize core client: %w", err) - } - } - - var store atStore - if cfg.TemplatesFile != "" { - store = newFileATStore(cfg.TemplatesFile) - } else { - store = newk8sATStore(k8sClient) - } - - return &RouterServer{ - cfg: cfg, - k8sClient: k8sClient, - clientset: clientset, - atStore: store, - }, nil -} - -func (s *RouterServer) Run(ctx context.Context) error { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - sigChan := make(chan os.Signal, 1) - signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) - go func() { - <-sigChan - cancel() - }() - - var level slog.Level - switch strings.ToLower(s.cfg.LogLevel) { - case "debug": - level = slog.LevelDebug - case "warn": - level = slog.LevelWarn - case "error": - level = slog.LevelError - default: - level = slog.LevelInfo - } - slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: level}))) - - // Tracing must be initialized before constructing the ateapi gRPC client - // below, because otelgrpc.NewClientHandler captures the global - // TracerProvider at construction time. - tp, err := serverboot.InitTracing(ctx, serverboot.TracingOptions{ - ServiceName: routerServiceName, - Sampler: sdktrace.ParentBased(sdktrace.NeverSample()), - }) - if err != nil { - return fmt.Errorf("failed to initialize tracing: %w", err) - } - defer serverboot.ShutdownProvider("TracerProvider", tp.Shutdown) - - mp, err := serverboot.InitMetrics(ctx, routerServiceName) - if err != nil { - return fmt.Errorf("failed to initialize metrics: %w", err) - } - defer serverboot.ShutdownProvider("MeterProvider", mp.Shutdown) - - go serverboot.StartMetricsServer(ctx, serverboot.MetricsServerOptions{Addr: s.cfg.MetricsAddr}) - - authMode, err := ateapiauth.ParseMode(s.cfg.AteapiAuthMode) - if err != nil { - return fmt.Errorf("invalid --ateapi-auth: %w", err) - } - dialOpts, err := ateapiauth.DialOptions(ateapiauth.ClientConfig{ - Mode: authMode, - CAFile: s.cfg.AteapiCAFile, - ServerName: s.cfg.AteapiServerName, - TokenFile: s.cfg.AteapiTokenFile, - }) - if err != nil { - return fmt.Errorf("building ateapi dial options: %w", err) - } - dialOpts = append(dialOpts, grpc.WithStatsHandler(otelgrpc.NewClientHandler())) - conn, err := grpc.NewClient( - s.cfg.AteapiAddr, - dialOpts..., - ) - if err != nil { - return fmt.Errorf("failed to establish grpc channel to ateapi client: %w", err) - } - slog.InfoContext(ctx, "Connecting to ateapi", slog.String("address", s.cfg.AteapiAddr), slog.String("auth", string(authMode))) - s.apiClient = ateapipb.NewControlClient(conn) - - slog.InfoContext(ctx, "Starting substrate router subsystem", slog.Bool("standalone", s.cfg.Standalone)) - - g, ctx := errgroup.WithContext(ctx) - - xdsSrv := NewXdsServer(s.cfg.XdsPort) - xdsSrv.SetConfig(s.cfg.HttpPort, s.cfg.ExtprocPort, s.cfg.ExtprocAddr) - if err := xdsSrv.SetOtlpCollector(s.cfg.OtlpCollectorAddress); err != nil { - return fmt.Errorf("configure OTLP collector: %w", err) - } - - var certContent, keyContent string - if s.cfg.EnvoyCertPath == "" { - slog.InfoContext(ctx, "No Envoy certificate path provided, generating self-signed certificate for testing") - var err error - certContent, keyContent, err = generateSelfSignedCert() - if err != nil { - return fmt.Errorf("failed to generate self-signed cert: %w", err) - } - } - - xdsSrv.SetTlsConfig(s.cfg.HttpsPort, s.cfg.EnvoyCertPath, certContent, keyContent) - if s.extprocSrv == nil { - routeDuration, err := newRouteDurationHistogram() - if err != nil { - return fmt.Errorf("failed to create route-duration histogram: %w", err) - } - s.extprocSrv = NewExtProcServer(s.cfg.ExtprocPort, s.apiClient, routeDuration) - } - ctrl := NewController(s.k8sClient, s.clientset, s.cfg, xdsSrv, s.extprocSrv) - - s.health = newRouterHealth(s.cfg.HealthInterval, s.clientset, s.apiClient, s.cfg) - - // Start Controller / Watcher - g.Go(func() error { - slog.InfoContext(ctx, "Starting ActorTemplate controller") - return ctrl.Start(ctx) - }) - - // Start periodic service checking logic - g.Go(func() error { - slog.InfoContext(ctx, "Starting periodic health checker", slog.Duration("interval", s.cfg.HealthInterval)) - s.health.Start(ctx) - return nil - }) - - // Start xDS Server - g.Go(func() error { - slog.InfoContext(ctx, "Starting Envoy xDS Server", slog.Int("port", s.cfg.XdsPort)) - lis, err := net.Listen("tcp", fmt.Sprintf(":%d", s.cfg.XdsPort)) - if err != nil { - return fmt.Errorf("failed to listen on port %d: %w", s.cfg.XdsPort, err) - } - defer lis.Close() - - return xdsSrv.Serve(ctx, lis) - }) - - // Start ExtProc Server - g.Go(func() error { - slog.InfoContext(ctx, "Starting ExtProc Server", slog.Int("port", s.cfg.ExtprocPort)) - lis, err := net.Listen("tcp", fmt.Sprintf(":%d", s.cfg.ExtprocPort)) - if err != nil { - return fmt.Errorf("failed to listen on extproc port %d: %w", s.cfg.ExtprocPort, err) - } - defer lis.Close() - - return s.extprocSrv.Serve(ctx, lis) - }) - - // Start HTTP status endpoint - if s.cfg.StatusPort > 0 { - listener, err := net.Listen("tcp", fmt.Sprintf(":%d", s.cfg.StatusPort)) - if err != nil { - return fmt.Errorf("failed binding Router HTTP status server port: %w", err) - } - - mux := http.NewServeMux() - mux.HandleFunc("/statusz", s.handleStatusz) - - httpServer := &http.Server{ - Handler: otelhttp.NewHandler(mux, "/"), - } - - g.Go(func() error { - go func() { - if err := httpServer.Serve(listener); err != nil && !errors.Is(err, http.ErrServerClosed) { - slog.ErrorContext(ctx, "status HTTP server exited unexpectedly", slog.Any("err", err)) - } - }() - <-ctx.Done() - return httpServer.Close() - }) - } - - return g.Wait() -} - -func generateSelfSignedCert() (string, string, error) { - priv, err := rsa.GenerateKey(rand.Reader, 2048) - if err != nil { - return "", "", err - } - - template := x509.Certificate{ - SerialNumber: big.NewInt(1), - Subject: pkix.Name{ - Organization: []string{"Substrate Local Test"}, - }, - NotBefore: time.Now(), - NotAfter: time.Now().Add(time.Hour * 24 * 365), - - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - DNSNames: []string{"localhost"}, - } - - derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv) - if err != nil { - return "", "", err - } - - certPem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) - - privBytes, err := x509.MarshalPKCS8PrivateKey(priv) - if err != nil { - return "", "", err - } - keyPem := pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}) - - return string(certPem), string(keyPem), nil -} diff --git a/cmd/atenet/internal/router/status.go b/cmd/atenet/internal/router/status.go deleted file mode 100644 index eab4c8183..000000000 --- a/cmd/atenet/internal/router/status.go +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - _ "embed" - "encoding/json" - "fmt" - "html/template" - "log/slog" - "net/http" - "os" - "runtime/debug" - "strings" - "sync" - "time" - - "github.com/spf13/pflag" - "go.opentelemetry.io/otel" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var BuildTag = "dev" - -type RecordedQuery struct { - Timestamp time.Time `json:"timestamp"` - Client string `json:"client"` - Host string `json:"host"` - Path string `json:"path"` - Method string `json:"method"` - Action string `json:"action"` - Target string `json:"target"` - Duration time.Duration `json:"duration"` -} - -type QueryRecorder struct { - mu sync.RWMutex - queries []RecordedQuery - size int - index int -} - -func NewQueryRecorder(size int) *QueryRecorder { - return &QueryRecorder{ - queries: make([]RecordedQuery, 0, size), - size: size, - } -} - -func (qr *QueryRecorder) Add(q RecordedQuery) { - if qr == nil { - return - } - - qr.mu.Lock() - defer qr.mu.Unlock() - - if len(qr.queries) < qr.size { - qr.queries = append(qr.queries, q) - } else { - qr.queries[qr.index] = q - qr.index = (qr.index + 1) % qr.size - } -} - -func (qr *QueryRecorder) Get() []RecordedQuery { - if qr == nil { - return nil - } - - qr.mu.RLock() - defer qr.mu.RUnlock() - - n := len(qr.queries) - if n == 0 { - return nil - } - - res := make([]RecordedQuery, n) - if n < qr.size { - for i := 0; i < n; i++ { - res[i] = qr.queries[n-1-i] - } - } else { - for i := 0; i < n; i++ { - pos := (qr.index - 1 - i + n) % n - res[i] = qr.queries[pos] - } - } - - return res -} - -// redactPath drops the query string, which may carry credentials (CWE-598). -func redactPath(path string) string { - p, _, _ := strings.Cut(path, "?") - return p -} - -func (qr *QueryRecorder) AddRouterRequest( - start time.Time, - duration time.Duration, - action, - target string, - m *requestMetadata, -) { - qr.Add(RecordedQuery{ - Timestamp: start, - Client: m.headers[":authority"], - Host: m.host, - Path: redactPath(m.path), - Method: m.headers[":method"], - Action: action, - Target: target, - Duration: duration, - }) -} - -type TemplateInfo struct { - Name string `json:"name"` - Namespace string `json:"namespace"` -} - -type DashboardContext struct { - BuildTag string `json:"build_tag"` - RouterClusterIP string `json:"router_cluster_ip"` - Namespace string `json:"namespace"` - HttpPort int `json:"port_http"` - XdsPort int `json:"port_xds"` - ExtprocPort int `json:"port_extproc"` - StatusPort int `json:"status_port"` - Args string `json:"args"` - Flags map[string]string `json:"flags"` - Queries []FormattedQuery `json:"queries"` - Health RouterHealthReport `json:"health"` - Templates []TemplateInfo `json:"templates"` -} - -type FormattedQuery struct { - Timestamp string `json:"timestamp"` - Client string `json:"client"` - Host string `json:"host"` - Path string `json:"path"` - Method string `json:"method"` - Action string `json:"action"` - Target string `json:"target"` - Duration string `json:"duration"` -} - -func (s *RouterServer) getRouterIP(ctx context.Context) string { - if s.cfg.Standalone || s.clientset == nil { - return "Standalone Mode (No Cluster IP)" - } - - svc, err := s.clientset.CoreV1().Services(s.cfg.Namespace).Get(ctx, "atenet-router", metav1.GetOptions{}) - if err != nil { - return fmt.Sprintf("Lookup Failed: %v", err) - } - - if svc.Spec.ClusterIP == "" || svc.Spec.ClusterIP == "None" { - return "ClusterIP Unassigned" - } - - return svc.Spec.ClusterIP -} - -func (s *RouterServer) handleStatusz(w http.ResponseWriter, req *http.Request) { - ctx, span := otel.Tracer(routerServiceName).Start(req.Context(), "handleStatusz") - defer span.End() - - ctx, cancel := context.WithTimeout(ctx, 3*time.Second) - defer cancel() - - routerIP := s.getRouterIP(ctx) - - buildInfo := BuildTag - if info, ok := debug.ReadBuildInfo(); ok { - for _, setting := range info.Settings { - if setting.Key == "vcs.revision" { - buildInfo += fmt.Sprintf(" (rev: %s)", setting.Value) - } - } - } - - argsStr := strings.Join(os.Args, " ") - - flagsMap := make(map[string]string) - if s.Cmd != nil { - s.Cmd.Flags().VisitAll(func(f *pflag.Flag) { - flagsMap[f.Name] = f.Value.String() - }) - } - - var rawQueries []RecordedQuery - if s.extprocSrv != nil && s.extprocSrv.recorder != nil { - rawQueries = s.extprocSrv.recorder.Get() - } - - formattedQueries := make([]FormattedQuery, len(rawQueries)) - for i, q := range rawQueries { - formattedQueries[i] = FormattedQuery{ - Timestamp: q.Timestamp.Format(time.RFC3339), - Client: q.Client, - Host: q.Host, - Path: q.Path, - Method: q.Method, - Action: q.Action, - Target: q.Target, - Duration: fmt.Sprintf("%.2f ms", float64(q.Duration.Microseconds())/1000), - } - } - - var hr RouterHealthReport - if s.health != nil { - hr = s.health.Report() - } - - var templateInfos []TemplateInfo - if s.atStore != nil { - templates, err := s.atStore.readyTemplates(ctx) - if err != nil { - slog.ErrorContext(ctx, "Failed to get ActorTemplates for status", slog.String("err", err.Error())) - } else { - templateInfos = make([]TemplateInfo, len(templates)) - for i, t := range templates { - templateInfos[i] = TemplateInfo{ - Name: t.Name, - Namespace: t.Namespace, - } - } - } - } - - data := DashboardContext{ - BuildTag: buildInfo, - RouterClusterIP: routerIP, - Namespace: s.cfg.Namespace, - HttpPort: s.cfg.HttpPort, - XdsPort: s.cfg.XdsPort, - ExtprocPort: s.cfg.ExtprocPort, - StatusPort: s.cfg.StatusPort, - Args: argsStr, - Flags: flagsMap, - Queries: formattedQueries, - Health: hr, - Templates: templateInfos, - } - - accept := req.Header.Get("Accept") - formatParam := req.URL.Query().Get("format") - - if strings.Contains(accept, "application/json") || formatParam == "json" { - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - _ = json.NewEncoder(w).Encode(data) - return - } - - w.Header().Set("Content-Type", "text/html; charset=utf-8") - tmpl, err := template.New("dashboard").Parse(dashboardHTML) - if err != nil { - http.Error(w, fmt.Sprintf("Template parsing failed: %v", err), http.StatusInternalServerError) - return - } - - w.WriteHeader(http.StatusOK) - _ = tmpl.Execute(w, data) -} - -//go:embed dashboard.html -var dashboardHTML string diff --git a/cmd/atenet/internal/router/status_test.go b/cmd/atenet/internal/router/status_test.go deleted file mode 100644 index a72011848..000000000 --- a/cmd/atenet/internal/router/status_test.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "encoding/json" - "fmt" - "io" - "net" - "net/http" - "os" - "strings" - "testing" - "time" -) - -func TestStatuszEndpoint(t *testing.T) { - dnsAddr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("Failed determining dynamic port: %v", err) - } - l1, err := net.ListenTCP("tcp", dnsAddr) - if err != nil { - t.Fatalf("Failed creating listener: %v", err) - } - httpPort := l1.Addr().(*net.TCPAddr).Port - l1.Close() - - // Pre-configure local yaml mockup - tmpFile, err := os.CreateTemp("", "templates-*.yaml") - if err != nil { - t.Fatalf("Unable creating temp files: %v", err) - } - defer os.Remove(tmpFile.Name()) - tmpFile.Close() - - cfg := RouterConfig{ - Standalone: true, - Namespace: "default", - StatusPort: httpPort, - HttpPort: 8080, - XdsPort: 18000, - ExtprocPort: 50051, - TemplatesFile: tmpFile.Name(), - MetricsAddr: "127.0.0.1:0", - AteapiCAFile: "unused-in-mtls-mode", - } - - srv, err := NewRouterServer(cfg) - if err != nil { - t.Fatalf("Failed generating router server: %v", err) - } - - srv.extprocSrv = NewExtProcServer(cfg.ExtprocPort, &mockClient{}, nil) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Inject recorded queries - srv.extprocSrv.recorder.Add(RecordedQuery{ - Timestamp: time.Now(), - Client: "127.0.0.1", - Host: "example.com", - Path: "/v1/test", - Method: "GET", - Action: "Matched test-actor", - Target: "10.0.0.5", - Duration: time.Millisecond * 10, - }) - - statusReady := make(chan struct{}) - go func() { - close(statusReady) - if runErr := srv.Run(ctx); runErr != nil && !strings.Contains(runErr.Error(), "context canceled") { - t.Logf("status server Run returned unexpected error: %v", runErr) - } - }() - - <-statusReady - - statuszUrl := fmt.Sprintf("http://127.0.0.1:%d/statusz", httpPort) - - var resp *http.Response - var getErr error - for i := 0; i < 20; i++ { - resp, getErr = http.Get(statuszUrl) - if getErr == nil { - break - } - time.Sleep(100 * time.Millisecond) - } - if getErr != nil { - t.Fatalf("Failed retrieving status request output details after retries: %v", getErr) - } - defer resp.Body.Close() - - htmlBytes, err := io.ReadAll(resp.Body) - if err != nil { - t.Fatalf("Status details parsing operation error: %v", err) - } - content := string(htmlBytes) - - if !strings.Contains(content, "atenet Router Status") { - t.Errorf("Status content missing expected header") - } - - if !strings.Contains(content, "Matched test-actor") { - t.Errorf("Recorded processed activities trace text is missing from HTML response output") - } - - // Verify format=json serialization integration checks - jsonUrl := fmt.Sprintf("%s?format=json", statuszUrl) - jsonResp, err := http.Get(jsonUrl) - if err != nil { - t.Fatalf("JSON format endpoint call resulted in error: %v", err) - } - defer jsonResp.Body.Close() - - var dashboard DashboardContext - if err := json.NewDecoder(jsonResp.Body).Decode(&dashboard); err != nil { - t.Fatalf("JSON decoding task completed in failure: %v", err) - } - - if len(dashboard.Queries) != 1 { - t.Errorf("Missing operations telemetry data elements inside raw serialized response json outputs") - } - - if dashboard.Queries[0].Target != "10.0.0.5" { - t.Errorf("Target parameters unassigned inside context payload context properties: found %s", dashboard.Queries[0].Target) - } -} diff --git a/cmd/atenet/internal/router/xds.go b/cmd/atenet/internal/router/xds.go deleted file mode 100644 index e7e1602a9..000000000 --- a/cmd/atenet/internal/router/xds.go +++ /dev/null @@ -1,606 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "fmt" - "log/slog" - "net" - "strconv" - "sync" - "time" - - "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "google.golang.org/grpc" - "google.golang.org/protobuf/types/known/anypb" - "google.golang.org/protobuf/types/known/durationpb" - "google.golang.org/protobuf/types/known/wrapperspb" - - accesslogv3 "github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3" - clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - mutationrulesv3 "github.com/envoyproxy/go-control-plane/envoy/config/common/mutation_rules/v3" - corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - endpointv3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" - listenerv3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" - routev3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" - tracev3 "github.com/envoyproxy/go-control-plane/envoy/config/trace/v3" - streamaccesslogv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3" - dfpclusterv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3" - dfpcommonv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3" - dfpv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3" - extprocv3filter "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3" - routerv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/router/v3" - hcmv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" - getaddrinfov3 "github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3" - tlsv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" - httpv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3" - clustergrpc "github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3" - discoverygrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - endpointgrpc "github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3" - listenergrpc "github.com/envoyproxy/go-control-plane/envoy/service/listener/v3" - routegrpc "github.com/envoyproxy/go-control-plane/envoy/service/route/v3" - typev3 "github.com/envoyproxy/go-control-plane/envoy/type/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - cachev3 "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - resourcev3 "github.com/envoyproxy/go-control-plane/pkg/resource/v3" - serverv3 "github.com/envoyproxy/go-control-plane/pkg/server/v3" -) - -const ( - NodeID = "substrate-envoy-node" - IngressHTTPListener = "ingress_http_listener" - IngressHTTPSListener = "ingress_https_listener" - RouteName = "substrate_routes" - ClusterName = "ate-cluster" - OtlpClusterName = "otel_collector_cluster" -) - -// XdsServer implements an aggregated discovery service server for dynamic Envoy router nodes. -type XdsServer struct { - xdsPort int - extprocPort int - extprocAddr string - ingressPort int - snapshot cachev3.SnapshotCache - srv serverv3.Server - versionCount int64 - - mu sync.Mutex - - httpsPort int - certPath string - certContent string - keyContent string - - otlpHost string - otlpPort uint32 -} - -func NewXdsServer(xdsPort int) *XdsServer { - cache := cachev3.NewSnapshotCache(true, cachev3.IDHash{}, nil) - srv := serverv3.NewServer(context.Background(), cache, nil) - - return &XdsServer{ - xdsPort: xdsPort, - snapshot: cache, - srv: srv, - extprocPort: 50051, // matches default extproc port - extprocAddr: "127.0.0.1", - ingressPort: 8080, - } -} - -func (x *XdsServer) SetConfig(ingressPort int, extprocPort int, extprocAddr string) { - x.mu.Lock() - defer x.mu.Unlock() - x.ingressPort = ingressPort - x.extprocPort = extprocPort - x.extprocAddr = extprocAddr -} - -func (x *XdsServer) SetTlsConfig(httpsPort int, certPath string, certContent string, keyContent string) { - x.mu.Lock() - defer x.mu.Unlock() - x.httpsPort = httpsPort - x.certPath = certPath - x.certContent = certContent - x.keyContent = keyContent -} - -// SetOtlpCollector enables Envoy-side tracing pointed at the OTLP gRPC -// collector at host:port. addr empty disables tracing. port defaults to -// 4317 if omitted. -func (x *XdsServer) SetOtlpCollector(addr string) error { - x.mu.Lock() - defer x.mu.Unlock() - if addr == "" { - x.otlpHost = "" - x.otlpPort = 0 - return nil - } - host, portStr, err := net.SplitHostPort(addr) - if err != nil { - host = addr - portStr = "4317" - } - port, err := strconv.ParseUint(portStr, 10, 32) - if err != nil { - return fmt.Errorf("parse OTLP collector port from %q: %w", addr, err) - } - x.otlpHost = host - x.otlpPort = uint32(port) - return nil -} - -func (x *XdsServer) UpdateSnapshot() error { - x.mu.Lock() - defer x.mu.Unlock() - - x.versionCount++ - ver := strconv.FormatInt(x.versionCount, 10) - - // Clusters - clusters := []types.Resource{ - x.buildCluster(), - x.buildDynamicForwardProxyCluster(), - } - if x.otlpHost != "" { - clusters = append(clusters, x.buildOtlpCollectorCluster()) - } - - // Routes - routes := []types.Resource{ - x.buildRoutes(), - } - - // Listeners - listeners := []types.Resource{ - x.buildListener(), - } - if x.httpsPort > 0 { - listeners = append(listeners, x.buildHttpsListener()) - } - - // Snapshot - snapshot, err := cachev3.NewSnapshot(ver, map[resourcev3.Type][]types.Resource{ - resourcev3.ClusterType: clusters, - resourcev3.RouteType: routes, - resourcev3.ListenerType: listeners, - }) - - if err != nil { - return fmt.Errorf("failed to build xDS Snapshot: %w", err) - } - - if err := snapshot.Consistent(); err != nil { - return fmt.Errorf("snapshot evaluation failed integrity check: %w", err) - } - - slog.Info("Deploying updated xDS configuration snapshot", slog.String("version", ver)) - return x.snapshot.SetSnapshot(context.Background(), NodeID, snapshot) -} - -func (x *XdsServer) Serve(ctx context.Context, lis net.Listener) error { - // Ensure a first snapshot is deployed - if err := x.UpdateSnapshot(); err != nil { - slog.ErrorContext(ctx, "Warning - initial xDS setup update failed", slog.String("err", err.Error())) - } - - grpcServer := grpc.NewServer( - grpc.StatsHandler(otelgrpc.NewServerHandler()), - ) - discoverygrpc.RegisterAggregatedDiscoveryServiceServer(grpcServer, x.srv) - clustergrpc.RegisterClusterDiscoveryServiceServer(grpcServer, x.srv) - endpointgrpc.RegisterEndpointDiscoveryServiceServer(grpcServer, x.srv) - listenergrpc.RegisterListenerDiscoveryServiceServer(grpcServer, x.srv) - routegrpc.RegisterRouteDiscoveryServiceServer(grpcServer, x.srv) - - errChan := make(chan error, 1) - go func() { - if err := grpcServer.Serve(lis); err != nil { - errChan <- err - } - }() - - select { - case <-ctx.Done(): - grpcServer.GracefulStop() - return nil - case err := <-errChan: - return err - } -} - -func (x *XdsServer) buildCluster() *clusterv3.Cluster { - h2Opts, _ := anypb.New(&httpv3.HttpProtocolOptions{ - UpstreamProtocolOptions: &httpv3.HttpProtocolOptions_ExplicitHttpConfig_{ - ExplicitHttpConfig: &httpv3.HttpProtocolOptions_ExplicitHttpConfig{ - ProtocolConfig: &httpv3.HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions{}, - }, - }, - }) - - return &clusterv3.Cluster{ - Name: ClusterName, - ConnectTimeout: durationpb.New(250 * time.Millisecond), - ClusterDiscoveryType: &clusterv3.Cluster_Type{ - Type: clusterv3.Cluster_STATIC, - }, - LbPolicy: clusterv3.Cluster_ROUND_ROBIN, - LoadAssignment: &endpointv3.ClusterLoadAssignment{ - ClusterName: ClusterName, - Endpoints: []*endpointv3.LocalityLbEndpoints{ - { - LbEndpoints: []*endpointv3.LbEndpoint{ - { - HostIdentifier: &endpointv3.LbEndpoint_Endpoint{ - Endpoint: &endpointv3.Endpoint{ - Address: &corev3.Address{ - Address: &corev3.Address_SocketAddress{ - SocketAddress: &corev3.SocketAddress{ - Address: x.extprocAddr, - PortSpecifier: &corev3.SocketAddress_PortValue{ - PortValue: uint32(x.extprocPort), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - TypedExtensionProtocolOptions: map[string]*anypb.Any{ - "envoy.extensions.upstreams.http.v3.HttpProtocolOptions": h2Opts, - }, - } -} - -func buildDnsCacheConfig() *dfpcommonv3.DnsCacheConfig { - resolverConfigAny, _ := anypb.New(&getaddrinfov3.GetAddrInfoDnsResolverConfig{}) - return &dfpcommonv3.DnsCacheConfig{ - Name: "dynamic_forward_proxy_cache_config", - DnsLookupFamily: clusterv3.Cluster_V4_ONLY, - TypedDnsResolverConfig: &corev3.TypedExtensionConfig{ - Name: "envoy.network.dns_resolver.getaddrinfo", - TypedConfig: resolverConfigAny, - }, - } -} - -// buildOtlpCollectorCluster builds a STRICT_DNS HTTP/2 cluster that -// targets the OTLP gRPC collector. Required when HCM tracing is enabled -// so Envoy has somewhere to ship spans. -func (x *XdsServer) buildOtlpCollectorCluster() *clusterv3.Cluster { - h2Opts, _ := anypb.New(&httpv3.HttpProtocolOptions{ - UpstreamProtocolOptions: &httpv3.HttpProtocolOptions_ExplicitHttpConfig_{ - ExplicitHttpConfig: &httpv3.HttpProtocolOptions_ExplicitHttpConfig{ - ProtocolConfig: &httpv3.HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions{}, - }, - }, - }) - - return &clusterv3.Cluster{ - Name: OtlpClusterName, - ConnectTimeout: durationpb.New(1 * time.Second), - ClusterDiscoveryType: &clusterv3.Cluster_Type{ - Type: clusterv3.Cluster_STRICT_DNS, - }, - LbPolicy: clusterv3.Cluster_ROUND_ROBIN, - LoadAssignment: &endpointv3.ClusterLoadAssignment{ - ClusterName: OtlpClusterName, - Endpoints: []*endpointv3.LocalityLbEndpoints{ - { - LbEndpoints: []*endpointv3.LbEndpoint{ - { - HostIdentifier: &endpointv3.LbEndpoint_Endpoint{ - Endpoint: &endpointv3.Endpoint{ - Address: &corev3.Address{ - Address: &corev3.Address_SocketAddress{ - SocketAddress: &corev3.SocketAddress{ - Address: x.otlpHost, - PortSpecifier: &corev3.SocketAddress_PortValue{ - PortValue: x.otlpPort, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - TypedExtensionProtocolOptions: map[string]*anypb.Any{ - "envoy.extensions.upstreams.http.v3.HttpProtocolOptions": h2Opts, - }, - } -} - -func (x *XdsServer) buildDynamicForwardProxyCluster() *clusterv3.Cluster { - dfpClusterConfig := &dfpclusterv3.ClusterConfig{ - ClusterImplementationSpecifier: &dfpclusterv3.ClusterConfig_DnsCacheConfig{ - DnsCacheConfig: buildDnsCacheConfig(), - }, - } - - clusterConfigAny, _ := anypb.New(dfpClusterConfig) - - return &clusterv3.Cluster{ - Name: "dynamic_forward_proxy_cluster", - LbPolicy: clusterv3.Cluster_CLUSTER_PROVIDED, - ClusterDiscoveryType: &clusterv3.Cluster_ClusterType{ - ClusterType: &clusterv3.Cluster_CustomClusterType{ - Name: "envoy.clusters.dynamic_forward_proxy", - TypedConfig: clusterConfigAny, - }, - }, - } -} - -func (x *XdsServer) buildRoutes() *routev3.RouteConfiguration { - return &routev3.RouteConfiguration{ - Name: RouteName, - VirtualHosts: []*routev3.VirtualHost{ - { - Name: "local_service", - Domains: []string{"*"}, - Routes: []*routev3.Route{ - { - Match: &routev3.RouteMatch{ - PathSpecifier: &routev3.RouteMatch_Prefix{ - Prefix: "/", - }, - }, - Action: &routev3.Route_Route{ - Route: &routev3.RouteAction{ - ClusterSpecifier: &routev3.RouteAction_Cluster{ - Cluster: "dynamic_forward_proxy_cluster", - }, - Timeout: durationpb.New(10 * time.Second), - }, - }, - }, - }, - }, - }, - } -} - -func (x *XdsServer) buildHcm(statPrefix string) *anypb.Any { - extProcConfig, _ := anypb.New(&extprocv3filter.ExternalProcessor{ - GrpcService: &corev3.GrpcService{ - TargetSpecifier: &corev3.GrpcService_EnvoyGrpc_{ - EnvoyGrpc: &corev3.GrpcService_EnvoyGrpc{ - ClusterName: ClusterName, - }, - }, - Timeout: durationpb.New(5 * time.Second), - }, - MutationRules: &mutationrulesv3.HeaderMutationRules{ - AllowAllRouting: &wrapperspb.BoolValue{Value: true}, - }, - // Explicitly configure the message timeout to avoid the 200ms default - MessageTimeout: durationpb.New(5 * time.Second), - ProcessingMode: &extprocv3filter.ProcessingMode{ - RequestHeaderMode: extprocv3filter.ProcessingMode_SEND, - ResponseHeaderMode: extprocv3filter.ProcessingMode_SKIP, - RequestBodyMode: extprocv3filter.ProcessingMode_NONE, - ResponseBodyMode: extprocv3filter.ProcessingMode_NONE, - RequestTrailerMode: extprocv3filter.ProcessingMode_SKIP, - ResponseTrailerMode: extprocv3filter.ProcessingMode_SKIP, - }, - }) - - dfpFilterConfig, _ := anypb.New(&dfpv3.FilterConfig{ - ImplementationSpecifier: &dfpv3.FilterConfig_DnsCacheConfig{ - DnsCacheConfig: buildDnsCacheConfig(), - }, - }) - - routerAny, _ := anypb.New(&routerv3.Router{}) - - accessLogConfig, _ := anypb.New(&streamaccesslogv3.StdoutAccessLog{}) - - hcm, _ := anypb.New(&hcmv3.HttpConnectionManager{ - StatPrefix: statPrefix, - GenerateRequestId: &wrapperspb.BoolValue{Value: true}, - Tracing: x.buildTracing(), - AccessLog: []*accesslogv3.AccessLog{ - { - Name: "envoy.access_loggers.stdout", - ConfigType: &accesslogv3.AccessLog_TypedConfig{ - TypedConfig: accessLogConfig, - }, - }, - }, - HttpFilters: []*hcmv3.HttpFilter{ - { - Name: "envoy.filters.http.ext_proc", - ConfigType: &hcmv3.HttpFilter_TypedConfig{ - TypedConfig: extProcConfig, - }, - }, - { - Name: "envoy.filters.http.dynamic_forward_proxy", - ConfigType: &hcmv3.HttpFilter_TypedConfig{ - TypedConfig: dfpFilterConfig, - }, - }, - { - Name: "envoy.filters.http.router", - ConfigType: &hcmv3.HttpFilter_TypedConfig{ - TypedConfig: routerAny, - }, - }, - }, - RouteSpecifier: &hcmv3.HttpConnectionManager_Rds{ - Rds: &hcmv3.Rds{ - RouteConfigName: RouteName, - ConfigSource: &corev3.ConfigSource{ - ResourceApiVersion: corev3.ApiVersion_V3, - ConfigSourceSpecifier: &corev3.ConfigSource_Ads{ - Ads: &corev3.AggregatedConfigSource{}, - }, - }, - }, - }, - }) - return hcm -} - -// buildTracing returns the HCM Tracing block that points Envoy at the -// configured OTLP gRPC collector. Returns nil when no collector is set, -// in which case Envoy emits no spans on its own. -// -// `RandomSampling: 100%` makes Envoy ALWAYS sample requests that arrive -// with no parent traceparent. We rely on upstream clients (locust, etc.) -// to gate sampling: requests without a sampled parent are still tagged -// `sampled` here but downstream services in this repo use -// `ParentBased(NeverSample)` so unsampled-by-client requests stay -// unsampled overall. -func (x *XdsServer) buildTracing() *hcmv3.HttpConnectionManager_Tracing { - if x.otlpHost == "" { - return nil - } - otelConfig, _ := anypb.New(&tracev3.OpenTelemetryConfig{ - GrpcService: &corev3.GrpcService{ - TargetSpecifier: &corev3.GrpcService_EnvoyGrpc_{ - EnvoyGrpc: &corev3.GrpcService_EnvoyGrpc{ - ClusterName: OtlpClusterName, - }, - }, - }, - ServiceName: "atenet-router-envoy", - }) - return &hcmv3.HttpConnectionManager_Tracing{ - RandomSampling: &typev3.Percent{Value: 100}, - Provider: &tracev3.Tracing_Http{ - Name: "envoy.tracers.opentelemetry", - ConfigType: &tracev3.Tracing_Http_TypedConfig{ - TypedConfig: otelConfig, - }, - }, - } -} - -func (x *XdsServer) buildListener() *listenerv3.Listener { - hcm := x.buildHcm("ingress_http") - - return &listenerv3.Listener{ - Name: IngressHTTPListener, - Address: &corev3.Address{ - Address: &corev3.Address_SocketAddress{ - SocketAddress: &corev3.SocketAddress{ - Address: "0.0.0.0", - PortSpecifier: &corev3.SocketAddress_PortValue{ - PortValue: uint32(x.ingressPort), - }, - }, - }, - }, - FilterChains: []*listenerv3.FilterChain{ - { - Filters: []*listenerv3.Filter{ - { - Name: "envoy.filters.network.http_connection_manager", - ConfigType: &listenerv3.Filter_TypedConfig{ - TypedConfig: hcm, - }, - }, - }, - }, - }, - } -} - -func (x *XdsServer) buildHttpsListener() *listenerv3.Listener { - hcm := x.buildHcm("ingress_https") - - tlsConfig := &tlsv3.DownstreamTlsContext{ - CommonTlsContext: &tlsv3.CommonTlsContext{ - TlsCertificates: []*tlsv3.TlsCertificate{ - x.buildTlsCertificate(), - }, - }, - } - tlsConfigAny, _ := anypb.New(tlsConfig) - - return &listenerv3.Listener{ - Name: IngressHTTPSListener, - Address: &corev3.Address{ - Address: &corev3.Address_SocketAddress{ - SocketAddress: &corev3.SocketAddress{ - Address: "0.0.0.0", - PortSpecifier: &corev3.SocketAddress_PortValue{ - PortValue: uint32(x.httpsPort), - }, - }, - }, - }, - FilterChains: []*listenerv3.FilterChain{ - { - Filters: []*listenerv3.Filter{ - { - Name: "envoy.filters.network.http_connection_manager", - ConfigType: &listenerv3.Filter_TypedConfig{ - TypedConfig: hcm, - }, - }, - }, - TransportSocket: &corev3.TransportSocket{ - Name: "envoy.transport_sockets.tls", - ConfigType: &corev3.TransportSocket_TypedConfig{ - TypedConfig: tlsConfigAny, - }, - }, - }, - }, - } -} - -func (x *XdsServer) buildTlsCertificate() *tlsv3.TlsCertificate { - if x.certPath != "" { - return &tlsv3.TlsCertificate{ - CertificateChain: &corev3.DataSource{ - Specifier: &corev3.DataSource_Filename{ - Filename: x.certPath, - }, - }, - PrivateKey: &corev3.DataSource{ - Specifier: &corev3.DataSource_Filename{ - Filename: x.certPath, // Assuming combined file - }, - }, - } - } - - return &tlsv3.TlsCertificate{ - CertificateChain: &corev3.DataSource{ - Specifier: &corev3.DataSource_InlineString{ - InlineString: x.certContent, - }, - }, - PrivateKey: &corev3.DataSource{ - Specifier: &corev3.DataSource_InlineString{ - InlineString: x.keyContent, - }, - }, - } -} diff --git a/cmd/atenet/internal/router/xds_test.go b/cmd/atenet/internal/router/xds_test.go deleted file mode 100644 index 92e347648..000000000 --- a/cmd/atenet/internal/router/xds_test.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package router - -import ( - "context" - "net" - "strings" - "testing" - "time" - - clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - listenerv3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" - routev3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" - cachev3 "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - resourcev3 "github.com/envoyproxy/go-control-plane/pkg/resource/v3" -) - -func TestXdsServer_UpdateSnapshot(t *testing.T) { - server := NewXdsServer(18000) - server.SetConfig(8081, 50052, "10.0.0.1") - - err := server.UpdateSnapshot() - if err != nil { - t.Fatalf("UpdateSnapshot failed: %v", err) - } - - res, err := server.snapshot.GetSnapshot(NodeID) - if err != nil { - t.Fatalf("Failed to get generated snapshot: %v", err) - } - - snap, ok := res.(*cachev3.Snapshot) - if !ok { - t.Fatalf("Snapshot doesn't conform to type *cachev3.Snapshot, got %T", res) - } - - // Check consistent snapshot - if err := snap.Consistent(); err != nil { - t.Fatalf("Integrity check failed on snapshot: %v", err) - } - - // Verify clusters generated - clustersMap := snap.GetResources(resourcev3.ClusterType) - if len(clustersMap) != 2 { - t.Errorf("Expected 2 cluster definitions, got %d", len(clustersMap)) - } - - if raw, exists := clustersMap["ate-cluster"]; !exists { - t.Error("Static 'ate-cluster' is missing from clusters") - } else { - c := raw.(*clusterv3.Cluster) - if c.GetName() != "ate-cluster" { - t.Errorf("Expected name 'ate-cluster', got %s", c.GetName()) - } - - // Validate Endpoint address mapped from Server parameters - eps := c.GetLoadAssignment().GetEndpoints()[0].GetLbEndpoints()[0].GetEndpoint().GetAddress().GetSocketAddress() - if eps.GetAddress() != "10.0.0.1" { - t.Errorf("Expected address '10.0.0.1', got %s", eps.GetAddress()) - } - if eps.GetPortValue() != 50052 { - t.Errorf("Expected port 50052, got %d", eps.GetPortValue()) - } - } - - if raw, exists := clustersMap["dynamic_forward_proxy_cluster"]; !exists { - t.Error("'dynamic_forward_proxy_cluster' is missing from clusters") - } else { - c := raw.(*clusterv3.Cluster) - if c.GetName() != "dynamic_forward_proxy_cluster" { - t.Errorf("Expected 'dynamic_forward_proxy_cluster', got %s", c.GetName()) - } - } - - // Verify Virtual Hosts generated inside Route configuration - routesMap := snap.GetResources(resourcev3.RouteType) - if len(routesMap) != 1 { - t.Fatalf("Expected 1 route configuration object, got %d", len(routesMap)) - } - - if raw, exists := routesMap[RouteName]; !exists { - t.Errorf("Route name '%s' is missing from snapshot routes configuration", RouteName) - } else { - rc := raw.(*routev3.RouteConfiguration) - if rc.GetName() != RouteName { - t.Errorf("Expected route name '%s', got %s", RouteName, rc.GetName()) - } - - if len(rc.GetVirtualHosts()) != 1 { - t.Fatalf("Expected 1 VirtualHost definition for static routes case, got %d", len(rc.GetVirtualHosts())) - } - - vh := rc.GetVirtualHosts()[0] - if len(vh.GetDomains()) != 1 || vh.GetDomains()[0] != "*" { - t.Errorf("Expected domain '*', got %v", vh.GetDomains()) - } - - if len(vh.GetRoutes()) != 1 { - t.Fatalf("Expected 1 route in fallback VirtualHost, got %d", len(vh.GetRoutes())) - } - - fallbackRoute := vh.GetRoutes()[0] - if fallbackRoute.GetMatch().GetPrefix() != "/" { - t.Errorf("Expected path mapping prefix '/', got '%s'", fallbackRoute.GetMatch().GetPrefix()) - } - } - - // Verify listeners generated - listenersMap := snap.GetResources(resourcev3.ListenerType) - if len(listenersMap) != 1 { - t.Fatalf("Expected 1 listener definition, got %d", len(listenersMap)) - } - - if raw, exists := listenersMap[IngressHTTPListener]; !exists { - t.Errorf("Listener name '%s' is missing from snapshot listeners", IngressHTTPListener) - } else { - l := raw.(*listenerv3.Listener) - sa := l.GetAddress().GetSocketAddress() - if sa.GetPortValue() != 8081 { - t.Errorf("Expected port 8081, got %d", sa.GetPortValue()) - } - if sa.GetAddress() != "0.0.0.0" { - t.Errorf("Expected address '0.0.0.0', got %s", sa.GetAddress()) - } - } -} - -func TestXdsServer_UpdateSnapshot_WithHttps(t *testing.T) { - server := NewXdsServer(18000) - server.SetConfig(8085, 50053, "127.0.0.1") - server.SetTlsConfig(8443, "", "dummy-cert", "dummy-key") - - err := server.UpdateSnapshot() - if err != nil { - t.Fatalf("UpdateSnapshot failed: %v", err) - } - - res, err := server.snapshot.GetSnapshot(NodeID) - if err != nil { - t.Fatalf("Failed to get snapshot: %v", err) - } - - snap, ok := res.(*cachev3.Snapshot) - if !ok { - t.Fatalf("Snapshot doesn't conform to type *cachev3.Snapshot, got %T", res) - } - - listenersMap := snap.GetResources(resourcev3.ListenerType) - if len(listenersMap) != 2 { - t.Fatalf("Expected 2 listener definitions, got %d", len(listenersMap)) - } - - if raw, exists := listenersMap[IngressHTTPSListener]; !exists { - t.Errorf("Listener name '%s' is missing from snapshot listeners", IngressHTTPSListener) - } else { - l := raw.(*listenerv3.Listener) - sa := l.GetAddress().GetSocketAddress() - if sa.GetPortValue() != 8443 { - t.Errorf("Expected port 8443, got %d", sa.GetPortValue()) - } - - // Verify TLS config - fc := l.GetFilterChains()[0] - ts := fc.GetTransportSocket() - if ts.GetName() != "envoy.transport_sockets.tls" { - t.Errorf("Expected transport socket 'envoy.transport_sockets.tls', got '%s'", ts.GetName()) - } - } -} - -func TestXdsServer_Serve_Shutdown(t *testing.T) { - server := NewXdsServer(18000) - server.SetConfig(8085, 50053, "127.0.0.1") - - lis, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("Failed to create tcp listener: %v", err) - } - defer lis.Close() - - ctx, cancel := context.WithCancel(context.Background()) - errChan := make(chan error, 1) - - go func() { - errChan <- server.Serve(ctx, lis) - }() - - // Cancel the context to trigger graceful stop - cancel() - - select { - case err := <-errChan: - if err != nil && !strings.Contains(err.Error(), "use of closed network connection") { - t.Errorf("Serve error returned: %v", err) - } - case <-time.After(2 * time.Second): - t.Error("Timeout exceeded waiting for Serve to finish graceful closure") - } -} diff --git a/cmd/ateom-gvisor/main.go b/cmd/ateom-gvisor/main.go index 6d0129452..b68cb001a 100644 --- a/cmd/ateom-gvisor/main.go +++ b/cmd/ateom-gvisor/main.go @@ -22,6 +22,7 @@ import ( "fmt" "log/slog" "net" + "net/url" "os" "runtime" "sort" @@ -31,6 +32,7 @@ import ( "github.com/agent-substrate/substrate/internal/actorlog" "github.com/agent-substrate/substrate/internal/ateinterceptors" "github.com/agent-substrate/substrate/internal/ateompath" + "github.com/agent-substrate/substrate/internal/atunnel" "github.com/agent-substrate/substrate/internal/contextlogging" "github.com/agent-substrate/substrate/internal/proto/ateompb" "github.com/agent-substrate/substrate/internal/readyz" @@ -53,6 +55,13 @@ import ( var ( podUID = pflag.String("pod-uid", "", "The UID of the current pod") + atunnelListenAddress = pflag.String("atunnel-listen-address", "0.0.0.0:443", "Address for actor ingress HTTPS") + atunnelCredentialBundle = pflag.String("atunnel-credential-bundle", "/run/podidentity.podcert.ate.dev/credential-bundle.pem", "PEM credential bundle for actor ingress HTTPS") + atunnelTrustBundle = pflag.String("atunnel-trust-bundle", "/run/podidentity.podcert.ate.dev/trust-bundle.pem", "PEM trust bundle for actor ingress clients") + atunnelClientIdentity = pflag.String("atunnel-client-identity", "spiffe://cluster.local/ns/ate-system/sa/ateway-ingress", "SPIFFE identity allowed to call actor ingress HTTPS") + atunnelEgressListenAddress = pflag.String("atunnel-egress-listen-address", "0.0.0.0:15001", "Address for transparently intercepted actor egress TCP") + atunnelEgressTrustBundle = pflag.String("atunnel-egress-trust-bundle", "/run/servicedns.podcert.ate.dev/trust-bundle.pem", "PEM trust bundle for the egress gateway") + showVersion = pflag.Bool("version", false, "Print version and exit.") reapLock sync.RWMutex @@ -67,6 +76,7 @@ const ( actorVethGateway = "169.254.17.1" actorVethIP = "169.254.17.2" actorNftTableName = "ateom_actor" + actorHTTPUpstream = "http://169.254.17.2:80" ) func main() { @@ -137,7 +147,16 @@ func do(ctx context.Context) error { } actorLogger := actorlog.NewActorLogger(syncedWriter, metadata.OnGCE()) - ateomService := NewService(interiorNetNS, actorLogger) + upstream, err := url.Parse(actorHTTPUpstream) + if err != nil { + return fmt.Errorf("while parsing atunnel upstream: %w", err) + } + atunnelServer, atunnelEgress, atunnelEgressPort, err := runAtunnel(ctx, upstream) + if err != nil { + return err + } + + ateomService := NewService(interiorNetNS, actorLogger, atunnelServer, atunnelEgress, atunnelEgressPort, *atunnelCredentialBundle, *atunnelEgressTrustBundle) svr := grpc.NewServer( grpc.StatsHandler(otelgrpc.NewServerHandler()), @@ -154,6 +173,50 @@ func do(ctx context.Context) error { return nil } +func runAtunnel(ctx context.Context, upstream *url.URL) (*atunnel.Server, *atunnel.Egress, uint16, error) { + atunnelServer, err := atunnel.NewServer(atunnel.Config{ + CredentialBundlePath: *atunnelCredentialBundle, + TrustBundlePath: *atunnelTrustBundle, + AllowedClientID: *atunnelClientIdentity, + Upstream: upstream, + }) + if err != nil { + return nil, nil, 0, fmt.Errorf("while configuring atunnel: %w", err) + } + atunnelListener, err := net.Listen("tcp", *atunnelListenAddress) + if err != nil { + return nil, nil, 0, fmt.Errorf("while opening atunnel listener: %w", err) + } + go func() { + if err := atunnelServer.Serve(ctx, atunnelListener); err != nil { + serverboot.Fatal(ctx, "Failed to serve actor ingress", err) + } + }() + slog.InfoContext(ctx, "atunnel serving", slog.String("address", *atunnelListenAddress)) + + atunnelEgress, err := atunnel.NewEgress(atunnel.TCPOriginalDestination) + if err != nil { + return nil, nil, 0, fmt.Errorf("while configuring atunnel egress: %w", err) + } + egressListener, err := net.Listen("tcp", *atunnelEgressListenAddress) + if err != nil { + return nil, nil, 0, fmt.Errorf("while opening atunnel egress listener: %w", err) + } + egressTCPAddr, ok := egressListener.Addr().(*net.TCPAddr) + if !ok || egressTCPAddr.Port < 1 || egressTCPAddr.Port > 65535 { + _ = egressListener.Close() + return nil, nil, 0, fmt.Errorf("atunnel egress listener has invalid address %q", egressListener.Addr()) + } + atunnelEgressPort := uint16(egressTCPAddr.Port) + go func() { + if err := atunnelEgress.Serve(ctx, egressListener); err != nil { + serverboot.Fatal(ctx, "Failed to serve actor egress", err) + } + }() + slog.InfoContext(ctx, "atunnel egress serving", slog.String("address", *atunnelEgressListenAddress)) + return atunnelServer, atunnelEgress, atunnelEgressPort, nil +} + // AteomService is a service for shepherding single microvm. type AteomService struct { ateompb.UnimplementedAteomServer @@ -164,22 +227,36 @@ type AteomService struct { interiorNetNS netns.NsHandle actorLogger *actorlog.ActorLogger + atunnel *atunnel.Server + atunnelEgress *atunnel.Egress + // atunnelEgressPort is zero when tunneled egress is disabled. Otherwise, + // actor TCP connections are transparently redirected to this local port. + atunnelEgressPort uint16 + atunnelCredentialBundle string + atunnelEgressTrustBundle string } var _ ateompb.AteomServer = (*AteomService)(nil) // NewService creates a new AteomService. -func NewService(interiorNetNS netns.NsHandle, actorLogger *actorlog.ActorLogger) *AteomService { - svc := &AteomService{ - interiorNetNS: interiorNetNS, - actorLogger: actorLogger, +func NewService(interiorNetNS netns.NsHandle, actorLogger *actorlog.ActorLogger, atunnelServer *atunnel.Server, atunnelEgress *atunnel.Egress, atunnelEgressPort uint16, credentialBundle, egressTrustBundle string) *AteomService { + return &AteomService{ + interiorNetNS: interiorNetNS, + actorLogger: actorLogger, + atunnel: atunnelServer, + atunnelEgress: atunnelEgress, + atunnelEgressPort: atunnelEgressPort, + atunnelCredentialBundle: credentialBundle, + atunnelEgressTrustBundle: egressTrustBundle, } - return svc } func (s *AteomService) RunWorkload(ctx context.Context, req *ateompb.RunWorkloadRequest) (resp *ateompb.RunWorkloadResponse, retErr error) { s.lock.Lock() defer s.lock.Unlock() + if err := s.deactivateActorNetworking(ctx); err != nil { + return nil, err + } s.actorLogger.EmitLifecycleLog("Actor starting", req.GetAtespace(), req.GetActorName(), req.GetActorUid(), req.GetActorTemplateNamespace(), req.GetActorTemplateName()) @@ -188,7 +265,7 @@ func (s *AteomService) RunWorkload(ctx context.Context, req *ateompb.RunWorkload // * Correct runsc version is downloaded and placed on disk. // * All OCI bundles are set up, including for "pause" container. - if err := s.setupActorNetwork(ctx); err != nil { + if err := s.setupActorNetwork(ctx, req.GetEgressGatewayAddress() != ""); err != nil { return nil, fmt.Errorf("while setting up actor network: %w", err) } defer func() { @@ -230,6 +307,9 @@ func (s *AteomService) RunWorkload(ctx context.Context, req *ateompb.RunWorkload if err := readyz.WaitAll(ctx, req.GetSpec().GetContainers(), actorVethIP); err != nil { return nil, fmt.Errorf("while waiting for container readyz: %w", err) } + if err := s.activateActorNetworking(req.GetAtespace(), req.GetActorName(), req.GetActorVersion(), req.GetEgressGatewayAddress()); err != nil { + return nil, err + } s.actorLogger.EmitLifecycleLog("Actor started", req.GetAtespace(), req.GetActorName(), req.GetActorUid(), req.GetActorTemplateNamespace(), req.GetActorTemplateName()) @@ -239,6 +319,9 @@ func (s *AteomService) RunWorkload(ctx context.Context, req *ateompb.RunWorkload func (s *AteomService) CheckpointWorkload(ctx context.Context, req *ateompb.CheckpointWorkloadRequest) (*ateompb.CheckpointWorkloadResponse, error) { s.lock.Lock() defer s.lock.Unlock() + if err := s.deactivateActorNetworking(ctx); err != nil { + return nil, err + } s.actorLogger.EmitLifecycleLog("Actor checkpointing", req.GetAtespace(), req.GetActorName(), req.GetActorUid(), req.GetActorTemplateNamespace(), req.GetActorTemplateName()) @@ -352,6 +435,9 @@ func (r *runsc) cleanupContainersAfterCheckpoint(ctx context.Context, containers func (s *AteomService) RestoreWorkload(ctx context.Context, req *ateompb.RestoreWorkloadRequest) (resp *ateompb.RestoreWorkloadResponse, retErr error) { s.lock.Lock() defer s.lock.Unlock() + if err := s.deactivateActorNetworking(ctx); err != nil { + return nil, err + } s.actorLogger.EmitLifecycleLog("Actor restoring", req.GetAtespace(), req.GetActorName(), req.GetActorUid(), req.GetActorTemplateNamespace(), req.GetActorTemplateName()) @@ -361,7 +447,7 @@ func (s *AteomService) RestoreWorkload(ctx context.Context, req *ateompb.Restore // * All OCI bundles are set up, including for "pause" container. // * Checkpoint downloaded and placed on disk - if err := s.setupActorNetwork(ctx); err != nil { + if err := s.setupActorNetwork(ctx, req.GetEgressGatewayAddress() != ""); err != nil { return nil, fmt.Errorf("while setting up actor network: %w", err) } defer func() { @@ -430,13 +516,65 @@ func (s *AteomService) RestoreWorkload(ctx context.Context, req *ateompb.Restore if err := readyz.WaitAll(ctx, req.GetSpec().GetContainers(), actorVethIP); err != nil { return nil, fmt.Errorf("while waiting for container readyz: %w", err) } + if err := s.activateActorNetworking(req.GetAtespace(), req.GetActorName(), req.GetActorVersion(), req.GetEgressGatewayAddress()); err != nil { + return nil, err + } s.actorLogger.EmitLifecycleLog("Actor restored", req.GetAtespace(), req.GetActorName(), req.GetActorUid(), req.GetActorTemplateNamespace(), req.GetActorTemplateName()) return &ateompb.RestoreWorkloadResponse{}, nil } -func (s *AteomService) setupActorNetwork(ctx context.Context) (retErr error) { +func (s *AteomService) activateActorNetworking(atespace, actorName string, actorVersion int64, egressGatewayAddress string) error { + var egressClient atunnel.EgressDialer + if s.atunnelEgress != nil && egressGatewayAddress != "" { + serverName, _, err := net.SplitHostPort(egressGatewayAddress) + if err != nil { + return fmt.Errorf("invalid egress gateway address %q: %w", egressGatewayAddress, err) + } + egressClient, err = atunnel.NewClient(atunnel.ClientConfig{ + GatewayAddress: egressGatewayAddress, + ServerName: serverName, + CredentialBundlePath: s.atunnelCredentialBundle, + TrustBundlePath: s.atunnelEgressTrustBundle, + }) + if err != nil { + return fmt.Errorf("while configuring actor egress client: %w", err) + } + } + if s.atunnel != nil { + if err := s.atunnel.Activate(atespace, actorName); err != nil { + return fmt.Errorf("while activating actor ingress: %w", err) + } + } + if egressClient != nil { + if err := s.atunnelEgress.Activate(egressClient, atespace, actorName, actorVersion, ""); err != nil { + if s.atunnel != nil { + _ = s.atunnel.Deactivate(context.Background()) + } + return fmt.Errorf("while activating actor egress: %w", err) + } + } + return nil +} + +func (s *AteomService) deactivateActorNetworking(ctx context.Context) error { + // Stop admitting traffic and drain active streams before the Actor network + // is torn down. Attempt both directions even if one fails to deactivate. + var err error + if s.atunnel != nil { + err = errors.Join(err, s.atunnel.Deactivate(ctx)) + } + if s.atunnelEgress != nil { + err = errors.Join(err, s.atunnelEgress.Deactivate(ctx)) + } + if err != nil { + return fmt.Errorf("while deactivating actor networking: %w", err) + } + return nil +} + +func (s *AteomService) setupActorNetwork(ctx context.Context, redirectEgress bool) (retErr error) { // Build a fresh point-to-point network between the worker pod netns and the // gVisor interior netns. The worker side keeps the pod's real eth0, creates // ateom0 as the gateway, and moves only the veth peer into the actor netns. @@ -444,10 +582,8 @@ func (s *AteomService) setupActorNetwork(ctx context.Context) (retErr error) { // the worker-side veth address. This replaces the old behavior of moving the // Kubernetes-provided eth0 out of the worker pod. // - // The nftables rules installed here are a compatibility bridge for the - // current router assumptions: actor egress is masqueraded behind the worker - // pod IP, and inbound traffic to the worker pod's HTTP port is DNAT'd to the - // actor veth IP. + // nftables redirects actor TCP egress to atunnel when configured and + // masquerades traffic not handled by the TCP tunnel (notably DNS/UDP). // // Clean up stale state from a failed prior activation before creating the // next actor-side network. The worker currently runs one actor at a time. @@ -458,11 +594,6 @@ func (s *AteomService) setupActorNetwork(ctx context.Context) (retErr error) { } }() - podIP, err := podIPv4() - if err != nil { - return fmt.Errorf("while resolving pod IPv4 address: %w", err) - } - hostAddr, err := parseAddr(hostVethCIDR) if err != nil { return err @@ -504,7 +635,11 @@ func (s *AteomService) setupActorNetwork(ctx context.Context) (retErr error) { if err := enableIPv4Forwarding(); err != nil { return err } - if err := installActorNftablesRules(podIP); err != nil { + egressPort := uint16(0) + if redirectEgress { + egressPort = s.atunnelEgressPort + } + if err := installActorNftablesRules(egressPort); err != nil { return err } @@ -627,29 +762,6 @@ func (s *AteomService) cleanupActorNetworkOrExit(ctx context.Context, msg string } } -func podIPv4() (net.IP, error) { - // Resolve the worker pod IPv4 address from the pod namespace's real eth0. - // Because eth0 now stays in the pod namespace, this IP remains available for - // both normal worker connectivity and the temporary inbound DNAT rule. - eth0Link, err := netlink.LinkByName("eth0") - if err != nil { - return nil, fmt.Errorf("while getting pod eth0: %w", err) - } - addrs, err := netlink.AddrList(eth0Link, netlink.FAMILY_V4) - if err != nil { - return nil, fmt.Errorf("while listing pod eth0 addresses: %w", err) - } - for _, addr := range addrs { - if addr.IP == nil { - continue - } - if ip := addr.IP.To4(); ip != nil { - return ip, nil - } - } - return nil, fmt.Errorf("pod eth0 has no IPv4 address") -} - func parseAddr(cidr string) (*netlink.Addr, error) { addr, err := netlink.ParseAddr(cidr) if err != nil { @@ -669,26 +781,24 @@ func enableIPv4Forwarding() error { return nil } -func installActorNftablesRules(podIP net.IP) error { +func installActorNftablesRules(egressPort uint16) error { // Install a dedicated nftables table for the active actor. Keeping all // rules in an ateom-owned table makes cleanup simple and avoids mutating // Kubernetes or CNI-managed chains directly. // // TODO: Add IPv6 veth addressing, forwarding, and nftables rules once actor - // networking supports dual-stack pods. The current compatibility path is - // IPv4-only. + // networking supports dual-stack pods. The current actor network is IPv4-only. // - // The temporary compatibility rules do three things: + // The rules do three things: // - // * postrouting: masquerade actor egress from 169.254.17.2 behind the worker - // pod IP so replies route back to the pod. - // * prerouting: DNAT traffic sent to the worker pod IP on TCP/80 to the - // actor veth IP on TCP/80, preserving existing inbound behavior. + // * prerouting: redirect new actor TCP connections to atunnel's local + // listener. REDIRECT preserves SO_ORIGINAL_DST for the CONNECT authority. + // * postrouting: masquerade traffic not handled by the TCP tunnel, notably + // DNS over UDP, so hostname resolution continues to work. // * forward: accept forwarded packets between the actor veth and pod eth0. // - // This is not the final egress policy path. The later AgentGateway phase - // should replace the broad masquerade path with transparent TCP capture and - // default-deny rules. + // TODO: Restrict the compatibility masquerade to DNS traffic sent to the + // configured cluster resolver and drop all other non-tunneled actor egress. if err := removeActorNftablesRules(); err != nil { return err } @@ -707,32 +817,9 @@ func installActorNftablesRules(podIP net.IP) error { Hooknum: nftables.ChainHookPrerouting, Priority: nftables.ChainPriorityNATDest, }) - // TODO: Support inbound UDP DNAT for actors that expose UDP protocols such - // as QUIC. - // TODO: Replace the hard-coded HTTP port with the actor's configured - // inbound ports, either by adding one rule per port or by matching a set. - preroutingExprs := append(ipDestinationEqual(podIP.String()), tcpDestinationPortEqual(80)...) - preroutingExprs = append(preroutingExprs, - &expr.Immediate{ - Register: 1, - Data: net.ParseIP(actorVethIP).To4(), - }, - &expr.Immediate{ - Register: 2, - Data: binaryutil.BigEndian.PutUint16(80), - }, - &expr.NAT{ - Type: expr.NATTypeDestNAT, - Family: unix.NFPROTO_IPV4, - RegAddrMin: 1, - RegProtoMin: 2, - }, - ) - c.AddRule(&nftables.Rule{ - Table: table, - Chain: prerouting, - Exprs: preroutingExprs, - }) + if redirectRule := actorEgressRedirectRule(table, prerouting, egressPort); redirectRule != nil { + c.AddRule(redirectRule) + } postrouting := c.AddChain(&nftables.Chain{ Name: "postrouting", @@ -796,10 +883,6 @@ func ipSourceEqual(ip string) []expr.Any { return ipPayloadEqual(12, ip) } -func ipDestinationEqual(ip string) []expr.Any { - return ipPayloadEqual(16, ip) -} - func ipPayloadEqual(offset uint32, ip string) []expr.Any { return []expr.Any{ &expr.Payload{ @@ -816,7 +899,7 @@ func ipPayloadEqual(offset uint32, ip string) []expr.Any { } } -func tcpDestinationPortEqual(port uint16) []expr.Any { +func tcpProtocol() []expr.Any { return []expr.Any{ &expr.Meta{Key: expr.MetaKeyL4PROTO, Register: 1}, &expr.Cmp{ @@ -824,18 +907,22 @@ func tcpDestinationPortEqual(port uint16) []expr.Any { Register: 1, Data: []byte{unix.IPPROTO_TCP}, }, - &expr.Payload{ - DestRegister: 1, - Base: expr.PayloadBaseTransportHeader, - Offset: 2, - Len: 2, - }, - &expr.Cmp{ - Op: expr.CmpOpEq, + } +} + +func actorEgressRedirectRule(table *nftables.Table, chain *nftables.Chain, port uint16) *nftables.Rule { + if port == 0 { + return nil + } + exprs := append(ipSourceEqual(actorVethIP), tcpProtocol()...) + exprs = append(exprs, + &expr.Immediate{ Register: 1, Data: binaryutil.BigEndian.PutUint16(port), }, - } + &expr.Redir{RegisterProtoMin: 1}, + ) + return &nftables.Rule{Table: table, Chain: chain, Exprs: exprs} } func createNetNSWithoutSwitching(ctx context.Context, name string) (netns.NsHandle, error) { diff --git a/cmd/ateom-microvm/checkpoint.go b/cmd/ateom-microvm/checkpoint.go index 50a19c168..441d81075 100644 --- a/cmd/ateom-microvm/checkpoint.go +++ b/cmd/ateom-microvm/checkpoint.go @@ -44,6 +44,9 @@ import ( func (s *AteomService) CheckpointWorkload(ctx context.Context, req *ateompb.CheckpointWorkloadRequest) (*ateompb.CheckpointWorkloadResponse, error) { s.lock.Lock() defer s.lock.Unlock() + if err := s.deactivateActorNetworking(ctx); err != nil { + return nil, err + } atespace := req.GetAtespace() name := req.GetActorName() diff --git a/cmd/ateom-microvm/main.go b/cmd/ateom-microvm/main.go index 1dcce1cb1..beb8acaac 100644 --- a/cmd/ateom-microvm/main.go +++ b/cmd/ateom-microvm/main.go @@ -24,10 +24,12 @@ package main import ( "context" + "errors" "flag" "fmt" "log/slog" "net" + "net/url" "os" "strings" "sync" @@ -37,6 +39,7 @@ import ( "github.com/agent-substrate/substrate/internal/actorlog" "github.com/agent-substrate/substrate/internal/ateinterceptors" "github.com/agent-substrate/substrate/internal/ateompath" + "github.com/agent-substrate/substrate/internal/atunnel" "github.com/agent-substrate/substrate/internal/proto/ateompb" "github.com/agent-substrate/substrate/internal/serverboot" "github.com/agent-substrate/substrate/internal/version" @@ -54,6 +57,13 @@ var ( kataConfig = flag.String("kata-config", "", "Path to a kata configuration.toml (passed to the shim as KATA_CONF_FILE). Empty uses kata's default. atelet generates one pointing at runtime-fetched assets.") kataDebug = flag.Bool("kata-debug", false, "Verbose kata-agent debugging: raise the guest agent log level and forward the guest console (incl. agent logs) into the pod logs.") showVersion = flag.Bool("version", false, "Print version and exit.") + + atunnelListenAddress = flag.String("atunnel-listen-address", "0.0.0.0:443", "Address for actor ingress HTTPS") + atunnelCredentialBundle = flag.String("atunnel-credential-bundle", "/run/podidentity.podcert.ate.dev/credential-bundle.pem", "PEM credential bundle for actor ingress HTTPS") + atunnelTrustBundle = flag.String("atunnel-trust-bundle", "/run/podidentity.podcert.ate.dev/trust-bundle.pem", "PEM trust bundle for actor ingress clients") + atunnelClientIdentity = flag.String("atunnel-client-identity", "spiffe://cluster.local/ns/ate-system/sa/ateway-ingress", "SPIFFE identity allowed to call actor ingress HTTPS") + atunnelEgressListenAddress = flag.String("atunnel-egress-listen-address", "0.0.0.0:15001", "Address for transparently intercepted actor egress TCP") + atunnelEgressTrustBundle = flag.String("atunnel-egress-trust-bundle", "/run/servicedns.podcert.ate.dev/trust-bundle.pem", "PEM trust bundle for the egress gateway") ) func main() { @@ -138,12 +148,55 @@ func do(ctx context.Context) error { // logWriter with the runtime logger so the two streams to os.Stdout are // serialized through one SyncedWriter and never interleave-corrupt lines. actorLogger := actorlog.NewActorLogger(logWriter, metadata.OnGCE()) + upstream, err := url.Parse("http://169.254.17.2:80") + if err != nil { + return fmt.Errorf("while parsing atunnel upstream: %w", err) + } + atunnelServer, err := atunnel.NewServer(atunnel.Config{ + CredentialBundlePath: *atunnelCredentialBundle, + TrustBundlePath: *atunnelTrustBundle, + AllowedClientID: *atunnelClientIdentity, + Upstream: upstream, + }) + if err != nil { + return fmt.Errorf("while configuring atunnel: %w", err) + } + atunnelListener, err := net.Listen("tcp", *atunnelListenAddress) + if err != nil { + return fmt.Errorf("while opening atunnel listener: %w", err) + } + go func() { + if err := atunnelServer.Serve(ctx, atunnelListener); err != nil { + serverboot.Fatal(ctx, "Failed to serve actor ingress", err) + } + }() + slog.InfoContext(ctx, "atunnel serving", slog.String("address", *atunnelListenAddress)) + atunnelEgress, err := atunnel.NewEgress(atunnel.TCPOriginalDestination) + if err != nil { + return fmt.Errorf("while configuring atunnel egress: %w", err) + } + egressListener, err := net.Listen("tcp", *atunnelEgressListenAddress) + if err != nil { + return fmt.Errorf("while opening atunnel egress listener: %w", err) + } + egressTCPAddr, ok := egressListener.Addr().(*net.TCPAddr) + if !ok || egressTCPAddr.Port < 1 || egressTCPAddr.Port > 65535 { + _ = egressListener.Close() + return fmt.Errorf("atunnel egress listener has invalid address %q", egressListener.Addr()) + } + atunnelEgressPort := uint16(egressTCPAddr.Port) + go func() { + if err := atunnelEgress.Serve(ctx, egressListener); err != nil { + serverboot.Fatal(ctx, "Failed to serve actor egress", err) + } + }() + slog.InfoContext(ctx, "atunnel egress serving", slog.String("address", *atunnelEgressListenAddress)) svr := grpc.NewServer( grpc.StatsHandler(otelgrpc.NewServerHandler()), grpc.UnaryInterceptor(ateinterceptors.InternalServerUnaryInterceptor), ) - ateompb.RegisterAteomServer(svr, NewService(*podUID, *chBinary, *kataConfig, *kataDebug, interiorNetNS, actorLogger)) + ateompb.RegisterAteomServer(svr, NewService(*podUID, *chBinary, *kataConfig, *kataDebug, interiorNetNS, actorLogger, atunnelServer, atunnelEgress, atunnelEgressPort, *atunnelCredentialBundle, *atunnelEgressTrustBundle)) reflection.Register(svr) slog.InfoContext(ctx, "ateom-microvm serving", slog.String("socket", sockPath)) @@ -201,7 +254,14 @@ type AteomService struct { // actorLogger forwards the actor container's stdout/stderr to the worker pod's // stdout as ate.dev/*-labeled JSON and emits actor lifecycle events (parity // with ateom-gvisor). - actorLogger *actorlog.ActorLogger + actorLogger *actorlog.ActorLogger + atunnel *atunnel.Server + atunnelEgress *atunnel.Egress + // atunnelEgressPort is zero when tunneled egress is disabled. Otherwise, + // actor TCP connections are transparently redirected to this local port. + atunnelEgressPort uint16 + atunnelCredentialBundle string + atunnelEgressTrustBundle string // running maps actor UID -> the live micro-VM, kept so CheckpointWorkload can // pause+snapshot+teardown the same sandbox (and RestoreWorkload can track the @@ -212,14 +272,68 @@ type AteomService struct { var _ ateompb.AteomServer = (*AteomService)(nil) // NewService creates a new AteomService. -func NewService(podUID, chBinary, kataConfig string, kataDebug bool, interiorNetNS netns.NsHandle, actorLogger *actorlog.ActorLogger) *AteomService { +func NewService(podUID, chBinary, kataConfig string, kataDebug bool, interiorNetNS netns.NsHandle, actorLogger *actorlog.ActorLogger, atunnelServer *atunnel.Server, atunnelEgress *atunnel.Egress, atunnelEgressPort uint16, credentialBundle, egressTrustBundle string) *AteomService { return &AteomService{ - podUID: podUID, - chBinary: chBinary, - kataConfig: kataConfig, - kataDebug: kataDebug, - interiorNetNS: interiorNetNS, - actorLogger: actorLogger, - running: map[string]*runningActor{}, + podUID: podUID, + chBinary: chBinary, + kataConfig: kataConfig, + kataDebug: kataDebug, + interiorNetNS: interiorNetNS, + actorLogger: actorLogger, + atunnel: atunnelServer, + atunnelEgress: atunnelEgress, + atunnelEgressPort: atunnelEgressPort, + atunnelCredentialBundle: credentialBundle, + atunnelEgressTrustBundle: egressTrustBundle, + running: map[string]*runningActor{}, } } + +func (s *AteomService) activateActorNetworking(atespace, actorName string, actorVersion int64, egressGatewayAddress string) error { + var egressClient atunnel.EgressDialer + if s.atunnelEgress != nil && egressGatewayAddress != "" { + serverName, _, err := net.SplitHostPort(egressGatewayAddress) + if err != nil { + return fmt.Errorf("invalid egress gateway address %q: %w", egressGatewayAddress, err) + } + egressClient, err = atunnel.NewClient(atunnel.ClientConfig{ + GatewayAddress: egressGatewayAddress, + ServerName: serverName, + CredentialBundlePath: s.atunnelCredentialBundle, + TrustBundlePath: s.atunnelEgressTrustBundle, + }) + if err != nil { + return fmt.Errorf("while configuring actor egress client: %w", err) + } + } + if s.atunnel != nil { + if err := s.atunnel.Activate(atespace, actorName); err != nil { + return fmt.Errorf("while activating actor ingress: %w", err) + } + } + if egressClient != nil { + if err := s.atunnelEgress.Activate(egressClient, atespace, actorName, actorVersion, ""); err != nil { + if s.atunnel != nil { + _ = s.atunnel.Deactivate(context.Background()) + } + return fmt.Errorf("while activating actor egress: %w", err) + } + } + return nil +} + +func (s *AteomService) deactivateActorNetworking(ctx context.Context) error { + // Stop admitting traffic and drain active streams before the Actor network + // is torn down. Attempt both directions even if one fails to deactivate. + var err error + if s.atunnel != nil { + err = errors.Join(err, s.atunnel.Deactivate(ctx)) + } + if s.atunnelEgress != nil { + err = errors.Join(err, s.atunnelEgress.Deactivate(ctx)) + } + if err != nil { + return fmt.Errorf("while deactivating actor networking: %w", err) + } + return nil +} diff --git a/cmd/ateom-microvm/net.go b/cmd/ateom-microvm/net.go index cc047d4f2..60643df8a 100644 --- a/cmd/ateom-microvm/net.go +++ b/cmd/ateom-microvm/net.go @@ -20,8 +20,8 @@ package main // point-to-point veth pair per activation, with the worker side (ateom0, // 169.254.17.1/30) staying in the pod netns next to the pod's real eth0, and // the peer moved into the interior netns, renamed eth0, and given the stable -// actor address 169.254.17.2/30. nftables rules in the pod netns masquerade -// actor egress behind the pod IP and DNAT inbound pod-IP:80 to the actor. +// actor address 169.254.17.2/30. nftables rules in the pod netns redirect actor +// TCP egress to atunnel and masquerade DNS/UDP. // // kata consumes the interior netns exactly like a CNI-provisioned container // netns: its tcfilter network model builds a tap cross-connected to eth0 (the @@ -120,7 +120,7 @@ func mustParseIP(s string) net.IP { // pod netns and the kata interior netns (see the package comment). Idempotent // via cleanup-before-setup; also sweeps stale kata taps out of the interior // netns so the sandbox always builds on a clean slate. -func (s *AteomService) setupActorNetwork(ctx context.Context) (retErr error) { +func (s *AteomService) setupActorNetwork(ctx context.Context, redirectEgress bool) (retErr error) { s.cleanupActorNetworkOrExit(ctx, "Failed to clean up stale actor network before setup") defer func() { if retErr != nil { @@ -128,11 +128,6 @@ func (s *AteomService) setupActorNetwork(ctx context.Context) (retErr error) { } }() - podIP, err := podIPv4() - if err != nil { - return fmt.Errorf("while resolving pod IPv4 address: %w", err) - } - // Sweep leftover links (kata taps from torn-down runs, restore taps) from // the persistent interior netns before the new veth peer arrives. if err := netNSDo(ctx, s.interiorNetNS, func(ctx context.Context) error { @@ -190,7 +185,11 @@ func (s *AteomService) setupActorNetwork(ctx context.Context) (retErr error) { if err := enableIPv4Forwarding(); err != nil { return err } - if err := installActorNftablesRules(podIP); err != nil { + egressPort := uint16(0) + if redirectEgress { + egressPort = s.atunnelEgressPort + } + if err := installActorNftablesRules(egressPort); err != nil { return err } @@ -287,28 +286,6 @@ func (s *AteomService) cleanupActorNetworkOrExit(ctx context.Context, msg string } } -// podIPv4 resolves the worker pod IPv4 address from the pod namespace's real -// eth0 (which stays in the pod namespace in the veth model). -func podIPv4() (net.IP, error) { - eth0Link, err := netlink.LinkByName("eth0") - if err != nil { - return nil, fmt.Errorf("while getting pod eth0: %w", err) - } - addrs, err := netlink.AddrList(eth0Link, netlink.FAMILY_V4) - if err != nil { - return nil, fmt.Errorf("while listing pod eth0 addresses: %w", err) - } - for _, addr := range addrs { - if addr.IP == nil { - continue - } - if ip := addr.IP.To4(); ip != nil { - return ip, nil - } - } - return nil, fmt.Errorf("pod eth0 has no IPv4 address") -} - func parseAddr(cidr string) (*netlink.Addr, error) { addr, err := netlink.ParseAddr(cidr) if err != nil { @@ -333,12 +310,16 @@ func enableIPv4Forwarding() error { return nil } -func installActorNftablesRules(podIP net.IP) error { +func installActorNftablesRules(egressPort uint16) error { // Dedicated ateom-owned IPv4 table (cheap cleanup, no CNI chain mutation): - // * postrouting: masquerade actor egress (169.254.17.2) behind the pod IP. - // * prerouting: DNAT pod-IP:80/tcp to the actor veth IP. + // * prerouting: redirect actor TCP to atunnel, preserving SO_ORIGINAL_DST. + // * postrouting: masquerade traffic not handled by the TCP tunnel, notably + // DNS over UDP. // * forward: accept forwarded packets between the actor veth and pod eth0. - // Mirrors cmd/ateom-gvisor (same compatibility-bridge caveats and TODOs). + // Mirrors cmd/ateom-gvisor. + // + // TODO: Restrict the compatibility masquerade to DNS traffic sent to the + // configured cluster resolver and drop all other non-tunneled actor egress. if err := removeActorNftablesRules(); err != nil { return err } @@ -357,28 +338,9 @@ func installActorNftablesRules(podIP net.IP) error { Hooknum: nftables.ChainHookPrerouting, Priority: nftables.ChainPriorityNATDest, }) - preroutingExprs := append(ipDestinationEqual(podIP.String()), tcpDestinationPortEqual(80)...) - preroutingExprs = append(preroutingExprs, - &expr.Immediate{ - Register: 1, - Data: net.ParseIP(actorVethIP).To4(), - }, - &expr.Immediate{ - Register: 2, - Data: binaryutil.BigEndian.PutUint16(80), - }, - &expr.NAT{ - Type: expr.NATTypeDestNAT, - Family: unix.NFPROTO_IPV4, - RegAddrMin: 1, - RegProtoMin: 2, - }, - ) - c.AddRule(&nftables.Rule{ - Table: table, - Chain: prerouting, - Exprs: preroutingExprs, - }) + if redirectRule := actorEgressRedirectRule(table, prerouting, egressPort); redirectRule != nil { + c.AddRule(redirectRule) + } postrouting := c.AddChain(&nftables.Chain{ Name: "postrouting", @@ -439,10 +401,6 @@ func ipSourceEqual(ip string) []expr.Any { return ipPayloadEqual(12, ip) } -func ipDestinationEqual(ip string) []expr.Any { - return ipPayloadEqual(16, ip) -} - func ipPayloadEqual(offset uint32, ip string) []expr.Any { return []expr.Any{ &expr.Payload{ @@ -459,7 +417,7 @@ func ipPayloadEqual(offset uint32, ip string) []expr.Any { } } -func tcpDestinationPortEqual(port uint16) []expr.Any { +func tcpProtocol() []expr.Any { return []expr.Any{ &expr.Meta{Key: expr.MetaKeyL4PROTO, Register: 1}, &expr.Cmp{ @@ -467,18 +425,22 @@ func tcpDestinationPortEqual(port uint16) []expr.Any { Register: 1, Data: []byte{unix.IPPROTO_TCP}, }, - &expr.Payload{ - DestRegister: 1, - Base: expr.PayloadBaseTransportHeader, - Offset: 2, - Len: 2, - }, - &expr.Cmp{ - Op: expr.CmpOpEq, + } +} + +func actorEgressRedirectRule(table *nftables.Table, chain *nftables.Chain, port uint16) *nftables.Rule { + if port == 0 { + return nil + } + exprs := append(ipSourceEqual(actorVethIP), tcpProtocol()...) + exprs = append(exprs, + &expr.Immediate{ Register: 1, Data: binaryutil.BigEndian.PutUint16(port), }, - } + &expr.Redir{RegisterProtoMin: 1}, + ) + return &nftables.Rule{Table: table, Chain: chain, Exprs: exprs} } // createNetNSWithoutSwitching creates a named netns and returns its handle, diff --git a/cmd/ateom-microvm/restore.go b/cmd/ateom-microvm/restore.go index b8778e254..0cda3d7cc 100644 --- a/cmd/ateom-microvm/restore.go +++ b/cmd/ateom-microvm/restore.go @@ -52,6 +52,9 @@ import ( func (s *AteomService) RestoreWorkload(ctx context.Context, req *ateompb.RestoreWorkloadRequest) (resp *ateompb.RestoreWorkloadResponse, retErr error) { s.lock.Lock() defer s.lock.Unlock() + if err := s.deactivateActorNetworking(ctx); err != nil { + return nil, err + } atespace := req.GetAtespace() name := req.GetActorName() @@ -113,7 +116,7 @@ func (s *AteomService) RestoreWorkload(ctx context.Context, req *ateompb.Restore // Networking: rebuild the per-activation veth + tap; the snapshot's virtio-net // is fd-backed, so CH needs fresh tap FDs (net_fds) on restore. - if err := s.setupActorNetwork(ctx); err != nil { + if err := s.setupActorNetwork(ctx, req.GetEgressGatewayAddress() != ""); err != nil { return nil, fmt.Errorf("while setting up actor network: %w", err) } defer func() { @@ -199,6 +202,9 @@ func (s *AteomService) RestoreWorkload(ctx context.Context, req *ateompb.Restore } } + if err := s.activateActorNetworking(atespace, name, req.GetActorVersion(), req.GetEgressGatewayAddress()); err != nil { + return nil, err + } s.running[actorUID] = ra s.actorLogger.EmitLifecycleLog("Actor restored", atespace, name, actorUID, templateNS, templateName) slog.InfoContext(ctx, "Actor restored (overlay rootfs)", diff --git a/cmd/ateom-microvm/run.go b/cmd/ateom-microvm/run.go index 6348a30f2..480df34d2 100644 --- a/cmd/ateom-microvm/run.go +++ b/cmd/ateom-microvm/run.go @@ -187,6 +187,9 @@ func writeGuestResolvConf(rootfs string) error { func (s *AteomService) RunWorkload(ctx context.Context, req *ateompb.RunWorkloadRequest) (resp *ateompb.RunWorkloadResponse, retErr error) { s.lock.Lock() defer s.lock.Unlock() + if err := s.deactivateActorNetworking(ctx); err != nil { + return nil, err + } atespace := req.GetAtespace() name := req.GetActorName() @@ -219,7 +222,7 @@ func (s *AteomService) RunWorkload(ctx context.Context, req *ateompb.RunWorkload // Networking (host side): per-activation veth into the interior netns. The // tap + TC mirror is built below (after the VM exists) so its FDs are fresh. - if err := s.setupActorNetwork(ctx); err != nil { + if err := s.setupActorNetwork(ctx, req.GetEgressGatewayAddress() != ""); err != nil { return nil, fmt.Errorf("while setting up actor network: %w", err) } defer func() { @@ -352,6 +355,9 @@ func (s *AteomService) RunWorkload(ctx context.Context, req *ateompb.RunWorkload } ra := &runningActor{chCmd: chCmd, vfsdCmd: vfsdCmd, apiSocket: apiSocket, baseID: actorUID, logAgent: ac} + if err := s.activateActorNetworking(atespace, name, req.GetActorVersion(), req.GetEgressGatewayAddress()); err != nil { + return nil, err + } s.running[actorUID] = ra // Forward each container's stdout/stderr into the pod logs. The overlay workload's diff --git a/cmd/benchmarking/boomer-glutton/main.go b/cmd/benchmarking/boomer-glutton/main.go index 9a5817bfd..56f1d93ce 100644 --- a/cmd/benchmarking/boomer-glutton/main.go +++ b/cmd/benchmarking/boomer-glutton/main.go @@ -37,7 +37,7 @@ import ( func main() { var ( apiEndpoint = flag.String("api-endpoint", "api.ate-system.svc.cluster.local:443", "ateapi gRPC endpoint host:port.") - routerURL = flag.String("router-url", "http://atenet-router.ate-system.svc.cluster.local", "atenet HTTP router base URL (no trailing slash).") + routerURL = flag.String("router-url", "http://ateway-ingress.ate-system.svc.cluster.local", "ingress gateway base URL (no trailing slash).") atespace = flag.String("atespace", "benchmark", "Atespace every actor this worker creates lives in. Ensured (CreateAtespace, AlreadyExists is ok) at startup.") promAddr = flag.String("prometheus-addr", ":8001", "Address for the Prometheus /metrics endpoint.") configJSON = flag.String("config-json", "", "Initial dynconfig as a JSON object (keys: trace_probability, min_wait_time, max_wait_time in seconds). Unset fields keep their built-in defaults.") diff --git a/cmd/podcertcontroller/internal/podidentitysigner/podidentitysigner.go b/cmd/podcertcontroller/internal/podidentitysigner/podidentitysigner.go index 5b63a15e4..8c35d39f3 100644 --- a/cmd/podcertcontroller/internal/podidentitysigner/podidentitysigner.go +++ b/cmd/podcertcontroller/internal/podidentitysigner/podidentitysigner.go @@ -127,7 +127,7 @@ func (h *Impl) MakeCert(ctx context.Context, pcr *certsv1beta1.PodCertificateReq NotAfter: notAfter, URIs: []*url.URL{spiffeURI}, KeyUsage: x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, } subjectCertDER, err := x509.CreateCertificate(rand.Reader, template, h.caPool.CAs[0].RootCertificate, subjectPublicKey, h.caPool.CAs[0].SigningKey) diff --git a/demos/counter/README.md b/demos/counter/README.md index 0ed987a98..04735881b 100644 --- a/demos/counter/README.md +++ b/demos/counter/README.md @@ -50,7 +50,7 @@ To interact with the router locally: ```bash # Port-forward the Atenet Router -kubectl port-forward -n ate-system svc/atenet-router 8000:80 +kubectl port-forward -n ate-system svc/ateway-ingress 8000:80 ``` ## How to Use diff --git a/demos/egress/README.md b/demos/egress/README.md new file mode 100644 index 000000000..72925bb34 --- /dev/null +++ b/demos/egress/README.md @@ -0,0 +1,45 @@ +# Egress Demo + +This demo runs an Actor that accepts `{"url":"..."}`, sends an HTTP GET to +that URL, and returns the upstream status and body. It is a fixture for future +end-to-end egress gateway tests. The gateway and tunnel plumbing are installed, +but the public Actor API does not yet provide a way to opt into tunneled egress. + +Deploy the WorkerPool and ActorTemplate: + +```bash +./hack/install-ate.sh --deploy-demo-egress +``` + +Create an Actor: + +```bash +kubectl ate create atespace demo +kubectl ate create actor egress-demo \ + --atespace demo \ + --template ate-demo-egress/egress +kubectl port-forward -n ate-system service/ateway-ingress 8000:80 +``` + +Fetch a URL through the Actor's current direct-egress path: + +```bash +curl -X POST http://localhost:8000/ \ + -H 'Host: egress-demo.demo.actors.resources.substrate.ate.dev' \ + -H 'Content-Type: application/json' \ + -d '{"url":"http://example.com/"}' +``` + +## E2E test + +Deploy this demo, then run the networking ingress suite: + +```bash +./hack/run-e2e-kind.sh ./internal/e2e/suites/networking +``` + +Remove the demo resources with: + +```bash +./hack/install-ate.sh --delete-demo-egress +``` diff --git a/demos/egress/egress.yaml.tmpl b/demos/egress/egress.yaml.tmpl new file mode 100644 index 000000000..e6f9b080f --- /dev/null +++ b/demos/egress/egress.yaml.tmpl @@ -0,0 +1,56 @@ +# Copyright 2026 Google LLC +# +# 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. + +apiVersion: v1 +kind: Namespace +metadata: + name: ate-demo-egress + +--- + +apiVersion: ate.dev/v1alpha1 +kind: WorkerPool +metadata: + name: egress + namespace: ate-demo-egress + labels: + workload: egress +spec: + replicas: 2 + ateomImage: ko://github.com/agent-substrate/substrate/cmd/ateom-gvisor + +--- + +apiVersion: ate.dev/v1alpha1 +kind: ActorTemplate +metadata: + name: egress + namespace: ate-demo-egress +spec: + pauseImage: "registry.k8s.io/pause:3.10.2@sha256:f548e0e8e3dc1896ca956272154dde3314e8cc4fde0a57577ee9fa1c63f5baf4" + containers: + - name: egress + image: ko://github.com/agent-substrate/substrate/demos/egress + command: ["/ko-app/egress"] + readyz: + httpGet: + path: /readyz + port: 80 + workerSelector: + matchLabels: + workload: egress + snapshotsConfig: + onPause: Full + onCommit: Full + location: gs://${BUCKET_NAME}/ate-demo-egress/ diff --git a/demos/egress/main.go b/demos/egress/main.go new file mode 100644 index 000000000..4c0288e12 --- /dev/null +++ b/demos/egress/main.go @@ -0,0 +1,125 @@ +// Copyright 2026 Google LLC +// +// 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. + +// Command egress is a small HTTP service for demonstrating per-Actor egress +// policy. It accepts a URL, fetches it, and returns the upstream response. +package main + +import ( + "encoding/json" + "fmt" + "io" + "log/slog" + "net/http" + "net/url" + "os" + "time" +) + +const ( + listenAddress = ":80" + maxRequestBody = 64 << 10 + maxResponseBody = 1 << 20 + requestTimeout = 15 * time.Second +) + +type fetchRequest struct { + URL string `json:"url"` +} + +type fetchResponse struct { + StatusCode int `json:"statusCode,omitempty"` + Body string `json:"body,omitempty"` + Error string `json:"error,omitempty"` +} + +func main() { + slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, nil))) + + client := &http.Client{Timeout: requestTimeout} + slog.Info("starting egress demo", "address", listenAddress) + if err := http.ListenAndServe(listenAddress, newHandler(client)); err != nil { + slog.Error("egress demo stopped", "error", err) + os.Exit(1) + } +} + +func newHandler(client *http.Client) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/readyz", func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusOK) + _, _ = io.WriteString(w, "ok\n") + }) + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + w.Header().Set("Allow", http.MethodPost) + writeJSON(w, http.StatusMethodNotAllowed, fetchResponse{Error: "method must be POST"}) + return + } + + var input fetchRequest + decoder := json.NewDecoder(http.MaxBytesReader(w, r.Body, maxRequestBody)) + if err := decoder.Decode(&input); err != nil { + writeJSON(w, http.StatusBadRequest, fetchResponse{Error: fmt.Sprintf("invalid JSON payload: %v", err)}) + return + } + if err := validateURL(input.URL); err != nil { + writeJSON(w, http.StatusBadRequest, fetchResponse{Error: err.Error()}) + return + } + + outbound, err := http.NewRequestWithContext(r.Context(), http.MethodGet, input.URL, nil) + if err != nil { + writeJSON(w, http.StatusBadRequest, fetchResponse{Error: fmt.Sprintf("invalid URL: %v", err)}) + return + } + if traceparent := r.Header.Get("traceparent"); traceparent != "" { + outbound.Header.Set("traceparent", traceparent) + } + response, err := client.Do(outbound) + if err != nil { + writeJSON(w, http.StatusBadGateway, fetchResponse{Error: fmt.Sprintf("request failed: %v", err)}) + return + } + defer response.Body.Close() + + body, err := io.ReadAll(io.LimitReader(response.Body, maxResponseBody)) + if err != nil { + writeJSON(w, http.StatusBadGateway, fetchResponse{Error: fmt.Sprintf("reading response: %v", err)}) + return + } + writeJSON(w, response.StatusCode, fetchResponse{StatusCode: response.StatusCode, Body: string(body)}) + }) + return mux +} + +func validateURL(raw string) error { + parsed, err := url.Parse(raw) + if err != nil { + return fmt.Errorf("invalid URL: %w", err) + } + if parsed.Scheme != "http" && parsed.Scheme != "https" { + return fmt.Errorf("URL scheme must be http or https") + } + if parsed.Hostname() == "" { + return fmt.Errorf("URL must include a hostname") + } + return nil +} + +func writeJSON(w http.ResponseWriter, status int, response fetchResponse) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(status) + _ = json.NewEncoder(w).Encode(response) +} diff --git a/demos/egress/main_test.go b/demos/egress/main_test.go new file mode 100644 index 000000000..6cd203732 --- /dev/null +++ b/demos/egress/main_test.go @@ -0,0 +1,109 @@ +// Copyright 2026 Google LLC +// +// 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. + +package main + +import ( + "encoding/json" + "errors" + "io" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func TestFetch(t *testing.T) { + const traceparent = "00-0123456789abcdef0123456789abcdef-0123456789abcdef-01" + client := &http.Client{Transport: roundTripFunc(func(r *http.Request) (*http.Response, error) { + if r.Method != http.MethodGet { + t.Errorf("upstream method = %s, want GET", r.Method) + } + if got := r.Header.Get("traceparent"); got != traceparent { + t.Errorf("upstream traceparent = %q, want %q", got, traceparent) + } + return &http.Response{ + StatusCode: http.StatusTeapot, + Body: io.NopCloser(strings.NewReader("hello from upstream")), + Header: make(http.Header), + }, nil + })} + + payload, err := json.Marshal(fetchRequest{URL: "https://allowed.example/"}) + if err != nil { + t.Fatal(err) + } + recorder := httptest.NewRecorder() + request := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(string(payload))) + request.Header.Set("traceparent", traceparent) + newHandler(client).ServeHTTP(recorder, request) + + if recorder.Code != http.StatusTeapot { + t.Fatalf("status = %d, want %d", recorder.Code, http.StatusTeapot) + } + var got fetchResponse + if err := json.NewDecoder(recorder.Body).Decode(&got); err != nil { + t.Fatalf("decoding response: %v", err) + } + if got.StatusCode != http.StatusTeapot || got.Body != "hello from upstream" { + t.Errorf("response = %+v", got) + } +} + +func TestInvalidRequests(t *testing.T) { + tests := []struct { + name string + method string + body string + status int + }{ + {name: "method", method: http.MethodGet, body: `{}`, status: http.StatusMethodNotAllowed}, + {name: "malformed JSON", method: http.MethodPost, body: `{`, status: http.StatusBadRequest}, + {name: "missing hostname", method: http.MethodPost, body: `{"url":"https:///path"}`, status: http.StatusBadRequest}, + {name: "unsupported scheme", method: http.MethodPost, body: `{"url":"file:///etc/passwd"}`, status: http.StatusBadRequest}, + } + + handler := newHandler(http.DefaultClient) + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + recorder := httptest.NewRecorder() + request := httptest.NewRequest(test.method, "/", strings.NewReader(test.body)) + handler.ServeHTTP(recorder, request) + if recorder.Code != test.status { + t.Errorf("status = %d, want %d; body = %s", recorder.Code, test.status, recorder.Body.String()) + } + }) + } +} + +func TestOutboundFailure(t *testing.T) { + client := &http.Client{Transport: roundTripFunc(func(*http.Request) (*http.Response, error) { + return nil, errors.New("blocked") + })} + handler := newHandler(client) + recorder := httptest.NewRecorder() + request := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(`{"url":"https://example.com/"}`)) + + handler.ServeHTTP(recorder, request) + + if recorder.Code != http.StatusBadGateway { + t.Errorf("status = %d, want %d; body = %s", recorder.Code, http.StatusBadGateway, recorder.Body.String()) + } +} + +type roundTripFunc func(*http.Request) (*http.Response, error) + +func (f roundTripFunc) RoundTrip(request *http.Request) (*http.Response, error) { + return f(request) +} diff --git a/demos/multi-template/README.md b/demos/multi-template/README.md index 8eb883dd8..7b2705d97 100644 --- a/demos/multi-template/README.md +++ b/demos/multi-template/README.md @@ -55,7 +55,7 @@ kubectl ate create actor f1 -a demo --template ate-demo-multi-template-fspersist To interact with the router locally: ```bash -kubectl port-forward -n ate-system svc/atenet-router 8000:80 +kubectl port-forward -n ate-system svc/ateway-ingress 8000:80 ``` ## How to Use diff --git a/demos/sandbox/README.md b/demos/sandbox/README.md index 174393473..65e9070d4 100644 --- a/demos/sandbox/README.md +++ b/demos/sandbox/README.md @@ -66,7 +66,7 @@ If running clients locally, port-forward the API and router in separate terminal kubectl port-forward -n ate-system svc/api 8080:443 # Terminal 2: Router -kubectl port-forward -n ate-system svc/atenet-router 8000:80 +kubectl port-forward -n ate-system svc/ateway-ingress 8000:80 ``` ## How to Use the Client diff --git a/docs/architecture.md b/docs/architecture.md index a29251446..9cfb103cc 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -340,13 +340,23 @@ A `WorkerPool` selects a **sandbox class** (`spec.sandboxClass`), and each class * **micro-VM** (`ateom-microvm`): Runs the workload inside a [Kata Containers](https://katacontainers.io/) guest on the [Cloud Hypervisor](https://www.cloudhypervisor.org/) VMM. Suspend and resume capture a memory-only VM snapshot and restore it on-demand using `userfaultfd` memory demand-paging, with container rootfs writes captured in guest RAM via a `tmpfs` overlay. -### Networking Stack (`atenet` + Envoy) +### Networking Stack (`atenet` DNS + `ateway` + `atunnel`) Handles session-aware routing and automatic re-animation. * **Uniform DNS Mesh**: Substrate provides a location-transparent actor discovery scheme via a global DNS suffix (`..actors.resources.substrate.ate.dev`). - * **Routing**: The `atenet` router (powered by Envoy and an External Processing server) intercepts traffic destined for the mesh. It extracts the actor name from the `Host` header, queries the Control Plane to determine the actor's current location, and triggers a `ResumeActor` workflow if the session is currently suspended. + * **Ingress Routing**: `ateway-ingress` runs + [agentgateway](https://github.com/agentgateway/agentgateway) and accepts HTTP + traffic for the Actor DNS suffix. Its Substrate routing policy extracts the + Actor name and Atespace from the `Host` header and calls the Control Plane to + resume the Actor and resolve its current worker assignment. + + * **Worker Tunnel**: After resolving the assignment, `ateway-ingress` opens an + authenticated TLS tunnel to the worker's `atunnel` listener on port 443. + `atunnel`, hosted by `ateom`, forwards the request to the active Actor over + its private veth interface. Worker pod port 80 is not a direct Actor ingress + path. * **Latency**: The data plane is optimized for sub-100ms activation by bypassing Kubernetes' eventual consistency and performing atomic physical assignments. @@ -360,26 +370,29 @@ suspended (UML sequence diagram): sequenceDiagram actor Client participant DNS as atenet DNS - participant Router as atenet router + participant Gateway as ateway-ingress participant API as ate-api-server participant Atelet as atelet - participant Ateom as ateom + participant Tunnel as ateom / atunnel + participant Actor participant Store as snapshot storage Client->>DNS: resolve actor DNS name - DNS-->>Client: router address - Client->>Router: HTTP request (Host = actor) - Router->>API: ResumeActor(actorName) + DNS-->>Client: ingress gateway address + Client->>Gateway: HTTP request (Host = actor) + Gateway->>API: ResumeActor(atespace, actor name) API->>Atelet: Restore Store-->>Atelet: download snapshot - Atelet->>Ateom: RestoreWorkload - Note over Ateom: runsc restore - Ateom-->>Atelet: ready + Atelet->>Tunnel: RestoreWorkload + Note over Tunnel: restore sandbox and activate Actor network + Tunnel-->>Atelet: ready Atelet-->>API: worker pod IP - API-->>Router: worker pod IP - Router->>Ateom: proxy request to worker pod - Ateom-->>Router: response - Router-->>Client: response + API-->>Gateway: worker assignment + Gateway->>Tunnel: mTLS tunnel to worker port 443 + Tunnel->>Actor: forward request to Actor port + Actor-->>Tunnel: response + Tunnel-->>Gateway: response + Gateway-->>Client: response Note over API,Store: later: an explicit SuspendActor checkpoints back to storage and frees the worker ``` @@ -423,8 +436,9 @@ Triggered by an inbound request at the Gateway or an explicit API call. 4. **Status**: Status transitions to `STATUS_RUNNING`. The actor now has an active Worker IP. - 5. **Response**: The Control Plane returns the worker IP to the Gateway, - which forwards the original request. + 5. **Response**: The Control Plane returns the worker assignment to the + Gateway. The Gateway opens an authenticated tunnel to `atunnel` on that + worker, which forwards the original request to the active Actor. ### Phase 3: Hibernation (`SuspendActor`) diff --git a/docs/dev/code-layout.md b/docs/dev/code-layout.md index 1a6c7b8de..1cf562078 100644 --- a/docs/dev/code-layout.md +++ b/docs/dev/code-layout.md @@ -50,7 +50,7 @@ Each subdirectory of `cmd/` corresponds to one compiled binary: | `cmd/ateapi` | Control-plane API server (gRPC) | | `cmd/atecontroller` | Kubernetes controller for WorkerPool/ActorTemplate | | `cmd/atelet` | Node supervisor (DaemonSet) | -| `cmd/atenet` | Network proxy / Envoy external-processing server | +| `cmd/atenet` | Actor DNS controller | | `cmd/ateom-gvisor` | In-pod gVisor container image entry point | | `cmd/ateom-microvm` | In-pod kata + cloud-hypervisor micro-VM container image entry point | | `cmd/kubectl-ate` | `kubectl` plugin for interacting with Substrate | diff --git a/docs/observability.md b/docs/observability.md index bbe9aeee4..458160997 100644 --- a/docs/observability.md +++ b/docs/observability.md @@ -107,7 +107,6 @@ Agent Substrate emits foundational OpenTelemetry system and server metrics to mo | Metric | Emitted by | Type | Measures | |--------|------------|------|----------| | `rpc.server.call.duration` | ateapi & atelet (gRPC servers, via `otelgrpc`) | histogram | per-method gRPC latency, request rate, and errors (labels `rpc.method`, `rpc.response.status_code`) | -| `atenet.router.route.duration` | atenet-router | histogram | Substrate E2E — Envoy receiving a request to Envoy forwarding it to the resolved worker, excluding actor compute and the response | | `atelet.snapshot.size` | atelet | histogram | uncompressed size in bytes of each gVisor snapshot image written during checkpoint (labels `kind`, `actor_template_namespace`, `actor_template_name`) | The table lists the OpenTelemetry instrument names. How a name appears in a query depends on the backend (Cloud Monitoring (GMP) / Kind collector). @@ -136,7 +135,7 @@ To explore metrics locally: ## 3. Tracing -Distributed tracing tracks the end-to-end flow of requests as they pass through the Agent Substrate gateway, router, worker pods, and external services. +Distributed tracing tracks the end-to-end flow of requests as they pass through the Agent Substrate gateway, worker pods, and external services. Currently, Agent Substrate supports on-demand request tracing. When initiated by a client (e.g., via the `--trace` flag), Agent Substrate leverages OpenTelemetry (OTel) for context propagation across the call stack. Each traced request generates a unique trace hash/ID, which you can use to inspect the detailed request lifecycle and span hierarchy inside Google Cloud Trace or Jaeger. @@ -178,8 +177,6 @@ Telemetry is emitted the same way everywhere; only the backend differs between a | Traces | Jaeger UI | Google Cloud Trace | | Dashboards | Not supported | Google Cloud Monitoring (see [Dashboards](#5-dashboards)) | -> In Kind only `ateapi` and `atelet` are pointed at the in-cluster collector; `atenet-router` still targets the GKE collector endpoint, so `atenet.router.route.duration` is emitted but not collected locally. - --- ## 5. Dashboards diff --git a/docs/threat-model.md b/docs/threat-model.md index 7e3a0d1ac..250126928 100644 --- a/docs/threat-model.md +++ b/docs/threat-model.md @@ -41,9 +41,9 @@ Substrate is an early, fast moving product. It is full of debate and subject to * **ateom:** Per-worker Pod sidecar, running inside the worker Pod. Ateom sets up "interior" sandboxes in the worker Pod and manages sandbox lifecycle, including image pulls. It currently uses gvisor but Substrate will support multiple microvm solutions. * **Worker:** Preprovisioned Pods that actors get scheduled to. * **Actor:** The core compute primitive, gets scheduled to/from worker via Run for cold start and Resume for snapshot resume. -* **Actor IP:** Actor networking is based on Pod networking. Each actor gets the IP of the worker it's currently scheduled to. The ateom has the opportunity to set up additional rules when it sets up interior sandboxes. -* **Actor DNS:** Each Actor gets a DNS name like `..actors.resources.substrate.ate.dev`. Substrate runs a custom CoreDNS instance that returns atenet-router's IP address for any A record query matching the actor DNS name pattern. Substrate also includes a built-in controller that both keeps Substrate's CoreDNS configuration up to date with the router's Service IP and updates kube-dns with a stub domain for `actors.resources.substrate.ate.dev` that points to the IP of Substrate's CoreDNS Service. The latter enables traditional Kubernetes Pods to resolve Substrate Actor DNS names. -* **atenet-router:** Substrate runs an Envoy proxy to handle ingress to actors. When a client sends a request to an actor's DNS name, it is resolved to atenet-router's Envoy sidecar. Envoy then forwards headers to atenet-router (ext\_proc filter), which extracts the actor name, automatically resumes the actor if it is in a suspended state, queries the Substrate API for the current IP of the actor, and tells Envoy to rewrite the host header to the actor IP before forwarding the request to the actor. atenet-router includes a local xDS server that configures the Envoy sidecar with this behavior. +* **Actor Network:** `ateom` creates a private point-to-point veth network for the active Actor inside a worker Pod. The Actor is not served directly from the worker Pod's port 80; ingress enters through `atunnel`'s authenticated listener on port 443. +* **Actor DNS:** Each Actor gets a DNS name like `..actors.resources.substrate.ate.dev`. Substrate runs a custom CoreDNS instance that returns the `ateway-ingress` Service IP for A record queries matching the Actor DNS pattern. A controller keeps this target current and configures kube-dns with a stub domain for `actors.resources.substrate.ate.dev`, enabling traditional Kubernetes Pods to resolve Actor names. +* **ateway-ingress:** Substrate runs agentgateway to handle Actor ingress. Its Substrate routing policy extracts the Actor name and Atespace from the HTTP `Host` header, calls the Substrate API to resume the Actor and obtain its current worker assignment, and selects that worker as a dynamic backend. The gateway then connects with mTLS to `atunnel` on worker port 443; `atunnel` validates the gateway identity and forwards traffic only to the Actor currently assigned to that worker. * **Object Storage:** Used to store actor snapshots. * **Filesystem support:** Container local filesystem is saved in snapshots, future integrations likely to include networked storage. * **Substrate Database:** Currently Valkey (Redis-compatible API). The choice of backend database/interface is under active debate. @@ -73,13 +73,13 @@ While it's probably unlikely that Substrate, which is expected to be an internal | GitHub Issue | Priority | Threat | Mitigating Invariants | Suggested Concrete Mitigations | Notes | | :---- | :---- | :---- | :---- | :---- | :---- | -| | Critical | Access to the internal network allows arbitrary actions to be performed on ate-apiserver, atelet, substrate backend database, etc. | All system components must have basic mutual authentication and authorization, and communicate over TLS. All clients (including end users and actors) must be authenticated and authorized. Unauthenticated traffic must be rejected. Where possible, use firewalls to block access from ranges that have no business communicating with Substrate components. | mTLS or other secure channel (e.g. UDS) between networked system components (ate-apiserver, atelet, ateom, etc) each atelet has a unique identity cryptographically tied to the node identity ate-router should check client permissions before resuming actors or forwarding traffic to actors. The only component authorized to connect directly to the backend database should be ate-apiserver. Use Kubernetes NetworkPolicy to block access to the Substrate API and other core components by default. | | +| | Critical | Access to the internal network allows arbitrary actions to be performed on ate-apiserver, atelet, substrate backend database, etc. | All system components must have basic mutual authentication and authorization, and communicate over TLS. All clients (including end users and actors) must be authenticated and authorized. Unauthenticated traffic must be rejected. Where possible, use firewalls to block access from ranges that have no business communicating with Substrate components. | mTLS or other secure channel (e.g. UDS) between networked system components (ate-apiserver, atelet, ateom, etc); each atelet has a unique identity cryptographically tied to the node identity. The ingress gateway should check client permissions before resuming actors or forwarding traffic to actors. The only component authorized to connect directly to the backend database should be ate-apiserver. Use Kubernetes NetworkPolicy to block access to the Substrate API and other core components by default. | | | | High | Privilege escalation via access to sensitive labels. | If Substrate offers its own resource labeling mechanism, it must also offer a way to authorize label updates on a per-label basis. | Substrate authorization system requires explicit authorization to update metadata, separate from updating resource body. Substrate authorization system supports per-label authorization rules. | Plenty of attacks in K8s were possible because labels had semantic meaning, but the permission model could implicitly granted access to modify labels, even if it was inappropriate. For example, /status subresource allows label updates. Substrate shouldn't repeat this mistake. | -| | High | Attacker gains control of Substrate API server, router, or other ingress/egress proxy. | Isolate the control plane from the data plane, and isolate data plane ingress from sandboxes. | Don't co-locate ate-apiserver or other control-plane components on the same machines as the untrusted sandboxes. This also supports control-plane / data-plane isolation from a reliability and performance perspective. Consider running any gateway/router that enables direct interaction with sandboxes on a separate VM from the sandboxes. Consider using a zero-trust architecture where traffic is encrypted and authenticated end-to-end and routed via a mesh. | While the sandbox is trusted as an isolation layer, the residual risk is typically not worth the marginal cost savings of colocating, and isolation is recommend to avoid noisy neighbor problems and other reliability issues that stem from mixing the control-plane and data-plane, especially for large scale deployments of Substrate. | +| | High | Attacker gains control of the Substrate API server or an ingress/egress gateway. | Isolate the control plane from the data plane, and isolate data plane ingress from sandboxes. | Don't co-locate ate-apiserver or other control-plane components on the same machines as the untrusted sandboxes. This also supports control-plane / data-plane isolation from a reliability and performance perspective. Consider running any gateway that enables direct interaction with sandboxes on a separate VM from the sandboxes. Consider using a zero-trust architecture where traffic is encrypted and authenticated end-to-end and routed via a mesh. | While the sandbox is trusted as an isolation layer, the residual risk is typically not worth the marginal cost savings of colocating, and isolation is recommend to avoid noisy neighbor problems or other reliability issues that stem from mixing the control-plane and data-plane, especially for large scale deployments of Substrate. | | | High | Attacker who can create ActorTemplates specifies malicious runtime. | Ensure available runtime can only be configured by administrators. | Consider a mechanism like RuntimeClass to decouple configuration of available runtimes from consumption of available runtimes. | | | | High | Attacker who can create ActorTemplates can read or write any storage buckets atelet has access to. | Ensure that bucket access is least-privilege. | Use credentials derived from actor identity to read snapshots. Configure permissions to prevent atelet or nodes from having access to sensitive buckets. Don't support arbitrary URLs in APIs, instead design a standard approach for accessing the correct resource given the ActorTemplate name and compute the mapping internally, subject to scheduling-aware authorization checks. | For example: Attacker creates an ActorTemplate with the runsc URL or golden snapshot URL pointing to an arbitrary bucket in the same project/resource scope as the cluster. If atelet has project-wide access to buckets, this could cause the state to be pulled into the worker pod or malicious actor. Similarly, an attacker could set the snapshots URL to point to an internal infrastructure bucket, causing data to be written to that bucket. | -| | Medium | DoS attack against API, router, or available cluster resources. | Minimize exposure and ensure APIs and proxies implement appropriately scoped quotas and rate limiting. | Don't co-locate ate-apiserver or other control-plane components on the same machines as the untrusted sandboxes. Don't expose ate-apiserver directly to the internet. Consider an identity-aware WAF (likely up to providers) if external access is required. Use network policy to block direct interaction between untrusted sandboxes and the ate-apiserver. Implement quotas and rate limiting in the API and in proxies. This includes quotas for the number of actors a user can allocate. Use a zero-trust architecture that prevents identity spoofing or intentional misrouting to get around limits. | Notably, the router checks ate-apiserver for the actor IP on each request. A flood of traffic to actors could potentially result in high read load on ate-apiserver. Caching could be considered, but cache invalidation during actor rescheduling would be important to avoid misrouting traffic. | -| | Medium | Internal network traffic is intercepted or spoofed | Encrypt all traffic by default | Use mTLS between all system components, and between the router and actors. | It may be desirable to rely on cloud providers to transparently encrypt traffic between VMs on their internal network. Worth discussing what makes the most sense. | +| | Medium | DoS attack against API, gateway, or available cluster resources. | Minimize exposure and ensure APIs and proxies implement appropriately scoped quotas and rate limiting. | Don't co-locate ate-apiserver or other control-plane components on the same machines as the untrusted sandboxes. Don't expose ate-apiserver directly to the internet. Consider an identity-aware WAF (likely up to providers) if external access is required. Use network policy to block direct interaction between untrusted sandboxes and the ate-apiserver. Implement quotas and rate limiting in the API and in proxies. This includes quotas for the number of actors a user can allocate. Use a zero-trust architecture that prevents identity spoofing or intentional misrouting to get around limits. | The gateway calls ate-apiserver to resolve Actor assignments and uses a short-lived cache. A flood of Actor traffic could still create high API load; cache invalidation during Actor rescheduling must avoid stale routing. | +| | Medium | Internal network traffic is intercepted or spoofed | Encrypt all traffic by default | Use mTLS between all system components, including the gateway-to-worker `atunnel` connection. | It may be desirable to rely on cloud providers to transparently encrypt traffic between VMs on their internal network. Worth discussing what makes the most sense. | ## Misconfiguration Risks @@ -88,7 +88,7 @@ While it's probably unlikely that Substrate, which is expected to be an internal | | High | Improper handling of Secrets | Ensure there is an official, secure, recommended way to pass secret data, like API access tokens, to actors. | Support env and filesystem plumbing for Kubernetes Secrets, to provide an official path that avoids secret material being plumbed via nonspecific fields that are difficult to audit. Ensure secrets are encrypted in transit and ideally stored in memory. If exposed via the filesystem, do so via in-memory tmpfs. | If we don't support this, users will inevitably put secrets in plaintext. | | | Medium | Complexity configuring permissions for frameworks on top of Substrate may lead to unintentional privilege escalation. | It must be clear to users what the downstream effects of auth config in substrate are. | If it's not intuitive, it must be documented in a user guide. | AI framework has to set up permissions to access ATE, and to access K8s, and potentially for actors (based on ATE identity and K8s identity) to access the framework. We need to make this easy. Think about past K8s issues like escalate/bind risk. Substrate resource model is spread across ate-apiserver and K8s, increasing complexity and chance for error. | | | Medium | Flat namespace of actors encourages broad permission grants or complex graph-oriented policy. | Support a grouping mechanism that can be used in policy controls. | Add namespaces to Substrate, similar to Kubernetes. | | -| | Medium | DNS misconfiguration | Access to DNS configuration should be limited to authoritative controllers. Routing should use stable configurations and query the API for the current IP before routing each request. | Don't co-locate controllers with access to sensitive system state on the same nodes as actors. Limit permissions to update DNS configuration. Actively query Substrate API to ensure IPs are as up-to-date as possible. Potentially use mTLS based on actor DNS name between ate-router and actors. | As noted above, a flood of requests could create high read load on ate-apiserver. Caching could be considered, but cache invalidation during actor rescheduling would be important to avoid misrouting traffic. Establishing a backend mTLS tunnel between ate-router and each actor based on a serving cert signed for the actor's DNS name could be another approach to avoiding misrouting. | +| | Medium | DNS misconfiguration | Access to DNS configuration should be limited to authoritative controllers. Routing should use stable configurations and query the API for the current worker assignment before forwarding requests. | Don't co-locate controllers with access to sensitive system state on the same nodes as actors. Limit permissions to update DNS configuration. Use the Substrate API and bounded caching to keep assignments current. Authenticate gateway-to-worker traffic with mTLS. | A flood of requests could create high read load on ate-apiserver. Cache invalidation during Actor rescheduling is important to avoid stale routing. The gateway-to-`atunnel` mTLS connection prevents the removed direct worker-port path from bypassing worker assignment checks. | ## Attacks from Actors diff --git a/go.mod b/go.mod index 0bc9e101e..135b68e1d 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,6 @@ require ( github.com/aws/aws-sdk-go-v2/config v1.32.17 github.com/aws/aws-sdk-go-v2/service/s3 v1.101.0 github.com/containerd/ttrpc v1.2.8 - github.com/envoyproxy/go-control-plane v0.14.0 - github.com/envoyproxy/go-control-plane/envoy v1.37.0 github.com/google/go-cmp v0.7.0 github.com/google/go-containerregistry v0.21.5 github.com/google/nftables v0.3.0 @@ -96,7 +94,7 @@ require ( github.com/docker/cli v29.4.0+incompatible // indirect github.com/docker/docker-credential-helpers v0.9.3 // indirect github.com/emicklei/go-restful/v3 v3.13.0 // indirect - github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/fatih/color v1.18.0 // indirect diff --git a/hack/install-ate.sh b/hack/install-ate.sh index c8f568975..b054b9009 100755 --- a/hack/install-ate.sh +++ b/hack/install-ate.sh @@ -40,6 +40,7 @@ ATE_DEMOS=() # Include demos. source "${ROOT}"/hack/install-demo-counter.sh +source "${ROOT}"/hack/install-demo-egress.sh source "${ROOT}"/hack/install-demo-sandbox.sh source "${ROOT}"/hack/install-demo-claude-code-multiplex.sh source "${ROOT}"/hack/install-demo-agent-secret.sh @@ -305,7 +306,8 @@ deploy_ate_system() { log_step "Waiting for ATE system components to be ready..." run_kubectl rollout status deployment/ate-api-server -n ate-system --timeout=120s run_kubectl rollout status deployment/ate-controller -n ate-system --timeout=120s - run_kubectl rollout status deployment/atenet-router -n ate-system --timeout=120s + run_kubectl rollout status deployment/ateway-ingress -n ate-system --timeout=120s + run_kubectl rollout status deployment/ateway-egress -n ate-system --timeout=120s run_kubectl rollout status statefulset/valkey-cluster -n ate-system --timeout=120s run_kubectl rollout status daemonset/atelet -n ate-system --timeout=120s } @@ -368,9 +370,11 @@ deploy_atenet() { run_kubectl apply -f manifests/ate-install/ate-system-namespace.yaml \ && run_kubectl wait --for=jsonpath='{.status.phase}'=Active namespace/ate-system --timeout=60s - run_ko apply -f manifests/ate-install/atenet-router.yaml + run_kubectl apply -f manifests/ate-install/ateway-ingress.yaml + run_kubectl apply -f manifests/ate-install/ateway-egress.yaml run_ko apply -f manifests/ate-install/atenet-dns.yaml - run_kubectl rollout status deployment/atenet-router -n ate-system --timeout=120s + run_kubectl rollout status deployment/ateway-ingress -n ate-system --timeout=120s + run_kubectl rollout status deployment/ateway-egress -n ate-system --timeout=120s run_kubectl rollout status deployment/atenet-dns -n ate-system --timeout=120s } @@ -484,7 +488,9 @@ delete_ate_system() { delete_atenet() { log_step "delete_atenet" - run_kubectl delete --ignore-not-found -f manifests/ate-install/atenet-router.yaml + run_kubectl delete --ignore-not-found -f manifests/ate-install/ateway-ingress.yaml + run_kubectl delete --ignore-not-found -f manifests/ate-install/ateway-egress.yaml + run_kubectl delete --ignore-not-found -f manifests/ate-install/atenet-dns.yaml } deploy_benchmarks() { diff --git a/hack/install-demo-egress.sh b/hack/install-demo-egress.sh new file mode 100644 index 000000000..17a21f266 --- /dev/null +++ b/hack/install-demo-egress.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# Copyright 2026 Google LLC +# +# 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. +# +# This is sourced as part of install-ate.sh. Do not run directly. + +ATE_DEMOS+=(demo-egress) # register demo-egress + +demo-egress_cmdline() { + case "${1}" in + --deploy-demo-egress) demo-egress_deploy ;; + --delete-demo-egress) demo-egress_delete ;; + *) + return 1 + ;; + esac + return 0 +} + +demo-egress_deploy() { + log_step "demo-egress_deploy" + ensure_crds + sed "s|\${BUCKET_NAME}|${BUCKET_NAME}|g" demos/egress/egress.yaml.tmpl \ + | run_ko apply -f - + + log_step "Waiting for egress demo to be ready..." + run_kubectl rollout status deployment/egress-deployment -n ate-demo-egress --timeout=300s + run_kubectl wait --for=condition=Ready actortemplate/egress -n ate-demo-egress --timeout=300s +} + +demo-egress_delete() { + log_step "demo-egress_delete" + delete_demo_actors ate-demo-egress egress + sed "s|\${BUCKET_NAME}|${BUCKET_NAME}|g" demos/egress/egress.yaml.tmpl \ + | run_kubectl delete --ignore-not-found -f - +} diff --git a/hack/run-e2e.sh b/hack/run-e2e.sh index d86978afc..5ea3d865a 100755 --- a/hack/run-e2e.sh +++ b/hack/run-e2e.sh @@ -15,6 +15,7 @@ # limitations under the License. set -o errexit -o nounset -o pipefail +set -x ROOT="$(git rev-parse --show-toplevel)" cd "${ROOT}" diff --git a/hack/run-microvm-demo.sh b/hack/run-microvm-demo.sh index 2e29f6ba6..1cd783527 100755 --- a/hack/run-microvm-demo.sh +++ b/hack/run-microvm-demo.sh @@ -170,8 +170,8 @@ cat <= http.StatusMultipleChoices { + body, _ := io.ReadAll(io.LimitReader(resp.Body, 4<<10)) + _ = resp.Body.Close() + _ = tlsConn.Close() + message := strings.TrimSpace(string(body)) + if message == "" { + message = http.StatusText(resp.StatusCode) + } + return nil, fmt.Errorf("atunnel: egress gateway rejected CONNECT with %s: %s", resp.Status, message) + } + + return &bufferedConn{Conn: tlsConn, reader: reader}, nil +} + +func validateDestination(destination string) error { + host, port, err := net.SplitHostPort(destination) + if err != nil { + return fmt.Errorf("atunnel: invalid egress destination %q: %w", destination, err) + } + if host == "" { + return fmt.Errorf("atunnel: invalid egress destination %q: host is empty", destination) + } + if net.ParseIP(host) == nil { + return fmt.Errorf("atunnel: invalid egress destination %q: host must be an IP address", destination) + } + portNumber, err := strconv.Atoi(port) + if err != nil || portNumber < 1 || portNumber > 65535 { + return fmt.Errorf("atunnel: invalid egress destination %q: port must be between 1 and 65535", destination) + } + return nil +} + +type bufferedConn struct { + net.Conn + reader *bufio.Reader +} + +func (c *bufferedConn) Read(p []byte) (int, error) { + return c.reader.Read(p) +} + +func (c *bufferedConn) CloseWrite() error { + if conn, ok := c.Conn.(interface{ CloseWrite() error }); ok { + return conn.CloseWrite() + } + return nil +} diff --git a/internal/atunnel/client_test.go b/internal/atunnel/client_test.go new file mode 100644 index 000000000..f52629f19 --- /dev/null +++ b/internal/atunnel/client_test.go @@ -0,0 +1,251 @@ +// Copyright 2026 Google LLC +// +// 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. + +package atunnel + +import ( + "bufio" + "context" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/tls" + "crypto/x509" + "encoding/pem" + "fmt" + "io" + "math/big" + "net" + "net/http" + "os" + "path/filepath" + "strings" + "testing" + "time" +) + +func TestClientDialContext(t *testing.T) { + ca := newTestCA(t) + client := newTestClient(t, ca) + request := make(chan *http.Request, 1) + gatewayAddress := serveTestConnectGateway(t, ca, func(conn net.Conn, req *http.Request) { + request <- req + if _, err := io.WriteString(conn, "HTTP/1.1 200 Connection Established\r\n\r\nhello"); err != nil { + t.Errorf("writing CONNECT response: %v", err) + return + } + payload := make([]byte, len("ping")) + if _, err := io.ReadFull(conn, payload); err != nil { + t.Errorf("reading tunneled payload: %v", err) + return + } + if string(payload) != "ping" { + t.Errorf("tunneled payload = %q, want ping", payload) + } + }) + client.gatewayAddress = gatewayAddress + + conn, err := client.DialContext(context.Background(), "192.0.2.10:443", EgressMetadata{ + Atespace: "team-a", + ActorName: "actor-1", + ActorVersion: 7, + BearerToken: "actor-token", + }) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + + gotRequest := <-request + if gotRequest.Method != http.MethodConnect { + t.Errorf("method = %q, want CONNECT", gotRequest.Method) + } + if gotRequest.Host != "192.0.2.10:443" { + t.Errorf("authority = %q, want 192.0.2.10:443", gotRequest.Host) + } + if got := gotRequest.Header.Get(ActorAtespaceHeader); got != "team-a" { + t.Errorf("%s = %q, want team-a", ActorAtespaceHeader, got) + } + if got := gotRequest.Header.Get(ActorNameHeader); got != "actor-1" { + t.Errorf("%s = %q, want actor-1", ActorNameHeader, got) + } + if got := gotRequest.Header.Get(ActorVersionHeader); got != "7" { + t.Errorf("%s = %q, want 7", ActorVersionHeader, got) + } + if got := gotRequest.Header.Get("Authorization"); got != "Bearer actor-token" { + t.Errorf("Authorization = %q, want Bearer actor-token", got) + } + + buffered := make([]byte, len("hello")) + if _, err := io.ReadFull(conn, buffered); err != nil { + t.Fatal(err) + } + if string(buffered) != "hello" { + t.Errorf("buffered payload = %q, want hello", buffered) + } + if _, err := io.WriteString(conn, "ping"); err != nil { + t.Fatal(err) + } +} + +func TestClientDialContextRejected(t *testing.T) { + ca := newTestCA(t) + client := newTestClient(t, ca) + client.gatewayAddress = serveTestConnectGateway(t, ca, func(conn net.Conn, _ *http.Request) { + body := "denied by policy" + _, _ = fmt.Fprintf(conn, "HTTP/1.1 403 Forbidden\r\nContent-Length: %d\r\n\r\n%s", len(body), body) + }) + + _, err := client.DialContext(context.Background(), "192.0.2.10:443", EgressMetadata{ + Atespace: "team-a", + ActorName: "actor-1", + ActorVersion: 7, + }) + if err == nil || !strings.Contains(err.Error(), "denied by policy") { + t.Fatalf("DialContext error = %v, want policy rejection", err) + } +} + +func TestClientDialContextValidatesInput(t *testing.T) { + ca := newTestCA(t) + client := newTestClient(t, ca) + tests := []struct { + name string + destination string + metadata EgressMetadata + }{ + { + name: "destination has no port", + destination: "192.0.2.10", + metadata: EgressMetadata{Atespace: "team-a", ActorName: "actor-1", ActorVersion: 7}, + }, + { + name: "destination is a hostname", + destination: "example.com:443", + metadata: EgressMetadata{Atespace: "team-a", ActorName: "actor-1", ActorVersion: 7}, + }, + { + name: "invalid atespace", + destination: "192.0.2.10:443", + metadata: EgressMetadata{Atespace: "TEAM A", ActorName: "actor-1", ActorVersion: 7}, + }, + { + name: "invalid actor", + destination: "192.0.2.10:443", + metadata: EgressMetadata{Atespace: "team-a", ActorName: "actor/1", ActorVersion: 7}, + }, + { + name: "invalid actor version", + destination: "192.0.2.10:443", + metadata: EgressMetadata{Atespace: "team-a", ActorName: "actor-1"}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if _, err := client.DialContext(context.Background(), tt.destination, tt.metadata); err == nil { + t.Fatal("DialContext unexpectedly succeeded") + } + }) + } +} + +func newTestClient(t *testing.T, ca *testCA) *Client { + t.Helper() + dir := t.TempDir() + bundlePath := filepath.Join(dir, "client.pem") + trustPath := filepath.Join(dir, "trust.pem") + writeCredentialBundle(t, bundlePath, ca.issue(t, + "spiffe://cluster.local/ns/ate-demo/sa/ateom", + []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + )) + if err := os.WriteFile(trustPath, ca.certPEM, 0o600); err != nil { + t.Fatal(err) + } + client, err := NewClient(ClientConfig{ + GatewayAddress: "127.0.0.1:1", + ServerName: "egress.test", + CredentialBundlePath: bundlePath, + TrustBundlePath: trustPath, + }) + if err != nil { + t.Fatal(err) + } + return client +} + +func serveTestConnectGateway(t *testing.T, ca *testCA, handle func(net.Conn, *http.Request)) string { + t.Helper() + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + serverCert := issueDNSCertificate(t, ca, "egress.test") + clientCAs := x509.NewCertPool() + clientCAs.AppendCertsFromPEM(ca.certPEM) + tlsListener := tls.NewListener(listener, &tls.Config{ + MinVersion: tls.VersionTLS12, + Certificates: []tls.Certificate{serverCert}, + ClientAuth: tls.RequireAndVerifyClientCert, + ClientCAs: clientCAs, + }) + t.Cleanup(func() { _ = tlsListener.Close() }) + + go func() { + conn, err := tlsListener.Accept() + if err != nil { + return + } + defer conn.Close() + req, err := http.ReadRequest(bufio.NewReader(conn)) + if err != nil { + t.Errorf("reading CONNECT request: %v", err) + return + } + handle(conn, req) + }() + return listener.Addr().String() +} + +func issueDNSCertificate(t *testing.T, ca *testCA, dnsName string) tls.Certificate { + t.Helper() + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + now := time.Now() + template := &x509.Certificate{ + SerialNumber: big.NewInt(now.UnixNano()), + NotBefore: now.Add(-time.Minute), + NotAfter: now.Add(time.Hour), + DNSNames: []string{dnsName}, + KeyUsage: x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + } + der, err := x509.CreateCertificate(rand.Reader, template, ca.cert, &key.PublicKey, ca.key) + if err != nil { + t.Fatal(err) + } + keyDER, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + t.Fatal(err) + } + cert, err := tls.X509KeyPair( + pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der}), + pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: keyDER}), + ) + if err != nil { + t.Fatal(err) + } + return cert +} diff --git a/internal/atunnel/egress.go b/internal/atunnel/egress.go new file mode 100644 index 000000000..5b1d63b08 --- /dev/null +++ b/internal/atunnel/egress.go @@ -0,0 +1,207 @@ +// Copyright 2026 Google LLC +// +// 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. + +package atunnel + +import ( + "context" + "errors" + "fmt" + "io" + "log/slog" + "net" + "sync" + + "github.com/agent-substrate/substrate/internal/resources" +) + +// EgressDialer opens an authenticated tunnel to an original destination. +type EgressDialer interface { + DialContext(context.Context, string, EgressMetadata) (net.Conn, error) +} + +// OriginalDestination returns the address that a transparently intercepted +// connection originally targeted. +type OriginalDestination func(net.Conn) (string, error) + +// Egress proxies actor TCP connections through an egress CONNECT dialer. It is +// long-lived across actor activations, but only carries traffic while an actor +// is assigned to its worker. +type Egress struct { + originalDestination OriginalDestination + + mu sync.Mutex + active *egressActivation +} + +type egressActivation struct { + metadata EgressMetadata + dialer EgressDialer + ctx context.Context + cancel context.CancelFunc + wg sync.WaitGroup +} + +// NewEgress creates an activation-aware egress proxy. +func NewEgress(originalDestination OriginalDestination) (*Egress, error) { + if originalDestination == nil { + return nil, fmt.Errorf("atunnel: original destination resolver is required") + } + return &Egress{ + originalDestination: originalDestination, + }, nil +} + +// Serve accepts intercepted actor connections until ctx is canceled or the +// listener fails. +func (e *Egress) Serve(ctx context.Context, listener net.Listener) error { + done := make(chan struct{}) + go func() { + select { + case <-ctx.Done(): + _ = listener.Close() + case <-done: + } + }() + defer close(done) + + for { + conn, err := listener.Accept() + if err != nil { + if ctx.Err() != nil || errors.Is(err, net.ErrClosed) { + return nil + } + return fmt.Errorf("atunnel: accepting actor egress connection: %w", err) + } + e.handle(conn) + } +} + +// Activate allows egress for one actor. There can be only one active actor per +// worker. bearerToken may be empty until actor JWT issuance is available. +func (e *Egress) Activate(dialer EgressDialer, atespace, actorName string, actorVersion int64, bearerToken string) error { + if dialer == nil { + return fmt.Errorf("atunnel: egress dialer is required") + } + if !resources.IsValidResourceName(atespace) || !resources.IsValidResourceName(actorName) { + return fmt.Errorf("atunnel: invalid actor identity %q/%q", atespace, actorName) + } + if actorVersion < 1 { + return fmt.Errorf("atunnel: actor version must be positive") + } + e.mu.Lock() + defer e.mu.Unlock() + if e.active != nil { + return fmt.Errorf("atunnel: actor %s/%s already has active egress", e.active.metadata.Atespace, e.active.metadata.ActorName) + } + ctx, cancel := context.WithCancel(context.Background()) + e.active = &egressActivation{ + metadata: EgressMetadata{ + Atespace: atespace, + ActorName: actorName, + ActorVersion: actorVersion, + BearerToken: bearerToken, + }, + dialer: dialer, + ctx: ctx, + cancel: cancel, + } + return nil +} + +// Deactivate rejects new egress, closes active streams, and waits for their +// forwarding goroutines to exit. +func (e *Egress) Deactivate(ctx context.Context) error { + e.mu.Lock() + active := e.active + e.active = nil + if active != nil { + active.cancel() + } + e.mu.Unlock() + if active == nil { + return nil + } + + done := make(chan struct{}) + go func() { + active.wg.Wait() + close(done) + }() + select { + case <-done: + return nil + case <-ctx.Done(): + return fmt.Errorf("atunnel: waiting for active egress streams to stop: %w", ctx.Err()) + } +} + +func (e *Egress) handle(downstream net.Conn) { + e.mu.Lock() + active := e.active + if active == nil { + e.mu.Unlock() + _ = downstream.Close() + return + } + active.wg.Add(1) + e.mu.Unlock() + + go func() { + defer active.wg.Done() + defer downstream.Close() + + destination, err := e.originalDestination(downstream) + if err != nil { + slog.WarnContext(active.ctx, "atunnel failed to resolve original egress destination", slog.Any("err", err)) + return + } + upstream, err := active.dialer.DialContext(active.ctx, destination, active.metadata) + if err != nil { + slog.WarnContext(active.ctx, "atunnel failed to open egress tunnel", slog.String("destination", destination), slog.Any("err", err)) + return + } + defer upstream.Close() + + stop := context.AfterFunc(active.ctx, func() { + _ = downstream.Close() + _ = upstream.Close() + }) + defer stop() + + copyBothWays(downstream, upstream) + }() +} + +func copyBothWays(a, b net.Conn) { + done := make(chan struct{}, 2) + go func() { + _, _ = io.Copy(a, b) + closeWrite(a) + done <- struct{}{} + }() + go func() { + _, _ = io.Copy(b, a) + closeWrite(b) + done <- struct{}{} + }() + <-done + <-done +} + +func closeWrite(conn net.Conn) { + if conn, ok := conn.(interface{ CloseWrite() error }); ok { + _ = conn.CloseWrite() + } +} diff --git a/internal/atunnel/egress_test.go b/internal/atunnel/egress_test.go new file mode 100644 index 000000000..17828fbd5 --- /dev/null +++ b/internal/atunnel/egress_test.go @@ -0,0 +1,114 @@ +// Copyright 2026 Google LLC +// +// 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. + +package atunnel + +import ( + "context" + "io" + "net" + "testing" + "time" +) + +func TestEgressForwardsActiveActor(t *testing.T) { + dialed := make(chan egressDial, 1) + upstreamProxy, upstreamGateway := net.Pipe() + t.Cleanup(func() { + _ = upstreamProxy.Close() + _ = upstreamGateway.Close() + }) + dialer := egressDialerFunc(func(_ context.Context, destination string, metadata EgressMetadata) (net.Conn, error) { + dialed <- egressDial{destination: destination, metadata: metadata} + return upstreamProxy, nil + }) + egress, err := NewEgress(func(net.Conn) (string, error) { + return "192.0.2.10:443", nil + }) + if err != nil { + t.Fatal(err) + } + if err := egress.Activate(dialer, "team-a", "actor-1", 7, "actor-token"); err != nil { + t.Fatal(err) + } + + downstreamActor, downstreamProxy := net.Pipe() + t.Cleanup(func() { + _ = downstreamActor.Close() + _ = downstreamProxy.Close() + }) + egress.handle(downstreamProxy) + + gotDial := <-dialed + if gotDial.destination != "192.0.2.10:443" { + t.Errorf("destination = %q, want 192.0.2.10:443", gotDial.destination) + } + if gotDial.metadata != (EgressMetadata{Atespace: "team-a", ActorName: "actor-1", ActorVersion: 7, BearerToken: "actor-token"}) { + t.Errorf("metadata = %+v", gotDial.metadata) + } + + actorPayload := []byte("from actor") + go func() { _, _ = downstreamActor.Write(actorPayload) }() + gotAtGateway := make([]byte, len(actorPayload)) + if _, err := io.ReadFull(upstreamGateway, gotAtGateway); err != nil { + t.Fatal(err) + } + if string(gotAtGateway) != string(actorPayload) { + t.Errorf("gateway payload = %q, want %q", gotAtGateway, actorPayload) + } + + gatewayPayload := []byte("from gateway") + go func() { _, _ = upstreamGateway.Write(gatewayPayload) }() + gotAtActor := make([]byte, len(gatewayPayload)) + if _, err := io.ReadFull(downstreamActor, gotAtActor); err != nil { + t.Fatal(err) + } + if string(gotAtActor) != string(gatewayPayload) { + t.Errorf("actor payload = %q, want %q", gotAtActor, gatewayPayload) + } + + if err := egress.Deactivate(context.Background()); err != nil { + t.Fatal(err) + } +} + +func TestEgressRejectsInactiveConnection(t *testing.T) { + egress, err := NewEgress(func(net.Conn) (string, error) { + t.Fatal("inactive egress resolved destination") + return "", nil + }) + if err != nil { + t.Fatal(err) + } + actor, proxy := net.Pipe() + defer actor.Close() + if err := actor.SetReadDeadline(time.Now().Add(time.Second)); err != nil { + t.Fatal(err) + } + egress.handle(proxy) + if _, err := actor.Read(make([]byte, 1)); err == nil { + t.Fatal("inactive connection remained open") + } +} + +type egressDial struct { + destination string + metadata EgressMetadata +} + +type egressDialerFunc func(context.Context, string, EgressMetadata) (net.Conn, error) + +func (f egressDialerFunc) DialContext(ctx context.Context, destination string, metadata EgressMetadata) (net.Conn, error) { + return f(ctx, destination, metadata) +} diff --git a/internal/atunnel/original_dst_linux.go b/internal/atunnel/original_dst_linux.go new file mode 100644 index 000000000..e8ca8f17a --- /dev/null +++ b/internal/atunnel/original_dst_linux.go @@ -0,0 +1,71 @@ +// Copyright 2026 Google LLC +// +// 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. + +//go:build linux + +package atunnel + +import ( + "encoding/binary" + "fmt" + "net" + "strconv" + "unsafe" + + "golang.org/x/sys/unix" +) + +// TCPOriginalDestination reads the IPv4 destination preserved by a Linux +// REDIRECT rule. Actor networking is currently IPv4-only; add the IPv6 +// IP6T_SO_ORIGINAL_DST variant when actor veth setup gains dual-stack support. +func TCPOriginalDestination(conn net.Conn) (string, error) { + tcpConn, ok := conn.(*net.TCPConn) + if !ok { + return "", fmt.Errorf("atunnel: original destination requires a TCP connection, got %T", conn) + } + rawConn, err := tcpConn.SyscallConn() + if err != nil { + return "", fmt.Errorf("atunnel: acquiring TCP syscall connection: %w", err) + } + + var addr unix.RawSockaddrInet4 + var sockoptErr error + if err := rawConn.Control(func(fd uintptr) { + size := uint32(unsafe.Sizeof(addr)) + _, _, errno := unix.Syscall6( + unix.SYS_GETSOCKOPT, + fd, + unix.SOL_IP, + unix.SO_ORIGINAL_DST, + uintptr(unsafe.Pointer(&addr)), + uintptr(unsafe.Pointer(&size)), + 0, + ) + if errno != 0 { + sockoptErr = errno + } + }); err != nil { + return "", fmt.Errorf("atunnel: accessing TCP socket: %w", err) + } + if sockoptErr != nil { + return "", fmt.Errorf("atunnel: reading original TCP destination: %w", sockoptErr) + } + + portBytes := (*[2]byte)(unsafe.Pointer(&addr.Port)) + port := binary.BigEndian.Uint16(portBytes[:]) + if port == 0 { + return "", fmt.Errorf("atunnel: original TCP destination has port zero") + } + return net.JoinHostPort(net.IP(addr.Addr[:]).String(), strconv.Itoa(int(port))), nil +} diff --git a/internal/atunnel/server.go b/internal/atunnel/server.go new file mode 100644 index 000000000..b8dca5e8b --- /dev/null +++ b/internal/atunnel/server.go @@ -0,0 +1,286 @@ +// Copyright 2026 Google LLC +// +// 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. + +// Package atunnel carries actor ingress and egress through an ateom worker pod. +package atunnel + +import ( + "context" + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "log/slog" + "net" + "net/http" + "net/http/httputil" + "net/url" + "os" + "strconv" + "strings" + "sync" + "time" + + "github.com/agent-substrate/substrate/internal/resources" +) + +const ( + // StaleAssignmentHeader distinguishes an atunnel routing rejection from a + // 421 returned by the actor application itself. + StaleAssignmentHeader = "X-Ate-Assignment-Stale" +) + +// Config configures an ingress Server. +type Config struct { + CredentialBundlePath string + TrustBundlePath string + AllowedClientID string + Upstream *url.URL +} + +// Server is an activation-aware HTTPS reverse proxy. It is long-lived across +// actor activations, but only routes requests for the actor currently assigned +// to its worker. +type Server struct { + credentialBundlePath string + tlsConfig *tls.Config + proxy *httputil.ReverseProxy + + mu sync.Mutex + active *activation +} + +type activation struct { + atespace string + actorName string + ctx context.Context + cancel context.CancelFunc + wg sync.WaitGroup +} + +// NewServer creates a Server and validates its TLS material. +func NewServer(cfg Config) (*Server, error) { + if cfg.CredentialBundlePath == "" { + return nil, fmt.Errorf("atunnel: credential bundle path is required") + } + if cfg.TrustBundlePath == "" { + return nil, fmt.Errorf("atunnel: trust bundle path is required") + } + if cfg.AllowedClientID == "" { + return nil, fmt.Errorf("atunnel: allowed client identity is required") + } + if cfg.Upstream == nil || cfg.Upstream.Scheme == "" || cfg.Upstream.Host == "" { + return nil, fmt.Errorf("atunnel: upstream URL is required") + } + + // Load once at startup so a malformed or missing projection fails the pod + // promptly. GetCertificate reloads the bundle for every new TLS connection, + // allowing kubelet's projected certificate rotation to take effect. + if _, err := loadCredentialBundle(cfg.CredentialBundlePath); err != nil { + return nil, err + } + trustPEM, err := os.ReadFile(cfg.TrustBundlePath) + if err != nil { + return nil, fmt.Errorf("atunnel: reading trust bundle: %w", err) + } + clientCAs := x509.NewCertPool() + if !clientCAs.AppendCertsFromPEM(trustPEM) { + return nil, fmt.Errorf("atunnel: trust bundle %q contains no certificates", cfg.TrustBundlePath) + } + + proxy := httputil.NewSingleHostReverseProxy(cfg.Upstream) + transport := http.DefaultTransport.(*http.Transport).Clone() + proxy.Transport = transport + proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) { + slog.WarnContext(r.Context(), "atunnel upstream request failed", slog.Any("err", err)) + http.Error(w, "bad gateway", http.StatusBadGateway) + } + + s := &Server{ + credentialBundlePath: cfg.CredentialBundlePath, + proxy: proxy, + } + s.tlsConfig = &tls.Config{ + MinVersion: tls.VersionTLS12, + GetCertificate: func(*tls.ClientHelloInfo) (*tls.Certificate, error) { + return loadCredentialBundle(s.credentialBundlePath) + }, + ClientAuth: tls.RequireAndVerifyClientCert, + ClientCAs: clientCAs, + VerifyConnection: func(cs tls.ConnectionState) error { + if len(cs.PeerCertificates) == 0 { + return fmt.Errorf("atunnel: client certificate is required") + } + for _, uri := range cs.PeerCertificates[0].URIs { + if uri.String() == cfg.AllowedClientID { + return nil + } + } + return fmt.Errorf("atunnel: client is not %q", cfg.AllowedClientID) + }, + } + return s, nil +} + +func loadCredentialBundle(path string) (*tls.Certificate, error) { + pemBytes, err := os.ReadFile(path) + if err != nil { + return nil, fmt.Errorf("atunnel: reading credential bundle: %w", err) + } + cert, err := tls.X509KeyPair(pemBytes, pemBytes) + if err != nil { + return nil, fmt.Errorf("atunnel: parsing credential bundle: %w", err) + } + return &cert, nil +} + +// Serve serves HTTPS on lis until ctx is canceled or the server fails. +func (s *Server) Serve(ctx context.Context, lis net.Listener) error { + httpServer := &http.Server{ + Handler: s, + TLSConfig: s.tlsConfig, + ReadHeaderTimeout: 10 * time.Second, + } + done := make(chan struct{}) + go func() { + select { + case <-ctx.Done(): + _ = httpServer.Close() + case <-done: + } + }() + err := httpServer.ServeTLS(lis, "", "") + close(done) + if errors.Is(err, http.ErrServerClosed) && ctx.Err() != nil { + return nil + } + return err +} + +// Activate allows requests for actorName in atespace. There can be only one +// active actor per worker. +func (s *Server) Activate(atespace, actorName string) error { + if !resources.IsValidResourceName(atespace) || !resources.IsValidResourceName(actorName) { + return fmt.Errorf("atunnel: invalid actor identity %q/%q", atespace, actorName) + } + s.mu.Lock() + defer s.mu.Unlock() + if s.active != nil { + return fmt.Errorf("atunnel: actor %s/%s is already active", s.active.atespace, s.active.actorName) + } + ctx, cancel := context.WithCancel(context.Background()) + s.active = &activation{ + atespace: atespace, + actorName: actorName, + ctx: ctx, + cancel: cancel, + } + return nil +} + +// Deactivate rejects new requests, cancels requests for the active actor, and +// waits for their handlers to exit before returning. +func (s *Server) Deactivate(ctx context.Context) error { + s.mu.Lock() + active := s.active + s.active = nil + if active != nil { + active.cancel() + } + s.mu.Unlock() + if active == nil { + return nil + } + + done := make(chan struct{}) + go func() { + active.wg.Wait() + close(done) + }() + select { + case <-done: + s.closeIdleUpstreamConnections() + return nil + case <-ctx.Done(): + s.closeIdleUpstreamConnections() + return fmt.Errorf("atunnel: waiting for active requests to stop: %w", ctx.Err()) + } +} + +func (s *Server) closeIdleUpstreamConnections() { + if transport, ok := s.proxy.Transport.(interface{ CloseIdleConnections() }); ok { + transport.CloseIdleConnections() + } +} + +// ServeHTTP validates the actor hostname on every request before proxying it. +func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + host, err := requestHostname(r.Host) + if err != nil { + s.reject(w) + return + } + atespace, actorName, err := resources.ParseActorDNSName(host) + if err != nil { + s.reject(w) + return + } + + s.mu.Lock() + active := s.active + if active == nil || active.atespace != atespace || active.actorName != actorName { + s.mu.Unlock() + s.reject(w) + return + } + active.wg.Add(1) + s.mu.Unlock() + defer active.wg.Done() + + requestCtx, cancel := context.WithCancel(r.Context()) + stop := context.AfterFunc(active.ctx, cancel) + defer func() { + stop() + cancel() + }() + + // ReverseProxy changes the URL destination but intentionally retains Host, + // allowing the actor application to observe its stable mesh hostname. + s.proxy.ServeHTTP(w, r.WithContext(requestCtx)) +} + +func (s *Server) reject(w http.ResponseWriter) { + w.Header().Set(StaleAssignmentHeader, "true") + http.Error(w, "misdirected request", http.StatusMisdirectedRequest) +} + +func requestHostname(hostport string) (string, error) { + if hostport == "" { + return "", fmt.Errorf("empty host") + } + host := hostport + if strings.Contains(hostport, ":") { + var port string + var err error + host, port, err = net.SplitHostPort(hostport) + if err != nil { + return "", fmt.Errorf("invalid host %q: %w", hostport, err) + } + portNumber, err := strconv.Atoi(port) + if err != nil || portNumber < 1 || portNumber > 65535 { + return "", fmt.Errorf("invalid port in host %q", hostport) + } + } + return strings.ToLower(host), nil +} diff --git a/internal/atunnel/server_test.go b/internal/atunnel/server_test.go new file mode 100644 index 000000000..8a7f56893 --- /dev/null +++ b/internal/atunnel/server_test.go @@ -0,0 +1,424 @@ +// Copyright 2026 Google LLC +// +// 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. + +package atunnel + +import ( + "context" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "math/big" + "net" + "net/http" + "net/http/httptest" + "net/url" + "os" + "path/filepath" + "testing" + "time" +) + +func TestServeHTTP(t *testing.T) { + upstreamHost := make(chan string, 3) + upstreamURL, err := url.Parse("http://actor.internal:80") + if err != nil { + t.Fatal(err) + } + + s := newTestServer(t, upstreamURL) + s.proxy.Transport = roundTripFunc(func(r *http.Request) (*http.Response, error) { + upstreamHost <- r.Host + return &http.Response{ + StatusCode: http.StatusNoContent, + Header: make(http.Header), + Body: http.NoBody, + }, nil + }) + if err := s.Activate("team-a", "actor-1"); err != nil { + t.Fatal(err) + } + + tests := []struct { + name string + host string + wantStatus int + }{ + {"active actor", "actor-1.team-a.actors.resources.substrate.ate.dev", http.StatusNoContent}, + {"active actor with port", "actor-1.team-a.actors.resources.substrate.ate.dev:443", http.StatusNoContent}, + {"DNS case insensitive", "ACTOR-1.TEAM-A.ACTORS.RESOURCES.SUBSTRATE.ATE.DEV", http.StatusNoContent}, + {"wrong actor", "actor-2.team-a.actors.resources.substrate.ate.dev", http.StatusMisdirectedRequest}, + {"wrong atespace", "actor-1.team-b.actors.resources.substrate.ate.dev", http.StatusMisdirectedRequest}, + {"suffix confusion", "actor-1.team-a.actors.resources.substrate.ate.dev.example.com", http.StatusMisdirectedRequest}, + {"malformed port", "actor-1.team-a.actors.resources.substrate.ate.dev:nope", http.StatusMisdirectedRequest}, + {"empty", "", http.StatusMisdirectedRequest}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "https://worker/hello", nil) + req.Host = tt.host + rec := httptest.NewRecorder() + s.ServeHTTP(rec, req) + if rec.Code != tt.wantStatus { + t.Fatalf("status = %d, want %d", rec.Code, tt.wantStatus) + } + if tt.wantStatus == http.StatusMisdirectedRequest && rec.Header().Get(StaleAssignmentHeader) != "true" { + t.Errorf("missing %s response header", StaleAssignmentHeader) + } + }) + } + + for range 3 { + if got := <-upstreamHost; got != "actor-1.team-a.actors.resources.substrate.ate.dev" && got != "actor-1.team-a.actors.resources.substrate.ate.dev:443" && got != "ACTOR-1.TEAM-A.ACTORS.RESOURCES.SUBSTRATE.ATE.DEV" { + t.Errorf("upstream Host = %q", got) + } + } +} + +type roundTripFunc func(*http.Request) (*http.Response, error) + +func (f roundTripFunc) RoundTrip(r *http.Request) (*http.Response, error) { + return f(r) +} + +type idleClosingRoundTripper struct { + closed bool +} + +func (t *idleClosingRoundTripper) RoundTrip(*http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: http.StatusNoContent, + Header: make(http.Header), + Body: http.NoBody, + }, nil +} + +func (t *idleClosingRoundTripper) CloseIdleConnections() { + t.closed = true +} + +func TestDeactivateClosesIdleUpstreamConnections(t *testing.T) { + upstream, err := url.Parse("http://actor.internal:80") + if err != nil { + t.Fatal(err) + } + s := newTestServer(t, upstream) + transport := &idleClosingRoundTripper{} + s.proxy.Transport = transport + if err := s.Activate("team-a", "actor-1"); err != nil { + t.Fatal(err) + } + + req := httptest.NewRequest(http.MethodGet, "https://worker/", nil) + req.Host = "actor-1.team-a.actors.resources.substrate.ate.dev" + rec := httptest.NewRecorder() + s.ServeHTTP(rec, req) + if rec.Code != http.StatusNoContent { + t.Fatalf("status = %d, want %d", rec.Code, http.StatusNoContent) + } + if err := s.Deactivate(context.Background()); err != nil { + t.Fatal(err) + } + if !transport.closed { + t.Fatal("Deactivate did not close idle upstream connections") + } +} + +func TestInactive(t *testing.T) { + upstream, err := url.Parse("http://127.0.0.1:1") + if err != nil { + t.Fatal(err) + } + s := newTestServer(t, upstream) + req := httptest.NewRequest(http.MethodGet, "https://worker/", nil) + req.Host = "actor-1.team-a.actors.resources.substrate.ate.dev" + + for _, phase := range []string{"before activation", "after deactivation"} { + t.Run(phase, func(t *testing.T) { + rec := httptest.NewRecorder() + s.ServeHTTP(rec, req) + if rec.Code != http.StatusMisdirectedRequest { + t.Fatalf("status = %d, want %d", rec.Code, http.StatusMisdirectedRequest) + } + }) + if phase == "before activation" { + if err := s.Activate("team-a", "actor-1"); err != nil { + t.Fatal(err) + } + if err := s.Deactivate(context.Background()); err != nil { + t.Fatal(err) + } + } + } +} + +func TestMutualTLSClientIdentity(t *testing.T) { + dir := t.TempDir() + ca := newTestCA(t) + serverCert := ca.issue(t, "", []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}) + bundlePath := filepath.Join(dir, "server.pem") + trustPath := filepath.Join(dir, "trust.pem") + writeCredentialBundle(t, bundlePath, serverCert) + if err := os.WriteFile(trustPath, ca.certPEM, 0o600); err != nil { + t.Fatal(err) + } + upstream, err := url.Parse("http://actor.internal:80") + if err != nil { + t.Fatal(err) + } + s, err := NewServer(Config{ + CredentialBundlePath: bundlePath, + TrustBundlePath: trustPath, + AllowedClientID: "spiffe://cluster.local/ns/ate-system/sa/ateway-ingress", + Upstream: upstream, + }) + if err != nil { + t.Fatal(err) + } + + untrustedCA := newTestCA(t) + tests := []struct { + name string + cert tls.Certificate + wantErr bool + }{ + { + name: "allowed identity", + cert: ca.issue(t, "spiffe://cluster.local/ns/ate-system/sa/ateway-ingress", []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}), + }, + { + name: "wrong identity", + cert: ca.issue(t, "spiffe://cluster.local/ns/ate-system/sa/not-the-gateway", []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}), + wantErr: true, + }, + { + name: "untrusted identity", + cert: untrustedCA.issue(t, "spiffe://cluster.local/ns/ate-system/sa/ateway-ingress", []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}), + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + serverErr, clientErr := tlsHandshake(s.tlsConfig, &tls.Config{ + MinVersion: tls.VersionTLS12, + InsecureSkipVerify: true, // Test only the server's client authentication here. + Certificates: []tls.Certificate{tt.cert}, + }) + gotErr := serverErr != nil || clientErr != nil + if gotErr != tt.wantErr { + t.Fatalf("server error = %v, client error = %v, want error %v", serverErr, clientErr, tt.wantErr) + } + }) + } +} + +func TestDeactivateCancelsInflightRequest(t *testing.T) { + upstream, err := url.Parse("http://actor.internal:80") + if err != nil { + t.Fatal(err) + } + s := newTestServer(t, upstream) + if err := s.Activate("team-a", "actor-1"); err != nil { + t.Fatal(err) + } + started := make(chan struct{}) + s.proxy.Transport = roundTripFunc(func(r *http.Request) (*http.Response, error) { + close(started) + <-r.Context().Done() + return nil, r.Context().Err() + }) + + done := make(chan struct{}) + go func() { + defer close(done) + req := httptest.NewRequest(http.MethodGet, "https://worker/", nil) + req.Host = "actor-1.team-a.actors.resources.substrate.ate.dev" + s.ServeHTTP(httptest.NewRecorder(), req) + }() + <-started + if err := s.Deactivate(context.Background()); err != nil { + t.Fatal(err) + } + <-done +} + +func newTestServer(t *testing.T, upstream *url.URL) *Server { + t.Helper() + dir := t.TempDir() + bundle, trust := makeCertFiles(t, dir) + s, err := NewServer(Config{ + CredentialBundlePath: bundle, + TrustBundlePath: trust, + AllowedClientID: "spiffe://cluster.local/ns/ate-system/sa/ateway-ingress", + Upstream: upstream, + }) + if err != nil { + t.Fatal(err) + } + return s +} + +func makeCertFiles(t *testing.T, dir string) (bundlePath, trustPath string) { + t.Helper() + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + now := time.Now() + template := &x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{CommonName: "test"}, + NotBefore: now.Add(-time.Minute), + NotAfter: now.Add(time.Hour), + IsCA: true, + KeyUsage: x509.KeyUsageCertSign | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + } + der, err := x509.CreateCertificate(rand.Reader, template, template, &key.PublicKey, key) + if err != nil { + t.Fatal(err) + } + keyDER, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + t.Fatal(err) + } + certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der}) + keyPEM := pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: keyDER}) + bundlePath = filepath.Join(dir, "bundle.pem") + trustPath = filepath.Join(dir, "trust.pem") + if err := os.WriteFile(bundlePath, append(certPEM, keyPEM...), 0o600); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(trustPath, certPEM, 0o600); err != nil { + t.Fatal(err) + } + return bundlePath, trustPath +} + +type testCA struct { + cert *x509.Certificate + key *ecdsa.PrivateKey + certPEM []byte +} + +func newTestCA(t *testing.T) *testCA { + t.Helper() + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + now := time.Now() + template := &x509.Certificate{ + SerialNumber: big.NewInt(now.UnixNano()), + Subject: pkix.Name{CommonName: "test CA"}, + NotBefore: now.Add(-time.Minute), + NotAfter: now.Add(time.Hour), + IsCA: true, + KeyUsage: x509.KeyUsageCertSign, + BasicConstraintsValid: true, + } + der, err := x509.CreateCertificate(rand.Reader, template, template, &key.PublicKey, key) + if err != nil { + t.Fatal(err) + } + cert, err := x509.ParseCertificate(der) + if err != nil { + t.Fatal(err) + } + return &testCA{ + cert: cert, + key: key, + certPEM: pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der}), + } +} + +func (ca *testCA) issue(t *testing.T, spiffeID string, usages []x509.ExtKeyUsage) tls.Certificate { + t.Helper() + key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + t.Fatal(err) + } + now := time.Now() + template := &x509.Certificate{ + SerialNumber: big.NewInt(now.UnixNano()), + NotBefore: now.Add(-time.Minute), + NotAfter: now.Add(time.Hour), + KeyUsage: x509.KeyUsageDigitalSignature, + ExtKeyUsage: usages, + } + if spiffeID != "" { + uri, err := url.Parse(spiffeID) + if err != nil { + t.Fatal(err) + } + template.URIs = []*url.URL{uri} + } + der, err := x509.CreateCertificate(rand.Reader, template, ca.cert, &key.PublicKey, ca.key) + if err != nil { + t.Fatal(err) + } + keyDER, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + t.Fatal(err) + } + cert, err := tls.X509KeyPair( + append(pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der}), ca.certPEM...), + pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: keyDER}), + ) + if err != nil { + t.Fatal(err) + } + return cert +} + +func writeCredentialBundle(t *testing.T, path string, cert tls.Certificate) { + t.Helper() + key, ok := cert.PrivateKey.(*ecdsa.PrivateKey) + if !ok { + t.Fatalf("private key has type %T", cert.PrivateKey) + } + keyDER, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + t.Fatal(err) + } + var bundle []byte + for _, der := range cert.Certificate { + bundle = append(bundle, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der})...) + } + bundle = append(bundle, pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: keyDER})...) + if err := os.WriteFile(path, bundle, 0o600); err != nil { + t.Fatal(err) + } +} + +func tlsHandshake(serverConfig, clientConfig *tls.Config) (serverErr, clientErr error) { + serverConn, clientConn := net.Pipe() + serverTLS := tls.Server(serverConn, serverConfig) + clientTLS := tls.Client(clientConn, clientConfig) + done := make(chan error, 1) + go func() { + err := serverTLS.Handshake() + _ = serverConn.Close() + done <- err + }() + clientErr = clientTLS.Handshake() + _ = clientConn.Close() + serverErr = <-done + return serverErr, clientErr +} diff --git a/internal/e2e/router_client.go b/internal/e2e/router_client.go index cd5f0d67a..9d439ceed 100644 --- a/internal/e2e/router_client.go +++ b/internal/e2e/router_client.go @@ -15,6 +15,7 @@ package e2e import ( + "bytes" "context" "fmt" "io" @@ -34,10 +35,10 @@ import ( const ( routerNamespace = "ate-system" - routerService = "atenet-router" + routerService = "ateway-ingress" ) -// RouterClient sends HTTP requests to actors through the atenet router, the +// RouterClient sends HTTP requests to actors through the ingress gateway, the // same way real traffic arrives (so the request is routed and, if needed, the // actor is resumed). It port-forwards the router Service, mirroring the // approach in internal/ateclient. @@ -47,7 +48,7 @@ type RouterClient struct { stopCh chan struct{} } -// NewRouterClient establishes a port-forward to the atenet router. Call Close +// NewRouterClient establishes a port-forward to the ingress gateway. Call Close // to tear it down. func NewRouterClient(ctx context.Context) (*RouterClient, error) { config, err := ateclient.LoadConfig(KubeConfig, KubeContext) @@ -197,10 +198,23 @@ func (c *RouterClient) Close() { // actor's mesh Host so the router routes (and resumes) it. The caller must close // the body. func (c *RouterClient) Get(ctx context.Context, atespace, actorName, path string) (*http.Response, error) { - req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.baseURL+path, nil) + return c.request(ctx, http.MethodGet, atespace, actorName, path, nil) +} + +// PostJSON issues a POST with a JSON body to an Actor through the router. The +// caller must close the response body. +func (c *RouterClient) PostJSON(ctx context.Context, atespace, actorName, path string, body []byte) (*http.Response, error) { + return c.request(ctx, http.MethodPost, atespace, actorName, path, bytes.NewReader(body)) +} + +func (c *RouterClient) request(ctx context.Context, method, atespace, actorName, path string, body io.Reader) (*http.Response, error) { + req, err := http.NewRequestWithContext(ctx, method, c.baseURL+path, body) if err != nil { return nil, err } + if method == http.MethodPost { + req.Header.Set("Content-Type", "application/json") + } // The router routes on the Host/:authority, not a header. req.Host = resources.ActorDNSName(atespace, actorName) return c.http.Do(req) diff --git a/internal/e2e/router_client_test.go b/internal/e2e/router_client_test.go index 632534515..0765ca120 100644 --- a/internal/e2e/router_client_test.go +++ b/internal/e2e/router_client_test.go @@ -15,6 +15,10 @@ package e2e import ( + "context" + "io" + "net/http" + "strings" "testing" corev1 "k8s.io/api/core/v1" @@ -22,18 +26,62 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" ) +func TestRouterClientPostJSON(t *testing.T) { + client := &RouterClient{ + baseURL: "http://router.test", + http: &http.Client{Transport: testRoundTripper(func(request *http.Request) (*http.Response, error) { + if request.Method != http.MethodPost { + t.Errorf("method = %q, want POST", request.Method) + } + if request.Host != "fetcher.demo.actors.resources.substrate.ate.dev" { + t.Errorf("host = %q", request.Host) + } + if request.URL.Path != "/fetch" { + t.Errorf("path = %q, want /fetch", request.URL.Path) + } + if request.Header.Get("Content-Type") != "application/json" { + t.Errorf("content type = %q, want application/json", request.Header.Get("Content-Type")) + } + body, err := io.ReadAll(request.Body) + if err != nil { + t.Fatalf("reading body: %v", err) + } + if string(body) != `{"url":"https://example.com/"}` { + t.Errorf("body = %q", body) + } + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(strings.NewReader("ok")), + Header: make(http.Header), + }, nil + })}, + } + + response, err := client.PostJSON(context.Background(), "demo", "fetcher", "/fetch", []byte(`{"url":"https://example.com/"}`)) + if err != nil { + t.Fatalf("PostJSON: %v", err) + } + response.Body.Close() +} + +type testRoundTripper func(*http.Request) (*http.Response, error) + +func (f testRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) { + return f(request) +} + func TestResolveHTTPTargetPort(t *testing.T) { pod := &corev1.Pod{ Spec: corev1.PodSpec{ Containers: []corev1.Container{{ - Name: "envoy", + Name: "agentgateway", Ports: []corev1.ContainerPort{{Name: "http", ContainerPort: 8080}}, }}, }, } svc := func(p corev1.ServicePort) *corev1.Service { return &corev1.Service{ - ObjectMeta: metav1.ObjectMeta{Name: "atenet-router"}, + ObjectMeta: metav1.ObjectMeta{Name: "ateway-ingress"}, Spec: corev1.ServiceSpec{Ports: []corev1.ServicePort{p}}, } } @@ -42,7 +90,7 @@ func TestResolveHTTPTargetPort(t *testing.T) { zeroPortPod := &corev1.Pod{ Spec: corev1.PodSpec{ Containers: []corev1.Container{{ - Name: "envoy", + Name: "agentgateway", Ports: []corev1.ContainerPort{{Name: "http", ContainerPort: 0}}, }}, }, diff --git a/internal/e2e/suites/demo/demo_test.go b/internal/e2e/suites/demo/demo_test.go index d7755a0ff..a5d1e62ff 100644 --- a/internal/e2e/suites/demo/demo_test.go +++ b/internal/e2e/suites/demo/demo_test.go @@ -640,18 +640,18 @@ func callActorOnce(t *testing.T, atespace, actorName string) (string, error) { t.Helper() clients := e2e.GetClients() - svc, err := clients.K8s.CoreV1().Services("ate-system").Get(context.Background(), "atenet-router", metav1.GetOptions{}) + svc, err := clients.K8s.CoreV1().Services("ate-system").Get(context.Background(), "ateway-ingress", metav1.GetOptions{}) if err != nil { - return "", fmt.Errorf("failed to get atenet-router service: %w", err) + return "", fmt.Errorf("failed to get ateway-ingress service: %w", err) } selector := labels.SelectorFromSet(svc.Spec.Selector).String() pods, err := clients.K8s.CoreV1().Pods("ate-system").List(context.Background(), metav1.ListOptions{LabelSelector: selector}) if err != nil { - return "", fmt.Errorf("failed to list atenet-router pods: %w", err) + return "", fmt.Errorf("failed to list ateway-ingress pods: %w", err) } if len(pods.Items) == 0 { - return "", fmt.Errorf("no atenet-router pods found") + return "", fmt.Errorf("no ateway-ingress pods found") } targetPod := pods.Items[0] diff --git a/internal/e2e/suites/networking/networking_test.go b/internal/e2e/suites/networking/networking_test.go new file mode 100644 index 000000000..660b309f0 --- /dev/null +++ b/internal/e2e/suites/networking/networking_test.go @@ -0,0 +1,119 @@ +// Copyright 2026 Google LLC +// +// 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. + +package networking + +import ( + "context" + "fmt" + "io" + "net/http" + "testing" + "time" + + "github.com/agent-substrate/substrate/internal/e2e" + "github.com/agent-substrate/substrate/pkg/proto/ateapipb" +) + +const networkingAtespace = "networking-e2e" + +func TestActorDirectAccess(t *testing.T) { + ctx := context.Background() + actorID, actor := createAndResumeActor(t, ctx, "direct") + router := mustRouterClient(t, ctx) + defer router.Close() + + t.Run("direct", func(t *testing.T) { + assertDirectActorAccess(t, ctx, e2e.GetClients(), actor) + }) + t.Run("via ingress", func(t *testing.T) { + response, err := router.Get(ctx, networkingAtespace, actorID, "/readyz") + if err != nil { + t.Fatalf("GET Actor through ingress: %v", err) + } + defer response.Body.Close() + body, err := io.ReadAll(response.Body) + if err != nil { + t.Fatalf("reading ingress response body (HTTP %d): %v", response.StatusCode, err) + } + if response.StatusCode != http.StatusOK { + t.Fatalf("Actor access through ingress returned HTTP %d, want 200; body: %s", response.StatusCode, body) + } + t.Logf("Actor access through ingress succeeded; body: %s", body) + }) +} + +func createAndResumeActor(t *testing.T, ctx context.Context, prefix string) (string, *ateapipb.Actor) { + t.Helper() + clients := e2e.GetClients() + actorID := fmt.Sprintf("%s-%d", prefix, time.Now().UnixNano()) + actorRef := &ateapipb.ObjectRef{Atespace: networkingAtespace, Name: actorID} + + t.Logf("creating actor %s/%s", networkingAtespace, actorID) + _, _ = clients.SubstrateAPI.CreateAtespace(ctx, &ateapipb.CreateAtespaceRequest{ + Atespace: &ateapipb.Atespace{Metadata: &ateapipb.ResourceMetadata{Name: networkingAtespace}}, + }) + if _, err := clients.SubstrateAPI.CreateActor(ctx, &ateapipb.CreateActorRequest{Actor: &ateapipb.Actor{ + Metadata: &ateapipb.ResourceMetadata{Atespace: networkingAtespace, Name: actorID}, + ActorTemplateNamespace: "ate-demo-egress", + ActorTemplateName: "egress", + }}); err != nil { + t.Fatalf("CreateActor: %v (deploy the fixture with --deploy-demo-egress)", err) + } + t.Cleanup(func() { + _, _ = clients.SubstrateAPI.SuspendActor(context.Background(), &ateapipb.SuspendActorRequest{Actor: actorRef}) + _, _ = clients.SubstrateAPI.DeleteActor(context.Background(), &ateapipb.DeleteActorRequest{Actor: actorRef}) + }) + + resumeResponse, err := clients.SubstrateAPI.ResumeActor(ctx, &ateapipb.ResumeActorRequest{Actor: actorRef}) + if err != nil { + t.Fatalf("ResumeActor: %v", err) + } + t.Logf("resumed actor %s/%s", networkingAtespace, actorID) + return actorID, resumeResponse.GetActor() +} + +func mustRouterClient(t *testing.T, ctx context.Context) *e2e.RouterClient { + t.Helper() + router, err := e2e.NewRouterClient(ctx) + if err != nil { + t.Fatalf("NewRouterClient: %v", err) + } + return router +} + +func assertDirectActorAccess(t *testing.T, ctx context.Context, clients *e2e.Clients, actor *ateapipb.Actor) { + t.Helper() + if actor.GetAteomPodNamespace() == "" || actor.GetAteomPodName() == "" { + t.Fatalf("resumed Actor has no worker pod assignment: %+v", actor) + } + + // The Kubernetes pod proxy performs this request from inside the cluster to + // the assigned worker's port 80. It bypasses ateway-ingress and therefore + // verifies that the old direct path remains unavailable without relying on + // the test runner having a route to the pod CIDR. + result := clients.K8s.CoreV1().RESTClient().Get(). + Namespace(actor.GetAteomPodNamespace()). + Resource("pods"). + Name(actor.GetAteomPodName() + ":80"). + SubResource("proxy"). + Suffix("readyz"). + Do(ctx) + body, err := result.Raw() + + if err == nil { + t.Fatalf("direct Actor access through %s/%s:80 unexpectedly succeeded; body: %s", actor.GetAteomPodNamespace(), actor.GetAteomPodName(), body) + } + t.Logf("direct Actor access through %s/%s:80 was blocked as expected: %v", actor.GetAteomPodNamespace(), actor.GetAteomPodName(), err) +} diff --git a/internal/e2e/suites/networking/testmain_test.go b/internal/e2e/suites/networking/testmain_test.go new file mode 100644 index 000000000..2d31b9c9f --- /dev/null +++ b/internal/e2e/suites/networking/testmain_test.go @@ -0,0 +1,24 @@ +// Copyright 2026 Google LLC +// +// 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. + +package networking + +import ( + "os" + "testing" + + "github.com/agent-substrate/substrate/internal/e2e" +) + +func TestMain(m *testing.M) { os.Exit(e2e.RunTestMain(m)) } diff --git a/internal/e2e/testmain.go b/internal/e2e/testmain.go index 44ae9237c..8b3f35bbf 100644 --- a/internal/e2e/testmain.go +++ b/internal/e2e/testmain.go @@ -18,6 +18,7 @@ import ( "context" goflag "flag" "fmt" + "os" "testing" "github.com/spf13/pflag" @@ -41,6 +42,10 @@ func RunTestMain(m *testing.M) int { bindFlags() pflag.CommandLine.AddGoFlagSet(goflag.CommandLine) pflag.Parse() + if err := pflag.ParseSkippedFlags(os.Args[1:], goflag.CommandLine); err != nil { + fmt.Printf("Failed to parse Go test flags: %v\n", err) + return 1 + } if !RunE2E { fmt.Println(Colorf(` diff --git a/internal/proto/ateletpb/atelet.pb.go b/internal/proto/ateletpb/atelet.pb.go index b24d7036a..be4f2c922 100644 --- a/internal/proto/ateletpb/atelet.pb.go +++ b/internal/proto/ateletpb/atelet.pb.go @@ -189,20 +189,25 @@ func (SnapshotScope) EnumDescriptor() ([]byte, []int) { } type RunRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - TargetAteomUid string `protobuf:"bytes,1,opt,name=target_ateom_uid,json=targetAteomUid,proto3" json:"target_ateom_uid,omitempty"` - Atespace string `protobuf:"bytes,2,opt,name=atespace,proto3" json:"atespace,omitempty"` - ActorName string `protobuf:"bytes,3,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` - ActorUid string `protobuf:"bytes,4,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` - ActorTemplateNamespace string `protobuf:"bytes,5,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` - ActorTemplateName string `protobuf:"bytes,6,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` - Spec *WorkloadSpec `protobuf:"bytes,7,opt,name=spec,proto3" json:"spec,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + TargetAteomUid string `protobuf:"bytes,1,opt,name=target_ateom_uid,json=targetAteomUid,proto3" json:"target_ateom_uid,omitempty"` + Atespace string `protobuf:"bytes,2,opt,name=atespace,proto3" json:"atespace,omitempty"` + ActorName string `protobuf:"bytes,3,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` + ActorUid string `protobuf:"bytes,4,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` + // Actor resource version observed by ate-api when assigning this worker. + ActorVersion int64 `protobuf:"varint,9,opt,name=actor_version,json=actorVersion,proto3" json:"actor_version,omitempty"` + ActorTemplateNamespace string `protobuf:"bytes,5,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` + ActorTemplateName string `protobuf:"bytes,6,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` + Spec *WorkloadSpec `protobuf:"bytes,7,opt,name=spec,proto3" json:"spec,omitempty"` // The sandbox binaries to use for booting this actor from scratch. atelet // fetches the relevant assets and records them with the actor's on-node state // so a later Checkpoint can pin the same version into the snapshot manifest. SandboxAssets *SandboxAssets `protobuf:"bytes,8,opt,name=sandbox_assets,json=sandboxAssets,proto3" json:"sandbox_assets,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + EgressGatewayAddress *string `protobuf:"bytes,10,opt,name=egress_gateway_address,json=egressGatewayAddress,proto3,oneof" json:"egress_gateway_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RunRequest) Reset() { @@ -263,6 +268,13 @@ func (x *RunRequest) GetActorUid() string { return "" } +func (x *RunRequest) GetActorVersion() int64 { + if x != nil { + return x.ActorVersion + } + return 0 +} + func (x *RunRequest) GetActorTemplateNamespace() string { if x != nil { return x.ActorTemplateNamespace @@ -291,6 +303,13 @@ func (x *RunRequest) GetSandboxAssets() *SandboxAssets { return nil } +func (x *RunRequest) GetEgressGatewayAddress() string { + if x != nil && x.EgressGatewayAddress != nil { + return *x.EgressGatewayAddress + } + return "" +} + // AssetFile is one content-addressed file atelet fetches for a sandbox runtime // (e.g. the gVisor runsc binary). type AssetFile struct { @@ -1250,13 +1269,15 @@ func (*CheckpointResponse) Descriptor() ([]byte, []int) { } type RestoreRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - TargetAteomUid string `protobuf:"bytes,1,opt,name=target_ateom_uid,json=targetAteomUid,proto3" json:"target_ateom_uid,omitempty"` - Atespace string `protobuf:"bytes,2,opt,name=atespace,proto3" json:"atespace,omitempty"` - ActorName string `protobuf:"bytes,3,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` - ActorUid string `protobuf:"bytes,4,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` - ActorTemplateNamespace string `protobuf:"bytes,5,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` - ActorTemplateName string `protobuf:"bytes,6,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + TargetAteomUid string `protobuf:"bytes,1,opt,name=target_ateom_uid,json=targetAteomUid,proto3" json:"target_ateom_uid,omitempty"` + Atespace string `protobuf:"bytes,2,opt,name=atespace,proto3" json:"atespace,omitempty"` + ActorName string `protobuf:"bytes,3,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` + ActorUid string `protobuf:"bytes,4,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` + // Actor resource version observed by ate-api when assigning this worker. + ActorVersion int64 `protobuf:"varint,12,opt,name=actor_version,json=actorVersion,proto3" json:"actor_version,omitempty"` + ActorTemplateNamespace string `protobuf:"bytes,5,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` + ActorTemplateName string `protobuf:"bytes,6,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` // Sandbox binary config is not sent on restore: the snapshot is // self-describing. atelet reads the snapshot manifest to recover the pinned // sandbox version that created it. @@ -1270,9 +1291,12 @@ type RestoreRequest struct { // *RestoreRequest_ExternalConfig Config isRestoreRequest_Config `protobuf_oneof:"config"` // What content to restore from the checkpoint. - Scope SnapshotScope `protobuf:"varint,11,opt,name=scope,proto3,enum=atelet.SnapshotScope" json:"scope,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Scope SnapshotScope `protobuf:"varint,11,opt,name=scope,proto3,enum=atelet.SnapshotScope" json:"scope,omitempty"` + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + EgressGatewayAddress *string `protobuf:"bytes,23,opt,name=egress_gateway_address,json=egressGatewayAddress,proto3,oneof" json:"egress_gateway_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RestoreRequest) Reset() { @@ -1333,6 +1357,13 @@ func (x *RestoreRequest) GetActorUid() string { return "" } +func (x *RestoreRequest) GetActorVersion() int64 { + if x != nil { + return x.ActorVersion + } + return 0 +} + func (x *RestoreRequest) GetActorTemplateNamespace() string { if x != nil { return x.ActorTemplateNamespace @@ -1393,6 +1424,13 @@ func (x *RestoreRequest) GetScope() SnapshotScope { return SnapshotScope_SNAPSHOT_SCOPE_UNSPECIFIED } +func (x *RestoreRequest) GetEgressGatewayAddress() string { + if x != nil && x.EgressGatewayAddress != nil { + return *x.EgressGatewayAddress + } + return "" +} + type isRestoreRequest_Config interface { isRestoreRequest_Config() } @@ -1449,18 +1487,22 @@ var File_atelet_proto protoreflect.FileDescriptor const file_atelet_proto_rawDesc = "" + "\n" + - "\fatelet.proto\x12\x06atelet\"\xe0\x02\n" + + "\fatelet.proto\x12\x06atelet\"\xdb\x03\n" + "\n" + "RunRequest\x12(\n" + "\x10target_ateom_uid\x18\x01 \x01(\tR\x0etargetAteomUid\x12\x1a\n" + "\batespace\x18\x02 \x01(\tR\batespace\x12\x1d\n" + "\n" + "actor_name\x18\x03 \x01(\tR\tactorName\x12\x1b\n" + - "\tactor_uid\x18\x04 \x01(\tR\bactorUid\x128\n" + + "\tactor_uid\x18\x04 \x01(\tR\bactorUid\x12#\n" + + "\ractor_version\x18\t \x01(\x03R\factorVersion\x128\n" + "\x18actor_template_namespace\x18\x05 \x01(\tR\x16actorTemplateNamespace\x12.\n" + "\x13actor_template_name\x18\x06 \x01(\tR\x11actorTemplateName\x12(\n" + "\x04spec\x18\a \x01(\v2\x14.atelet.WorkloadSpecR\x04spec\x12<\n" + - "\x0esandbox_assets\x18\b \x01(\v2\x15.atelet.SandboxAssetsR\rsandboxAssets\"5\n" + + "\x0esandbox_assets\x18\b \x01(\v2\x15.atelet.SandboxAssetsR\rsandboxAssets\x129\n" + + "\x16egress_gateway_address\x18\n" + + " \x01(\tH\x00R\x14egressGatewayAddress\x88\x01\x01B\x19\n" + + "\x17_egress_gateway_address\"5\n" + "\tAssetFile\x12\x10\n" + "\x03url\x18\x01 \x01(\tR\x03url\x12\x16\n" + "\x06sha256\x18\x02 \x01(\tR\x06sha256\"\x8e\x01\n" + @@ -1530,13 +1572,14 @@ const file_atelet_proto_rawDesc = "" + " \x01(\v2'.atelet.ExternalCheckpointConfigurationH\x00R\x0eexternalConfig\x12+\n" + "\x05scope\x18\v \x01(\x0e2\x15.atelet.SnapshotScopeR\x05scopeB\b\n" + "\x06config\"\x14\n" + - "\x12CheckpointResponse\"\xa8\x04\n" + + "\x12CheckpointResponse\"\xa3\x05\n" + "\x0eRestoreRequest\x12(\n" + "\x10target_ateom_uid\x18\x01 \x01(\tR\x0etargetAteomUid\x12\x1a\n" + "\batespace\x18\x02 \x01(\tR\batespace\x12\x1d\n" + "\n" + "actor_name\x18\x03 \x01(\tR\tactorName\x12\x1b\n" + - "\tactor_uid\x18\x04 \x01(\tR\bactorUid\x128\n" + + "\tactor_uid\x18\x04 \x01(\tR\bactorUid\x12#\n" + + "\ractor_version\x18\f \x01(\x03R\factorVersion\x128\n" + "\x18actor_template_namespace\x18\x05 \x01(\tR\x16actorTemplateNamespace\x12.\n" + "\x13actor_template_name\x18\x06 \x01(\tR\x11actorTemplateName\x12(\n" + "\x04spec\x18\a \x01(\v2\x14.atelet.WorkloadSpecR\x04spec\x12*\n" + @@ -1544,8 +1587,10 @@ const file_atelet_proto_rawDesc = "" + "\flocal_config\x18\t \x01(\v2$.atelet.LocalCheckpointConfigurationH\x00R\vlocalConfig\x12R\n" + "\x0fexternal_config\x18\n" + " \x01(\v2'.atelet.ExternalCheckpointConfigurationH\x00R\x0eexternalConfig\x12+\n" + - "\x05scope\x18\v \x01(\x0e2\x15.atelet.SnapshotScopeR\x05scopeB\b\n" + - "\x06config\"\x11\n" + + "\x05scope\x18\v \x01(\x0e2\x15.atelet.SnapshotScopeR\x05scope\x129\n" + + "\x16egress_gateway_address\x18\x17 \x01(\tH\x01R\x14egressGatewayAddress\x88\x01\x01B\b\n" + + "\x06configB\x19\n" + + "\x17_egress_gateway_address\"\x11\n" + "\x0fRestoreResponse*F\n" + "\n" + "VolumeType\x12\x1b\n" + @@ -1648,6 +1693,7 @@ func file_atelet_proto_init() { if File_atelet_proto != nil { return } + file_atelet_proto_msgTypes[0].OneofWrappers = []any{} file_atelet_proto_msgTypes[6].OneofWrappers = []any{ (*Volume_DurableDir)(nil), } diff --git a/internal/proto/ateletpb/atelet.proto b/internal/proto/ateletpb/atelet.proto index 98706bf9d..400bcf4d0 100644 --- a/internal/proto/ateletpb/atelet.proto +++ b/internal/proto/ateletpb/atelet.proto @@ -38,6 +38,8 @@ message RunRequest { string atespace = 2; string actor_name = 3; string actor_uid = 4; + // Actor resource version observed by ate-api when assigning this worker. + int64 actor_version = 9; string actor_template_namespace = 5; string actor_template_name = 6; @@ -48,6 +50,10 @@ message RunRequest { // fetches the relevant assets and records them with the actor's on-node state // so a later Checkpoint can pin the same version into the snapshot manifest. SandboxAssets sandbox_assets = 8; + + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + optional string egress_gateway_address = 10; } // AssetFile is one content-addressed file atelet fetches for a sandbox runtime @@ -212,6 +218,8 @@ message RestoreRequest { string atespace = 2; string actor_name = 3; string actor_uid = 4; + // Actor resource version observed by ate-api when assigning this worker. + int64 actor_version = 12; string actor_template_namespace = 5; string actor_template_name = 6; @@ -231,6 +239,10 @@ message RestoreRequest { // What content to restore from the checkpoint. SnapshotScope scope = 11; + + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + optional string egress_gateway_address = 23; } message RestoreResponse { diff --git a/internal/proto/ateompb/ateom.pb.go b/internal/proto/ateompb/ateom.pb.go index 12c4fa1a7..b91d4beef 100644 --- a/internal/proto/ateompb/ateom.pb.go +++ b/internal/proto/ateompb/ateom.pb.go @@ -91,21 +91,26 @@ func (SnapshotScope) EnumDescriptor() ([]byte, []int) { } type RunWorkloadRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Atespace string `protobuf:"bytes,1,opt,name=atespace,proto3" json:"atespace,omitempty"` - ActorName string `protobuf:"bytes,2,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` - ActorUid string `protobuf:"bytes,3,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` - ActorTemplateNamespace string `protobuf:"bytes,4,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` - ActorTemplateName string `protobuf:"bytes,5,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` - RunscPath string `protobuf:"bytes,6,opt,name=runsc_path,json=runscPath,proto3" json:"runsc_path,omitempty"` - Spec *WorkloadSpec `protobuf:"bytes,7,opt,name=spec,proto3" json:"spec,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Atespace string `protobuf:"bytes,1,opt,name=atespace,proto3" json:"atespace,omitempty"` + ActorName string `protobuf:"bytes,2,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` + ActorUid string `protobuf:"bytes,3,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` + // Actor resource version observed by ate-api when assigning this worker. + ActorVersion int64 `protobuf:"varint,9,opt,name=actor_version,json=actorVersion,proto3" json:"actor_version,omitempty"` + ActorTemplateNamespace string `protobuf:"bytes,4,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` + ActorTemplateName string `protobuf:"bytes,5,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` + RunscPath string `protobuf:"bytes,6,opt,name=runsc_path,json=runscPath,proto3" json:"runsc_path,omitempty"` + Spec *WorkloadSpec `protobuf:"bytes,7,opt,name=spec,proto3" json:"spec,omitempty"` // runtime_asset_paths maps a runtime asset name (e.g. "cloud-hypervisor", // "virtiofsd", "kata-kernel", "kata-image", "kata-config") // to the local on-disk path atelet fetched it to (content-addressed, like // runsc_path). Empty for the gVisor runtime, which uses runsc_path. RuntimeAssetPaths map[string]string `protobuf:"bytes,8,rep,name=runtime_asset_paths,json=runtimeAssetPaths,proto3" json:"runtime_asset_paths,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + EgressGatewayAddress *string `protobuf:"bytes,10,opt,name=egress_gateway_address,json=egressGatewayAddress,proto3,oneof" json:"egress_gateway_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RunWorkloadRequest) Reset() { @@ -159,6 +164,13 @@ func (x *RunWorkloadRequest) GetActorUid() string { return "" } +func (x *RunWorkloadRequest) GetActorVersion() int64 { + if x != nil { + return x.ActorVersion + } + return 0 +} + func (x *RunWorkloadRequest) GetActorTemplateNamespace() string { if x != nil { return x.ActorTemplateNamespace @@ -194,6 +206,13 @@ func (x *RunWorkloadRequest) GetRuntimeAssetPaths() map[string]string { return nil } +func (x *RunWorkloadRequest) GetEgressGatewayAddress() string { + if x != nil && x.EgressGatewayAddress != nil { + return *x.EgressGatewayAddress + } + return "" +} + // WorkloadSpec parallels Pod, but with far fewer configurable fields. type WorkloadSpec struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -611,23 +630,28 @@ func (x *CheckpointWorkloadResponse) GetSnapshotFiles() []string { } type RestoreWorkloadRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Atespace string `protobuf:"bytes,1,opt,name=atespace,proto3" json:"atespace,omitempty"` - ActorName string `protobuf:"bytes,2,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` - ActorUid string `protobuf:"bytes,3,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` - ActorTemplateNamespace string `protobuf:"bytes,4,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` - ActorTemplateName string `protobuf:"bytes,5,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` - RunscPath string `protobuf:"bytes,6,opt,name=runsc_path,json=runscPath,proto3" json:"runsc_path,omitempty"` - Spec *WorkloadSpec `protobuf:"bytes,7,opt,name=spec,proto3" json:"spec,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Atespace string `protobuf:"bytes,1,opt,name=atespace,proto3" json:"atespace,omitempty"` + ActorName string `protobuf:"bytes,2,opt,name=actor_name,json=actorName,proto3" json:"actor_name,omitempty"` + ActorUid string `protobuf:"bytes,3,opt,name=actor_uid,json=actorUid,proto3" json:"actor_uid,omitempty"` + // Actor resource version observed by ate-api when assigning this worker. + ActorVersion int64 `protobuf:"varint,11,opt,name=actor_version,json=actorVersion,proto3" json:"actor_version,omitempty"` + ActorTemplateNamespace string `protobuf:"bytes,4,opt,name=actor_template_namespace,json=actorTemplateNamespace,proto3" json:"actor_template_namespace,omitempty"` + ActorTemplateName string `protobuf:"bytes,5,opt,name=actor_template_name,json=actorTemplateName,proto3" json:"actor_template_name,omitempty"` + RunscPath string `protobuf:"bytes,6,opt,name=runsc_path,json=runscPath,proto3" json:"runsc_path,omitempty"` + Spec *WorkloadSpec `protobuf:"bytes,7,opt,name=spec,proto3" json:"spec,omitempty"` // The object storage URI prefix of the snapshot to restore. SnapshotUriPrefix string `protobuf:"bytes,8,opt,name=snapshot_uri_prefix,json=snapshotUriPrefix,proto3" json:"snapshot_uri_prefix,omitempty"` // runtime_asset_paths maps a runtime asset name to the local on-disk path // atelet fetched it to (see RunWorkloadRequest). Empty for gVisor. RuntimeAssetPaths map[string]string `protobuf:"bytes,9,rep,name=runtime_asset_paths,json=runtimeAssetPaths,proto3" json:"runtime_asset_paths,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // What content to restore from the snapshot. - Scope SnapshotScope `protobuf:"varint,10,opt,name=scope,proto3,enum=ateom.SnapshotScope" json:"scope,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Scope SnapshotScope `protobuf:"varint,10,opt,name=scope,proto3,enum=ateom.SnapshotScope" json:"scope,omitempty"` + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + EgressGatewayAddress *string `protobuf:"bytes,12,opt,name=egress_gateway_address,json=egressGatewayAddress,proto3,oneof" json:"egress_gateway_address,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RestoreWorkloadRequest) Reset() { @@ -681,6 +705,13 @@ func (x *RestoreWorkloadRequest) GetActorUid() string { return "" } +func (x *RestoreWorkloadRequest) GetActorVersion() int64 { + if x != nil { + return x.ActorVersion + } + return 0 +} + func (x *RestoreWorkloadRequest) GetActorTemplateNamespace() string { if x != nil { return x.ActorTemplateNamespace @@ -730,6 +761,13 @@ func (x *RestoreWorkloadRequest) GetScope() SnapshotScope { return SnapshotScope_SNAPSHOT_SCOPE_UNSPECIFIED } +func (x *RestoreWorkloadRequest) GetEgressGatewayAddress() string { + if x != nil && x.EgressGatewayAddress != nil { + return *x.EgressGatewayAddress + } + return "" +} + type RestoreWorkloadResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -770,21 +808,25 @@ var File_ateom_proto protoreflect.FileDescriptor const file_ateom_proto_rawDesc = "" + "\n" + - "\vateom.proto\x12\x05ateom\"\xc6\x03\n" + + "\vateom.proto\x12\x05ateom\"\xc1\x04\n" + "\x12RunWorkloadRequest\x12\x1a\n" + "\batespace\x18\x01 \x01(\tR\batespace\x12\x1d\n" + "\n" + "actor_name\x18\x02 \x01(\tR\tactorName\x12\x1b\n" + - "\tactor_uid\x18\x03 \x01(\tR\bactorUid\x128\n" + + "\tactor_uid\x18\x03 \x01(\tR\bactorUid\x12#\n" + + "\ractor_version\x18\t \x01(\x03R\factorVersion\x128\n" + "\x18actor_template_namespace\x18\x04 \x01(\tR\x16actorTemplateNamespace\x12.\n" + "\x13actor_template_name\x18\x05 \x01(\tR\x11actorTemplateName\x12\x1d\n" + "\n" + "runsc_path\x18\x06 \x01(\tR\trunscPath\x12'\n" + "\x04spec\x18\a \x01(\v2\x13.ateom.WorkloadSpecR\x04spec\x12`\n" + - "\x13runtime_asset_paths\x18\b \x03(\v20.ateom.RunWorkloadRequest.RuntimeAssetPathsEntryR\x11runtimeAssetPaths\x1aD\n" + + "\x13runtime_asset_paths\x18\b \x03(\v20.ateom.RunWorkloadRequest.RuntimeAssetPathsEntryR\x11runtimeAssetPaths\x129\n" + + "\x16egress_gateway_address\x18\n" + + " \x01(\tH\x00R\x14egressGatewayAddress\x88\x01\x01\x1aD\n" + "\x16RuntimeAssetPathsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"@\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x19\n" + + "\x17_egress_gateway_address\"@\n" + "\fWorkloadSpec\x120\n" + "\n" + "containers\x18\x01 \x03(\v2\x10.ateom.ContainerR\n" + @@ -817,12 +859,13 @@ const file_ateom_proto_rawDesc = "" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"C\n" + "\x1aCheckpointWorkloadResponse\x12%\n" + - "\x0esnapshot_files\x18\x01 \x03(\tR\rsnapshotFiles\"\xaa\x04\n" + + "\x0esnapshot_files\x18\x01 \x03(\tR\rsnapshotFiles\"\xa5\x05\n" + "\x16RestoreWorkloadRequest\x12\x1a\n" + "\batespace\x18\x01 \x01(\tR\batespace\x12\x1d\n" + "\n" + "actor_name\x18\x02 \x01(\tR\tactorName\x12\x1b\n" + - "\tactor_uid\x18\x03 \x01(\tR\bactorUid\x128\n" + + "\tactor_uid\x18\x03 \x01(\tR\bactorUid\x12#\n" + + "\ractor_version\x18\v \x01(\x03R\factorVersion\x128\n" + "\x18actor_template_namespace\x18\x04 \x01(\tR\x16actorTemplateNamespace\x12.\n" + "\x13actor_template_name\x18\x05 \x01(\tR\x11actorTemplateName\x12\x1d\n" + "\n" + @@ -831,10 +874,12 @@ const file_ateom_proto_rawDesc = "" + "\x13snapshot_uri_prefix\x18\b \x01(\tR\x11snapshotUriPrefix\x12d\n" + "\x13runtime_asset_paths\x18\t \x03(\v24.ateom.RestoreWorkloadRequest.RuntimeAssetPathsEntryR\x11runtimeAssetPaths\x12*\n" + "\x05scope\x18\n" + - " \x01(\x0e2\x14.ateom.SnapshotScopeR\x05scope\x1aD\n" + + " \x01(\x0e2\x14.ateom.SnapshotScopeR\x05scope\x129\n" + + "\x16egress_gateway_address\x18\f \x01(\tH\x00R\x14egressGatewayAddress\x88\x01\x01\x1aD\n" + "\x16RuntimeAssetPathsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x19\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x19\n" + + "\x17_egress_gateway_address\"\x19\n" + "\x17RestoreWorkloadResponse*a\n" + "\rSnapshotScope\x12\x1e\n" + "\x1aSNAPSHOT_SCOPE_UNSPECIFIED\x10\x00\x12\x17\n" + @@ -905,6 +950,8 @@ func file_ateom_proto_init() { if File_ateom_proto != nil { return } + file_ateom_proto_msgTypes[0].OneofWrappers = []any{} + file_ateom_proto_msgTypes[8].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/internal/proto/ateompb/ateom.proto b/internal/proto/ateompb/ateom.proto index a282d81cb..89ca97c27 100644 --- a/internal/proto/ateompb/ateom.proto +++ b/internal/proto/ateompb/ateom.proto @@ -51,6 +51,8 @@ message RunWorkloadRequest { string atespace = 1; string actor_name = 2; string actor_uid = 3; + // Actor resource version observed by ate-api when assigning this worker. + int64 actor_version = 9; string actor_template_namespace = 4; string actor_template_name = 5; @@ -64,6 +66,10 @@ message RunWorkloadRequest { // to the local on-disk path atelet fetched it to (content-addressed, like // runsc_path). Empty for the gVisor runtime, which uses runsc_path. map runtime_asset_paths = 8; + + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + optional string egress_gateway_address = 10; } // WorkloadSpec parallels Pod, but with far fewer configurable fields. @@ -147,6 +153,8 @@ message RestoreWorkloadRequest { string atespace = 1; string actor_name = 2; string actor_uid = 3; + // Actor resource version observed by ate-api when assigning this worker. + int64 actor_version = 11; string actor_template_namespace = 4; string actor_template_name = 5; @@ -164,6 +172,10 @@ message RestoreWorkloadRequest { // What content to restore from the snapshot. SnapshotScope scope = 10; + + // Remote egress gateway selected for this activation. When absent, actor + // traffic uses direct egress instead of being redirected through atunnel. + optional string egress_gateway_address = 12; } message RestoreWorkloadResponse { diff --git a/manifests/ate-install/atenet-router-monitoring.yaml b/manifests/ate-install/atenet-router-monitoring.yaml deleted file mode 100644 index 6a42ac904..000000000 --- a/manifests/ate-install/atenet-router-monitoring.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2026 Google LLC -# -# 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. - -# Scrape the Envoy sidecar's admin /stats/prometheus endpoint so its end-to-end -# request-latency histogram (envoy_http_downstream_rq_time, milliseconds) reaches -# Google Managed Prometheus. This is E2E *context* for the per-stage latency -# dashboard, not an SLI we own (the SLI is the OTLP atenet.router.route.duration -# histogram). Envoy only speaks Prometheus, so it needs an explicit scrape; the -# admin port (9901) is already exposed by the envoy container above. -apiVersion: monitoring.googleapis.com/v1 -kind: PodMonitoring -metadata: - name: atenet-router-envoy - namespace: ate-system - labels: - app: atenet-router -spec: - selector: - matchLabels: - app: atenet-router - endpoints: - - port: admin - path: /stats/prometheus - interval: 30s diff --git a/manifests/ate-install/atenet-router.yaml b/manifests/ate-install/atenet-router.yaml deleted file mode 100644 index 967f22c29..000000000 --- a/manifests/ate-install/atenet-router.yaml +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright 2026 Google LLC -# -# 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. - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: atenet-router - namespace: ate-system - labels: - app: atenet-router ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: atenet-router -rules: -- apiGroups: - - "ate.dev" - resources: - - actortemplates - verbs: - - get - - watch - - list ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: atenet-router -subjects: -- kind: ServiceAccount - name: atenet-router - namespace: ate-system -roleRef: - kind: ClusterRole - name: atenet-router - apiGroup: rbac.authorization.k8s.io ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: atenet-router-envoy-config - namespace: ate-system -data: - envoy.yaml: | - admin: - address: - socket_address: - address: 0.0.0.0 - port_value: 9901 - - node: - id: substrate-envoy-node - cluster: substrate-router-cluster - - dynamic_resources: - lds_config: - resource_api_version: V3 - ads: {} - cds_config: - resource_api_version: V3 - ads: {} - ads_config: - api_type: GRPC - transport_api_version: V3 - grpc_services: - - envoy_grpc: - cluster_name: xds_cluster - - static_resources: - clusters: - - name: xds_cluster - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - typed_extension_protocol_options: - envoy.extensions.upstreams.http.v3.HttpProtocolOptions: - "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions - explicit_http_config: - http2_protocol_options: {} - load_assignment: - cluster_name: xds_cluster - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: 127.0.0.1 - port_value: 18000 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: atenet-router - namespace: ate-system - labels: - app: atenet-router -spec: - replicas: 1 - selector: - matchLabels: - app: atenet-router - template: - metadata: - labels: - app: atenet-router - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9090" - spec: - serviceAccountName: atenet-router - containers: - - name: atenet-router - image: ko://github.com/agent-substrate/substrate/cmd/atenet - args: - - "router" - - "--standalone" - - "--namespace=ate-system" - - "--port-http=8080" - - "--port-xds=18000" - - "--port-extproc=50051" - - "--extproc-address=127.0.0.1" - - "--ateapi-address=api.ate-system.svc:443" - - "--status-port=4040" - - "--port-https=8443" - - "--envoy-cert-path=/run/servicedns.podcert.ate.dev/credential-bundle.pem" - - "--otlp-collector-address=opentelemetry-collector.gke-managed-otel.svc.cluster.local:4317" - - "--ateapi-ca-file=/run/servicedns-ca/trust-bundle.pem" - env: - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: POD_UID - valueFrom: - fieldRef: - fieldPath: metadata.uid - - name: OTEL_RESOURCE_ATTRIBUTES - value: k8s.namespace.name=$(POD_NAMESPACE),k8s.pod.name=$(POD_NAME),k8s.pod.uid=$(POD_UID),service.instance.id=$(POD_UID) - - name: OTEL_EXPORTER_OTLP_ENDPOINT - value: http://opentelemetry-collector.gke-managed-otel.svc.cluster.local:4317 - ports: - - name: xds - containerPort: 18000 - - name: extproc - containerPort: 50051 - - name: status - containerPort: 4040 - - name: metrics - containerPort: 9090 - - name: envoy - image: envoyproxy/envoy:v1.30-latest - command: - - "/usr/local/bin/envoy" - - "-c" - - "/etc/envoy/envoy.yaml" - - "--component-log-level" - - "upstream:debug,router:debug,ext_proc:debug" - ports: - - name: http - containerPort: 8080 - - name: https - containerPort: 8443 - - name: admin - containerPort: 9901 - volumeMounts: - - name: envoy-config - mountPath: /etc/envoy - - name: "servicedns" - mountPath: "/run/servicedns.podcert.ate.dev" - volumes: - - name: envoy-config - configMap: - name: atenet-router-envoy-config - - name: "servicedns" - projected: - sources: - - podCertificate: - signerName: servicedns.podcert.ate.dev/identity - keyType: ECDSAP256 - credentialBundlePath: credential-bundle.pem ---- -apiVersion: v1 -kind: Service -metadata: - name: atenet-router - namespace: ate-system -spec: - type: ClusterIP - selector: - app: atenet-router - ports: - - name: http - port: 80 - targetPort: 8080 - protocol: TCP - - name: https - port: 443 - targetPort: 8443 - protocol: TCP diff --git a/manifests/ate-install/ateway-egress.yaml b/manifests/ate-install/ateway-egress.yaml new file mode 100644 index 000000000..f135b0b6e --- /dev/null +++ b/manifests/ate-install/ateway-egress.yaml @@ -0,0 +1,186 @@ +# Copyright 2026 Google LLC +# +# 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. + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: ateway-egress + namespace: ate-system +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: ateway-egress + namespace: ate-system +data: + config.yaml: | + config: + tracing: {} + frontendPolicies: + connect: + mode: tunnel + gateways: + egress: + port: 443 + tls: + cert: /run/servicedns.podcert.ate.dev/credential-bundle.pem + key: /run/servicedns.podcert.ate.dev/credential-bundle.pem + root: /run/podidentity.podcert.ate.dev/trust-bundle.pem + binds: + - port: 80 + mode: internal + listeners: + - name: egress-http + protocol: HTTP + routes: + - name: actor-egress-http + policies: + substrateEgress: + host: https://api.ate-system.svc + policies: + backendTLS: + cert: /run/podidentity.podcert.ate.dev/credential-bundle.pem + key: /run/podidentity.podcert.ate.dev/credential-bundle.pem + root: /run/servicedns.podcert.ate.dev/trust-bundle.pem + backends: + - dynamic: {} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ateway-egress + namespace: ate-system + labels: + app: ateway-egress +spec: + replicas: 1 + selector: + matchLabels: + app: ateway-egress + template: + metadata: + labels: + app: ateway-egress + spec: + serviceAccountName: ateway-egress + securityContext: + sysctls: + - name: net.ipv4.ip_unprivileged_port_start + value: "0" + containers: + - name: agentgateway + # TODO: replace with official image once general direction is approved + image: ghcr.io/howardjohn-dev/agentgateway:v0.0.0-substrate.3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsNonRoot: true + runAsUser: 65532 + args: + - -f + - /etc/agentgateway/config.yaml + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_UID + valueFrom: + fieldRef: + fieldPath: metadata.uid + - name: OTEL_RESOURCE_ATTRIBUTES + value: k8s.namespace.name=$(POD_NAMESPACE),k8s.pod.name=$(POD_NAME),k8s.pod.uid=$(POD_UID),service.instance.id=$(POD_UID) + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://opentelemetry-collector.otel-system.svc:4317 + - name: OTEL_SERVICE_NAME + value: ateway-egress + ports: + - name: https + containerPort: 443 + - name: health + containerPort: 15021 + readinessProbe: + httpGet: + path: /healthz/ready + port: health + periodSeconds: 10 + startupProbe: + failureThreshold: 60 + httpGet: + path: /healthz/ready + port: health + periodSeconds: 1 + successThreshold: 1 + timeoutSeconds: 2 + volumeMounts: + - name: config + mountPath: /etc/agentgateway + readOnly: true + - name: servicedns + mountPath: /run/servicedns.podcert.ate.dev + readOnly: true + - name: podidentity + mountPath: /run/podidentity.podcert.ate.dev + readOnly: true + volumes: + - name: config + configMap: + name: ateway-egress + - name: servicedns + projected: + sources: + - podCertificate: + signerName: servicedns.podcert.ate.dev/identity + keyType: ECDSAP256 + credentialBundlePath: credential-bundle.pem + - clusterTrustBundle: + signerName: servicedns.podcert.ate.dev/identity + labelSelector: + matchLabels: + podcert.ate.dev/canarying: live + path: trust-bundle.pem + - name: podidentity + projected: + sources: + - podCertificate: + signerName: podidentity.podcert.ate.dev/identity + keyType: ECDSAP256 + credentialBundlePath: credential-bundle.pem + - clusterTrustBundle: + signerName: podidentity.podcert.ate.dev/identity + labelSelector: + matchLabels: + podcert.ate.dev/canarying: live + path: trust-bundle.pem +--- +apiVersion: v1 +kind: Service +metadata: + name: ateway-egress + namespace: ate-system +spec: + type: ClusterIP + selector: + app: ateway-egress + ports: + - name: https + port: 443 + targetPort: https + protocol: TCP diff --git a/manifests/ate-install/ateway-ingress.yaml b/manifests/ate-install/ateway-ingress.yaml new file mode 100644 index 000000000..2b2d474a2 --- /dev/null +++ b/manifests/ate-install/ateway-ingress.yaml @@ -0,0 +1,192 @@ +# Copyright 2026 Google LLC +# +# 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. + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: ateway-ingress + namespace: ate-system +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: ateway-ingress + namespace: ate-system +data: + config.yaml: | + config: + tracing: {} + gateways: + http: + port: 80 + https: + port: 443 + tls: + cert: /run/servicedns.podcert.ate.dev/credential-bundle.pem + key: /run/servicedns.podcert.ate.dev/credential-bundle.pem + routes: + - gateways: + - http + - https + policies: + substrateIngress: + host: https://api.ate-system.svc + targetPort: 443 + cacheTtl: 5s + policies: + backendTLS: + root: /run/servicedns.podcert.ate.dev/trust-bundle.pem + backends: + - dynamic: {} + policies: + backendTLS: + cert: /run/podidentity.podcert.ate.dev/credential-bundle.pem + key: /run/podidentity.podcert.ate.dev/credential-bundle.pem + root: /run/podidentity.podcert.ate.dev/trust-bundle.pem + insecureHost: true +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ateway-ingress + namespace: ate-system + labels: + app: ateway-ingress +spec: + replicas: 1 + selector: + matchLabels: + app: ateway-ingress + template: + metadata: + labels: + app: ateway-ingress + spec: + serviceAccountName: ateway-ingress + securityContext: + sysctls: + - name: net.ipv4.ip_unprivileged_port_start + value: "0" + containers: + - name: agentgateway + # TODO: replace with official image once general direction is approved + image: ghcr.io/howardjohn-dev/agentgateway:v0.0.0-substrate.3 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsNonRoot: true + runAsUser: 65532 + args: + - -f + - /etc/agentgateway/config.yaml + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_UID + valueFrom: + fieldRef: + fieldPath: metadata.uid + - name: OTEL_RESOURCE_ATTRIBUTES + value: k8s.namespace.name=$(POD_NAMESPACE),k8s.pod.name=$(POD_NAME),k8s.pod.uid=$(POD_UID),service.instance.id=$(POD_UID) + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://opentelemetry-collector.otel-system.svc:4317 + - name: OTEL_SERVICE_NAME + value: ateway-ingress + ports: + - name: http + containerPort: 80 + - name: https + containerPort: 443 + - name: health + containerPort: 15021 + readinessProbe: + httpGet: + path: /healthz/ready + port: 15021 + periodSeconds: 10 + startupProbe: + failureThreshold: 60 + httpGet: + path: /healthz/ready + port: 15021 + periodSeconds: 1 + successThreshold: 1 + timeoutSeconds: 2 + volumeMounts: + - name: config + mountPath: /etc/agentgateway + readOnly: true + - name: servicedns + mountPath: /run/servicedns.podcert.ate.dev + readOnly: true + - name: podidentity + mountPath: /run/podidentity.podcert.ate.dev + readOnly: true + volumes: + - name: config + configMap: + name: ateway-ingress + - name: servicedns + projected: + sources: + - podCertificate: + signerName: servicedns.podcert.ate.dev/identity + keyType: ECDSAP256 + credentialBundlePath: credential-bundle.pem + - clusterTrustBundle: + signerName: servicedns.podcert.ate.dev/identity + labelSelector: + matchLabels: + podcert.ate.dev/canarying: live + path: trust-bundle.pem + - name: podidentity + projected: + sources: + - podCertificate: + signerName: podidentity.podcert.ate.dev/identity + keyType: ECDSAP256 + credentialBundlePath: credential-bundle.pem + - clusterTrustBundle: + signerName: podidentity.podcert.ate.dev/identity + labelSelector: + matchLabels: + podcert.ate.dev/canarying: live + path: trust-bundle.pem +--- +apiVersion: v1 +kind: Service +metadata: + name: ateway-ingress + namespace: ate-system +spec: + type: ClusterIP + selector: + app: ateway-ingress + ports: + - name: http + port: 80 + targetPort: http + protocol: TCP + - name: https + port: 443 + targetPort: https + protocol: TCP diff --git a/manifests/ate-install/jwt/kustomization.yaml b/manifests/ate-install/jwt/kustomization.yaml index a6331c498..c008a1deb 100644 --- a/manifests/ate-install/jwt/kustomization.yaml +++ b/manifests/ate-install/jwt/kustomization.yaml @@ -20,7 +20,8 @@ resources: - ../ate-controller.yaml - ../atelet.yaml - ../atenet-dns.yaml - - ../atenet-router.yaml + - ../ateway-egress.yaml + - ../ateway-ingress.yaml - ../valkey.yaml - ../pod-certificate-controller.yaml @@ -49,16 +50,3 @@ patches: - op: add path: /spec/template/spec/containers/0/args/- value: --ateapi-token-file=/run/ateapi-token/token - - target: - group: apps - version: v1 - kind: Deployment - name: atenet-router - namespace: ate-system - patch: |- - - op: add - path: /spec/template/spec/containers/0/args/- - value: --ateapi-auth=jwt - - op: add - path: /spec/template/spec/containers/0/args/- - value: --ateapi-token-file=/run/ateapi-token/token diff --git a/manifests/ate-install/jwt/patches.yaml b/manifests/ate-install/jwt/patches.yaml index 62656d6d4..c0f653bb6 100644 --- a/manifests/ate-install/jwt/patches.yaml +++ b/manifests/ate-install/jwt/patches.yaml @@ -46,38 +46,3 @@ spec: matchLabels: podcert.ate.dev/canarying: live path: trust-bundle.pem ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: atenet-router - namespace: ate-system -spec: - template: - spec: - containers: - - name: atenet-router - volumeMounts: - - name: ateapi-token - mountPath: /run/ateapi-token - readOnly: true - - name: servicedns-ca - mountPath: /run/servicedns-ca - readOnly: true - volumes: - - name: ateapi-token - projected: - sources: - - serviceAccountToken: - audience: api.ate-system.svc - expirationSeconds: 3600 - path: token - - name: servicedns-ca - projected: - sources: - - clusterTrustBundle: - signerName: servicedns.podcert.ate.dev/identity - labelSelector: - matchLabels: - podcert.ate.dev/canarying: live - path: trust-bundle.pem diff --git a/manifests/ate-install/kind-jwt/kustomization.yaml b/manifests/ate-install/kind-jwt/kustomization.yaml index 8769b7a10..45e846af0 100644 --- a/manifests/ate-install/kind-jwt/kustomization.yaml +++ b/manifests/ate-install/kind-jwt/kustomization.yaml @@ -43,16 +43,3 @@ patches: - op: add path: /spec/template/spec/containers/0/args/- value: --ateapi-token-file=/run/ateapi-token/token - - target: - group: apps - version: v1 - kind: Deployment - name: atenet-router - namespace: ate-system - patch: |- - - op: add - path: /spec/template/spec/containers/0/args/- - value: --ateapi-auth=jwt - - op: add - path: /spec/template/spec/containers/0/args/- - value: --ateapi-token-file=/run/ateapi-token/token diff --git a/manifests/ate-install/kind/kustomization.yaml b/manifests/ate-install/kind/kustomization.yaml index 1f0792e8b..f13d6c387 100644 --- a/manifests/ate-install/kind/kustomization.yaml +++ b/manifests/ate-install/kind/kustomization.yaml @@ -20,7 +20,8 @@ resources: - ../ate-controller.yaml - ./atelet - ../atenet-dns.yaml - - ../atenet-router.yaml + - ../ateway-egress.yaml + - ../ateway-ingress.yaml - ../valkey.yaml - ../pod-certificate-controller.yaml - rustfs.yaml diff --git a/vendor/github.com/envoyproxy/go-control-plane/LICENSE b/vendor/github.com/envoyproxy/go-control-plane/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config.pb.go deleted file mode 100644 index fdc417226..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config.pb.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/config/common/key_value/v3/config.proto - -package key_valuev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/cncf/xds/go/xds/annotations/v3" - v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This shared configuration for Envoy key value stores. -type KeyValueStoreConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // [#extension-category: envoy.common.key_value] - Config *v3.TypedExtensionConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyValueStoreConfig) Reset() { - *x = KeyValueStoreConfig{} - mi := &file_envoy_config_common_key_value_v3_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyValueStoreConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyValueStoreConfig) ProtoMessage() {} - -func (x *KeyValueStoreConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_config_common_key_value_v3_config_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyValueStoreConfig.ProtoReflect.Descriptor instead. -func (*KeyValueStoreConfig) Descriptor() ([]byte, []int) { - return file_envoy_config_common_key_value_v3_config_proto_rawDescGZIP(), []int{0} -} - -func (x *KeyValueStoreConfig) GetConfig() *v3.TypedExtensionConfig { - if x != nil { - return x.Config - } - return nil -} - -var File_envoy_config_common_key_value_v3_config_proto protoreflect.FileDescriptor - -const file_envoy_config_common_key_value_v3_config_proto_rawDesc = "" + - "\n" + - "-envoy/config/common/key_value/v3/config.proto\x12 envoy.config.common.key_value.v3\x1a$envoy/config/core/v3/extension.proto\x1a\x1fxds/annotations/v3/status.proto\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"m\n" + - "\x13KeyValueStoreConfig\x12L\n" + - "\x06config\x18\x01 \x01(\v2*.envoy.config.core.v3.TypedExtensionConfigB\b\xfaB\x05\x8a\x01\x02\x10\x01R\x06config:\b\xd2Ƥ\xe1\x06\x02\b\x01B\x9c\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - ".io.envoyproxy.envoy.config.common.key_value.v3B\vConfigProtoP\x01ZSgithub.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3;key_valuev3b\x06proto3" - -var ( - file_envoy_config_common_key_value_v3_config_proto_rawDescOnce sync.Once - file_envoy_config_common_key_value_v3_config_proto_rawDescData []byte -) - -func file_envoy_config_common_key_value_v3_config_proto_rawDescGZIP() []byte { - file_envoy_config_common_key_value_v3_config_proto_rawDescOnce.Do(func() { - file_envoy_config_common_key_value_v3_config_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_config_common_key_value_v3_config_proto_rawDesc), len(file_envoy_config_common_key_value_v3_config_proto_rawDesc))) - }) - return file_envoy_config_common_key_value_v3_config_proto_rawDescData -} - -var file_envoy_config_common_key_value_v3_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_config_common_key_value_v3_config_proto_goTypes = []any{ - (*KeyValueStoreConfig)(nil), // 0: envoy.config.common.key_value.v3.KeyValueStoreConfig - (*v3.TypedExtensionConfig)(nil), // 1: envoy.config.core.v3.TypedExtensionConfig -} -var file_envoy_config_common_key_value_v3_config_proto_depIdxs = []int32{ - 1, // 0: envoy.config.common.key_value.v3.KeyValueStoreConfig.config:type_name -> envoy.config.core.v3.TypedExtensionConfig - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_config_common_key_value_v3_config_proto_init() } -func file_envoy_config_common_key_value_v3_config_proto_init() { - if File_envoy_config_common_key_value_v3_config_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_config_common_key_value_v3_config_proto_rawDesc), len(file_envoy_config_common_key_value_v3_config_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_config_common_key_value_v3_config_proto_goTypes, - DependencyIndexes: file_envoy_config_common_key_value_v3_config_proto_depIdxs, - MessageInfos: file_envoy_config_common_key_value_v3_config_proto_msgTypes, - }.Build() - File_envoy_config_common_key_value_v3_config_proto = out.File - file_envoy_config_common_key_value_v3_config_proto_goTypes = nil - file_envoy_config_common_key_value_v3_config_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config.pb.validate.go deleted file mode 100644 index 7243a25c4..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config.pb.validate.go +++ /dev/null @@ -1,179 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/config/common/key_value/v3/config.proto - -package key_valuev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on KeyValueStoreConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *KeyValueStoreConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyValueStoreConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeyValueStoreConfigMultiError, or nil if none found. -func (m *KeyValueStoreConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyValueStoreConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetConfig() == nil { - err := KeyValueStoreConfigValidationError{ - field: "Config", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyValueStoreConfigValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyValueStoreConfigValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyValueStoreConfigValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return KeyValueStoreConfigMultiError(errors) - } - - return nil -} - -// KeyValueStoreConfigMultiError is an error wrapping multiple validation -// errors returned by KeyValueStoreConfig.ValidateAll() if the designated -// constraints aren't met. -type KeyValueStoreConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyValueStoreConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyValueStoreConfigMultiError) AllErrors() []error { return m } - -// KeyValueStoreConfigValidationError is the validation error returned by -// KeyValueStoreConfig.Validate if the designated constraints aren't met. -type KeyValueStoreConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyValueStoreConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyValueStoreConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyValueStoreConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyValueStoreConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyValueStoreConfigValidationError) ErrorName() string { - return "KeyValueStoreConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e KeyValueStoreConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyValueStoreConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyValueStoreConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyValueStoreConfigValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config_vtproto.pb.go deleted file mode 100644 index 0d7bf3742..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3/config_vtproto.pb.go +++ /dev/null @@ -1,95 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/config/common/key_value/v3/config.proto - -package key_valuev3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *KeyValueStoreConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KeyValueStoreConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *KeyValueStoreConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Config != nil { - if vtmsg, ok := interface{}(m.Config).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Config) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *KeyValueStoreConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Config != nil { - if size, ok := interface{}(m.Config).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Config) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream.pb.go deleted file mode 100644 index b416dffc8..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream.pb.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/access_loggers/stream/v3/stream.proto - -package streamv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Custom configuration for an :ref:`AccessLog ` -// that writes log entries directly to the operating system's standard output. -// [#extension: envoy.access_loggers.stdout] -type StdoutAccessLog struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to AccessLogFormat: - // - // *StdoutAccessLog_LogFormat - AccessLogFormat isStdoutAccessLog_AccessLogFormat `protobuf_oneof:"access_log_format"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StdoutAccessLog) Reset() { - *x = StdoutAccessLog{} - mi := &file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StdoutAccessLog) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StdoutAccessLog) ProtoMessage() {} - -func (x *StdoutAccessLog) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StdoutAccessLog.ProtoReflect.Descriptor instead. -func (*StdoutAccessLog) Descriptor() ([]byte, []int) { - return file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescGZIP(), []int{0} -} - -func (x *StdoutAccessLog) GetAccessLogFormat() isStdoutAccessLog_AccessLogFormat { - if x != nil { - return x.AccessLogFormat - } - return nil -} - -func (x *StdoutAccessLog) GetLogFormat() *v3.SubstitutionFormatString { - if x != nil { - if x, ok := x.AccessLogFormat.(*StdoutAccessLog_LogFormat); ok { - return x.LogFormat - } - } - return nil -} - -type isStdoutAccessLog_AccessLogFormat interface { - isStdoutAccessLog_AccessLogFormat() -} - -type StdoutAccessLog_LogFormat struct { - // Configuration to form access log data and format. - // If not specified, use :ref:`default format `. - LogFormat *v3.SubstitutionFormatString `protobuf:"bytes,1,opt,name=log_format,json=logFormat,proto3,oneof"` -} - -func (*StdoutAccessLog_LogFormat) isStdoutAccessLog_AccessLogFormat() {} - -// Custom configuration for an :ref:`AccessLog ` -// that writes log entries directly to the operating system's standard error. -// [#extension: envoy.access_loggers.stderr] -type StderrAccessLog struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to AccessLogFormat: - // - // *StderrAccessLog_LogFormat - AccessLogFormat isStderrAccessLog_AccessLogFormat `protobuf_oneof:"access_log_format"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StderrAccessLog) Reset() { - *x = StderrAccessLog{} - mi := &file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StderrAccessLog) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StderrAccessLog) ProtoMessage() {} - -func (x *StderrAccessLog) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StderrAccessLog.ProtoReflect.Descriptor instead. -func (*StderrAccessLog) Descriptor() ([]byte, []int) { - return file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescGZIP(), []int{1} -} - -func (x *StderrAccessLog) GetAccessLogFormat() isStderrAccessLog_AccessLogFormat { - if x != nil { - return x.AccessLogFormat - } - return nil -} - -func (x *StderrAccessLog) GetLogFormat() *v3.SubstitutionFormatString { - if x != nil { - if x, ok := x.AccessLogFormat.(*StderrAccessLog_LogFormat); ok { - return x.LogFormat - } - } - return nil -} - -type isStderrAccessLog_AccessLogFormat interface { - isStderrAccessLog_AccessLogFormat() -} - -type StderrAccessLog_LogFormat struct { - // Configuration to form access log data and format. - // If not specified, use :ref:`default format `. - LogFormat *v3.SubstitutionFormatString `protobuf:"bytes,1,opt,name=log_format,json=logFormat,proto3,oneof"` -} - -func (*StderrAccessLog_LogFormat) isStderrAccessLog_AccessLogFormat() {} - -var File_envoy_extensions_access_loggers_stream_v3_stream_proto protoreflect.FileDescriptor - -const file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDesc = "" + - "\n" + - "6envoy/extensions/access_loggers/stream/v3/stream.proto\x12)envoy.extensions.access_loggers.stream.v3\x1a5envoy/config/core/v3/substitution_format_string.proto\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"\x81\x01\n" + - "\x0fStdoutAccessLog\x12Y\n" + - "\n" + - "log_format\x18\x01 \x01(\v2..envoy.config.core.v3.SubstitutionFormatStringB\b\xfaB\x05\x8a\x01\x02\x10\x01H\x00R\tlogFormatB\x13\n" + - "\x11access_log_format\"\x81\x01\n" + - "\x0fStderrAccessLog\x12Y\n" + - "\n" + - "log_format\x18\x01 \x01(\v2..envoy.config.core.v3.SubstitutionFormatStringB\b\xfaB\x05\x8a\x01\x02\x10\x01H\x00R\tlogFormatB\x13\n" + - "\x11access_log_formatB\xab\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "7io.envoyproxy.envoy.extensions.access_loggers.stream.v3B\vStreamProtoP\x01ZYgithub.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3;streamv3b\x06proto3" - -var ( - file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescOnce sync.Once - file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescData []byte -) - -func file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescGZIP() []byte { - file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescOnce.Do(func() { - file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDesc), len(file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDesc))) - }) - return file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDescData -} - -var file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_extensions_access_loggers_stream_v3_stream_proto_goTypes = []any{ - (*StdoutAccessLog)(nil), // 0: envoy.extensions.access_loggers.stream.v3.StdoutAccessLog - (*StderrAccessLog)(nil), // 1: envoy.extensions.access_loggers.stream.v3.StderrAccessLog - (*v3.SubstitutionFormatString)(nil), // 2: envoy.config.core.v3.SubstitutionFormatString -} -var file_envoy_extensions_access_loggers_stream_v3_stream_proto_depIdxs = []int32{ - 2, // 0: envoy.extensions.access_loggers.stream.v3.StdoutAccessLog.log_format:type_name -> envoy.config.core.v3.SubstitutionFormatString - 2, // 1: envoy.extensions.access_loggers.stream.v3.StderrAccessLog.log_format:type_name -> envoy.config.core.v3.SubstitutionFormatString - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_envoy_extensions_access_loggers_stream_v3_stream_proto_init() } -func file_envoy_extensions_access_loggers_stream_v3_stream_proto_init() { - if File_envoy_extensions_access_loggers_stream_v3_stream_proto != nil { - return - } - file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes[0].OneofWrappers = []any{ - (*StdoutAccessLog_LogFormat)(nil), - } - file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes[1].OneofWrappers = []any{ - (*StderrAccessLog_LogFormat)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDesc), len(file_envoy_extensions_access_loggers_stream_v3_stream_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_access_loggers_stream_v3_stream_proto_goTypes, - DependencyIndexes: file_envoy_extensions_access_loggers_stream_v3_stream_proto_depIdxs, - MessageInfos: file_envoy_extensions_access_loggers_stream_v3_stream_proto_msgTypes, - }.Build() - File_envoy_extensions_access_loggers_stream_v3_stream_proto = out.File - file_envoy_extensions_access_loggers_stream_v3_stream_proto_goTypes = nil - file_envoy_extensions_access_loggers_stream_v3_stream_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream.pb.validate.go deleted file mode 100644 index 74051b454..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream.pb.validate.go +++ /dev/null @@ -1,351 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/access_loggers/stream/v3/stream.proto - -package streamv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on StdoutAccessLog with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *StdoutAccessLog) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StdoutAccessLog with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// StdoutAccessLogMultiError, or nil if none found. -func (m *StdoutAccessLog) ValidateAll() error { - return m.validate(true) -} - -func (m *StdoutAccessLog) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.AccessLogFormat.(type) { - case *StdoutAccessLog_LogFormat: - if v == nil { - err := StdoutAccessLogValidationError{ - field: "AccessLogFormat", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetLogFormat() == nil { - err := StdoutAccessLogValidationError{ - field: "LogFormat", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetLogFormat()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StdoutAccessLogValidationError{ - field: "LogFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StdoutAccessLogValidationError{ - field: "LogFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLogFormat()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StdoutAccessLogValidationError{ - field: "LogFormat", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return StdoutAccessLogMultiError(errors) - } - - return nil -} - -// StdoutAccessLogMultiError is an error wrapping multiple validation errors -// returned by StdoutAccessLog.ValidateAll() if the designated constraints -// aren't met. -type StdoutAccessLogMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StdoutAccessLogMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StdoutAccessLogMultiError) AllErrors() []error { return m } - -// StdoutAccessLogValidationError is the validation error returned by -// StdoutAccessLog.Validate if the designated constraints aren't met. -type StdoutAccessLogValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StdoutAccessLogValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StdoutAccessLogValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StdoutAccessLogValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StdoutAccessLogValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StdoutAccessLogValidationError) ErrorName() string { return "StdoutAccessLogValidationError" } - -// Error satisfies the builtin error interface -func (e StdoutAccessLogValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStdoutAccessLog.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StdoutAccessLogValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StdoutAccessLogValidationError{} - -// Validate checks the field values on StderrAccessLog with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *StderrAccessLog) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StderrAccessLog with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// StderrAccessLogMultiError, or nil if none found. -func (m *StderrAccessLog) ValidateAll() error { - return m.validate(true) -} - -func (m *StderrAccessLog) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.AccessLogFormat.(type) { - case *StderrAccessLog_LogFormat: - if v == nil { - err := StderrAccessLogValidationError{ - field: "AccessLogFormat", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if m.GetLogFormat() == nil { - err := StderrAccessLogValidationError{ - field: "LogFormat", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetLogFormat()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StderrAccessLogValidationError{ - field: "LogFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StderrAccessLogValidationError{ - field: "LogFormat", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLogFormat()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StderrAccessLogValidationError{ - field: "LogFormat", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return StderrAccessLogMultiError(errors) - } - - return nil -} - -// StderrAccessLogMultiError is an error wrapping multiple validation errors -// returned by StderrAccessLog.ValidateAll() if the designated constraints -// aren't met. -type StderrAccessLogMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StderrAccessLogMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StderrAccessLogMultiError) AllErrors() []error { return m } - -// StderrAccessLogValidationError is the validation error returned by -// StderrAccessLog.Validate if the designated constraints aren't met. -type StderrAccessLogValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StderrAccessLogValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StderrAccessLogValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StderrAccessLogValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StderrAccessLogValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StderrAccessLogValidationError) ErrorName() string { return "StderrAccessLogValidationError" } - -// Error satisfies the builtin error interface -func (e StderrAccessLogValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStderrAccessLog.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StderrAccessLogValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StderrAccessLogValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream_vtproto.pb.go deleted file mode 100644 index ca780d792..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3/stream_vtproto.pb.go +++ /dev/null @@ -1,237 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/access_loggers/stream/v3/stream.proto - -package streamv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *StdoutAccessLog) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StdoutAccessLog) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StdoutAccessLog) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.AccessLogFormat.(*StdoutAccessLog_LogFormat); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *StdoutAccessLog_LogFormat) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StdoutAccessLog_LogFormat) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.LogFormat != nil { - if vtmsg, ok := interface{}(m.LogFormat).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.LogFormat) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *StderrAccessLog) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StderrAccessLog) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StderrAccessLog) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.AccessLogFormat.(*StderrAccessLog_LogFormat); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *StderrAccessLog_LogFormat) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StderrAccessLog_LogFormat) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.LogFormat != nil { - if vtmsg, ok := interface{}(m.LogFormat).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.LogFormat) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *StdoutAccessLog) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.AccessLogFormat.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *StdoutAccessLog_LogFormat) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LogFormat != nil { - if size, ok := interface{}(m.LogFormat).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.LogFormat) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *StderrAccessLog) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.AccessLogFormat.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *StderrAccessLog_LogFormat) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LogFormat != nil { - if size, ok := interface{}(m.LogFormat).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.LogFormat) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.pb.go deleted file mode 100644 index f21ba01c2..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.pb.go +++ /dev/null @@ -1,327 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.proto - -package dynamic_forward_proxyv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - v31 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - v32 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Configuration for the dynamic forward proxy cluster. See the :ref:`architecture overview -// ` for more information. -// [#extension: envoy.clusters.dynamic_forward_proxy] -type ClusterConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to ClusterImplementationSpecifier: - // - // *ClusterConfig_DnsCacheConfig - // *ClusterConfig_SubClustersConfig - ClusterImplementationSpecifier isClusterConfig_ClusterImplementationSpecifier `protobuf_oneof:"cluster_implementation_specifier"` - // If true allow the cluster configuration to disable the auto_sni and auto_san_validation options - // in the :ref:`cluster's upstream_http_protocol_options - // ` - AllowInsecureClusterOptions bool `protobuf:"varint,2,opt,name=allow_insecure_cluster_options,json=allowInsecureClusterOptions,proto3" json:"allow_insecure_cluster_options,omitempty"` - // If true allow HTTP/2 and HTTP/3 connections to be reused for requests to different - // origins than the connection was initially created for. This will only happen when the - // resolved address for the new connection matches the peer address of the connection and - // the TLS certificate is also valid for the new hostname. For example, if a connection - // has previously been established to foo.example.com at IP 1.2.3.4 with a certificate - // that is valid for “*.example.com“, then this connection could be used for requests to - // bar.example.com if that also resolved to 1.2.3.4. - // - // .. note:: - // - // By design, this feature will maximize reuse of connections. This means that instead - // opening a new connection when an existing connection reaches the maximum number of - // concurrent streams, requests will instead be sent to the existing connection. - // - // .. note:: - // - // The coalesced connections might be to upstreams that would not be otherwise - // selected by Envoy. See the section `Connection Reuse in RFC 7540 - // `_ - AllowCoalescedConnections bool `protobuf:"varint,3,opt,name=allow_coalesced_connections,json=allowCoalescedConnections,proto3" json:"allow_coalesced_connections,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ClusterConfig) Reset() { - *x = ClusterConfig{} - mi := &file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ClusterConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClusterConfig) ProtoMessage() {} - -func (x *ClusterConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClusterConfig.ProtoReflect.Descriptor instead. -func (*ClusterConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescGZIP(), []int{0} -} - -func (x *ClusterConfig) GetClusterImplementationSpecifier() isClusterConfig_ClusterImplementationSpecifier { - if x != nil { - return x.ClusterImplementationSpecifier - } - return nil -} - -func (x *ClusterConfig) GetDnsCacheConfig() *v3.DnsCacheConfig { - if x != nil { - if x, ok := x.ClusterImplementationSpecifier.(*ClusterConfig_DnsCacheConfig); ok { - return x.DnsCacheConfig - } - } - return nil -} - -func (x *ClusterConfig) GetSubClustersConfig() *SubClustersConfig { - if x != nil { - if x, ok := x.ClusterImplementationSpecifier.(*ClusterConfig_SubClustersConfig); ok { - return x.SubClustersConfig - } - } - return nil -} - -func (x *ClusterConfig) GetAllowInsecureClusterOptions() bool { - if x != nil { - return x.AllowInsecureClusterOptions - } - return false -} - -func (x *ClusterConfig) GetAllowCoalescedConnections() bool { - if x != nil { - return x.AllowCoalescedConnections - } - return false -} - -type isClusterConfig_ClusterImplementationSpecifier interface { - isClusterConfig_ClusterImplementationSpecifier() -} - -type ClusterConfig_DnsCacheConfig struct { - // The DNS cache configuration that the cluster will attach to. Note this configuration must - // match that of associated :ref:`dynamic forward proxy HTTP filter configuration - // `. - DnsCacheConfig *v3.DnsCacheConfig `protobuf:"bytes,1,opt,name=dns_cache_config,json=dnsCacheConfig,proto3,oneof"` -} - -type ClusterConfig_SubClustersConfig struct { - // Configuration for sub clusters, when this configuration is enabled, - // Envoy will create an independent sub cluster dynamically for each host:port. - // Most of the configuration of a sub cluster is inherited from the current cluster, - // i.e. health_checks, dns_resolvers and etc. - // And the load_assignment will be set to the only one endpoint, host:port. - // - // Compared to the dns_cache_config, it has the following advantages: - // - // 1. sub clusters will be created with the STRICT_DNS DiscoveryType, - // so that Envoy will use all of the IPs resolved from the host. - // - // 2. each sub cluster is full featured cluster, with lb_policy and health check and etc enabled. - SubClustersConfig *SubClustersConfig `protobuf:"bytes,4,opt,name=sub_clusters_config,json=subClustersConfig,proto3,oneof"` -} - -func (*ClusterConfig_DnsCacheConfig) isClusterConfig_ClusterImplementationSpecifier() {} - -func (*ClusterConfig_SubClustersConfig) isClusterConfig_ClusterImplementationSpecifier() {} - -// Configuration for sub clusters. Hard code STRICT_DNS cluster type now. -type SubClustersConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The :ref:`load balancer type ` to use - // when picking a host in a sub cluster. Note that CLUSTER_PROVIDED is not allowed here. - LbPolicy v31.Cluster_LbPolicy `protobuf:"varint,1,opt,name=lb_policy,json=lbPolicy,proto3,enum=envoy.config.cluster.v3.Cluster_LbPolicy" json:"lb_policy,omitempty"` - // The maximum number of sub clusters that the DFP cluster will hold. If not specified defaults to 1024. - MaxSubClusters *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=max_sub_clusters,json=maxSubClusters,proto3" json:"max_sub_clusters,omitempty"` - // The TTL for sub clusters that are unused. Sub clusters that have not been used in the configured time - // interval will be purged. If not specified defaults to 5m. - SubClusterTtl *durationpb.Duration `protobuf:"bytes,3,opt,name=sub_cluster_ttl,json=subClusterTtl,proto3" json:"sub_cluster_ttl,omitempty"` - // Sub clusters that should be created & warmed upon creation. This might provide a - // performance improvement, in the form of cache hits, for sub clusters that are going to be - // warmed during steady state and are known at config load time. - PreresolveClusters []*v32.SocketAddress `protobuf:"bytes,4,rep,name=preresolve_clusters,json=preresolveClusters,proto3" json:"preresolve_clusters,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubClustersConfig) Reset() { - *x = SubClustersConfig{} - mi := &file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubClustersConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubClustersConfig) ProtoMessage() {} - -func (x *SubClustersConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubClustersConfig.ProtoReflect.Descriptor instead. -func (*SubClustersConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescGZIP(), []int{1} -} - -func (x *SubClustersConfig) GetLbPolicy() v31.Cluster_LbPolicy { - if x != nil { - return x.LbPolicy - } - return v31.Cluster_LbPolicy(0) -} - -func (x *SubClustersConfig) GetMaxSubClusters() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxSubClusters - } - return nil -} - -func (x *SubClustersConfig) GetSubClusterTtl() *durationpb.Duration { - if x != nil { - return x.SubClusterTtl - } - return nil -} - -func (x *SubClustersConfig) GetPreresolveClusters() []*v32.SocketAddress { - if x != nil { - return x.PreresolveClusters - } - return nil -} - -var File_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto protoreflect.FileDescriptor - -const file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDesc = "" + - "\n" + - "@envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.proto\x122envoy.extensions.clusters.dynamic_forward_proxy.v3\x1a%envoy/config/cluster/v3/cluster.proto\x1a\"envoy/config/core/v3/address.proto\x1a@envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\x1a\x17validate/validate.proto\"\xe8\x03\n" + - "\rClusterConfig\x12l\n" + - "\x10dns_cache_config\x18\x01 \x01(\v2@.envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfigH\x00R\x0ednsCacheConfig\x12w\n" + - "\x13sub_clusters_config\x18\x04 \x01(\v2E.envoy.extensions.clusters.dynamic_forward_proxy.v3.SubClustersConfigH\x00R\x11subClustersConfig\x12C\n" + - "\x1eallow_insecure_cluster_options\x18\x02 \x01(\bR\x1ballowInsecureClusterOptions\x12>\n" + - "\x1ballow_coalesced_connections\x18\x03 \x01(\bR\x19allowCoalescedConnections:G\x9aň\x1eB\n" + - "@envoy.config.cluster.dynamic_forward_proxy.v2alpha.ClusterConfigB\"\n" + - " cluster_implementation_specifier\"\xd9\x02\n" + - "\x11SubClustersConfig\x12P\n" + - "\tlb_policy\x18\x01 \x01(\x0e2).envoy.config.cluster.v3.Cluster.LbPolicyB\b\xfaB\x05\x82\x01\x02\x10\x01R\blbPolicy\x12O\n" + - "\x10max_sub_clusters\x18\x02 \x01(\v2\x1c.google.protobuf.UInt32ValueB\a\xfaB\x04*\x02 \x00R\x0emaxSubClusters\x12K\n" + - "\x0fsub_cluster_ttl\x18\x03 \x01(\v2\x19.google.protobuf.DurationB\b\xfaB\x05\xaa\x01\x02*\x00R\rsubClusterTtl\x12T\n" + - "\x13preresolve_clusters\x18\x04 \x03(\v2#.envoy.config.core.v3.SocketAddressR\x12preresolveClustersB\xcd\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "@io.envoyproxy.envoy.extensions.clusters.dynamic_forward_proxy.v3B\fClusterProtoP\x01Zqgithub.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3;dynamic_forward_proxyv3b\x06proto3" - -var ( - file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescOnce sync.Once - file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescData []byte -) - -func file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescGZIP() []byte { - file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescOnce.Do(func() { - file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDesc), len(file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDesc))) - }) - return file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDescData -} - -var file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_goTypes = []any{ - (*ClusterConfig)(nil), // 0: envoy.extensions.clusters.dynamic_forward_proxy.v3.ClusterConfig - (*SubClustersConfig)(nil), // 1: envoy.extensions.clusters.dynamic_forward_proxy.v3.SubClustersConfig - (*v3.DnsCacheConfig)(nil), // 2: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig - (v31.Cluster_LbPolicy)(0), // 3: envoy.config.cluster.v3.Cluster.LbPolicy - (*wrapperspb.UInt32Value)(nil), // 4: google.protobuf.UInt32Value - (*durationpb.Duration)(nil), // 5: google.protobuf.Duration - (*v32.SocketAddress)(nil), // 6: envoy.config.core.v3.SocketAddress -} -var file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_depIdxs = []int32{ - 2, // 0: envoy.extensions.clusters.dynamic_forward_proxy.v3.ClusterConfig.dns_cache_config:type_name -> envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig - 1, // 1: envoy.extensions.clusters.dynamic_forward_proxy.v3.ClusterConfig.sub_clusters_config:type_name -> envoy.extensions.clusters.dynamic_forward_proxy.v3.SubClustersConfig - 3, // 2: envoy.extensions.clusters.dynamic_forward_proxy.v3.SubClustersConfig.lb_policy:type_name -> envoy.config.cluster.v3.Cluster.LbPolicy - 4, // 3: envoy.extensions.clusters.dynamic_forward_proxy.v3.SubClustersConfig.max_sub_clusters:type_name -> google.protobuf.UInt32Value - 5, // 4: envoy.extensions.clusters.dynamic_forward_proxy.v3.SubClustersConfig.sub_cluster_ttl:type_name -> google.protobuf.Duration - 6, // 5: envoy.extensions.clusters.dynamic_forward_proxy.v3.SubClustersConfig.preresolve_clusters:type_name -> envoy.config.core.v3.SocketAddress - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_init() } -func file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_init() { - if File_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto != nil { - return - } - file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_msgTypes[0].OneofWrappers = []any{ - (*ClusterConfig_DnsCacheConfig)(nil), - (*ClusterConfig_SubClustersConfig)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDesc), len(file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_goTypes, - DependencyIndexes: file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_depIdxs, - MessageInfos: file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_msgTypes, - }.Build() - File_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto = out.File - file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_goTypes = nil - file_envoy_extensions_clusters_dynamic_forward_proxy_v3_cluster_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.pb.validate.go deleted file mode 100644 index 26884ce91..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.pb.validate.go +++ /dev/null @@ -1,424 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.proto - -package dynamic_forward_proxyv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = v3.Cluster_LbPolicy(0) -) - -// Validate checks the field values on ClusterConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ClusterConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ClusterConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ClusterConfigMultiError, or -// nil if none found. -func (m *ClusterConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *ClusterConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for AllowInsecureClusterOptions - - // no validation rules for AllowCoalescedConnections - - switch v := m.ClusterImplementationSpecifier.(type) { - case *ClusterConfig_DnsCacheConfig: - if v == nil { - err := ClusterConfigValidationError{ - field: "ClusterImplementationSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetDnsCacheConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ClusterConfigValidationError{ - field: "DnsCacheConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ClusterConfigValidationError{ - field: "DnsCacheConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDnsCacheConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ClusterConfigValidationError{ - field: "DnsCacheConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ClusterConfig_SubClustersConfig: - if v == nil { - err := ClusterConfigValidationError{ - field: "ClusterImplementationSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSubClustersConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ClusterConfigValidationError{ - field: "SubClustersConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ClusterConfigValidationError{ - field: "SubClustersConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSubClustersConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ClusterConfigValidationError{ - field: "SubClustersConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return ClusterConfigMultiError(errors) - } - - return nil -} - -// ClusterConfigMultiError is an error wrapping multiple validation errors -// returned by ClusterConfig.ValidateAll() if the designated constraints -// aren't met. -type ClusterConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ClusterConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ClusterConfigMultiError) AllErrors() []error { return m } - -// ClusterConfigValidationError is the validation error returned by -// ClusterConfig.Validate if the designated constraints aren't met. -type ClusterConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ClusterConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ClusterConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ClusterConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ClusterConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ClusterConfigValidationError) ErrorName() string { return "ClusterConfigValidationError" } - -// Error satisfies the builtin error interface -func (e ClusterConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sClusterConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ClusterConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ClusterConfigValidationError{} - -// Validate checks the field values on SubClustersConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *SubClustersConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SubClustersConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SubClustersConfigMultiError, or nil if none found. -func (m *SubClustersConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *SubClustersConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := v3.Cluster_LbPolicy_name[int32(m.GetLbPolicy())]; !ok { - err := SubClustersConfigValidationError{ - field: "LbPolicy", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if wrapper := m.GetMaxSubClusters(); wrapper != nil { - - if wrapper.GetValue() <= 0 { - err := SubClustersConfigValidationError{ - field: "MaxSubClusters", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - if d := m.GetSubClusterTtl(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = SubClustersConfigValidationError{ - field: "SubClusterTtl", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := SubClustersConfigValidationError{ - field: "SubClusterTtl", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - for idx, item := range m.GetPreresolveClusters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SubClustersConfigValidationError{ - field: fmt.Sprintf("PreresolveClusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SubClustersConfigValidationError{ - field: fmt.Sprintf("PreresolveClusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SubClustersConfigValidationError{ - field: fmt.Sprintf("PreresolveClusters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return SubClustersConfigMultiError(errors) - } - - return nil -} - -// SubClustersConfigMultiError is an error wrapping multiple validation errors -// returned by SubClustersConfig.ValidateAll() if the designated constraints -// aren't met. -type SubClustersConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SubClustersConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SubClustersConfigMultiError) AllErrors() []error { return m } - -// SubClustersConfigValidationError is the validation error returned by -// SubClustersConfig.Validate if the designated constraints aren't met. -type SubClustersConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SubClustersConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SubClustersConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SubClustersConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SubClustersConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SubClustersConfigValidationError) ErrorName() string { - return "SubClustersConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e SubClustersConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSubClustersConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SubClustersConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SubClustersConfigValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster_vtproto.pb.go deleted file mode 100644 index ac609ad10..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster_vtproto.pb.go +++ /dev/null @@ -1,315 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/clusters/dynamic_forward_proxy/v3/cluster.proto - -package dynamic_forward_proxyv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - durationpb "github.com/planetscale/vtprotobuf/types/known/durationpb" - wrapperspb "github.com/planetscale/vtprotobuf/types/known/wrapperspb" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *ClusterConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClusterConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ClusterConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.ClusterImplementationSpecifier.(*ClusterConfig_SubClustersConfig); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if m.AllowCoalescedConnections { - i-- - if m.AllowCoalescedConnections { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.AllowInsecureClusterOptions { - i-- - if m.AllowInsecureClusterOptions { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if msg, ok := m.ClusterImplementationSpecifier.(*ClusterConfig_DnsCacheConfig); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *ClusterConfig_DnsCacheConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ClusterConfig_DnsCacheConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.DnsCacheConfig != nil { - if vtmsg, ok := interface{}(m.DnsCacheConfig).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.DnsCacheConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *ClusterConfig_SubClustersConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ClusterConfig_SubClustersConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.SubClustersConfig != nil { - size, err := m.SubClustersConfig.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *SubClustersConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SubClustersConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *SubClustersConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PreresolveClusters) > 0 { - for iNdEx := len(m.PreresolveClusters) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.PreresolveClusters[iNdEx]).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.PreresolveClusters[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x22 - } - } - if m.SubClusterTtl != nil { - size, err := (*durationpb.Duration)(m.SubClusterTtl).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.MaxSubClusters != nil { - size, err := (*wrapperspb.UInt32Value)(m.MaxSubClusters).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.LbPolicy != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.LbPolicy)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ClusterConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.ClusterImplementationSpecifier.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - if m.AllowInsecureClusterOptions { - n += 2 - } - if m.AllowCoalescedConnections { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ClusterConfig_DnsCacheConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DnsCacheConfig != nil { - if size, ok := interface{}(m.DnsCacheConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.DnsCacheConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ClusterConfig_SubClustersConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SubClustersConfig != nil { - l = m.SubClustersConfig.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *SubClustersConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LbPolicy != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.LbPolicy)) - } - if m.MaxSubClusters != nil { - l = (*wrapperspb.UInt32Value)(m.MaxSubClusters).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.SubClusterTtl != nil { - l = (*durationpb.Duration)(m.SubClusterTtl).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.PreresolveClusters) > 0 { - for _, e := range m.PreresolveClusters { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.pb.go deleted file mode 100644 index 884066627..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.pb.go +++ /dev/null @@ -1,417 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto - -package dynamic_forward_proxyv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - v32 "github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3" - v31 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Configuration of circuit breakers for resolver. -type DnsCacheCircuitBreakers struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The maximum number of pending requests that Envoy will allow to the - // resolver. If not specified, the default is 1024. - MaxPendingRequests *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=max_pending_requests,json=maxPendingRequests,proto3" json:"max_pending_requests,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DnsCacheCircuitBreakers) Reset() { - *x = DnsCacheCircuitBreakers{} - mi := &file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DnsCacheCircuitBreakers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DnsCacheCircuitBreakers) ProtoMessage() {} - -func (x *DnsCacheCircuitBreakers) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DnsCacheCircuitBreakers.ProtoReflect.Descriptor instead. -func (*DnsCacheCircuitBreakers) Descriptor() ([]byte, []int) { - return file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescGZIP(), []int{0} -} - -func (x *DnsCacheCircuitBreakers) GetMaxPendingRequests() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxPendingRequests - } - return nil -} - -// Configuration for the dynamic forward proxy DNS cache. See the :ref:`architecture overview -// ` for more information. -// [#next-free-field: 16] -type DnsCacheConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The name of the cache. Multiple named caches allow independent dynamic forward proxy - // configurations to operate within a single Envoy process using different configurations. All - // configurations with the same name *must* otherwise have the same settings when referenced - // from different configuration components. Configuration will fail to load if this is not - // the case. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The DNS lookup family to use during resolution. - // - // [#comment:TODO(mattklein123): Figure out how to support IPv4/IPv6 "happy eyeballs" mode. The - // way this might work is a new lookup family which returns both IPv4 and IPv6 addresses, and - // then configures a host to have a primary and fall back address. With this, we could very - // likely build a "happy eyeballs" connection pool which would race the primary / fall back - // address and return the one that wins. This same method could potentially also be used for - // QUIC to TCP fall back.] - DnsLookupFamily v3.Cluster_DnsLookupFamily `protobuf:"varint,2,opt,name=dns_lookup_family,json=dnsLookupFamily,proto3,enum=envoy.config.cluster.v3.Cluster_DnsLookupFamily" json:"dns_lookup_family,omitempty"` - // The DNS refresh rate for unresolved DNS hosts. If not specified defaults to 60s. - // - // The refresh rate is rounded to the closest millisecond, and must be at least 1ms. - // - // Once a host has been resolved, the refresh rate will be the DNS TTL, capped - // at a minimum of “dns_min_refresh_rate“. - DnsRefreshRate *durationpb.Duration `protobuf:"bytes,3,opt,name=dns_refresh_rate,json=dnsRefreshRate,proto3" json:"dns_refresh_rate,omitempty"` - // The minimum rate that DNS resolution will occur. Per “dns_refresh_rate“, once a host is - // resolved, the DNS TTL will be used, with a minimum set by “dns_min_refresh_rate“. - // “dns_min_refresh_rate“ defaults to 5s and must also be >= 1s. - DnsMinRefreshRate *durationpb.Duration `protobuf:"bytes,14,opt,name=dns_min_refresh_rate,json=dnsMinRefreshRate,proto3" json:"dns_min_refresh_rate,omitempty"` - // The TTL for hosts that are unused. Hosts that have not been used in the configured time - // interval will be purged. If not specified defaults to 5m. - // - // .. note: - // - // The TTL is only checked at the time of DNS refresh, as specified by ``dns_refresh_rate``. This - // means that if the configured TTL is shorter than the refresh rate the host may not be removed - // immediately. - // - // .. note: - // - // The TTL has no relation to DNS TTL and is only used to control Envoy's resource usage. - HostTtl *durationpb.Duration `protobuf:"bytes,4,opt,name=host_ttl,json=hostTtl,proto3" json:"host_ttl,omitempty"` - // The maximum number of hosts that the cache will hold. If not specified defaults to 1024. - // - // .. note: - // - // The implementation is approximate and enforced independently on each worker thread, thus - // it is possible for the maximum hosts in the cache to go slightly above the configured - // value depending on timing. This is similar to how other circuit breakers work. - MaxHosts *wrapperspb.UInt32Value `protobuf:"bytes,5,opt,name=max_hosts,json=maxHosts,proto3" json:"max_hosts,omitempty"` - // Disable the DNS refresh on failure. If this field is set to true, it will ignore the - // :ref:`typed_dns_resolver_config `. - // If not specified, it defaults to false. By enabling this feature, the failed hosts will now be treated as a cache miss, - // allowing the failed hosts to be resolved on demand. - DisableDnsRefreshOnFailure bool `protobuf:"varint,15,opt,name=disable_dns_refresh_on_failure,json=disableDnsRefreshOnFailure,proto3" json:"disable_dns_refresh_on_failure,omitempty"` - // If the DNS failure refresh rate is specified, - // this is used as the cache's DNS refresh rate when DNS requests are failing. If this setting is - // not specified, the failure refresh rate defaults to the dns_refresh_rate. - DnsFailureRefreshRate *v3.Cluster_RefreshRate `protobuf:"bytes,6,opt,name=dns_failure_refresh_rate,json=dnsFailureRefreshRate,proto3" json:"dns_failure_refresh_rate,omitempty"` - // The config of circuit breakers for resolver. It provides a configurable threshold. - // Envoy will use dns cache circuit breakers with default settings even if this value is not set. - DnsCacheCircuitBreaker *DnsCacheCircuitBreakers `protobuf:"bytes,7,opt,name=dns_cache_circuit_breaker,json=dnsCacheCircuitBreaker,proto3" json:"dns_cache_circuit_breaker,omitempty"` - // Always use TCP queries instead of UDP queries for DNS lookups. - // This field is deprecated in favor of “dns_resolution_config“ - // which aggregates all of the DNS resolver configuration in a single message. - // - // Deprecated: Marked as deprecated in envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto. - UseTcpForDnsLookups bool `protobuf:"varint,8,opt,name=use_tcp_for_dns_lookups,json=useTcpForDnsLookups,proto3" json:"use_tcp_for_dns_lookups,omitempty"` - // DNS resolution configuration which includes the underlying dns resolver addresses and options. - // This field is deprecated in favor of - // :ref:`typed_dns_resolver_config `. - // - // Deprecated: Marked as deprecated in envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto. - DnsResolutionConfig *v31.DnsResolutionConfig `protobuf:"bytes,9,opt,name=dns_resolution_config,json=dnsResolutionConfig,proto3" json:"dns_resolution_config,omitempty"` - // DNS resolver type configuration extension. This extension can be used to configure c-ares, apple, - // or any other DNS resolver types and the related parameters. - // For example, an object of - // :ref:`CaresDnsResolverConfig ` - // can be packed into this “typed_dns_resolver_config“. This configuration replaces the - // :ref:`dns_resolution_config ` - // configuration. - // During the transition period when both “dns_resolution_config“ and “typed_dns_resolver_config“ exists, - // when “typed_dns_resolver_config“ is in place, Envoy will use it and ignore “dns_resolution_config“. - // When “typed_dns_resolver_config“ is missing, the default behavior is in place. - // [#extension-category: envoy.network.dns_resolver] - TypedDnsResolverConfig *v31.TypedExtensionConfig `protobuf:"bytes,12,opt,name=typed_dns_resolver_config,json=typedDnsResolverConfig,proto3" json:"typed_dns_resolver_config,omitempty"` - // Hostnames that should be preresolved into the cache upon creation. This might provide a - // performance improvement, in the form of cache hits, for hostnames that are going to be - // resolved during steady state and are known at config load time. - PreresolveHostnames []*v31.SocketAddress `protobuf:"bytes,10,rep,name=preresolve_hostnames,json=preresolveHostnames,proto3" json:"preresolve_hostnames,omitempty"` - // The timeout used for DNS queries. This timeout is independent of any timeout and retry policy - // used by the underlying DNS implementation (e.g., c-areas and Apple DNS) which are opaque. - // Setting this timeout will ensure that queries succeed or fail within the specified time frame - // and are then retried using the standard refresh rates. Setting it to 0 will disable the Envoy DNS - // query timeout and use the underlying DNS implementation timeout. Defaults to 5s if not set. - DnsQueryTimeout *durationpb.Duration `protobuf:"bytes,11,opt,name=dns_query_timeout,json=dnsQueryTimeout,proto3" json:"dns_query_timeout,omitempty"` - // Configuration to flush the DNS cache to long term storage. - KeyValueConfig *v32.KeyValueStoreConfig `protobuf:"bytes,13,opt,name=key_value_config,json=keyValueConfig,proto3" json:"key_value_config,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DnsCacheConfig) Reset() { - *x = DnsCacheConfig{} - mi := &file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DnsCacheConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DnsCacheConfig) ProtoMessage() {} - -func (x *DnsCacheConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DnsCacheConfig.ProtoReflect.Descriptor instead. -func (*DnsCacheConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescGZIP(), []int{1} -} - -func (x *DnsCacheConfig) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *DnsCacheConfig) GetDnsLookupFamily() v3.Cluster_DnsLookupFamily { - if x != nil { - return x.DnsLookupFamily - } - return v3.Cluster_DnsLookupFamily(0) -} - -func (x *DnsCacheConfig) GetDnsRefreshRate() *durationpb.Duration { - if x != nil { - return x.DnsRefreshRate - } - return nil -} - -func (x *DnsCacheConfig) GetDnsMinRefreshRate() *durationpb.Duration { - if x != nil { - return x.DnsMinRefreshRate - } - return nil -} - -func (x *DnsCacheConfig) GetHostTtl() *durationpb.Duration { - if x != nil { - return x.HostTtl - } - return nil -} - -func (x *DnsCacheConfig) GetMaxHosts() *wrapperspb.UInt32Value { - if x != nil { - return x.MaxHosts - } - return nil -} - -func (x *DnsCacheConfig) GetDisableDnsRefreshOnFailure() bool { - if x != nil { - return x.DisableDnsRefreshOnFailure - } - return false -} - -func (x *DnsCacheConfig) GetDnsFailureRefreshRate() *v3.Cluster_RefreshRate { - if x != nil { - return x.DnsFailureRefreshRate - } - return nil -} - -func (x *DnsCacheConfig) GetDnsCacheCircuitBreaker() *DnsCacheCircuitBreakers { - if x != nil { - return x.DnsCacheCircuitBreaker - } - return nil -} - -// Deprecated: Marked as deprecated in envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto. -func (x *DnsCacheConfig) GetUseTcpForDnsLookups() bool { - if x != nil { - return x.UseTcpForDnsLookups - } - return false -} - -// Deprecated: Marked as deprecated in envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto. -func (x *DnsCacheConfig) GetDnsResolutionConfig() *v31.DnsResolutionConfig { - if x != nil { - return x.DnsResolutionConfig - } - return nil -} - -func (x *DnsCacheConfig) GetTypedDnsResolverConfig() *v31.TypedExtensionConfig { - if x != nil { - return x.TypedDnsResolverConfig - } - return nil -} - -func (x *DnsCacheConfig) GetPreresolveHostnames() []*v31.SocketAddress { - if x != nil { - return x.PreresolveHostnames - } - return nil -} - -func (x *DnsCacheConfig) GetDnsQueryTimeout() *durationpb.Duration { - if x != nil { - return x.DnsQueryTimeout - } - return nil -} - -func (x *DnsCacheConfig) GetKeyValueConfig() *v32.KeyValueStoreConfig { - if x != nil { - return x.KeyValueConfig - } - return nil -} - -var File_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto protoreflect.FileDescriptor - -const file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDesc = "" + - "\n" + - "@envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto\x120envoy.extensions.common.dynamic_forward_proxy.v3\x1a%envoy/config/cluster/v3/cluster.proto\x1a-envoy/config/common/key_value/v3/config.proto\x1a\"envoy/config/core/v3/address.proto\x1a$envoy/config/core/v3/extension.proto\x1a#envoy/config/core/v3/resolver.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a#envoy/annotations/deprecation.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\x1a\x17validate/validate.proto\"i\n" + - "\x17DnsCacheCircuitBreakers\x12N\n" + - "\x14max_pending_requests\x18\x01 \x01(\v2\x1c.google.protobuf.UInt32ValueR\x12maxPendingRequests\"\xdf\n" + - "\n" + - "\x0eDnsCacheConfig\x12\x1b\n" + - "\x04name\x18\x01 \x01(\tB\a\xfaB\x04r\x02\x10\x01R\x04name\x12f\n" + - "\x11dns_lookup_family\x18\x02 \x01(\x0e20.envoy.config.cluster.v3.Cluster.DnsLookupFamilyB\b\xfaB\x05\x82\x01\x02\x10\x01R\x0fdnsLookupFamily\x12Q\n" + - "\x10dns_refresh_rate\x18\x03 \x01(\v2\x19.google.protobuf.DurationB\f\xfaB\t\xaa\x01\x062\x04\x10\xc0\x84=R\x0ednsRefreshRate\x12V\n" + - "\x14dns_min_refresh_rate\x18\x0e \x01(\v2\x19.google.protobuf.DurationB\n" + - "\xfaB\a\xaa\x01\x042\x02\b\x01R\x11dnsMinRefreshRate\x12>\n" + - "\bhost_ttl\x18\x04 \x01(\v2\x19.google.protobuf.DurationB\b\xfaB\x05\xaa\x01\x02*\x00R\ahostTtl\x12B\n" + - "\tmax_hosts\x18\x05 \x01(\v2\x1c.google.protobuf.UInt32ValueB\a\xfaB\x04*\x02 \x00R\bmaxHosts\x12B\n" + - "\x1edisable_dns_refresh_on_failure\x18\x0f \x01(\bR\x1adisableDnsRefreshOnFailure\x12e\n" + - "\x18dns_failure_refresh_rate\x18\x06 \x01(\v2,.envoy.config.cluster.v3.Cluster.RefreshRateR\x15dnsFailureRefreshRate\x12\x84\x01\n" + - "\x19dns_cache_circuit_breaker\x18\a \x01(\v2I.envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheCircuitBreakersR\x16dnsCacheCircuitBreaker\x12A\n" + - "\x17use_tcp_for_dns_lookups\x18\b \x01(\bB\v\x92dž\xd8\x04\x033.0\x18\x01R\x13useTcpForDnsLookups\x12j\n" + - "\x15dns_resolution_config\x18\t \x01(\v2).envoy.config.core.v3.DnsResolutionConfigB\v\x92dž\xd8\x04\x033.0\x18\x01R\x13dnsResolutionConfig\x12e\n" + - "\x19typed_dns_resolver_config\x18\f \x01(\v2*.envoy.config.core.v3.TypedExtensionConfigR\x16typedDnsResolverConfig\x12V\n" + - "\x14preresolve_hostnames\x18\n" + - " \x03(\v2#.envoy.config.core.v3.SocketAddressR\x13preresolveHostnames\x12O\n" + - "\x11dns_query_timeout\x18\v \x01(\v2\x19.google.protobuf.DurationB\b\xfaB\x05\xaa\x01\x022\x00R\x0fdnsQueryTimeout\x12_\n" + - "\x10key_value_config\x18\r \x01(\v25.envoy.config.common.key_value.v3.KeyValueStoreConfigR\x0ekeyValueConfig:G\x9aň\x1eB\n" + - "@envoy.config.common.dynamic_forward_proxy.v2alpha.DnsCacheConfigB\xca\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - ">io.envoyproxy.envoy.extensions.common.dynamic_forward_proxy.v3B\rDnsCacheProtoP\x01Zogithub.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3;dynamic_forward_proxyv3b\x06proto3" - -var ( - file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescOnce sync.Once - file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescData []byte -) - -func file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescGZIP() []byte { - file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescOnce.Do(func() { - file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDesc), len(file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDesc))) - }) - return file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDescData -} - -var file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_goTypes = []any{ - (*DnsCacheCircuitBreakers)(nil), // 0: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheCircuitBreakers - (*DnsCacheConfig)(nil), // 1: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig - (*wrapperspb.UInt32Value)(nil), // 2: google.protobuf.UInt32Value - (v3.Cluster_DnsLookupFamily)(0), // 3: envoy.config.cluster.v3.Cluster.DnsLookupFamily - (*durationpb.Duration)(nil), // 4: google.protobuf.Duration - (*v3.Cluster_RefreshRate)(nil), // 5: envoy.config.cluster.v3.Cluster.RefreshRate - (*v31.DnsResolutionConfig)(nil), // 6: envoy.config.core.v3.DnsResolutionConfig - (*v31.TypedExtensionConfig)(nil), // 7: envoy.config.core.v3.TypedExtensionConfig - (*v31.SocketAddress)(nil), // 8: envoy.config.core.v3.SocketAddress - (*v32.KeyValueStoreConfig)(nil), // 9: envoy.config.common.key_value.v3.KeyValueStoreConfig -} -var file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_depIdxs = []int32{ - 2, // 0: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheCircuitBreakers.max_pending_requests:type_name -> google.protobuf.UInt32Value - 3, // 1: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_lookup_family:type_name -> envoy.config.cluster.v3.Cluster.DnsLookupFamily - 4, // 2: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_refresh_rate:type_name -> google.protobuf.Duration - 4, // 3: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_min_refresh_rate:type_name -> google.protobuf.Duration - 4, // 4: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.host_ttl:type_name -> google.protobuf.Duration - 2, // 5: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.max_hosts:type_name -> google.protobuf.UInt32Value - 5, // 6: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_failure_refresh_rate:type_name -> envoy.config.cluster.v3.Cluster.RefreshRate - 0, // 7: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_cache_circuit_breaker:type_name -> envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheCircuitBreakers - 6, // 8: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_resolution_config:type_name -> envoy.config.core.v3.DnsResolutionConfig - 7, // 9: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.typed_dns_resolver_config:type_name -> envoy.config.core.v3.TypedExtensionConfig - 8, // 10: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.preresolve_hostnames:type_name -> envoy.config.core.v3.SocketAddress - 4, // 11: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_query_timeout:type_name -> google.protobuf.Duration - 9, // 12: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.key_value_config:type_name -> envoy.config.common.key_value.v3.KeyValueStoreConfig - 13, // [13:13] is the sub-list for method output_type - 13, // [13:13] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name -} - -func init() { file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_init() } -func file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_init() { - if File_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDesc), len(file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_goTypes, - DependencyIndexes: file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_depIdxs, - MessageInfos: file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_msgTypes, - }.Build() - File_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto = out.File - file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_goTypes = nil - file_envoy_extensions_common_dynamic_forward_proxy_v3_dns_cache_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.pb.validate.go deleted file mode 100644 index d0bb5fdba..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.pb.validate.go +++ /dev/null @@ -1,612 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto - -package dynamic_forward_proxyv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = v3.Cluster_DnsLookupFamily(0) -) - -// Validate checks the field values on DnsCacheCircuitBreakers with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DnsCacheCircuitBreakers) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DnsCacheCircuitBreakers with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DnsCacheCircuitBreakersMultiError, or nil if none found. -func (m *DnsCacheCircuitBreakers) ValidateAll() error { - return m.validate(true) -} - -func (m *DnsCacheCircuitBreakers) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetMaxPendingRequests()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsCacheCircuitBreakersValidationError{ - field: "MaxPendingRequests", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsCacheCircuitBreakersValidationError{ - field: "MaxPendingRequests", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMaxPendingRequests()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsCacheCircuitBreakersValidationError{ - field: "MaxPendingRequests", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DnsCacheCircuitBreakersMultiError(errors) - } - - return nil -} - -// DnsCacheCircuitBreakersMultiError is an error wrapping multiple validation -// errors returned by DnsCacheCircuitBreakers.ValidateAll() if the designated -// constraints aren't met. -type DnsCacheCircuitBreakersMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DnsCacheCircuitBreakersMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DnsCacheCircuitBreakersMultiError) AllErrors() []error { return m } - -// DnsCacheCircuitBreakersValidationError is the validation error returned by -// DnsCacheCircuitBreakers.Validate if the designated constraints aren't met. -type DnsCacheCircuitBreakersValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DnsCacheCircuitBreakersValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DnsCacheCircuitBreakersValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DnsCacheCircuitBreakersValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DnsCacheCircuitBreakersValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DnsCacheCircuitBreakersValidationError) ErrorName() string { - return "DnsCacheCircuitBreakersValidationError" -} - -// Error satisfies the builtin error interface -func (e DnsCacheCircuitBreakersValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDnsCacheCircuitBreakers.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DnsCacheCircuitBreakersValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DnsCacheCircuitBreakersValidationError{} - -// Validate checks the field values on DnsCacheConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DnsCacheConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DnsCacheConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DnsCacheConfigMultiError, -// or nil if none found. -func (m *DnsCacheConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *DnsCacheConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := DnsCacheConfigValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := v3.Cluster_DnsLookupFamily_name[int32(m.GetDnsLookupFamily())]; !ok { - err := DnsCacheConfigValidationError{ - field: "DnsLookupFamily", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if d := m.GetDnsRefreshRate(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = DnsCacheConfigValidationError{ - field: "DnsRefreshRate", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gte := time.Duration(0*time.Second + 1000000*time.Nanosecond) - - if dur < gte { - err := DnsCacheConfigValidationError{ - field: "DnsRefreshRate", - reason: "value must be greater than or equal to 1ms", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetDnsMinRefreshRate(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = DnsCacheConfigValidationError{ - field: "DnsMinRefreshRate", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gte := time.Duration(1*time.Second + 0*time.Nanosecond) - - if dur < gte { - err := DnsCacheConfigValidationError{ - field: "DnsMinRefreshRate", - reason: "value must be greater than or equal to 1s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if d := m.GetHostTtl(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = DnsCacheConfigValidationError{ - field: "HostTtl", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := DnsCacheConfigValidationError{ - field: "HostTtl", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if wrapper := m.GetMaxHosts(); wrapper != nil { - - if wrapper.GetValue() <= 0 { - err := DnsCacheConfigValidationError{ - field: "MaxHosts", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - - // no validation rules for DisableDnsRefreshOnFailure - - if all { - switch v := interface{}(m.GetDnsFailureRefreshRate()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "DnsFailureRefreshRate", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "DnsFailureRefreshRate", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDnsFailureRefreshRate()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsCacheConfigValidationError{ - field: "DnsFailureRefreshRate", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetDnsCacheCircuitBreaker()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "DnsCacheCircuitBreaker", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "DnsCacheCircuitBreaker", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDnsCacheCircuitBreaker()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsCacheConfigValidationError{ - field: "DnsCacheCircuitBreaker", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for UseTcpForDnsLookups - - if all { - switch v := interface{}(m.GetDnsResolutionConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "DnsResolutionConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "DnsResolutionConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDnsResolutionConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsCacheConfigValidationError{ - field: "DnsResolutionConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetTypedDnsResolverConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "TypedDnsResolverConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "TypedDnsResolverConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTypedDnsResolverConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsCacheConfigValidationError{ - field: "TypedDnsResolverConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetPreresolveHostnames() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: fmt.Sprintf("PreresolveHostnames[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: fmt.Sprintf("PreresolveHostnames[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsCacheConfigValidationError{ - field: fmt.Sprintf("PreresolveHostnames[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if d := m.GetDnsQueryTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = DnsCacheConfigValidationError{ - field: "DnsQueryTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gte := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur < gte { - err := DnsCacheConfigValidationError{ - field: "DnsQueryTimeout", - reason: "value must be greater than or equal to 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if all { - switch v := interface{}(m.GetKeyValueConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "KeyValueConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DnsCacheConfigValidationError{ - field: "KeyValueConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyValueConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DnsCacheConfigValidationError{ - field: "KeyValueConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DnsCacheConfigMultiError(errors) - } - - return nil -} - -// DnsCacheConfigMultiError is an error wrapping multiple validation errors -// returned by DnsCacheConfig.ValidateAll() if the designated constraints -// aren't met. -type DnsCacheConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DnsCacheConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DnsCacheConfigMultiError) AllErrors() []error { return m } - -// DnsCacheConfigValidationError is the validation error returned by -// DnsCacheConfig.Validate if the designated constraints aren't met. -type DnsCacheConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DnsCacheConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DnsCacheConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DnsCacheConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DnsCacheConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DnsCacheConfigValidationError) ErrorName() string { return "DnsCacheConfigValidationError" } - -// Error satisfies the builtin error interface -func (e DnsCacheConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDnsCacheConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DnsCacheConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DnsCacheConfigValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache_vtproto.pb.go deleted file mode 100644 index a4be6cdc2..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache_vtproto.pb.go +++ /dev/null @@ -1,415 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto - -package dynamic_forward_proxyv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - durationpb "github.com/planetscale/vtprotobuf/types/known/durationpb" - wrapperspb "github.com/planetscale/vtprotobuf/types/known/wrapperspb" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *DnsCacheCircuitBreakers) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DnsCacheCircuitBreakers) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *DnsCacheCircuitBreakers) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.MaxPendingRequests != nil { - size, err := (*wrapperspb.UInt32Value)(m.MaxPendingRequests).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DnsCacheConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DnsCacheConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *DnsCacheConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.DisableDnsRefreshOnFailure { - i-- - if m.DisableDnsRefreshOnFailure { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x78 - } - if m.DnsMinRefreshRate != nil { - size, err := (*durationpb.Duration)(m.DnsMinRefreshRate).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x72 - } - if m.KeyValueConfig != nil { - if vtmsg, ok := interface{}(m.KeyValueConfig).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.KeyValueConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x6a - } - if m.TypedDnsResolverConfig != nil { - if vtmsg, ok := interface{}(m.TypedDnsResolverConfig).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.TypedDnsResolverConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x62 - } - if m.DnsQueryTimeout != nil { - size, err := (*durationpb.Duration)(m.DnsQueryTimeout).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x5a - } - if len(m.PreresolveHostnames) > 0 { - for iNdEx := len(m.PreresolveHostnames) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.PreresolveHostnames[iNdEx]).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.PreresolveHostnames[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x52 - } - } - if m.DnsResolutionConfig != nil { - if vtmsg, ok := interface{}(m.DnsResolutionConfig).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.DnsResolutionConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x4a - } - if m.UseTcpForDnsLookups { - i-- - if m.UseTcpForDnsLookups { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.DnsCacheCircuitBreaker != nil { - size, err := m.DnsCacheCircuitBreaker.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if m.DnsFailureRefreshRate != nil { - if vtmsg, ok := interface{}(m.DnsFailureRefreshRate).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.DnsFailureRefreshRate) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x32 - } - if m.MaxHosts != nil { - size, err := (*wrapperspb.UInt32Value)(m.MaxHosts).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if m.HostTtl != nil { - size, err := (*durationpb.Duration)(m.HostTtl).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if m.DnsRefreshRate != nil { - size, err := (*durationpb.Duration)(m.DnsRefreshRate).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.DnsLookupFamily != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.DnsLookupFamily)) - i-- - dAtA[i] = 0x10 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DnsCacheCircuitBreakers) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MaxPendingRequests != nil { - l = (*wrapperspb.UInt32Value)(m.MaxPendingRequests).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *DnsCacheConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DnsLookupFamily != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.DnsLookupFamily)) - } - if m.DnsRefreshRate != nil { - l = (*durationpb.Duration)(m.DnsRefreshRate).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.HostTtl != nil { - l = (*durationpb.Duration)(m.HostTtl).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.MaxHosts != nil { - l = (*wrapperspb.UInt32Value)(m.MaxHosts).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DnsFailureRefreshRate != nil { - if size, ok := interface{}(m.DnsFailureRefreshRate).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.DnsFailureRefreshRate) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DnsCacheCircuitBreaker != nil { - l = m.DnsCacheCircuitBreaker.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.UseTcpForDnsLookups { - n += 2 - } - if m.DnsResolutionConfig != nil { - if size, ok := interface{}(m.DnsResolutionConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.DnsResolutionConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.PreresolveHostnames) > 0 { - for _, e := range m.PreresolveHostnames { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.DnsQueryTimeout != nil { - l = (*durationpb.Duration)(m.DnsQueryTimeout).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.TypedDnsResolverConfig != nil { - if size, ok := interface{}(m.TypedDnsResolverConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.TypedDnsResolverConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.KeyValueConfig != nil { - if size, ok := interface{}(m.KeyValueConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.KeyValueConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DnsMinRefreshRate != nil { - l = (*durationpb.Duration)(m.DnsMinRefreshRate).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DisableDnsRefreshOnFailure { - n += 2 - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.pb.go deleted file mode 100644 index b244f30b4..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.pb.go +++ /dev/null @@ -1,383 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.proto - -package dynamic_forward_proxyv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Configuration for the dynamic forward proxy HTTP filter. See the :ref:`architecture overview -// ` for more information. -// [#extension: envoy.filters.http.dynamic_forward_proxy] -type FilterConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to ImplementationSpecifier: - // - // *FilterConfig_DnsCacheConfig - // *FilterConfig_SubClusterConfig - ImplementationSpecifier isFilterConfig_ImplementationSpecifier `protobuf_oneof:"implementation_specifier"` - // When this flag is set, the filter will add the resolved upstream address in the filter - // state. The state should be saved with key - // “envoy.stream.upstream_address“ (See - // :repo:`upstream_address.h`). - SaveUpstreamAddress bool `protobuf:"varint,2,opt,name=save_upstream_address,json=saveUpstreamAddress,proto3" json:"save_upstream_address,omitempty"` - // When this flag is set, the filter will check for the “envoy.upstream.dynamic_host“ - // and/or “envoy.upstream.dynamic_port“ filter state values before using the HTTP - // Host header for DNS resolution. This provides consistency with the - // :ref:`SNI dynamic forward proxy ` and - // :ref:`UDP dynamic forward proxy ` - // filters behavior when enabled. - // - // If the flag is not set (default), the filter will use the HTTP Host header - // for DNS resolution, maintaining backward compatibility. - AllowDynamicHostFromFilterState bool `protobuf:"varint,4,opt,name=allow_dynamic_host_from_filter_state,json=allowDynamicHostFromFilterState,proto3" json:"allow_dynamic_host_from_filter_state,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *FilterConfig) Reset() { - *x = FilterConfig{} - mi := &file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FilterConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FilterConfig) ProtoMessage() {} - -func (x *FilterConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FilterConfig.ProtoReflect.Descriptor instead. -func (*FilterConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescGZIP(), []int{0} -} - -func (x *FilterConfig) GetImplementationSpecifier() isFilterConfig_ImplementationSpecifier { - if x != nil { - return x.ImplementationSpecifier - } - return nil -} - -func (x *FilterConfig) GetDnsCacheConfig() *v3.DnsCacheConfig { - if x != nil { - if x, ok := x.ImplementationSpecifier.(*FilterConfig_DnsCacheConfig); ok { - return x.DnsCacheConfig - } - } - return nil -} - -func (x *FilterConfig) GetSubClusterConfig() *SubClusterConfig { - if x != nil { - if x, ok := x.ImplementationSpecifier.(*FilterConfig_SubClusterConfig); ok { - return x.SubClusterConfig - } - } - return nil -} - -func (x *FilterConfig) GetSaveUpstreamAddress() bool { - if x != nil { - return x.SaveUpstreamAddress - } - return false -} - -func (x *FilterConfig) GetAllowDynamicHostFromFilterState() bool { - if x != nil { - return x.AllowDynamicHostFromFilterState - } - return false -} - -type isFilterConfig_ImplementationSpecifier interface { - isFilterConfig_ImplementationSpecifier() -} - -type FilterConfig_DnsCacheConfig struct { - // The DNS cache configuration that the filter will attach to. Note this configuration must - // match that of associated :ref:`dynamic forward proxy cluster configuration - // `. - DnsCacheConfig *v3.DnsCacheConfig `protobuf:"bytes,1,opt,name=dns_cache_config,json=dnsCacheConfig,proto3,oneof"` -} - -type FilterConfig_SubClusterConfig struct { - // The configuration that the filter will use, when the related dynamic forward proxy cluster enabled - // sub clusters. - SubClusterConfig *SubClusterConfig `protobuf:"bytes,3,opt,name=sub_cluster_config,json=subClusterConfig,proto3,oneof"` -} - -func (*FilterConfig_DnsCacheConfig) isFilterConfig_ImplementationSpecifier() {} - -func (*FilterConfig_SubClusterConfig) isFilterConfig_ImplementationSpecifier() {} - -// Per route Configuration for the dynamic forward proxy HTTP filter. -type PerRouteConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to HostRewriteSpecifier: - // - // *PerRouteConfig_HostRewriteLiteral - // *PerRouteConfig_HostRewriteHeader - HostRewriteSpecifier isPerRouteConfig_HostRewriteSpecifier `protobuf_oneof:"host_rewrite_specifier"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *PerRouteConfig) Reset() { - *x = PerRouteConfig{} - mi := &file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *PerRouteConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PerRouteConfig) ProtoMessage() {} - -func (x *PerRouteConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PerRouteConfig.ProtoReflect.Descriptor instead. -func (*PerRouteConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescGZIP(), []int{1} -} - -func (x *PerRouteConfig) GetHostRewriteSpecifier() isPerRouteConfig_HostRewriteSpecifier { - if x != nil { - return x.HostRewriteSpecifier - } - return nil -} - -func (x *PerRouteConfig) GetHostRewriteLiteral() string { - if x != nil { - if x, ok := x.HostRewriteSpecifier.(*PerRouteConfig_HostRewriteLiteral); ok { - return x.HostRewriteLiteral - } - } - return "" -} - -func (x *PerRouteConfig) GetHostRewriteHeader() string { - if x != nil { - if x, ok := x.HostRewriteSpecifier.(*PerRouteConfig_HostRewriteHeader); ok { - return x.HostRewriteHeader - } - } - return "" -} - -type isPerRouteConfig_HostRewriteSpecifier interface { - isPerRouteConfig_HostRewriteSpecifier() -} - -type PerRouteConfig_HostRewriteLiteral struct { - // Indicates that before DNS lookup, the host header will be swapped with - // this value. If not set or empty, the original host header value - // will be used and no rewrite will happen. - // - // .. note:: - // - // This rewrite affects both DNS lookup and host header forwarding. However, this option shouldn't be used with - // :ref:`HCM host rewrite header ` given that - // the value set here would be used for DNS lookups whereas the value set in the HCM would be used for host - // header forwarding which might not be the desired outcome. - HostRewriteLiteral string `protobuf:"bytes,1,opt,name=host_rewrite_literal,json=hostRewriteLiteral,proto3,oneof"` -} - -type PerRouteConfig_HostRewriteHeader struct { - // Indicates that before DNS lookup, the host header will be swapped with - // the value of this header. If not set or empty, the original host header - // value will be used and no rewrite will happen. - // - // .. note:: - // - // This rewrite affects both DNS lookup and host header forwarding. However, this option shouldn't be used with - // :ref:`HCM host rewrite header ` given that - // the value set here would be used for DNS lookups whereas the value set in the HCM would be used for host - // header forwarding which might not be the desired outcome. - // - // .. note:: - // - // If the header appears multiple times only the first value is used. - HostRewriteHeader string `protobuf:"bytes,2,opt,name=host_rewrite_header,json=hostRewriteHeader,proto3,oneof"` -} - -func (*PerRouteConfig_HostRewriteLiteral) isPerRouteConfig_HostRewriteSpecifier() {} - -func (*PerRouteConfig_HostRewriteHeader) isPerRouteConfig_HostRewriteSpecifier() {} - -type SubClusterConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The timeout used for sub cluster initialization. Defaults to **5s** if not set. - ClusterInitTimeout *durationpb.Duration `protobuf:"bytes,3,opt,name=cluster_init_timeout,json=clusterInitTimeout,proto3" json:"cluster_init_timeout,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SubClusterConfig) Reset() { - *x = SubClusterConfig{} - mi := &file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SubClusterConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubClusterConfig) ProtoMessage() {} - -func (x *SubClusterConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubClusterConfig.ProtoReflect.Descriptor instead. -func (*SubClusterConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescGZIP(), []int{2} -} - -func (x *SubClusterConfig) GetClusterInitTimeout() *durationpb.Duration { - if x != nil { - return x.ClusterInitTimeout - } - return nil -} - -var File_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto protoreflect.FileDescriptor - -const file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDesc = "" + - "\n" + - "Renvoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.proto\x126envoy.extensions.filters.http.dynamic_forward_proxy.v3\x1a@envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\x1a\x17validate/validate.proto\"\xe1\x03\n" + - "\fFilterConfig\x12l\n" + - "\x10dns_cache_config\x18\x01 \x01(\v2@.envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfigH\x00R\x0ednsCacheConfig\x12x\n" + - "\x12sub_cluster_config\x18\x03 \x01(\v2H.envoy.extensions.filters.http.dynamic_forward_proxy.v3.SubClusterConfigH\x00R\x10subClusterConfig\x122\n" + - "\x15save_upstream_address\x18\x02 \x01(\bR\x13saveUpstreamAddress\x12M\n" + - "$allow_dynamic_host_from_filter_state\x18\x04 \x01(\bR\x1fallowDynamicHostFromFilterState:J\x9aň\x1eE\n" + - "Cenvoy.config.filter.http.dynamic_forward_proxy.v2alpha.FilterConfigB\x1a\n" + - "\x18implementation_specifier\"\xde\x01\n" + - "\x0ePerRouteConfig\x122\n" + - "\x14host_rewrite_literal\x18\x01 \x01(\tH\x00R\x12hostRewriteLiteral\x120\n" + - "\x13host_rewrite_header\x18\x02 \x01(\tH\x00R\x11hostRewriteHeader:L\x9aň\x1eG\n" + - "Eenvoy.config.filter.http.dynamic_forward_proxy.v2alpha.PerRouteConfigB\x18\n" + - "\x16host_rewrite_specifier\"i\n" + - "\x10SubClusterConfig\x12U\n" + - "\x14cluster_init_timeout\x18\x03 \x01(\v2\x19.google.protobuf.DurationB\b\xfaB\x05\xaa\x01\x02*\x00R\x12clusterInitTimeoutB\xe1\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "Dio.envoyproxy.envoy.extensions.filters.http.dynamic_forward_proxy.v3B\x18DynamicForwardProxyProtoP\x01Zugithub.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3;dynamic_forward_proxyv3b\x06proto3" - -var ( - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescOnce sync.Once - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescData []byte -) - -func file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescGZIP() []byte { - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescOnce.Do(func() { - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDesc), len(file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDesc))) - }) - return file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDescData -} - -var file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_goTypes = []any{ - (*FilterConfig)(nil), // 0: envoy.extensions.filters.http.dynamic_forward_proxy.v3.FilterConfig - (*PerRouteConfig)(nil), // 1: envoy.extensions.filters.http.dynamic_forward_proxy.v3.PerRouteConfig - (*SubClusterConfig)(nil), // 2: envoy.extensions.filters.http.dynamic_forward_proxy.v3.SubClusterConfig - (*v3.DnsCacheConfig)(nil), // 3: envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig - (*durationpb.Duration)(nil), // 4: google.protobuf.Duration -} -var file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_depIdxs = []int32{ - 3, // 0: envoy.extensions.filters.http.dynamic_forward_proxy.v3.FilterConfig.dns_cache_config:type_name -> envoy.extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig - 2, // 1: envoy.extensions.filters.http.dynamic_forward_proxy.v3.FilterConfig.sub_cluster_config:type_name -> envoy.extensions.filters.http.dynamic_forward_proxy.v3.SubClusterConfig - 4, // 2: envoy.extensions.filters.http.dynamic_forward_proxy.v3.SubClusterConfig.cluster_init_timeout:type_name -> google.protobuf.Duration - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_init() -} -func file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_init() { - if File_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto != nil { - return - } - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[0].OneofWrappers = []any{ - (*FilterConfig_DnsCacheConfig)(nil), - (*FilterConfig_SubClusterConfig)(nil), - } - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes[1].OneofWrappers = []any{ - (*PerRouteConfig_HostRewriteLiteral)(nil), - (*PerRouteConfig_HostRewriteHeader)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDesc), len(file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_rawDesc)), - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_goTypes, - DependencyIndexes: file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_depIdxs, - MessageInfos: file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_msgTypes, - }.Build() - File_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto = out.File - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_goTypes = nil - file_envoy_extensions_filters_http_dynamic_forward_proxy_v3_dynamic_forward_proxy_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.pb.validate.go deleted file mode 100644 index fa53c4272..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.pb.validate.go +++ /dev/null @@ -1,486 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.proto - -package dynamic_forward_proxyv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on FilterConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *FilterConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on FilterConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in FilterConfigMultiError, or -// nil if none found. -func (m *FilterConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *FilterConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for SaveUpstreamAddress - - // no validation rules for AllowDynamicHostFromFilterState - - switch v := m.ImplementationSpecifier.(type) { - case *FilterConfig_DnsCacheConfig: - if v == nil { - err := FilterConfigValidationError{ - field: "ImplementationSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetDnsCacheConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, FilterConfigValidationError{ - field: "DnsCacheConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, FilterConfigValidationError{ - field: "DnsCacheConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDnsCacheConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return FilterConfigValidationError{ - field: "DnsCacheConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *FilterConfig_SubClusterConfig: - if v == nil { - err := FilterConfigValidationError{ - field: "ImplementationSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSubClusterConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, FilterConfigValidationError{ - field: "SubClusterConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, FilterConfigValidationError{ - field: "SubClusterConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSubClusterConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return FilterConfigValidationError{ - field: "SubClusterConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return FilterConfigMultiError(errors) - } - - return nil -} - -// FilterConfigMultiError is an error wrapping multiple validation errors -// returned by FilterConfig.ValidateAll() if the designated constraints aren't met. -type FilterConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m FilterConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m FilterConfigMultiError) AllErrors() []error { return m } - -// FilterConfigValidationError is the validation error returned by -// FilterConfig.Validate if the designated constraints aren't met. -type FilterConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e FilterConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e FilterConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e FilterConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e FilterConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e FilterConfigValidationError) ErrorName() string { return "FilterConfigValidationError" } - -// Error satisfies the builtin error interface -func (e FilterConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sFilterConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = FilterConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = FilterConfigValidationError{} - -// Validate checks the field values on PerRouteConfig with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *PerRouteConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PerRouteConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in PerRouteConfigMultiError, -// or nil if none found. -func (m *PerRouteConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *PerRouteConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.HostRewriteSpecifier.(type) { - case *PerRouteConfig_HostRewriteLiteral: - if v == nil { - err := PerRouteConfigValidationError{ - field: "HostRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for HostRewriteLiteral - case *PerRouteConfig_HostRewriteHeader: - if v == nil { - err := PerRouteConfigValidationError{ - field: "HostRewriteSpecifier", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for HostRewriteHeader - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return PerRouteConfigMultiError(errors) - } - - return nil -} - -// PerRouteConfigMultiError is an error wrapping multiple validation errors -// returned by PerRouteConfig.ValidateAll() if the designated constraints -// aren't met. -type PerRouteConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PerRouteConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PerRouteConfigMultiError) AllErrors() []error { return m } - -// PerRouteConfigValidationError is the validation error returned by -// PerRouteConfig.Validate if the designated constraints aren't met. -type PerRouteConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PerRouteConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PerRouteConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PerRouteConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PerRouteConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PerRouteConfigValidationError) ErrorName() string { return "PerRouteConfigValidationError" } - -// Error satisfies the builtin error interface -func (e PerRouteConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPerRouteConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PerRouteConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PerRouteConfigValidationError{} - -// Validate checks the field values on SubClusterConfig with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *SubClusterConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SubClusterConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SubClusterConfigMultiError, or nil if none found. -func (m *SubClusterConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *SubClusterConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if d := m.GetClusterInitTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = SubClusterConfigValidationError{ - field: "ClusterInitTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - gt := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur <= gt { - err := SubClusterConfigValidationError{ - field: "ClusterInitTimeout", - reason: "value must be greater than 0s", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if len(errors) > 0 { - return SubClusterConfigMultiError(errors) - } - - return nil -} - -// SubClusterConfigMultiError is an error wrapping multiple validation errors -// returned by SubClusterConfig.ValidateAll() if the designated constraints -// aren't met. -type SubClusterConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SubClusterConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SubClusterConfigMultiError) AllErrors() []error { return m } - -// SubClusterConfigValidationError is the validation error returned by -// SubClusterConfig.Validate if the designated constraints aren't met. -type SubClusterConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SubClusterConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SubClusterConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SubClusterConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SubClusterConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SubClusterConfigValidationError) ErrorName() string { return "SubClusterConfigValidationError" } - -// Error satisfies the builtin error interface -func (e SubClusterConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSubClusterConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SubClusterConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SubClusterConfigValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy_vtproto.pb.go deleted file mode 100644 index b81060977..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy_vtproto.pb.go +++ /dev/null @@ -1,364 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/filters/http/dynamic_forward_proxy/v3/dynamic_forward_proxy.proto - -package dynamic_forward_proxyv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - durationpb "github.com/planetscale/vtprotobuf/types/known/durationpb" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *FilterConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FilterConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *FilterConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.AllowDynamicHostFromFilterState { - i-- - if m.AllowDynamicHostFromFilterState { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if msg, ok := m.ImplementationSpecifier.(*FilterConfig_SubClusterConfig); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if m.SaveUpstreamAddress { - i-- - if m.SaveUpstreamAddress { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if msg, ok := m.ImplementationSpecifier.(*FilterConfig_DnsCacheConfig); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *FilterConfig_DnsCacheConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *FilterConfig_DnsCacheConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.DnsCacheConfig != nil { - if vtmsg, ok := interface{}(m.DnsCacheConfig).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.DnsCacheConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *FilterConfig_SubClusterConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *FilterConfig_SubClusterConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.SubClusterConfig != nil { - size, err := m.SubClusterConfig.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *PerRouteConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PerRouteConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *PerRouteConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.HostRewriteSpecifier.(*PerRouteConfig_HostRewriteHeader); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.HostRewriteSpecifier.(*PerRouteConfig_HostRewriteLiteral); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *PerRouteConfig_HostRewriteLiteral) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *PerRouteConfig_HostRewriteLiteral) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.HostRewriteLiteral) - copy(dAtA[i:], m.HostRewriteLiteral) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.HostRewriteLiteral))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} -func (m *PerRouteConfig_HostRewriteHeader) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *PerRouteConfig_HostRewriteHeader) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.HostRewriteHeader) - copy(dAtA[i:], m.HostRewriteHeader) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.HostRewriteHeader))) - i-- - dAtA[i] = 0x12 - return len(dAtA) - i, nil -} -func (m *SubClusterConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SubClusterConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *SubClusterConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ClusterInitTimeout != nil { - size, err := (*durationpb.Duration)(m.ClusterInitTimeout).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} - -func (m *FilterConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.ImplementationSpecifier.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - if m.SaveUpstreamAddress { - n += 2 - } - if m.AllowDynamicHostFromFilterState { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *FilterConfig_DnsCacheConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DnsCacheConfig != nil { - if size, ok := interface{}(m.DnsCacheConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.DnsCacheConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *FilterConfig_SubClusterConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SubClusterConfig != nil { - l = m.SubClusterConfig.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *PerRouteConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.HostRewriteSpecifier.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *PerRouteConfig_HostRewriteLiteral) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.HostRewriteLiteral) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - return n -} -func (m *PerRouteConfig_HostRewriteHeader) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.HostRewriteHeader) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - return n -} -func (m *SubClusterConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClusterInitTimeout != nil { - l = (*durationpb.Duration)(m.ClusterInitTimeout).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc.pb.go deleted file mode 100644 index 9845b37c3..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc.pb.go +++ /dev/null @@ -1,1214 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto - -package ext_procv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v31 "github.com/envoyproxy/go-control-plane/envoy/config/common/mutation_rules/v3" - v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - v33 "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" - v32 "github.com/envoyproxy/go-control-plane/envoy/type/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - structpb "google.golang.org/protobuf/types/known/structpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Describes the route cache action to be taken when an external processor response -// is received in response to request headers. -type ExternalProcessor_RouteCacheAction int32 - -const ( - // The default behavior is to clear the route cache only when the - // :ref:`clear_route_cache ` - // field is set in an external processor response. - ExternalProcessor_DEFAULT ExternalProcessor_RouteCacheAction = 0 - // Always clear the route cache irrespective of the “clear_route_cache“ bit in - // the external processor response. - ExternalProcessor_CLEAR ExternalProcessor_RouteCacheAction = 1 - // Do not clear the route cache irrespective of the “clear_route_cache“ bit in - // the external processor response. Setting to “RETAIN“ is equivalent to setting the - // :ref:`disable_clear_route_cache ` - // to true. - ExternalProcessor_RETAIN ExternalProcessor_RouteCacheAction = 2 -) - -// Enum value maps for ExternalProcessor_RouteCacheAction. -var ( - ExternalProcessor_RouteCacheAction_name = map[int32]string{ - 0: "DEFAULT", - 1: "CLEAR", - 2: "RETAIN", - } - ExternalProcessor_RouteCacheAction_value = map[string]int32{ - "DEFAULT": 0, - "CLEAR": 1, - "RETAIN": 2, - } -) - -func (x ExternalProcessor_RouteCacheAction) Enum() *ExternalProcessor_RouteCacheAction { - p := new(ExternalProcessor_RouteCacheAction) - *p = x - return p -} - -func (x ExternalProcessor_RouteCacheAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ExternalProcessor_RouteCacheAction) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_enumTypes[0].Descriptor() -} - -func (ExternalProcessor_RouteCacheAction) Type() protoreflect.EnumType { - return &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_enumTypes[0] -} - -func (x ExternalProcessor_RouteCacheAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ExternalProcessor_RouteCacheAction.Descriptor instead. -func (ExternalProcessor_RouteCacheAction) EnumDescriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{0, 0} -} - -// The filter communicates with an external gRPC service called an "external processor" -// that can do a variety of things with the request and response: -// -// * Access and modify the HTTP headers on the request, response, or both. -// * Access and modify the HTTP request and response bodies. -// * Access and modify the dynamic stream metadata. -// * Immediately send an HTTP response downstream and terminate other processing. -// -// The filter communicates with the server using a gRPC bidirectional stream. After the initial -// request, the external server is in control over what additional data is sent to it -// and how it should be processed. -// -// By implementing the protocol specified by the stream, the external server can choose: -// -// * Whether it receives the response message at all. -// * Whether it receives the message body at all, in separate chunks, or as a single buffer. -// * To modify request or response trailers if they already exist. -// -// The filter supports up to six different processing steps. Each is represented by -// a gRPC stream message that is sent to the external processor. For each message, the -// processor must send a matching response. -// -// - Request headers: Contains the headers from the original HTTP request. -// - Request body: If the body is present, the behavior depends on the -// body send mode. In “BUFFERED“ or “BUFFERED_PARTIAL“ mode, the body is sent to the external -// processor in a single message. In “STREAMED“ or “FULL_DUPLEX_STREAMED“ mode, the body will -// be split across multiple messages sent to the external processor. In “GRPC“ mode, as each -// gRPC message arrives, it will be sent to the external processor (there will be exactly one -// gRPC message in each message sent to the external processor). In “NONE“ mode, the body will -// not be sent to the external processor. -// - Request trailers: Delivered if they are present and if the trailer mode is set -// to “SEND“. -// - Response headers: Contains the headers from the HTTP response. Keep in mind -// that if the upstream system sends them before processing the request body that -// this message may arrive before the complete body. -// - Response body: Sent according to the processing mode like the request body. -// - Response trailers: Delivered according to the processing mode like the -// request trailers. -// -// By default, the processor sends only the request and response headers messages. -// This may be changed to include any of the six steps by changing the “processing_mode“ -// setting of the filter configuration, or by setting the “mode_override“ of any response -// from the external processor. The latter is only enabled if “allow_mode_override“ is -// set to true. This way, a processor may, for example, use information -// in the request header to determine whether the message body must be examined, or whether -// the data plane should simply stream it straight through. -// -// All of this together allows a server to process the filter traffic in fairly -// sophisticated ways. For example: -// -// - A server may choose to examine all or part of the HTTP message bodies depending -// on the content of the headers. -// - A server may choose to immediately reject some messages based on their HTTP -// headers (or other dynamic metadata) and more carefully examine others. -// -// The protocol itself is based on a bidirectional gRPC stream. The data plane will send the server -// :ref:`ProcessingRequest ` -// messages, and the server must reply with -// :ref:`ProcessingResponse `. -// -// Stats about each gRPC call are recorded in a :ref:`dynamic filter state -// ` object in a namespace matching the filter -// name. -// -// [#next-free-field: 26] -type ExternalProcessor struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Configuration for the gRPC service that the filter will communicate with. - // Only one of “grpc_service“ or “http_service“ can be set. - // It is required that one of them must be set. - GrpcService *v3.GrpcService `protobuf:"bytes,1,opt,name=grpc_service,json=grpcService,proto3" json:"grpc_service,omitempty"` - // Configuration for the HTTP service that the filter will communicate with. - // Only one of “http_service“ or - // :ref:`grpc_service ` - // can be set. It is required that one of them must be set. - // - // If “http_service“ is set, the - // :ref:`processing_mode ` - // cannot be configured to send any body or trailers. i.e., “http_service“ only supports - // sending request or response headers to the side stream server. - // - // With this configuration, the data plane behavior is: - // - // 1. The headers are first put in a proto message - // :ref:`ProcessingRequest `. - // - // 2. This proto message is then transcoded into a JSON text. - // - // 3. The data plane then sends an HTTP POST message with content-type as "application/json", - // and this JSON text as body to the side stream server. - // - // After the side-stream receives this HTTP request message, it is expected to do as follows: - // - // 1. It converts the body, which is a JSON string, into a “ProcessingRequest“ - // proto message to examine and mutate the headers. - // - // 2. It then sets the mutated headers into a new proto message - // :ref:`ProcessingResponse `. - // - // 3. It converts the “ProcessingResponse“ proto message into a JSON text. - // - // 4. It then sends an HTTP response back to the data plane with status code as “"200"“, - // “content-type“ as “"application/json"“ and sets the JSON text as the body. - HttpService *ExtProcHttpService `protobuf:"bytes,20,opt,name=http_service,json=httpService,proto3" json:"http_service,omitempty"` - // By default, if in the following cases: - // - // 1. The gRPC stream cannot be established. - // - // 2. The gRPC stream is closed prematurely with an error. - // - // 3. The external processing timeouts. - // - // 4. The ext_proc server sends back spurious response messages. - // - // The filter will fail and a local reply with error code - // 504(for timeout case) or 500(for all other cases), will be sent to the downstream. - // - // However, with this parameter set to true and if the above cases happen, the processing - // continues without error. - FailureModeAllow bool `protobuf:"varint,2,opt,name=failure_mode_allow,json=failureModeAllow,proto3" json:"failure_mode_allow,omitempty"` - // Specifies default options for how HTTP headers, trailers, and bodies are - // sent. See “ProcessingMode“ for details. - ProcessingMode *ProcessingMode `protobuf:"bytes,3,opt,name=processing_mode,json=processingMode,proto3" json:"processing_mode,omitempty"` - // The data plane provides a number of :ref:`attributes ` - // for expressive policies. Each attribute name provided in this field will be - // matched against that list and populated in the - // :ref:`ProcessingRequest.attributes ` field. - // See the :ref:`attribute documentation ` - // for the list of supported attributes and their types. - RequestAttributes []string `protobuf:"bytes,5,rep,name=request_attributes,json=requestAttributes,proto3" json:"request_attributes,omitempty"` - // The data plane provides a number of :ref:`attributes ` - // for expressive policies. Each attribute name provided in this field will be - // matched against that list and populated in the - // :ref:`ProcessingRequest.attributes ` field. - // See the :ref:`attribute documentation ` - // for the list of supported attributes and their types. - ResponseAttributes []string `protobuf:"bytes,6,rep,name=response_attributes,json=responseAttributes,proto3" json:"response_attributes,omitempty"` - // Specifies the timeout for each individual message sent on the stream. - // Whenever the data plane sends a message on the stream that requires a - // response, it will reset this timer, and will stop processing and return - // an error (subject to the processing mode) if the timer expires before a - // matching response is received. There is no timeout when the filter is - // running in observability mode or when the body send mode is - // “FULL_DUPLEX_STREAMED“ or “GRPC“. Zero is a valid config which means - // the timer will be triggered immediately. If not configured, default is - // 200 milliseconds. - MessageTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=message_timeout,json=messageTimeout,proto3" json:"message_timeout,omitempty"` - // Optional additional prefix to use when emitting statistics. This allows to distinguish - // emitted statistics between configured “ext_proc“ filters in an HTTP filter chain. - StatPrefix string `protobuf:"bytes,8,opt,name=stat_prefix,json=statPrefix,proto3" json:"stat_prefix,omitempty"` - // Rules that determine what modifications an external processing server may - // make to message headers. If not set, all headers may be modified except - // for "host", ":authority", ":scheme", ":method", and headers that start - // with the header prefix set via - // :ref:`header_prefix ` - // (which is usually "x-envoy"). - // Note that changing headers such as "host" or ":authority" may not in itself - // change the data plane's routing decision, as routes can be cached. To also force the - // route to be recomputed, set the - // :ref:`clear_route_cache ` - // field to true in the same response. - MutationRules *v31.HeaderMutationRules `protobuf:"bytes,9,opt,name=mutation_rules,json=mutationRules,proto3" json:"mutation_rules,omitempty"` - // Specify the upper bound of - // :ref:`override_message_timeout ` - // If not specified, by default it is 0, which will effectively disable the “override_message_timeout“ API. - MaxMessageTimeout *durationpb.Duration `protobuf:"bytes,10,opt,name=max_message_timeout,json=maxMessageTimeout,proto3" json:"max_message_timeout,omitempty"` - // Allow headers matching the “forward_rules“ to be forwarded to the external processing server. - // If not set, all headers are forwarded to the external processing server. - ForwardRules *HeaderForwardingRules `protobuf:"bytes,12,opt,name=forward_rules,json=forwardRules,proto3" json:"forward_rules,omitempty"` - // Additional metadata to be added to the filter state for logging purposes. The metadata - // will be added to StreamInfo's filter state under the namespace corresponding to the - // ext_proc filter name. - FilterMetadata *structpb.Struct `protobuf:"bytes,13,opt,name=filter_metadata,json=filterMetadata,proto3" json:"filter_metadata,omitempty"` - // If “allow_mode_override“ is set to true, the filter config :ref:`processing_mode - // ` - // can be overridden by the response message from the external processing server - // :ref:`mode_override `. - // If not set, “mode_override“ API in the response message will be ignored. - // Mode override is not supported if the body send mode is “FULL_DUPLEX_STREAMED“. - AllowModeOverride bool `protobuf:"varint,14,opt,name=allow_mode_override,json=allowModeOverride,proto3" json:"allow_mode_override,omitempty"` - // If set to true, ignore the - // :ref:`immediate_response ` - // message in an external processor response. In such case, no local reply will be sent. - // Instead, the stream to the external processor will be closed. There will be no - // more external processing for this stream from now on. - DisableImmediateResponse bool `protobuf:"varint,15,opt,name=disable_immediate_response,json=disableImmediateResponse,proto3" json:"disable_immediate_response,omitempty"` - // Options related to the sending and receiving of dynamic metadata. - MetadataOptions *MetadataOptions `protobuf:"bytes,16,opt,name=metadata_options,json=metadataOptions,proto3" json:"metadata_options,omitempty"` - // If true, send each part of the HTTP request or response specified by “ProcessingMode“ - // without pausing on filter chain iteration. It is "Send and Go" mode that can be used - // by external processor to observe the request's data and status. In this mode: - // - // 1. Only “STREAMED“, “GRPC“, and “NONE“ body processing modes are supported; for any - // other body processing mode, the body will not be sent. - // - // 2. External processor should not send back processing response, as any responses will be ignored. - // This also means that - // :ref:`message_timeout ` - // restriction doesn't apply to this mode. - // - // 3. External processor may still close the stream to indicate that no more messages are needed. - // - // .. warning:: - // - // Flow control is a necessary mechanism to prevent the fast sender (either downstream client or upstream server) - // from overwhelming the external processor when its processing speed is slower. - // This protective measure is being explored and developed but has not been ready yet, so please use your own - // discretion when enabling this feature. - // This work is currently tracked under https://github.com/envoyproxy/envoy/issues/33319. - ObservabilityMode bool `protobuf:"varint,17,opt,name=observability_mode,json=observabilityMode,proto3" json:"observability_mode,omitempty"` - // Prevents clearing the route-cache when the - // :ref:`clear_route_cache ` - // field is set in an external processor response. - // Only one of “disable_clear_route_cache“ or “route_cache_action“ can be set. - // It is recommended to set “route_cache_action“ which supersedes “disable_clear_route_cache“. - DisableClearRouteCache bool `protobuf:"varint,11,opt,name=disable_clear_route_cache,json=disableClearRouteCache,proto3" json:"disable_clear_route_cache,omitempty"` - // Specifies the action to be taken when an external processor response is - // received in response to request headers. It is recommended to set this field rather than set - // :ref:`disable_clear_route_cache `. - // Only one of “disable_clear_route_cache“ or “route_cache_action“ can be set. - RouteCacheAction ExternalProcessor_RouteCacheAction `protobuf:"varint,18,opt,name=route_cache_action,json=routeCacheAction,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor_RouteCacheAction" json:"route_cache_action,omitempty"` - // Specifies the deferred closure timeout for gRPC stream that connects to external processor. Currently, the deferred stream closure - // is only used in :ref:`observability_mode `. - // In observability mode, gRPC streams may be held open to the external processor longer than the lifetime of the regular client to - // backend stream lifetime. In this case, the data plane will eventually timeout the external processor stream according to this time limit. - // The default value is 5000 milliseconds (5 seconds) if not specified. - DeferredCloseTimeout *durationpb.Duration `protobuf:"bytes,19,opt,name=deferred_close_timeout,json=deferredCloseTimeout,proto3" json:"deferred_close_timeout,omitempty"` - // Send body to the side stream server once it arrives without waiting for the header response from that server. - // It only works for “STREAMED“ body processing mode. For any other body - // processing modes, it is ignored. - // The server has two options upon receiving a header request: - // - // 1. Instant Response: send the header response as soon as the header request is received. - // - // 2. Delayed Response: wait for the body before sending any response. - // - // In all scenarios, the header-body ordering must always be maintained. - // - // If enabled the data plane will ignore the - // :ref:`mode_override ` - // value that the server sends in the header response. This is because the data plane may have already - // sent the body to the server, prior to processing the header response. - SendBodyWithoutWaitingForHeaderResponse bool `protobuf:"varint,21,opt,name=send_body_without_waiting_for_header_response,json=sendBodyWithoutWaitingForHeaderResponse,proto3" json:"send_body_without_waiting_for_header_response,omitempty"` - // When :ref:`allow_mode_override - // ` is enabled and - // “allowed_override_modes“ is configured, the filter config :ref:`processing_mode - // ` - // can only be overridden by the response message from the external processing server iff the - // :ref:`mode_override ` is allowed by - // the “allowed_override_modes“ allow-list below. - // Since “request_header_mode“ is not applicable in any way, it's ignored in comparison. - AllowedOverrideModes []*ProcessingMode `protobuf:"bytes,22,rep,name=allowed_override_modes,json=allowedOverrideModes,proto3" json:"allowed_override_modes,omitempty"` - // Decorator to introduce custom logic that runs after the “ProcessingRequest“ is constructed, but - // before it is sent to the External Processor. The “ProcessingRequest“ may be modified. - // - // .. note:: - // - // Processing request modifiers are currently in alpha. - // - // [#extension-category: envoy.http.ext_proc.processing_request_modifiers] - ProcessingRequestModifier *v3.TypedExtensionConfig `protobuf:"bytes,25,opt,name=processing_request_modifier,json=processingRequestModifier,proto3" json:"processing_request_modifier,omitempty"` - // Decorator to introduce custom logic that runs after a message received from - // the External Processor is processed, but before continuing filter chain iteration. - // - // .. note:: - // - // Response processors are currently in alpha. - // - // [#extension-category: envoy.http.ext_proc.response_processors] - OnProcessingResponse *v3.TypedExtensionConfig `protobuf:"bytes,23,opt,name=on_processing_response,json=onProcessingResponse,proto3" json:"on_processing_response,omitempty"` - // Sets the HTTP status code that is returned to the client when the external processing server returns - // an error, fails to respond, or cannot be reached. - // - // The default status is “HTTP 500 Internal Server Error“. - StatusOnError *v32.HttpStatus `protobuf:"bytes,24,opt,name=status_on_error,json=statusOnError,proto3" json:"status_on_error,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ExternalProcessor) Reset() { - *x = ExternalProcessor{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ExternalProcessor) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExternalProcessor) ProtoMessage() {} - -func (x *ExternalProcessor) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExternalProcessor.ProtoReflect.Descriptor instead. -func (*ExternalProcessor) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{0} -} - -func (x *ExternalProcessor) GetGrpcService() *v3.GrpcService { - if x != nil { - return x.GrpcService - } - return nil -} - -func (x *ExternalProcessor) GetHttpService() *ExtProcHttpService { - if x != nil { - return x.HttpService - } - return nil -} - -func (x *ExternalProcessor) GetFailureModeAllow() bool { - if x != nil { - return x.FailureModeAllow - } - return false -} - -func (x *ExternalProcessor) GetProcessingMode() *ProcessingMode { - if x != nil { - return x.ProcessingMode - } - return nil -} - -func (x *ExternalProcessor) GetRequestAttributes() []string { - if x != nil { - return x.RequestAttributes - } - return nil -} - -func (x *ExternalProcessor) GetResponseAttributes() []string { - if x != nil { - return x.ResponseAttributes - } - return nil -} - -func (x *ExternalProcessor) GetMessageTimeout() *durationpb.Duration { - if x != nil { - return x.MessageTimeout - } - return nil -} - -func (x *ExternalProcessor) GetStatPrefix() string { - if x != nil { - return x.StatPrefix - } - return "" -} - -func (x *ExternalProcessor) GetMutationRules() *v31.HeaderMutationRules { - if x != nil { - return x.MutationRules - } - return nil -} - -func (x *ExternalProcessor) GetMaxMessageTimeout() *durationpb.Duration { - if x != nil { - return x.MaxMessageTimeout - } - return nil -} - -func (x *ExternalProcessor) GetForwardRules() *HeaderForwardingRules { - if x != nil { - return x.ForwardRules - } - return nil -} - -func (x *ExternalProcessor) GetFilterMetadata() *structpb.Struct { - if x != nil { - return x.FilterMetadata - } - return nil -} - -func (x *ExternalProcessor) GetAllowModeOverride() bool { - if x != nil { - return x.AllowModeOverride - } - return false -} - -func (x *ExternalProcessor) GetDisableImmediateResponse() bool { - if x != nil { - return x.DisableImmediateResponse - } - return false -} - -func (x *ExternalProcessor) GetMetadataOptions() *MetadataOptions { - if x != nil { - return x.MetadataOptions - } - return nil -} - -func (x *ExternalProcessor) GetObservabilityMode() bool { - if x != nil { - return x.ObservabilityMode - } - return false -} - -func (x *ExternalProcessor) GetDisableClearRouteCache() bool { - if x != nil { - return x.DisableClearRouteCache - } - return false -} - -func (x *ExternalProcessor) GetRouteCacheAction() ExternalProcessor_RouteCacheAction { - if x != nil { - return x.RouteCacheAction - } - return ExternalProcessor_DEFAULT -} - -func (x *ExternalProcessor) GetDeferredCloseTimeout() *durationpb.Duration { - if x != nil { - return x.DeferredCloseTimeout - } - return nil -} - -func (x *ExternalProcessor) GetSendBodyWithoutWaitingForHeaderResponse() bool { - if x != nil { - return x.SendBodyWithoutWaitingForHeaderResponse - } - return false -} - -func (x *ExternalProcessor) GetAllowedOverrideModes() []*ProcessingMode { - if x != nil { - return x.AllowedOverrideModes - } - return nil -} - -func (x *ExternalProcessor) GetProcessingRequestModifier() *v3.TypedExtensionConfig { - if x != nil { - return x.ProcessingRequestModifier - } - return nil -} - -func (x *ExternalProcessor) GetOnProcessingResponse() *v3.TypedExtensionConfig { - if x != nil { - return x.OnProcessingResponse - } - return nil -} - -func (x *ExternalProcessor) GetStatusOnError() *v32.HttpStatus { - if x != nil { - return x.StatusOnError - } - return nil -} - -// ExtProcHttpService is used for HTTP communication between the filter and the external processing service. -type ExtProcHttpService struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Sets the HTTP service which the external processing requests must be sent to. - HttpService *v3.HttpService `protobuf:"bytes,1,opt,name=http_service,json=httpService,proto3" json:"http_service,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ExtProcHttpService) Reset() { - *x = ExtProcHttpService{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ExtProcHttpService) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtProcHttpService) ProtoMessage() {} - -func (x *ExtProcHttpService) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtProcHttpService.ProtoReflect.Descriptor instead. -func (*ExtProcHttpService) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{1} -} - -func (x *ExtProcHttpService) GetHttpService() *v3.HttpService { - if x != nil { - return x.HttpService - } - return nil -} - -// The MetadataOptions structure defines options for the sending and receiving of -// dynamic metadata. Specifically, which namespaces to send to the server, whether -// metadata returned by the server may be written, and how that metadata may be written. -type MetadataOptions struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Describes which typed or untyped filter dynamic metadata namespaces to forward to - // the external processing server. - ForwardingNamespaces *MetadataOptions_MetadataNamespaces `protobuf:"bytes,1,opt,name=forwarding_namespaces,json=forwardingNamespaces,proto3" json:"forwarding_namespaces,omitempty"` - // Describes which typed or untyped filter dynamic metadata namespaces to accept from - // the external processing server. Set to empty or leave unset to disallow writing - // any received dynamic metadata. Receiving of typed metadata is not supported. - ReceivingNamespaces *MetadataOptions_MetadataNamespaces `protobuf:"bytes,2,opt,name=receiving_namespaces,json=receivingNamespaces,proto3" json:"receiving_namespaces,omitempty"` - // Describes which cluster metadata namespaces to forward to - // the external processing server. - // .. note:: - // This is the least specific metadata. Should there be any namespace collision, - // cluster level metadata can be overridden by filter metadata. - ClusterMetadataForwardingNamespaces *MetadataOptions_MetadataNamespaces `protobuf:"bytes,3,opt,name=cluster_metadata_forwarding_namespaces,json=clusterMetadataForwardingNamespaces,proto3" json:"cluster_metadata_forwarding_namespaces,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *MetadataOptions) Reset() { - *x = MetadataOptions{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *MetadataOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataOptions) ProtoMessage() {} - -func (x *MetadataOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataOptions.ProtoReflect.Descriptor instead. -func (*MetadataOptions) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{2} -} - -func (x *MetadataOptions) GetForwardingNamespaces() *MetadataOptions_MetadataNamespaces { - if x != nil { - return x.ForwardingNamespaces - } - return nil -} - -func (x *MetadataOptions) GetReceivingNamespaces() *MetadataOptions_MetadataNamespaces { - if x != nil { - return x.ReceivingNamespaces - } - return nil -} - -func (x *MetadataOptions) GetClusterMetadataForwardingNamespaces() *MetadataOptions_MetadataNamespaces { - if x != nil { - return x.ClusterMetadataForwardingNamespaces - } - return nil -} - -// The HeaderForwardingRules structure specifies what headers are -// allowed to be forwarded to the external processing server. -// -// This works as below: -// -// 1. If neither “allowed_headers“ nor “disallowed_headers“ is set, all headers are forwarded. -// 2. If both “allowed_headers“ and “disallowed_headers“ are set, only headers in the -// “allowed_headers“ but not in the “disallowed_headers“ are forwarded. -// 3. If “allowed_headers“ is set, and “disallowed_headers“ is not set, only headers in -// the “allowed_headers“ are forwarded. -// 4. If “disallowed_headers“ is set, and “allowed_headers“ is not set, all headers except -// headers in the “disallowed_headers“ are forwarded. -type HeaderForwardingRules struct { - state protoimpl.MessageState `protogen:"open.v1"` - // If set, specifically allow any header in this list to be forwarded to the external - // processing server. This can be overridden by the below “disallowed_headers“. - AllowedHeaders *v33.ListStringMatcher `protobuf:"bytes,1,opt,name=allowed_headers,json=allowedHeaders,proto3" json:"allowed_headers,omitempty"` - // If set, specifically disallow any header in this list to be forwarded to the external - // processing server. This overrides the above “allowed_headers“ if a header matches both. - DisallowedHeaders *v33.ListStringMatcher `protobuf:"bytes,2,opt,name=disallowed_headers,json=disallowedHeaders,proto3" json:"disallowed_headers,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HeaderForwardingRules) Reset() { - *x = HeaderForwardingRules{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HeaderForwardingRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderForwardingRules) ProtoMessage() {} - -func (x *HeaderForwardingRules) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderForwardingRules.ProtoReflect.Descriptor instead. -func (*HeaderForwardingRules) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{3} -} - -func (x *HeaderForwardingRules) GetAllowedHeaders() *v33.ListStringMatcher { - if x != nil { - return x.AllowedHeaders - } - return nil -} - -func (x *HeaderForwardingRules) GetDisallowedHeaders() *v33.ListStringMatcher { - if x != nil { - return x.DisallowedHeaders - } - return nil -} - -// Extra settings that may be added to per-route configuration for a -// virtual host or cluster. -type ExtProcPerRoute struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to Override: - // - // *ExtProcPerRoute_Disabled - // *ExtProcPerRoute_Overrides - Override isExtProcPerRoute_Override `protobuf_oneof:"override"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ExtProcPerRoute) Reset() { - *x = ExtProcPerRoute{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ExtProcPerRoute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtProcPerRoute) ProtoMessage() {} - -func (x *ExtProcPerRoute) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtProcPerRoute.ProtoReflect.Descriptor instead. -func (*ExtProcPerRoute) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{4} -} - -func (x *ExtProcPerRoute) GetOverride() isExtProcPerRoute_Override { - if x != nil { - return x.Override - } - return nil -} - -func (x *ExtProcPerRoute) GetDisabled() bool { - if x != nil { - if x, ok := x.Override.(*ExtProcPerRoute_Disabled); ok { - return x.Disabled - } - } - return false -} - -func (x *ExtProcPerRoute) GetOverrides() *ExtProcOverrides { - if x != nil { - if x, ok := x.Override.(*ExtProcPerRoute_Overrides); ok { - return x.Overrides - } - } - return nil -} - -type isExtProcPerRoute_Override interface { - isExtProcPerRoute_Override() -} - -type ExtProcPerRoute_Disabled struct { - // Disable the filter for this particular vhost or route. - // If disabled is specified in multiple per-filter-configs, the most specific one will be used. - Disabled bool `protobuf:"varint,1,opt,name=disabled,proto3,oneof"` -} - -type ExtProcPerRoute_Overrides struct { - // Override aspects of the configuration for this route. A set of - // overrides in a more specific configuration will override a "disabled" - // flag set in a less-specific one. - Overrides *ExtProcOverrides `protobuf:"bytes,2,opt,name=overrides,proto3,oneof"` -} - -func (*ExtProcPerRoute_Disabled) isExtProcPerRoute_Override() {} - -func (*ExtProcPerRoute_Overrides) isExtProcPerRoute_Override() {} - -// Overrides that may be set on a per-route basis -// [#next-free-field: 10] -type ExtProcOverrides struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Set a different processing mode for this route than the default. - ProcessingMode *ProcessingMode `protobuf:"bytes,1,opt,name=processing_mode,json=processingMode,proto3" json:"processing_mode,omitempty"` - // [#not-implemented-hide:] - // Set a different asynchronous processing option than the default. - // Deprecated and not implemented. - // - // Deprecated: Marked as deprecated in envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto. - AsyncMode bool `protobuf:"varint,2,opt,name=async_mode,json=asyncMode,proto3" json:"async_mode,omitempty"` - // [#not-implemented-hide:] - // Set different optional attributes than the default setting of the - // “request_attributes“ field. - RequestAttributes []string `protobuf:"bytes,3,rep,name=request_attributes,json=requestAttributes,proto3" json:"request_attributes,omitempty"` - // [#not-implemented-hide:] - // Set different optional properties than the default setting of the - // “response_attributes“ field. - ResponseAttributes []string `protobuf:"bytes,4,rep,name=response_attributes,json=responseAttributes,proto3" json:"response_attributes,omitempty"` - // Set a different gRPC service for this route than the default. - GrpcService *v3.GrpcService `protobuf:"bytes,5,opt,name=grpc_service,json=grpcService,proto3" json:"grpc_service,omitempty"` - // Options related to the sending and receiving of dynamic metadata. - // Lists of forwarding and receiving namespaces will be overridden in their entirety, - // meaning the most-specific config that specifies this override will be the final - // config used. It is the prerogative of the control plane to ensure this - // most-specific config contains the correct final overrides. - MetadataOptions *MetadataOptions `protobuf:"bytes,6,opt,name=metadata_options,json=metadataOptions,proto3" json:"metadata_options,omitempty"` - // Additional metadata to include into streams initiated to the “ext_proc“ gRPC - // service. This can be used for scenarios in which additional ad hoc - // authorization headers (e.g. “x-foo-bar: baz-key“) are to be injected or - // when a route needs to partially override inherited metadata. - GrpcInitialMetadata []*v3.HeaderValue `protobuf:"bytes,7,rep,name=grpc_initial_metadata,json=grpcInitialMetadata,proto3" json:"grpc_initial_metadata,omitempty"` - // If true, the filter will not fail closed if the gRPC stream is prematurely closed - // or could not be opened. This field is the per-route override of - // :ref:`failure_mode_allow `. - FailureModeAllow *wrapperspb.BoolValue `protobuf:"bytes,8,opt,name=failure_mode_allow,json=failureModeAllow,proto3" json:"failure_mode_allow,omitempty"` - // Decorator to introduce custom logic that runs after the “ProcessingRequest“ is constructed, but - // before it is sent to the External Processor. The “ProcessingRequest“ may be modified. - // This is a per-route override of - // :ref:`processing_request_modifier `. - ProcessingRequestModifier *v3.TypedExtensionConfig `protobuf:"bytes,9,opt,name=processing_request_modifier,json=processingRequestModifier,proto3" json:"processing_request_modifier,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ExtProcOverrides) Reset() { - *x = ExtProcOverrides{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ExtProcOverrides) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExtProcOverrides) ProtoMessage() {} - -func (x *ExtProcOverrides) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExtProcOverrides.ProtoReflect.Descriptor instead. -func (*ExtProcOverrides) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{5} -} - -func (x *ExtProcOverrides) GetProcessingMode() *ProcessingMode { - if x != nil { - return x.ProcessingMode - } - return nil -} - -// Deprecated: Marked as deprecated in envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto. -func (x *ExtProcOverrides) GetAsyncMode() bool { - if x != nil { - return x.AsyncMode - } - return false -} - -func (x *ExtProcOverrides) GetRequestAttributes() []string { - if x != nil { - return x.RequestAttributes - } - return nil -} - -func (x *ExtProcOverrides) GetResponseAttributes() []string { - if x != nil { - return x.ResponseAttributes - } - return nil -} - -func (x *ExtProcOverrides) GetGrpcService() *v3.GrpcService { - if x != nil { - return x.GrpcService - } - return nil -} - -func (x *ExtProcOverrides) GetMetadataOptions() *MetadataOptions { - if x != nil { - return x.MetadataOptions - } - return nil -} - -func (x *ExtProcOverrides) GetGrpcInitialMetadata() []*v3.HeaderValue { - if x != nil { - return x.GrpcInitialMetadata - } - return nil -} - -func (x *ExtProcOverrides) GetFailureModeAllow() *wrapperspb.BoolValue { - if x != nil { - return x.FailureModeAllow - } - return nil -} - -func (x *ExtProcOverrides) GetProcessingRequestModifier() *v3.TypedExtensionConfig { - if x != nil { - return x.ProcessingRequestModifier - } - return nil -} - -type MetadataOptions_MetadataNamespaces struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Specifies a list of metadata namespaces whose values, if present, - // will be passed to the “ext_proc“ service as an opaque “protobuf::Struct“. - Untyped []string `protobuf:"bytes,1,rep,name=untyped,proto3" json:"untyped,omitempty"` - // Specifies a list of metadata namespaces whose values, if present, - // will be passed to the “ext_proc“ service as a “protobuf::Any“. This allows - // envoy and the external processing server to share the protobuf message - // definition for safe parsing. - Typed []string `protobuf:"bytes,2,rep,name=typed,proto3" json:"typed,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *MetadataOptions_MetadataNamespaces) Reset() { - *x = MetadataOptions_MetadataNamespaces{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *MetadataOptions_MetadataNamespaces) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetadataOptions_MetadataNamespaces) ProtoMessage() {} - -func (x *MetadataOptions_MetadataNamespaces) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetadataOptions_MetadataNamespaces.ProtoReflect.Descriptor instead. -func (*MetadataOptions_MetadataNamespaces) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *MetadataOptions_MetadataNamespaces) GetUntyped() []string { - if x != nil { - return x.Untyped - } - return nil -} - -func (x *MetadataOptions_MetadataNamespaces) GetTyped() []string { - if x != nil { - return x.Typed - } - return nil -} - -var File_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto protoreflect.FileDescriptor - -const file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDesc = "" + - "\n" + - "8envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto\x12)envoy.extensions.filters.http.ext_proc.v3\x1a:envoy/config/common/mutation_rules/v3/mutation_rules.proto\x1a\x1fenvoy/config/core/v3/base.proto\x1a$envoy/config/core/v3/extension.proto\x1a'envoy/config/core/v3/grpc_service.proto\x1a'envoy/config/core/v3/http_service.proto\x1a?envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto\x1a\"envoy/type/matcher/v3/string.proto\x1a\x1fenvoy/type/v3/http_status.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1fxds/annotations/v3/status.proto\x1a#envoy/annotations/deprecation.proto\x1a\x1eudpa/annotations/migrate.proto\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"\xdc\x10\n" + - "\x11ExternalProcessor\x12c\n" + - "\fgrpc_service\x18\x01 \x01(\v2!.envoy.config.core.v3.GrpcServiceB\x1d\xf2\x98\xfe\x8f\x05\x17\x12\x15ext_proc_service_typeR\vgrpcService\x12\x87\x01\n" + - "\fhttp_service\x18\x14 \x01(\v2=.envoy.extensions.filters.http.ext_proc.v3.ExtProcHttpServiceB%\xf2\x98\xfe\x8f\x05\x17\x12\x15ext_proc_service_type\xd2Ƥ\xe1\x06\x02\b\x01R\vhttpService\x12,\n" + - "\x12failure_mode_allow\x18\x02 \x01(\bR\x10failureModeAllow\x12b\n" + - "\x0fprocessing_mode\x18\x03 \x01(\v29.envoy.extensions.filters.http.ext_proc.v3.ProcessingModeR\x0eprocessingMode\x12-\n" + - "\x12request_attributes\x18\x05 \x03(\tR\x11requestAttributes\x12/\n" + - "\x13response_attributes\x18\x06 \x03(\tR\x12responseAttributes\x12Q\n" + - "\x0fmessage_timeout\x18\a \x01(\v2\x19.google.protobuf.DurationB\r\xfaB\n" + - "\xaa\x01\a\"\x03\b\x90\x1c2\x00R\x0emessageTimeout\x12\x1f\n" + - "\vstat_prefix\x18\b \x01(\tR\n" + - "statPrefix\x12a\n" + - "\x0emutation_rules\x18\t \x01(\v2:.envoy.config.common.mutation_rules.v3.HeaderMutationRulesR\rmutationRules\x12X\n" + - "\x13max_message_timeout\x18\n" + - " \x01(\v2\x19.google.protobuf.DurationB\r\xfaB\n" + - "\xaa\x01\a\"\x03\b\x90\x1c2\x00R\x11maxMessageTimeout\x12e\n" + - "\rforward_rules\x18\f \x01(\v2@.envoy.extensions.filters.http.ext_proc.v3.HeaderForwardingRulesR\fforwardRules\x12@\n" + - "\x0ffilter_metadata\x18\r \x01(\v2\x17.google.protobuf.StructR\x0efilterMetadata\x12.\n" + - "\x13allow_mode_override\x18\x0e \x01(\bR\x11allowModeOverride\x12<\n" + - "\x1adisable_immediate_response\x18\x0f \x01(\bR\x18disableImmediateResponse\x12e\n" + - "\x10metadata_options\x18\x10 \x01(\v2:.envoy.extensions.filters.http.ext_proc.v3.MetadataOptionsR\x0fmetadataOptions\x12-\n" + - "\x12observability_mode\x18\x11 \x01(\bR\x11observabilityMode\x12Y\n" + - "\x19disable_clear_route_cache\x18\v \x01(\bB\x1e\xf2\x98\xfe\x8f\x05\x18\x12\x16clear_route_cache_typeR\x16disableClearRouteCache\x12\x9b\x01\n" + - "\x12route_cache_action\x18\x12 \x01(\x0e2M.envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.RouteCacheActionB\x1e\xf2\x98\xfe\x8f\x05\x18\x12\x16clear_route_cache_typeR\x10routeCacheAction\x12O\n" + - "\x16deferred_close_timeout\x18\x13 \x01(\v2\x19.google.protobuf.DurationR\x14deferredCloseTimeout\x12^\n" + - "-send_body_without_waiting_for_header_response\x18\x15 \x01(\bR'sendBodyWithoutWaitingForHeaderResponse\x12o\n" + - "\x16allowed_override_modes\x18\x16 \x03(\v29.envoy.extensions.filters.http.ext_proc.v3.ProcessingModeR\x14allowedOverrideModes\x12t\n" + - "\x1bprocessing_request_modifier\x18\x19 \x01(\v2*.envoy.config.core.v3.TypedExtensionConfigB\b\xd2Ƥ\xe1\x06\x02\b\x01R\x19processingRequestModifier\x12j\n" + - "\x16on_processing_response\x18\x17 \x01(\v2*.envoy.config.core.v3.TypedExtensionConfigB\b\xd2Ƥ\xe1\x06\x02\b\x01R\x14onProcessingResponse\x12A\n" + - "\x0fstatus_on_error\x18\x18 \x01(\v2\x19.envoy.type.v3.HttpStatusR\rstatusOnError\"6\n" + - "\x10RouteCacheAction\x12\v\n" + - "\aDEFAULT\x10\x00\x12\t\n" + - "\x05CLEAR\x10\x01\x12\n" + - "\n" + - "\x06RETAIN\x10\x02J\x04\b\x04\x10\x05R\n" + - "async_mode\"Z\n" + - "\x12ExtProcHttpService\x12D\n" + - "\fhttp_service\x18\x01 \x01(\v2!.envoy.config.core.v3.HttpServiceR\vhttpService\"\x84\x04\n" + - "\x0fMetadataOptions\x12\x82\x01\n" + - "\x15forwarding_namespaces\x18\x01 \x01(\v2M.envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.MetadataNamespacesR\x14forwardingNamespaces\x12\x80\x01\n" + - "\x14receiving_namespaces\x18\x02 \x01(\v2M.envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.MetadataNamespacesR\x13receivingNamespaces\x12\xa2\x01\n" + - "&cluster_metadata_forwarding_namespaces\x18\x03 \x01(\v2M.envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.MetadataNamespacesR#clusterMetadataForwardingNamespaces\x1aD\n" + - "\x12MetadataNamespaces\x12\x18\n" + - "\auntyped\x18\x01 \x03(\tR\auntyped\x12\x14\n" + - "\x05typed\x18\x02 \x03(\tR\x05typed\"\xc3\x01\n" + - "\x15HeaderForwardingRules\x12Q\n" + - "\x0fallowed_headers\x18\x01 \x01(\v2(.envoy.type.matcher.v3.ListStringMatcherR\x0eallowedHeaders\x12W\n" + - "\x12disallowed_headers\x18\x02 \x01(\v2(.envoy.type.matcher.v3.ListStringMatcherR\x11disallowedHeaders\"\xa6\x01\n" + - "\x0fExtProcPerRoute\x12%\n" + - "\bdisabled\x18\x01 \x01(\bB\a\xfaB\x04j\x02\b\x01H\x00R\bdisabled\x12[\n" + - "\toverrides\x18\x02 \x01(\v2;.envoy.extensions.filters.http.ext_proc.v3.ExtProcOverridesH\x00R\toverridesB\x0f\n" + - "\boverride\x12\x03\xf8B\x01\"\xc6\x05\n" + - "\x10ExtProcOverrides\x12b\n" + - "\x0fprocessing_mode\x18\x01 \x01(\v29.envoy.extensions.filters.http.ext_proc.v3.ProcessingModeR\x0eprocessingMode\x12*\n" + - "\n" + - "async_mode\x18\x02 \x01(\bB\v\x92dž\xd8\x04\x033.0\x18\x01R\tasyncMode\x12-\n" + - "\x12request_attributes\x18\x03 \x03(\tR\x11requestAttributes\x12/\n" + - "\x13response_attributes\x18\x04 \x03(\tR\x12responseAttributes\x12D\n" + - "\fgrpc_service\x18\x05 \x01(\v2!.envoy.config.core.v3.GrpcServiceR\vgrpcService\x12e\n" + - "\x10metadata_options\x18\x06 \x01(\v2:.envoy.extensions.filters.http.ext_proc.v3.MetadataOptionsR\x0fmetadataOptions\x12U\n" + - "\x15grpc_initial_metadata\x18\a \x03(\v2!.envoy.config.core.v3.HeaderValueR\x13grpcInitialMetadata\x12H\n" + - "\x12failure_mode_allow\x18\b \x01(\v2\x1a.google.protobuf.BoolValueR\x10failureModeAllow\x12t\n" + - "\x1bprocessing_request_modifier\x18\t \x01(\v2*.envoy.config.core.v3.TypedExtensionConfigB\b\xd2Ƥ\xe1\x06\x02\b\x01R\x19processingRequestModifierB\xae\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "7io.envoyproxy.envoy.extensions.filters.http.ext_proc.v3B\fExtProcProtoP\x01Z[github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3;ext_procv3b\x06proto3" - -var ( - file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescOnce sync.Once - file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescData []byte -) - -func file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescGZIP() []byte { - file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescOnce.Do(func() { - file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDesc), len(file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDesc))) - }) - return file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDescData -} - -var file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_goTypes = []any{ - (ExternalProcessor_RouteCacheAction)(0), // 0: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.RouteCacheAction - (*ExternalProcessor)(nil), // 1: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor - (*ExtProcHttpService)(nil), // 2: envoy.extensions.filters.http.ext_proc.v3.ExtProcHttpService - (*MetadataOptions)(nil), // 3: envoy.extensions.filters.http.ext_proc.v3.MetadataOptions - (*HeaderForwardingRules)(nil), // 4: envoy.extensions.filters.http.ext_proc.v3.HeaderForwardingRules - (*ExtProcPerRoute)(nil), // 5: envoy.extensions.filters.http.ext_proc.v3.ExtProcPerRoute - (*ExtProcOverrides)(nil), // 6: envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides - (*MetadataOptions_MetadataNamespaces)(nil), // 7: envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.MetadataNamespaces - (*v3.GrpcService)(nil), // 8: envoy.config.core.v3.GrpcService - (*ProcessingMode)(nil), // 9: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode - (*durationpb.Duration)(nil), // 10: google.protobuf.Duration - (*v31.HeaderMutationRules)(nil), // 11: envoy.config.common.mutation_rules.v3.HeaderMutationRules - (*structpb.Struct)(nil), // 12: google.protobuf.Struct - (*v3.TypedExtensionConfig)(nil), // 13: envoy.config.core.v3.TypedExtensionConfig - (*v32.HttpStatus)(nil), // 14: envoy.type.v3.HttpStatus - (*v3.HttpService)(nil), // 15: envoy.config.core.v3.HttpService - (*v33.ListStringMatcher)(nil), // 16: envoy.type.matcher.v3.ListStringMatcher - (*v3.HeaderValue)(nil), // 17: envoy.config.core.v3.HeaderValue - (*wrapperspb.BoolValue)(nil), // 18: google.protobuf.BoolValue -} -var file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_depIdxs = []int32{ - 8, // 0: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.grpc_service:type_name -> envoy.config.core.v3.GrpcService - 2, // 1: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.http_service:type_name -> envoy.extensions.filters.http.ext_proc.v3.ExtProcHttpService - 9, // 2: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.processing_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode - 10, // 3: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.message_timeout:type_name -> google.protobuf.Duration - 11, // 4: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.mutation_rules:type_name -> envoy.config.common.mutation_rules.v3.HeaderMutationRules - 10, // 5: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.max_message_timeout:type_name -> google.protobuf.Duration - 4, // 6: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.forward_rules:type_name -> envoy.extensions.filters.http.ext_proc.v3.HeaderForwardingRules - 12, // 7: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.filter_metadata:type_name -> google.protobuf.Struct - 3, // 8: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.metadata_options:type_name -> envoy.extensions.filters.http.ext_proc.v3.MetadataOptions - 0, // 9: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.route_cache_action:type_name -> envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.RouteCacheAction - 10, // 10: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.deferred_close_timeout:type_name -> google.protobuf.Duration - 9, // 11: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.allowed_override_modes:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode - 13, // 12: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.processing_request_modifier:type_name -> envoy.config.core.v3.TypedExtensionConfig - 13, // 13: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.on_processing_response:type_name -> envoy.config.core.v3.TypedExtensionConfig - 14, // 14: envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor.status_on_error:type_name -> envoy.type.v3.HttpStatus - 15, // 15: envoy.extensions.filters.http.ext_proc.v3.ExtProcHttpService.http_service:type_name -> envoy.config.core.v3.HttpService - 7, // 16: envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.forwarding_namespaces:type_name -> envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.MetadataNamespaces - 7, // 17: envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.receiving_namespaces:type_name -> envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.MetadataNamespaces - 7, // 18: envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.cluster_metadata_forwarding_namespaces:type_name -> envoy.extensions.filters.http.ext_proc.v3.MetadataOptions.MetadataNamespaces - 16, // 19: envoy.extensions.filters.http.ext_proc.v3.HeaderForwardingRules.allowed_headers:type_name -> envoy.type.matcher.v3.ListStringMatcher - 16, // 20: envoy.extensions.filters.http.ext_proc.v3.HeaderForwardingRules.disallowed_headers:type_name -> envoy.type.matcher.v3.ListStringMatcher - 6, // 21: envoy.extensions.filters.http.ext_proc.v3.ExtProcPerRoute.overrides:type_name -> envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides - 9, // 22: envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides.processing_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode - 8, // 23: envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides.grpc_service:type_name -> envoy.config.core.v3.GrpcService - 3, // 24: envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides.metadata_options:type_name -> envoy.extensions.filters.http.ext_proc.v3.MetadataOptions - 17, // 25: envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides.grpc_initial_metadata:type_name -> envoy.config.core.v3.HeaderValue - 18, // 26: envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides.failure_mode_allow:type_name -> google.protobuf.BoolValue - 13, // 27: envoy.extensions.filters.http.ext_proc.v3.ExtProcOverrides.processing_request_modifier:type_name -> envoy.config.core.v3.TypedExtensionConfig - 28, // [28:28] is the sub-list for method output_type - 28, // [28:28] is the sub-list for method input_type - 28, // [28:28] is the sub-list for extension type_name - 28, // [28:28] is the sub-list for extension extendee - 0, // [0:28] is the sub-list for field type_name -} - -func init() { file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_init() } -func file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_init() { - if File_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto != nil { - return - } - file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_init() - file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes[4].OneofWrappers = []any{ - (*ExtProcPerRoute_Disabled)(nil), - (*ExtProcPerRoute_Overrides)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDesc), len(file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_rawDesc)), - NumEnums: 1, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_goTypes, - DependencyIndexes: file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_depIdxs, - EnumInfos: file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_enumTypes, - MessageInfos: file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_msgTypes, - }.Build() - File_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto = out.File - file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_goTypes = nil - file_envoy_extensions_filters_http_ext_proc_v3_ext_proc_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc.pb.validate.go deleted file mode 100644 index 01db7378d..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc.pb.validate.go +++ /dev/null @@ -1,1616 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto - -package ext_procv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ExternalProcessor with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ExternalProcessor) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExternalProcessor with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExternalProcessorMultiError, or nil if none found. -func (m *ExternalProcessor) ValidateAll() error { - return m.validate(true) -} - -func (m *ExternalProcessor) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetGrpcService()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHttpService()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "HttpService", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "HttpService", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpService()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "HttpService", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for FailureModeAllow - - if all { - switch v := interface{}(m.GetProcessingMode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "ProcessingMode", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "ProcessingMode", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProcessingMode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "ProcessingMode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if d := m.GetMessageTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = ExternalProcessorValidationError{ - field: "MessageTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(3600*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur < gte || dur > lte { - err := ExternalProcessorValidationError{ - field: "MessageTimeout", - reason: "value must be inside range [0s, 1h0m0s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - // no validation rules for StatPrefix - - if all { - switch v := interface{}(m.GetMutationRules()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "MutationRules", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "MutationRules", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMutationRules()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "MutationRules", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if d := m.GetMaxMessageTimeout(); d != nil { - dur, err := d.AsDuration(), d.CheckValid() - if err != nil { - err = ExternalProcessorValidationError{ - field: "MaxMessageTimeout", - reason: "value is not a valid duration", - cause: err, - } - if !all { - return err - } - errors = append(errors, err) - } else { - - lte := time.Duration(3600*time.Second + 0*time.Nanosecond) - gte := time.Duration(0*time.Second + 0*time.Nanosecond) - - if dur < gte || dur > lte { - err := ExternalProcessorValidationError{ - field: "MaxMessageTimeout", - reason: "value must be inside range [0s, 1h0m0s]", - } - if !all { - return err - } - errors = append(errors, err) - } - - } - } - - if all { - switch v := interface{}(m.GetForwardRules()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "ForwardRules", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "ForwardRules", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetForwardRules()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "ForwardRules", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetFilterMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "FilterMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "FilterMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFilterMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "FilterMetadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AllowModeOverride - - // no validation rules for DisableImmediateResponse - - if all { - switch v := interface{}(m.GetMetadataOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "MetadataOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "MetadataOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "MetadataOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for ObservabilityMode - - // no validation rules for DisableClearRouteCache - - // no validation rules for RouteCacheAction - - if all { - switch v := interface{}(m.GetDeferredCloseTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "DeferredCloseTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "DeferredCloseTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDeferredCloseTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "DeferredCloseTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for SendBodyWithoutWaitingForHeaderResponse - - for idx, item := range m.GetAllowedOverrideModes() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: fmt.Sprintf("AllowedOverrideModes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: fmt.Sprintf("AllowedOverrideModes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: fmt.Sprintf("AllowedOverrideModes[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetProcessingRequestModifier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "ProcessingRequestModifier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "ProcessingRequestModifier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProcessingRequestModifier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "ProcessingRequestModifier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetOnProcessingResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "OnProcessingResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "OnProcessingResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOnProcessingResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "OnProcessingResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetStatusOnError()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "StatusOnError", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExternalProcessorValidationError{ - field: "StatusOnError", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStatusOnError()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExternalProcessorValidationError{ - field: "StatusOnError", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ExternalProcessorMultiError(errors) - } - - return nil -} - -// ExternalProcessorMultiError is an error wrapping multiple validation errors -// returned by ExternalProcessor.ValidateAll() if the designated constraints -// aren't met. -type ExternalProcessorMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExternalProcessorMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExternalProcessorMultiError) AllErrors() []error { return m } - -// ExternalProcessorValidationError is the validation error returned by -// ExternalProcessor.Validate if the designated constraints aren't met. -type ExternalProcessorValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExternalProcessorValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExternalProcessorValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExternalProcessorValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExternalProcessorValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExternalProcessorValidationError) ErrorName() string { - return "ExternalProcessorValidationError" -} - -// Error satisfies the builtin error interface -func (e ExternalProcessorValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExternalProcessor.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExternalProcessorValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExternalProcessorValidationError{} - -// Validate checks the field values on ExtProcHttpService with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ExtProcHttpService) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExtProcHttpService with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExtProcHttpServiceMultiError, or nil if none found. -func (m *ExtProcHttpService) ValidateAll() error { - return m.validate(true) -} - -func (m *ExtProcHttpService) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHttpService()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcHttpServiceValidationError{ - field: "HttpService", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcHttpServiceValidationError{ - field: "HttpService", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpService()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcHttpServiceValidationError{ - field: "HttpService", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ExtProcHttpServiceMultiError(errors) - } - - return nil -} - -// ExtProcHttpServiceMultiError is an error wrapping multiple validation errors -// returned by ExtProcHttpService.ValidateAll() if the designated constraints -// aren't met. -type ExtProcHttpServiceMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtProcHttpServiceMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtProcHttpServiceMultiError) AllErrors() []error { return m } - -// ExtProcHttpServiceValidationError is the validation error returned by -// ExtProcHttpService.Validate if the designated constraints aren't met. -type ExtProcHttpServiceValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtProcHttpServiceValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtProcHttpServiceValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtProcHttpServiceValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtProcHttpServiceValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtProcHttpServiceValidationError) ErrorName() string { - return "ExtProcHttpServiceValidationError" -} - -// Error satisfies the builtin error interface -func (e ExtProcHttpServiceValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtProcHttpService.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtProcHttpServiceValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtProcHttpServiceValidationError{} - -// Validate checks the field values on MetadataOptions with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *MetadataOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// MetadataOptionsMultiError, or nil if none found. -func (m *MetadataOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetForwardingNamespaces()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataOptionsValidationError{ - field: "ForwardingNamespaces", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataOptionsValidationError{ - field: "ForwardingNamespaces", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetForwardingNamespaces()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataOptionsValidationError{ - field: "ForwardingNamespaces", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetReceivingNamespaces()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataOptionsValidationError{ - field: "ReceivingNamespaces", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataOptionsValidationError{ - field: "ReceivingNamespaces", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetReceivingNamespaces()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataOptionsValidationError{ - field: "ReceivingNamespaces", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetClusterMetadataForwardingNamespaces()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, MetadataOptionsValidationError{ - field: "ClusterMetadataForwardingNamespaces", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, MetadataOptionsValidationError{ - field: "ClusterMetadataForwardingNamespaces", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetClusterMetadataForwardingNamespaces()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return MetadataOptionsValidationError{ - field: "ClusterMetadataForwardingNamespaces", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return MetadataOptionsMultiError(errors) - } - - return nil -} - -// MetadataOptionsMultiError is an error wrapping multiple validation errors -// returned by MetadataOptions.ValidateAll() if the designated constraints -// aren't met. -type MetadataOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataOptionsMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataOptionsMultiError) AllErrors() []error { return m } - -// MetadataOptionsValidationError is the validation error returned by -// MetadataOptions.Validate if the designated constraints aren't met. -type MetadataOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataOptionsValidationError) ErrorName() string { return "MetadataOptionsValidationError" } - -// Error satisfies the builtin error interface -func (e MetadataOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataOptionsValidationError{} - -// Validate checks the field values on HeaderForwardingRules with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HeaderForwardingRules) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeaderForwardingRules with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HeaderForwardingRulesMultiError, or nil if none found. -func (m *HeaderForwardingRules) ValidateAll() error { - return m.validate(true) -} - -func (m *HeaderForwardingRules) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetAllowedHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderForwardingRulesValidationError{ - field: "AllowedHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderForwardingRulesValidationError{ - field: "AllowedHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAllowedHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderForwardingRulesValidationError{ - field: "AllowedHeaders", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetDisallowedHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderForwardingRulesValidationError{ - field: "DisallowedHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderForwardingRulesValidationError{ - field: "DisallowedHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDisallowedHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderForwardingRulesValidationError{ - field: "DisallowedHeaders", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return HeaderForwardingRulesMultiError(errors) - } - - return nil -} - -// HeaderForwardingRulesMultiError is an error wrapping multiple validation -// errors returned by HeaderForwardingRules.ValidateAll() if the designated -// constraints aren't met. -type HeaderForwardingRulesMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeaderForwardingRulesMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeaderForwardingRulesMultiError) AllErrors() []error { return m } - -// HeaderForwardingRulesValidationError is the validation error returned by -// HeaderForwardingRules.Validate if the designated constraints aren't met. -type HeaderForwardingRulesValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeaderForwardingRulesValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeaderForwardingRulesValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeaderForwardingRulesValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeaderForwardingRulesValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeaderForwardingRulesValidationError) ErrorName() string { - return "HeaderForwardingRulesValidationError" -} - -// Error satisfies the builtin error interface -func (e HeaderForwardingRulesValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeaderForwardingRules.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeaderForwardingRulesValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeaderForwardingRulesValidationError{} - -// Validate checks the field values on ExtProcPerRoute with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ExtProcPerRoute) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExtProcPerRoute with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExtProcPerRouteMultiError, or nil if none found. -func (m *ExtProcPerRoute) ValidateAll() error { - return m.validate(true) -} - -func (m *ExtProcPerRoute) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofOverridePresent := false - switch v := m.Override.(type) { - case *ExtProcPerRoute_Disabled: - if v == nil { - err := ExtProcPerRouteValidationError{ - field: "Override", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofOverridePresent = true - - if m.GetDisabled() != true { - err := ExtProcPerRouteValidationError{ - field: "Disabled", - reason: "value must equal true", - } - if !all { - return err - } - errors = append(errors, err) - } - - case *ExtProcPerRoute_Overrides: - if v == nil { - err := ExtProcPerRouteValidationError{ - field: "Override", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofOverridePresent = true - - if all { - switch v := interface{}(m.GetOverrides()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcPerRouteValidationError{ - field: "Overrides", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcPerRouteValidationError{ - field: "Overrides", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOverrides()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcPerRouteValidationError{ - field: "Overrides", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofOverridePresent { - err := ExtProcPerRouteValidationError{ - field: "Override", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ExtProcPerRouteMultiError(errors) - } - - return nil -} - -// ExtProcPerRouteMultiError is an error wrapping multiple validation errors -// returned by ExtProcPerRoute.ValidateAll() if the designated constraints -// aren't met. -type ExtProcPerRouteMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtProcPerRouteMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtProcPerRouteMultiError) AllErrors() []error { return m } - -// ExtProcPerRouteValidationError is the validation error returned by -// ExtProcPerRoute.Validate if the designated constraints aren't met. -type ExtProcPerRouteValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtProcPerRouteValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtProcPerRouteValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtProcPerRouteValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtProcPerRouteValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtProcPerRouteValidationError) ErrorName() string { return "ExtProcPerRouteValidationError" } - -// Error satisfies the builtin error interface -func (e ExtProcPerRouteValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtProcPerRoute.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtProcPerRouteValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtProcPerRouteValidationError{} - -// Validate checks the field values on ExtProcOverrides with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ExtProcOverrides) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExtProcOverrides with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExtProcOverridesMultiError, or nil if none found. -func (m *ExtProcOverrides) ValidateAll() error { - return m.validate(true) -} - -func (m *ExtProcOverrides) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetProcessingMode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "ProcessingMode", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "ProcessingMode", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProcessingMode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcOverridesValidationError{ - field: "ProcessingMode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for AsyncMode - - if all { - switch v := interface{}(m.GetGrpcService()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcOverridesValidationError{ - field: "GrpcService", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetMetadataOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "MetadataOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "MetadataOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcOverridesValidationError{ - field: "MetadataOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetGrpcInitialMetadata() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: fmt.Sprintf("GrpcInitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: fmt.Sprintf("GrpcInitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcOverridesValidationError{ - field: fmt.Sprintf("GrpcInitialMetadata[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetFailureModeAllow()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "FailureModeAllow", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "FailureModeAllow", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFailureModeAllow()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcOverridesValidationError{ - field: "FailureModeAllow", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetProcessingRequestModifier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "ProcessingRequestModifier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtProcOverridesValidationError{ - field: "ProcessingRequestModifier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProcessingRequestModifier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtProcOverridesValidationError{ - field: "ProcessingRequestModifier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ExtProcOverridesMultiError(errors) - } - - return nil -} - -// ExtProcOverridesMultiError is an error wrapping multiple validation errors -// returned by ExtProcOverrides.ValidateAll() if the designated constraints -// aren't met. -type ExtProcOverridesMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtProcOverridesMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtProcOverridesMultiError) AllErrors() []error { return m } - -// ExtProcOverridesValidationError is the validation error returned by -// ExtProcOverrides.Validate if the designated constraints aren't met. -type ExtProcOverridesValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtProcOverridesValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtProcOverridesValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtProcOverridesValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtProcOverridesValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtProcOverridesValidationError) ErrorName() string { return "ExtProcOverridesValidationError" } - -// Error satisfies the builtin error interface -func (e ExtProcOverridesValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtProcOverrides.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtProcOverridesValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtProcOverridesValidationError{} - -// Validate checks the field values on MetadataOptions_MetadataNamespaces with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *MetadataOptions_MetadataNamespaces) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on MetadataOptions_MetadataNamespaces -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// MetadataOptions_MetadataNamespacesMultiError, or nil if none found. -func (m *MetadataOptions_MetadataNamespaces) ValidateAll() error { - return m.validate(true) -} - -func (m *MetadataOptions_MetadataNamespaces) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return MetadataOptions_MetadataNamespacesMultiError(errors) - } - - return nil -} - -// MetadataOptions_MetadataNamespacesMultiError is an error wrapping multiple -// validation errors returned by -// MetadataOptions_MetadataNamespaces.ValidateAll() if the designated -// constraints aren't met. -type MetadataOptions_MetadataNamespacesMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m MetadataOptions_MetadataNamespacesMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m MetadataOptions_MetadataNamespacesMultiError) AllErrors() []error { return m } - -// MetadataOptions_MetadataNamespacesValidationError is the validation error -// returned by MetadataOptions_MetadataNamespaces.Validate if the designated -// constraints aren't met. -type MetadataOptions_MetadataNamespacesValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e MetadataOptions_MetadataNamespacesValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e MetadataOptions_MetadataNamespacesValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e MetadataOptions_MetadataNamespacesValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e MetadataOptions_MetadataNamespacesValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e MetadataOptions_MetadataNamespacesValidationError) ErrorName() string { - return "MetadataOptions_MetadataNamespacesValidationError" -} - -// Error satisfies the builtin error interface -func (e MetadataOptions_MetadataNamespacesValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sMetadataOptions_MetadataNamespaces.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = MetadataOptions_MetadataNamespacesValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = MetadataOptions_MetadataNamespacesValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc_vtproto.pb.go deleted file mode 100644 index 8b6aebf17..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/ext_proc_vtproto.pb.go +++ /dev/null @@ -1,1194 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/filters/http/ext_proc/v3/ext_proc.proto - -package ext_procv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - durationpb "github.com/planetscale/vtprotobuf/types/known/durationpb" - structpb "github.com/planetscale/vtprotobuf/types/known/structpb" - wrapperspb "github.com/planetscale/vtprotobuf/types/known/wrapperspb" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *ExternalProcessor) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExternalProcessor) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ExternalProcessor) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ProcessingRequestModifier != nil { - if vtmsg, ok := interface{}(m.ProcessingRequestModifier).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.ProcessingRequestModifier) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xca - } - if m.StatusOnError != nil { - if vtmsg, ok := interface{}(m.StatusOnError).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.StatusOnError) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc2 - } - if m.OnProcessingResponse != nil { - if vtmsg, ok := interface{}(m.OnProcessingResponse).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.OnProcessingResponse) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xba - } - if len(m.AllowedOverrideModes) > 0 { - for iNdEx := len(m.AllowedOverrideModes) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.AllowedOverrideModes[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xb2 - } - } - if m.SendBodyWithoutWaitingForHeaderResponse { - i-- - if m.SendBodyWithoutWaitingForHeaderResponse { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa8 - } - if m.HttpService != nil { - size, err := m.HttpService.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa2 - } - if m.DeferredCloseTimeout != nil { - size, err := (*durationpb.Duration)(m.DeferredCloseTimeout).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x9a - } - if m.RouteCacheAction != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.RouteCacheAction)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x90 - } - if m.ObservabilityMode { - i-- - if m.ObservabilityMode { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.MetadataOptions != nil { - size, err := m.MetadataOptions.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - if m.DisableImmediateResponse { - i-- - if m.DisableImmediateResponse { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x78 - } - if m.AllowModeOverride { - i-- - if m.AllowModeOverride { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - } - if m.FilterMetadata != nil { - size, err := (*structpb.Struct)(m.FilterMetadata).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x6a - } - if m.ForwardRules != nil { - size, err := m.ForwardRules.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if m.DisableClearRouteCache { - i-- - if m.DisableClearRouteCache { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.MaxMessageTimeout != nil { - size, err := (*durationpb.Duration)(m.MaxMessageTimeout).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if m.MutationRules != nil { - if vtmsg, ok := interface{}(m.MutationRules).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.MutationRules) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x4a - } - if len(m.StatPrefix) > 0 { - i -= len(m.StatPrefix) - copy(dAtA[i:], m.StatPrefix) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.StatPrefix))) - i-- - dAtA[i] = 0x42 - } - if m.MessageTimeout != nil { - size, err := (*durationpb.Duration)(m.MessageTimeout).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if len(m.ResponseAttributes) > 0 { - for iNdEx := len(m.ResponseAttributes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ResponseAttributes[iNdEx]) - copy(dAtA[i:], m.ResponseAttributes[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ResponseAttributes[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.RequestAttributes) > 0 { - for iNdEx := len(m.RequestAttributes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RequestAttributes[iNdEx]) - copy(dAtA[i:], m.RequestAttributes[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.RequestAttributes[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } - if m.ProcessingMode != nil { - size, err := m.ProcessingMode.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.FailureModeAllow { - i-- - if m.FailureModeAllow { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.GrpcService != nil { - if vtmsg, ok := interface{}(m.GrpcService).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.GrpcService) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExtProcHttpService) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExtProcHttpService) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ExtProcHttpService) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.HttpService != nil { - if vtmsg, ok := interface{}(m.HttpService).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.HttpService) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MetadataOptions_MetadataNamespaces) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetadataOptions_MetadataNamespaces) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *MetadataOptions_MetadataNamespaces) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Typed) > 0 { - for iNdEx := len(m.Typed) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Typed[iNdEx]) - copy(dAtA[i:], m.Typed[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Typed[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Untyped) > 0 { - for iNdEx := len(m.Untyped) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Untyped[iNdEx]) - copy(dAtA[i:], m.Untyped[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Untyped[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MetadataOptions) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetadataOptions) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *MetadataOptions) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ClusterMetadataForwardingNamespaces != nil { - size, err := m.ClusterMetadataForwardingNamespaces.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.ReceivingNamespaces != nil { - size, err := m.ReceivingNamespaces.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.ForwardingNamespaces != nil { - size, err := m.ForwardingNamespaces.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HeaderForwardingRules) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeaderForwardingRules) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HeaderForwardingRules) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.DisallowedHeaders != nil { - if vtmsg, ok := interface{}(m.DisallowedHeaders).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.DisallowedHeaders) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if m.AllowedHeaders != nil { - if vtmsg, ok := interface{}(m.AllowedHeaders).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.AllowedHeaders) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExtProcPerRoute) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExtProcPerRoute) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ExtProcPerRoute) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.Override.(*ExtProcPerRoute_Overrides); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Override.(*ExtProcPerRoute_Disabled); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *ExtProcPerRoute_Disabled) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ExtProcPerRoute_Disabled) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - i-- - if m.Disabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} -func (m *ExtProcPerRoute_Overrides) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ExtProcPerRoute_Overrides) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Overrides != nil { - size, err := m.Overrides.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *ExtProcOverrides) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExtProcOverrides) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ExtProcOverrides) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ProcessingRequestModifier != nil { - if vtmsg, ok := interface{}(m.ProcessingRequestModifier).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.ProcessingRequestModifier) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x4a - } - if m.FailureModeAllow != nil { - size, err := (*wrapperspb.BoolValue)(m.FailureModeAllow).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if len(m.GrpcInitialMetadata) > 0 { - for iNdEx := len(m.GrpcInitialMetadata) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.GrpcInitialMetadata[iNdEx]).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.GrpcInitialMetadata[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x3a - } - } - if m.MetadataOptions != nil { - size, err := m.MetadataOptions.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - if m.GrpcService != nil { - if vtmsg, ok := interface{}(m.GrpcService).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.GrpcService) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x2a - } - if len(m.ResponseAttributes) > 0 { - for iNdEx := len(m.ResponseAttributes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ResponseAttributes[iNdEx]) - copy(dAtA[i:], m.ResponseAttributes[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ResponseAttributes[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.RequestAttributes) > 0 { - for iNdEx := len(m.RequestAttributes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RequestAttributes[iNdEx]) - copy(dAtA[i:], m.RequestAttributes[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.RequestAttributes[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.AsyncMode { - i-- - if m.AsyncMode { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.ProcessingMode != nil { - size, err := m.ProcessingMode.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExternalProcessor) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GrpcService != nil { - if size, ok := interface{}(m.GrpcService).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.GrpcService) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.FailureModeAllow { - n += 2 - } - if m.ProcessingMode != nil { - l = m.ProcessingMode.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.RequestAttributes) > 0 { - for _, s := range m.RequestAttributes { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.ResponseAttributes) > 0 { - for _, s := range m.ResponseAttributes { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.MessageTimeout != nil { - l = (*durationpb.Duration)(m.MessageTimeout).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.StatPrefix) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.MutationRules != nil { - if size, ok := interface{}(m.MutationRules).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.MutationRules) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.MaxMessageTimeout != nil { - l = (*durationpb.Duration)(m.MaxMessageTimeout).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DisableClearRouteCache { - n += 2 - } - if m.ForwardRules != nil { - l = m.ForwardRules.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.FilterMetadata != nil { - l = (*structpb.Struct)(m.FilterMetadata).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.AllowModeOverride { - n += 2 - } - if m.DisableImmediateResponse { - n += 2 - } - if m.MetadataOptions != nil { - l = m.MetadataOptions.SizeVT() - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ObservabilityMode { - n += 3 - } - if m.RouteCacheAction != 0 { - n += 2 + protohelpers.SizeOfVarint(uint64(m.RouteCacheAction)) - } - if m.DeferredCloseTimeout != nil { - l = (*durationpb.Duration)(m.DeferredCloseTimeout).SizeVT() - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.HttpService != nil { - l = m.HttpService.SizeVT() - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.SendBodyWithoutWaitingForHeaderResponse { - n += 3 - } - if len(m.AllowedOverrideModes) > 0 { - for _, e := range m.AllowedOverrideModes { - l = e.SizeVT() - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.OnProcessingResponse != nil { - if size, ok := interface{}(m.OnProcessingResponse).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.OnProcessingResponse) - } - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.StatusOnError != nil { - if size, ok := interface{}(m.StatusOnError).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.StatusOnError) - } - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ProcessingRequestModifier != nil { - if size, ok := interface{}(m.ProcessingRequestModifier).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.ProcessingRequestModifier) - } - n += 2 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ExtProcHttpService) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HttpService != nil { - if size, ok := interface{}(m.HttpService).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.HttpService) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *MetadataOptions_MetadataNamespaces) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Untyped) > 0 { - for _, s := range m.Untyped { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.Typed) > 0 { - for _, s := range m.Typed { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *MetadataOptions) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ForwardingNamespaces != nil { - l = m.ForwardingNamespaces.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ReceivingNamespaces != nil { - l = m.ReceivingNamespaces.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ClusterMetadataForwardingNamespaces != nil { - l = m.ClusterMetadataForwardingNamespaces.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *HeaderForwardingRules) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AllowedHeaders != nil { - if size, ok := interface{}(m.AllowedHeaders).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.AllowedHeaders) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DisallowedHeaders != nil { - if size, ok := interface{}(m.DisallowedHeaders).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.DisallowedHeaders) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ExtProcPerRoute) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Override.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *ExtProcPerRoute_Disabled) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 2 - return n -} -func (m *ExtProcPerRoute_Overrides) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Overrides != nil { - l = m.Overrides.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ExtProcOverrides) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProcessingMode != nil { - l = m.ProcessingMode.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.AsyncMode { - n += 2 - } - if len(m.RequestAttributes) > 0 { - for _, s := range m.RequestAttributes { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.ResponseAttributes) > 0 { - for _, s := range m.ResponseAttributes { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.GrpcService != nil { - if size, ok := interface{}(m.GrpcService).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.GrpcService) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.MetadataOptions != nil { - l = m.MetadataOptions.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.GrpcInitialMetadata) > 0 { - for _, e := range m.GrpcInitialMetadata { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.FailureModeAllow != nil { - l = (*wrapperspb.BoolValue)(m.FailureModeAllow).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ProcessingRequestModifier != nil { - if size, ok := interface{}(m.ProcessingRequestModifier).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.ProcessingRequestModifier) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode.pb.go deleted file mode 100644 index 4b8b0c34d..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode.pb.go +++ /dev/null @@ -1,366 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto - -package ext_procv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Control how headers and trailers are handled -type ProcessingMode_HeaderSendMode int32 - -const ( - // When used to configure the ext_proc filter :ref:`processing_mode - // `, - // the default HeaderSendMode depends on which part of the message is being processed. By - // default, request and response headers are sent, while trailers are skipped. - // - // When used in :ref:`mode_override - // ` or - // :ref:`allowed_override_modes - // `, - // a value of DEFAULT indicates that there is no change from the behavior that is configured for - // the filter in :ref:`processing_mode - // `. - ProcessingMode_DEFAULT ProcessingMode_HeaderSendMode = 0 - // Send the header or trailer. - ProcessingMode_SEND ProcessingMode_HeaderSendMode = 1 - // Do not send the header or trailer. - ProcessingMode_SKIP ProcessingMode_HeaderSendMode = 2 -) - -// Enum value maps for ProcessingMode_HeaderSendMode. -var ( - ProcessingMode_HeaderSendMode_name = map[int32]string{ - 0: "DEFAULT", - 1: "SEND", - 2: "SKIP", - } - ProcessingMode_HeaderSendMode_value = map[string]int32{ - "DEFAULT": 0, - "SEND": 1, - "SKIP": 2, - } -) - -func (x ProcessingMode_HeaderSendMode) Enum() *ProcessingMode_HeaderSendMode { - p := new(ProcessingMode_HeaderSendMode) - *p = x - return p -} - -func (x ProcessingMode_HeaderSendMode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ProcessingMode_HeaderSendMode) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_enumTypes[0].Descriptor() -} - -func (ProcessingMode_HeaderSendMode) Type() protoreflect.EnumType { - return &file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_enumTypes[0] -} - -func (x ProcessingMode_HeaderSendMode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ProcessingMode_HeaderSendMode.Descriptor instead. -func (ProcessingMode_HeaderSendMode) EnumDescriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescGZIP(), []int{0, 0} -} - -// Control how the request and response bodies are handled -// When body mutation by external processor is enabled, ext_proc filter will always remove -// the content length header in four cases below because content length can not be guaranteed -// to be set correctly: -// 1) STREAMED BodySendMode: header processing completes before body mutation comes back. -// 2) BUFFERED_PARTIAL BodySendMode: body is buffered and could be injected in different phases. -// 3) BUFFERED BodySendMode + SKIP HeaderSendMode: header processing (e.g., update content-length) is skipped. -// 4) FULL_DUPLEX_STREAMED BodySendMode: header processing completes before body mutation comes back. -// -// In Envoy's http1 codec implementation, removing content length will enable chunked transfer -// encoding whenever feasible. The recipient (either client or server) must be able -// to parse and decode the chunked transfer coding. -// (see `details in RFC9112 `_). -// -// In BUFFERED BodySendMode + SEND HeaderSendMode, content length header is allowed but it is -// external processor's responsibility to set the content length correctly matched to the length -// of mutated body. If they don't match, the corresponding body mutation will be rejected and -// local reply will be sent with an error message. -type ProcessingMode_BodySendMode int32 - -const ( - // Do not send the body at all. This is the default. - ProcessingMode_NONE ProcessingMode_BodySendMode = 0 - // Stream the body to the server in pieces as they are seen. - ProcessingMode_STREAMED ProcessingMode_BodySendMode = 1 - // Buffer the message body in memory and send the entire body at once. - // If the body exceeds the configured buffer limit, then the - // downstream system will receive an error. - ProcessingMode_BUFFERED ProcessingMode_BodySendMode = 2 - // Buffer the message body in memory and send the entire body in one - // chunk. If the body exceeds the configured buffer limit, then the body contents - // up to the buffer limit will be sent. - ProcessingMode_BUFFERED_PARTIAL ProcessingMode_BodySendMode = 3 - ProcessingMode_FULL_DUPLEX_STREAMED ProcessingMode_BodySendMode = 4 - // [#not-implemented-hide:] - // A mode for gRPC traffic. This is similar to “FULL_DUPLEX_STREAMED“, - // except that instead of sending raw chunks of the HTTP/2 DATA frames, - // the ext_proc client will de-frame the individual gRPC messages inside - // the HTTP/2 DATA frames, and as each message is de-framed, it will be - // sent to the ext_proc server as a :ref:`request_body - // ` - // or :ref:`response_body - // `. - // The ext_proc server will stream back individual gRPC messages in the - // :ref:`StreamedBodyResponse ` - // field, but the number of messages sent by the ext_proc server - // does not need to equal the number of messages sent by the data - // plane. This allows the ext_proc server to change the number of - // messages sent on the stream. - // In this mode, the client will send body and trailers to the server as - // they arrive. - ProcessingMode_GRPC ProcessingMode_BodySendMode = 5 -) - -// Enum value maps for ProcessingMode_BodySendMode. -var ( - ProcessingMode_BodySendMode_name = map[int32]string{ - 0: "NONE", - 1: "STREAMED", - 2: "BUFFERED", - 3: "BUFFERED_PARTIAL", - 4: "FULL_DUPLEX_STREAMED", - 5: "GRPC", - } - ProcessingMode_BodySendMode_value = map[string]int32{ - "NONE": 0, - "STREAMED": 1, - "BUFFERED": 2, - "BUFFERED_PARTIAL": 3, - "FULL_DUPLEX_STREAMED": 4, - "GRPC": 5, - } -) - -func (x ProcessingMode_BodySendMode) Enum() *ProcessingMode_BodySendMode { - p := new(ProcessingMode_BodySendMode) - *p = x - return p -} - -func (x ProcessingMode_BodySendMode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ProcessingMode_BodySendMode) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_enumTypes[1].Descriptor() -} - -func (ProcessingMode_BodySendMode) Type() protoreflect.EnumType { - return &file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_enumTypes[1] -} - -func (x ProcessingMode_BodySendMode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ProcessingMode_BodySendMode.Descriptor instead. -func (ProcessingMode_BodySendMode) EnumDescriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescGZIP(), []int{0, 1} -} - -// [#next-free-field: 7] -type ProcessingMode struct { - state protoimpl.MessageState `protogen:"open.v1"` - // How to handle the request header. Default is "SEND". - // Note this field is ignored in :ref:`mode_override - // `, since mode - // overrides can only affect messages exchanged after the request header is processed. - RequestHeaderMode ProcessingMode_HeaderSendMode `protobuf:"varint,1,opt,name=request_header_mode,json=requestHeaderMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_HeaderSendMode" json:"request_header_mode,omitempty"` - // How to handle the response header. Default is "SEND". - ResponseHeaderMode ProcessingMode_HeaderSendMode `protobuf:"varint,2,opt,name=response_header_mode,json=responseHeaderMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_HeaderSendMode" json:"response_header_mode,omitempty"` - // How to handle the request body. Default is "NONE". - RequestBodyMode ProcessingMode_BodySendMode `protobuf:"varint,3,opt,name=request_body_mode,json=requestBodyMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_BodySendMode" json:"request_body_mode,omitempty"` - // How do handle the response body. Default is "NONE". - ResponseBodyMode ProcessingMode_BodySendMode `protobuf:"varint,4,opt,name=response_body_mode,json=responseBodyMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_BodySendMode" json:"response_body_mode,omitempty"` - // How to handle the request trailers. Default is "SKIP". - RequestTrailerMode ProcessingMode_HeaderSendMode `protobuf:"varint,5,opt,name=request_trailer_mode,json=requestTrailerMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_HeaderSendMode" json:"request_trailer_mode,omitempty"` - // How to handle the response trailers. Default is "SKIP". - ResponseTrailerMode ProcessingMode_HeaderSendMode `protobuf:"varint,6,opt,name=response_trailer_mode,json=responseTrailerMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_HeaderSendMode" json:"response_trailer_mode,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProcessingMode) Reset() { - *x = ProcessingMode{} - mi := &file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProcessingMode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProcessingMode) ProtoMessage() {} - -func (x *ProcessingMode) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProcessingMode.ProtoReflect.Descriptor instead. -func (*ProcessingMode) Descriptor() ([]byte, []int) { - return file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescGZIP(), []int{0} -} - -func (x *ProcessingMode) GetRequestHeaderMode() ProcessingMode_HeaderSendMode { - if x != nil { - return x.RequestHeaderMode - } - return ProcessingMode_DEFAULT -} - -func (x *ProcessingMode) GetResponseHeaderMode() ProcessingMode_HeaderSendMode { - if x != nil { - return x.ResponseHeaderMode - } - return ProcessingMode_DEFAULT -} - -func (x *ProcessingMode) GetRequestBodyMode() ProcessingMode_BodySendMode { - if x != nil { - return x.RequestBodyMode - } - return ProcessingMode_NONE -} - -func (x *ProcessingMode) GetResponseBodyMode() ProcessingMode_BodySendMode { - if x != nil { - return x.ResponseBodyMode - } - return ProcessingMode_NONE -} - -func (x *ProcessingMode) GetRequestTrailerMode() ProcessingMode_HeaderSendMode { - if x != nil { - return x.RequestTrailerMode - } - return ProcessingMode_DEFAULT -} - -func (x *ProcessingMode) GetResponseTrailerMode() ProcessingMode_HeaderSendMode { - if x != nil { - return x.ResponseTrailerMode - } - return ProcessingMode_DEFAULT -} - -var File_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto protoreflect.FileDescriptor - -const file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDesc = "" + - "\n" + - "?envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto\x12)envoy.extensions.filters.http.ext_proc.v3\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"\xcd\a\n" + - "\x0eProcessingMode\x12\x82\x01\n" + - "\x13request_header_mode\x18\x01 \x01(\x0e2H.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x11requestHeaderMode\x12\x84\x01\n" + - "\x14response_header_mode\x18\x02 \x01(\x0e2H.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x12responseHeaderMode\x12|\n" + - "\x11request_body_mode\x18\x03 \x01(\x0e2F.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x0frequestBodyMode\x12~\n" + - "\x12response_body_mode\x18\x04 \x01(\x0e2F.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x10responseBodyMode\x12\x84\x01\n" + - "\x14request_trailer_mode\x18\x05 \x01(\x0e2H.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x12requestTrailerMode\x12\x86\x01\n" + - "\x15response_trailer_mode\x18\x06 \x01(\x0e2H.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x13responseTrailerMode\"1\n" + - "\x0eHeaderSendMode\x12\v\n" + - "\aDEFAULT\x10\x00\x12\b\n" + - "\x04SEND\x10\x01\x12\b\n" + - "\x04SKIP\x10\x02\"n\n" + - "\fBodySendMode\x12\b\n" + - "\x04NONE\x10\x00\x12\f\n" + - "\bSTREAMED\x10\x01\x12\f\n" + - "\bBUFFERED\x10\x02\x12\x14\n" + - "\x10BUFFERED_PARTIAL\x10\x03\x12\x18\n" + - "\x14FULL_DUPLEX_STREAMED\x10\x04\x12\b\n" + - "\x04GRPC\x10\x05B\xb5\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "7io.envoyproxy.envoy.extensions.filters.http.ext_proc.v3B\x13ProcessingModeProtoP\x01Z[github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3;ext_procv3b\x06proto3" - -var ( - file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescOnce sync.Once - file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescData []byte -) - -func file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescGZIP() []byte { - file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescOnce.Do(func() { - file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDesc), len(file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDesc))) - }) - return file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDescData -} - -var file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_goTypes = []any{ - (ProcessingMode_HeaderSendMode)(0), // 0: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendMode - (ProcessingMode_BodySendMode)(0), // 1: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendMode - (*ProcessingMode)(nil), // 2: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode -} -var file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_depIdxs = []int32{ - 0, // 0: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.request_header_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendMode - 0, // 1: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.response_header_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendMode - 1, // 2: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.request_body_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendMode - 1, // 3: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.response_body_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendMode - 0, // 4: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.request_trailer_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendMode - 0, // 5: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.response_trailer_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.HeaderSendMode - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_init() } -func file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_init() { - if File_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDesc), len(file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_rawDesc)), - NumEnums: 2, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_goTypes, - DependencyIndexes: file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_depIdxs, - EnumInfos: file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_enumTypes, - MessageInfos: file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_msgTypes, - }.Build() - File_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto = out.File - file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_goTypes = nil - file_envoy_extensions_filters_http_ext_proc_v3_processing_mode_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode.pb.validate.go deleted file mode 100644 index 63cbec210..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode.pb.validate.go +++ /dev/null @@ -1,203 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto - -package ext_procv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ProcessingMode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ProcessingMode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ProcessingMode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ProcessingModeMultiError, -// or nil if none found. -func (m *ProcessingMode) ValidateAll() error { - return m.validate(true) -} - -func (m *ProcessingMode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := ProcessingMode_HeaderSendMode_name[int32(m.GetRequestHeaderMode())]; !ok { - err := ProcessingModeValidationError{ - field: "RequestHeaderMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := ProcessingMode_HeaderSendMode_name[int32(m.GetResponseHeaderMode())]; !ok { - err := ProcessingModeValidationError{ - field: "ResponseHeaderMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := ProcessingMode_BodySendMode_name[int32(m.GetRequestBodyMode())]; !ok { - err := ProcessingModeValidationError{ - field: "RequestBodyMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := ProcessingMode_BodySendMode_name[int32(m.GetResponseBodyMode())]; !ok { - err := ProcessingModeValidationError{ - field: "ResponseBodyMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := ProcessingMode_HeaderSendMode_name[int32(m.GetRequestTrailerMode())]; !ok { - err := ProcessingModeValidationError{ - field: "RequestTrailerMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := ProcessingMode_HeaderSendMode_name[int32(m.GetResponseTrailerMode())]; !ok { - err := ProcessingModeValidationError{ - field: "ResponseTrailerMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ProcessingModeMultiError(errors) - } - - return nil -} - -// ProcessingModeMultiError is an error wrapping multiple validation errors -// returned by ProcessingMode.ValidateAll() if the designated constraints -// aren't met. -type ProcessingModeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ProcessingModeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ProcessingModeMultiError) AllErrors() []error { return m } - -// ProcessingModeValidationError is the validation error returned by -// ProcessingMode.Validate if the designated constraints aren't met. -type ProcessingModeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ProcessingModeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ProcessingModeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ProcessingModeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ProcessingModeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ProcessingModeValidationError) ErrorName() string { return "ProcessingModeValidationError" } - -// Error satisfies the builtin error interface -func (e ProcessingModeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sProcessingMode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ProcessingModeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ProcessingModeValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode_vtproto.pb.go deleted file mode 100644 index b59fc6748..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3/processing_mode_vtproto.pb.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto - -package ext_procv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *ProcessingMode) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProcessingMode) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingMode) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ResponseTrailerMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ResponseTrailerMode)) - i-- - dAtA[i] = 0x30 - } - if m.RequestTrailerMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.RequestTrailerMode)) - i-- - dAtA[i] = 0x28 - } - if m.ResponseBodyMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ResponseBodyMode)) - i-- - dAtA[i] = 0x20 - } - if m.RequestBodyMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.RequestBodyMode)) - i-- - dAtA[i] = 0x18 - } - if m.ResponseHeaderMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ResponseHeaderMode)) - i-- - dAtA[i] = 0x10 - } - if m.RequestHeaderMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.RequestHeaderMode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ProcessingMode) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestHeaderMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.RequestHeaderMode)) - } - if m.ResponseHeaderMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ResponseHeaderMode)) - } - if m.RequestBodyMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.RequestBodyMode)) - } - if m.ResponseBodyMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ResponseBodyMode)) - } - if m.RequestTrailerMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.RequestTrailerMode)) - } - if m.ResponseTrailerMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ResponseTrailerMode)) - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.pb.go deleted file mode 100644 index 0b097d0da..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.pb.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.proto - -package getaddrinfov3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Configuration for getaddrinfo DNS resolver. This resolver will use the system's getaddrinfo() -// function to resolve hosts. -// -// .. attention:: -// -// Resolutions currently use a hard coded TTL of 60s because the getaddrinfo() API does not -// provide the actual TTL. Configuration for this can be added in the future if needed. -type GetAddrInfoDnsResolverConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Specifies the number of retries before the resolver gives up. If not specified, the resolver will - // retry indefinitely until it succeeds or the DNS query times out. - NumRetries *wrapperspb.UInt32Value `protobuf:"bytes,1,opt,name=num_retries,json=numRetries,proto3" json:"num_retries,omitempty"` - // Specifies the number of threads used to resolve pending DNS queries. If not specified, one thread is used. - NumResolverThreads *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=num_resolver_threads,json=numResolverThreads,proto3" json:"num_resolver_threads,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetAddrInfoDnsResolverConfig) Reset() { - *x = GetAddrInfoDnsResolverConfig{} - mi := &file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetAddrInfoDnsResolverConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAddrInfoDnsResolverConfig) ProtoMessage() {} - -func (x *GetAddrInfoDnsResolverConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetAddrInfoDnsResolverConfig.ProtoReflect.Descriptor instead. -func (*GetAddrInfoDnsResolverConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDescGZIP(), []int{0} -} - -func (x *GetAddrInfoDnsResolverConfig) GetNumRetries() *wrapperspb.UInt32Value { - if x != nil { - return x.NumRetries - } - return nil -} - -func (x *GetAddrInfoDnsResolverConfig) GetNumResolverThreads() *wrapperspb.UInt32Value { - if x != nil { - return x.NumResolverThreads - } - return nil -} - -var File_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto protoreflect.FileDescriptor - -const file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDesc = "" + - "\n" + - "Senvoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.proto\x124envoy.extensions.network.dns_resolver.getaddrinfo.v3\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1dudpa/annotations/status.proto\"\xad\x01\n" + - "\x1cGetAddrInfoDnsResolverConfig\x12=\n" + - "\vnum_retries\x18\x01 \x01(\v2\x1c.google.protobuf.UInt32ValueR\n" + - "numRetries\x12N\n" + - "\x14num_resolver_threads\x18\x02 \x01(\v2\x1c.google.protobuf.UInt32ValueR\x12numResolverThreadsB\xd6\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "Bio.envoyproxy.envoy.extensions.network.dns_resolver.getaddrinfo.v3B\x1bGetaddrinfoDnsResolverProtoP\x01Zigithub.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3;getaddrinfov3b\x06proto3" - -var ( - file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDescOnce sync.Once - file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDescData []byte -) - -func file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDescGZIP() []byte { - file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDescOnce.Do(func() { - file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDesc), len(file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDesc))) - }) - return file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDescData -} - -var file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_goTypes = []any{ - (*GetAddrInfoDnsResolverConfig)(nil), // 0: envoy.extensions.network.dns_resolver.getaddrinfo.v3.GetAddrInfoDnsResolverConfig - (*wrapperspb.UInt32Value)(nil), // 1: google.protobuf.UInt32Value -} -var file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_depIdxs = []int32{ - 1, // 0: envoy.extensions.network.dns_resolver.getaddrinfo.v3.GetAddrInfoDnsResolverConfig.num_retries:type_name -> google.protobuf.UInt32Value - 1, // 1: envoy.extensions.network.dns_resolver.getaddrinfo.v3.GetAddrInfoDnsResolverConfig.num_resolver_threads:type_name -> google.protobuf.UInt32Value - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { - file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_init() -} -func file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_init() { - if File_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDesc), len(file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_goTypes, - DependencyIndexes: file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_depIdxs, - MessageInfos: file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_msgTypes, - }.Build() - File_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto = out.File - file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_goTypes = nil - file_envoy_extensions_network_dns_resolver_getaddrinfo_v3_getaddrinfo_dns_resolver_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.pb.validate.go deleted file mode 100644 index 769f7d878..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.pb.validate.go +++ /dev/null @@ -1,198 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.proto - -package getaddrinfov3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on GetAddrInfoDnsResolverConfig with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetAddrInfoDnsResolverConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetAddrInfoDnsResolverConfig with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetAddrInfoDnsResolverConfigMultiError, or nil if none found. -func (m *GetAddrInfoDnsResolverConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *GetAddrInfoDnsResolverConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetNumRetries()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetAddrInfoDnsResolverConfigValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetAddrInfoDnsResolverConfigValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetAddrInfoDnsResolverConfigValidationError{ - field: "NumRetries", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetNumResolverThreads()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetAddrInfoDnsResolverConfigValidationError{ - field: "NumResolverThreads", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetAddrInfoDnsResolverConfigValidationError{ - field: "NumResolverThreads", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNumResolverThreads()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetAddrInfoDnsResolverConfigValidationError{ - field: "NumResolverThreads", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetAddrInfoDnsResolverConfigMultiError(errors) - } - - return nil -} - -// GetAddrInfoDnsResolverConfigMultiError is an error wrapping multiple -// validation errors returned by GetAddrInfoDnsResolverConfig.ValidateAll() if -// the designated constraints aren't met. -type GetAddrInfoDnsResolverConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetAddrInfoDnsResolverConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetAddrInfoDnsResolverConfigMultiError) AllErrors() []error { return m } - -// GetAddrInfoDnsResolverConfigValidationError is the validation error returned -// by GetAddrInfoDnsResolverConfig.Validate if the designated constraints -// aren't met. -type GetAddrInfoDnsResolverConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetAddrInfoDnsResolverConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetAddrInfoDnsResolverConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetAddrInfoDnsResolverConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetAddrInfoDnsResolverConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetAddrInfoDnsResolverConfigValidationError) ErrorName() string { - return "GetAddrInfoDnsResolverConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e GetAddrInfoDnsResolverConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetAddrInfoDnsResolverConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetAddrInfoDnsResolverConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetAddrInfoDnsResolverConfigValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver_vtproto.pb.go deleted file mode 100644 index 5c11edf1e..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver_vtproto.pb.go +++ /dev/null @@ -1,91 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/network/dns_resolver/getaddrinfo/v3/getaddrinfo_dns_resolver.proto - -package getaddrinfov3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - wrapperspb "github.com/planetscale/vtprotobuf/types/known/wrapperspb" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *GetAddrInfoDnsResolverConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetAddrInfoDnsResolverConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *GetAddrInfoDnsResolverConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.NumResolverThreads != nil { - size, err := (*wrapperspb.UInt32Value)(m.NumResolverThreads).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.NumRetries != nil { - size, err := (*wrapperspb.UInt32Value)(m.NumRetries).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetAddrInfoDnsResolverConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NumRetries != nil { - l = (*wrapperspb.UInt32Value)(m.NumRetries).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.NumResolverThreads != nil { - l = (*wrapperspb.UInt32Value)(m.NumResolverThreads).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options.pb.go deleted file mode 100644 index 2d6d24a04..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options.pb.go +++ /dev/null @@ -1,744 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/extensions/upstreams/http/v3/http_protocol_options.proto - -package httpv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - v33 "github.com/envoyproxy/go-control-plane/envoy/config/common/matcher/v3" - v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - v32 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" - v31 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// HttpProtocolOptions specifies Http upstream protocol options. This object -// is used in -// :ref:`typed_extension_protocol_options`, -// keyed by the name “envoy.extensions.upstreams.http.v3.HttpProtocolOptions“. -// -// This controls what protocol(s) should be used for upstream and how said protocol(s) are configured. -// -// This replaces the prior pattern of explicit protocol configuration directly -// in the cluster. So a configuration like this, explicitly configuring the use of HTTP/2 upstream: -// -// .. code:: -// -// clusters: -// - name: some_service -// connect_timeout: 5s -// upstream_http_protocol_options: -// auto_sni: true -// common_http_protocol_options: -// idle_timeout: 1s -// http2_protocol_options: -// max_concurrent_streams: 100 -// .... [further cluster config] -// -// Would now look like this: -// -// .. code:: -// -// clusters: -// - name: some_service -// connect_timeout: 5s -// typed_extension_protocol_options: -// envoy.extensions.upstreams.http.v3.HttpProtocolOptions: -// "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions -// upstream_http_protocol_options: -// auto_sni: true -// common_http_protocol_options: -// idle_timeout: 1s -// explicit_http_config: -// http2_protocol_options: -// max_concurrent_streams: 100 -// .... [further cluster config] -// -// [#next-free-field: 12] -type HttpProtocolOptions struct { - state protoimpl.MessageState `protogen:"open.v1"` - // This contains options common across HTTP/1 and HTTP/2 - CommonHttpProtocolOptions *v3.HttpProtocolOptions `protobuf:"bytes,1,opt,name=common_http_protocol_options,json=commonHttpProtocolOptions,proto3" json:"common_http_protocol_options,omitempty"` - // This contains common protocol options which are only applied upstream. - UpstreamHttpProtocolOptions *v3.UpstreamHttpProtocolOptions `protobuf:"bytes,2,opt,name=upstream_http_protocol_options,json=upstreamHttpProtocolOptions,proto3" json:"upstream_http_protocol_options,omitempty"` - // This controls the actual protocol to be used upstream. - // - // Types that are valid to be assigned to UpstreamProtocolOptions: - // - // *HttpProtocolOptions_ExplicitHttpConfig_ - // *HttpProtocolOptions_UseDownstreamProtocolConfig - // *HttpProtocolOptions_AutoConfig - UpstreamProtocolOptions isHttpProtocolOptions_UpstreamProtocolOptions `protobuf_oneof:"upstream_protocol_options"` - // Optional HTTP filters for the upstream HTTP filter chain. - // - // .. note:: - // - // Upstream HTTP filters are currently in alpha. - // - // These filters will be applied for all HTTP streams which flow through this - // cluster. Unlike downstream HTTP filters, they will *not* be applied to terminated CONNECT requests. - // - // If using upstream HTTP filters, please be aware that local errors sent by - // upstream HTTP filters will not trigger retries, and local errors sent by - // upstream HTTP filters will count as a final response if hedging is configured. - // [#extension-category: envoy.filters.http.upstream] - HttpFilters []*v31.HttpFilter `protobuf:"bytes,6,rep,name=http_filters,json=httpFilters,proto3" json:"http_filters,omitempty"` - // Configuration options for Unified Header Validation (UHV). - // UHV is an extensible mechanism for checking validity of HTTP responses. - // - // [#comment:TODO(yanavlasov): Make it a link to the default header validator doc when it becomes visible.] - // Leaving this field unspecified, selects the default header validator “envoy.http.header_validators.envoy_default“. - // - // [#not-implemented-hide:] - // [#extension-category: envoy.http.header_validators] - HeaderValidationConfig *v3.TypedExtensionConfig `protobuf:"bytes,7,opt,name=header_validation_config,json=headerValidationConfig,proto3" json:"header_validation_config,omitempty"` - // Defines http specific outlier detection parameters. - OutlierDetection *HttpProtocolOptions_OutlierDetection `protobuf:"bytes,8,opt,name=outlier_detection,json=outlierDetection,proto3" json:"outlier_detection,omitempty"` - // Specifies a list of HTTP-level mirroring policies for requests routed to this cluster. - // Cluster-level policies override route-level policies when they both are configured. - // - // .. note:: - // - // Mirroring will not be triggered if the :ref:`primary cluster - // ` does not exist. - RequestMirrorPolicies []*v32.RouteAction_RequestMirrorPolicy `protobuf:"bytes,9,rep,name=request_mirror_policies,json=requestMirrorPolicies,proto3" json:"request_mirror_policies,omitempty"` - // Specifies a list of hash policies for consistent hashing load balancing (e.g., Ring Hash or - // Maglev) for requests routed to this cluster. When configured, cluster-level policies override - // route-level policies. When not configured, route-level policies (if any) will be used. - // - // This enables consistent routing to the same upstream host for all requests to a cluster, - // which is particularly useful for stateful services like caching, session management, or - // sticky routing requirements. - // - // .. note:: - // - // Hash policies are only effective when the cluster is configured with a hash-based load - // balancing policy (e.g., :ref:`RING_HASH ` - // or :ref:`MAGLEV `). - HashPolicy []*v32.RouteAction_HashPolicy `protobuf:"bytes,10,rep,name=hash_policy,json=hashPolicy,proto3" json:"hash_policy,omitempty"` - // Specifies the retry policy for requests routed to this cluster. When configured, - // cluster-level retry policy overrides route-level retry policy. When not configured, - // route-level retry policy (if any) will be used. - // - // .. note:: - // - // Cluster-level retry policy will override route-level retry policy entirely. Policies are - // not merged. - RetryPolicy *v32.RetryPolicy `protobuf:"bytes,11,opt,name=retry_policy,json=retryPolicy,proto3" json:"retry_policy,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HttpProtocolOptions) Reset() { - *x = HttpProtocolOptions{} - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HttpProtocolOptions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpProtocolOptions) ProtoMessage() {} - -func (x *HttpProtocolOptions) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpProtocolOptions.ProtoReflect.Descriptor instead. -func (*HttpProtocolOptions) Descriptor() ([]byte, []int) { - return file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescGZIP(), []int{0} -} - -func (x *HttpProtocolOptions) GetCommonHttpProtocolOptions() *v3.HttpProtocolOptions { - if x != nil { - return x.CommonHttpProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions) GetUpstreamHttpProtocolOptions() *v3.UpstreamHttpProtocolOptions { - if x != nil { - return x.UpstreamHttpProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions) GetUpstreamProtocolOptions() isHttpProtocolOptions_UpstreamProtocolOptions { - if x != nil { - return x.UpstreamProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions) GetExplicitHttpConfig() *HttpProtocolOptions_ExplicitHttpConfig { - if x != nil { - if x, ok := x.UpstreamProtocolOptions.(*HttpProtocolOptions_ExplicitHttpConfig_); ok { - return x.ExplicitHttpConfig - } - } - return nil -} - -func (x *HttpProtocolOptions) GetUseDownstreamProtocolConfig() *HttpProtocolOptions_UseDownstreamHttpConfig { - if x != nil { - if x, ok := x.UpstreamProtocolOptions.(*HttpProtocolOptions_UseDownstreamProtocolConfig); ok { - return x.UseDownstreamProtocolConfig - } - } - return nil -} - -func (x *HttpProtocolOptions) GetAutoConfig() *HttpProtocolOptions_AutoHttpConfig { - if x != nil { - if x, ok := x.UpstreamProtocolOptions.(*HttpProtocolOptions_AutoConfig); ok { - return x.AutoConfig - } - } - return nil -} - -func (x *HttpProtocolOptions) GetHttpFilters() []*v31.HttpFilter { - if x != nil { - return x.HttpFilters - } - return nil -} - -func (x *HttpProtocolOptions) GetHeaderValidationConfig() *v3.TypedExtensionConfig { - if x != nil { - return x.HeaderValidationConfig - } - return nil -} - -func (x *HttpProtocolOptions) GetOutlierDetection() *HttpProtocolOptions_OutlierDetection { - if x != nil { - return x.OutlierDetection - } - return nil -} - -func (x *HttpProtocolOptions) GetRequestMirrorPolicies() []*v32.RouteAction_RequestMirrorPolicy { - if x != nil { - return x.RequestMirrorPolicies - } - return nil -} - -func (x *HttpProtocolOptions) GetHashPolicy() []*v32.RouteAction_HashPolicy { - if x != nil { - return x.HashPolicy - } - return nil -} - -func (x *HttpProtocolOptions) GetRetryPolicy() *v32.RetryPolicy { - if x != nil { - return x.RetryPolicy - } - return nil -} - -type isHttpProtocolOptions_UpstreamProtocolOptions interface { - isHttpProtocolOptions_UpstreamProtocolOptions() -} - -type HttpProtocolOptions_ExplicitHttpConfig_ struct { - // To explicitly configure either HTTP/1 or HTTP/2 (but not both!) use “explicit_http_config“. - ExplicitHttpConfig *HttpProtocolOptions_ExplicitHttpConfig `protobuf:"bytes,3,opt,name=explicit_http_config,json=explicitHttpConfig,proto3,oneof"` -} - -type HttpProtocolOptions_UseDownstreamProtocolConfig struct { - // This allows switching on protocol based on what protocol the downstream - // connection used. - UseDownstreamProtocolConfig *HttpProtocolOptions_UseDownstreamHttpConfig `protobuf:"bytes,4,opt,name=use_downstream_protocol_config,json=useDownstreamProtocolConfig,proto3,oneof"` -} - -type HttpProtocolOptions_AutoConfig struct { - // This allows switching on protocol based on ALPN - AutoConfig *HttpProtocolOptions_AutoHttpConfig `protobuf:"bytes,5,opt,name=auto_config,json=autoConfig,proto3,oneof"` -} - -func (*HttpProtocolOptions_ExplicitHttpConfig_) isHttpProtocolOptions_UpstreamProtocolOptions() {} - -func (*HttpProtocolOptions_UseDownstreamProtocolConfig) isHttpProtocolOptions_UpstreamProtocolOptions() { -} - -func (*HttpProtocolOptions_AutoConfig) isHttpProtocolOptions_UpstreamProtocolOptions() {} - -// If this is used, the cluster will only operate on one of the possible upstream protocols. -// Note that HTTP/2 or above should generally be used for upstream gRPC clusters. -type HttpProtocolOptions_ExplicitHttpConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to ProtocolConfig: - // - // *HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions - // *HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions - // *HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions - ProtocolConfig isHttpProtocolOptions_ExplicitHttpConfig_ProtocolConfig `protobuf_oneof:"protocol_config"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HttpProtocolOptions_ExplicitHttpConfig) Reset() { - *x = HttpProtocolOptions_ExplicitHttpConfig{} - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HttpProtocolOptions_ExplicitHttpConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpProtocolOptions_ExplicitHttpConfig) ProtoMessage() {} - -func (x *HttpProtocolOptions_ExplicitHttpConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpProtocolOptions_ExplicitHttpConfig.ProtoReflect.Descriptor instead. -func (*HttpProtocolOptions_ExplicitHttpConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *HttpProtocolOptions_ExplicitHttpConfig) GetProtocolConfig() isHttpProtocolOptions_ExplicitHttpConfig_ProtocolConfig { - if x != nil { - return x.ProtocolConfig - } - return nil -} - -func (x *HttpProtocolOptions_ExplicitHttpConfig) GetHttpProtocolOptions() *v3.Http1ProtocolOptions { - if x != nil { - if x, ok := x.ProtocolConfig.(*HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions); ok { - return x.HttpProtocolOptions - } - } - return nil -} - -func (x *HttpProtocolOptions_ExplicitHttpConfig) GetHttp2ProtocolOptions() *v3.Http2ProtocolOptions { - if x != nil { - if x, ok := x.ProtocolConfig.(*HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions); ok { - return x.Http2ProtocolOptions - } - } - return nil -} - -func (x *HttpProtocolOptions_ExplicitHttpConfig) GetHttp3ProtocolOptions() *v3.Http3ProtocolOptions { - if x != nil { - if x, ok := x.ProtocolConfig.(*HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions); ok { - return x.Http3ProtocolOptions - } - } - return nil -} - -type isHttpProtocolOptions_ExplicitHttpConfig_ProtocolConfig interface { - isHttpProtocolOptions_ExplicitHttpConfig_ProtocolConfig() -} - -type HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions struct { - HttpProtocolOptions *v3.Http1ProtocolOptions `protobuf:"bytes,1,opt,name=http_protocol_options,json=httpProtocolOptions,proto3,oneof"` -} - -type HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions struct { - Http2ProtocolOptions *v3.Http2ProtocolOptions `protobuf:"bytes,2,opt,name=http2_protocol_options,json=http2ProtocolOptions,proto3,oneof"` -} - -type HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions struct { - // .. warning:: - // - // QUIC upstream support is currently not ready for internet use. - // Please see :ref:`here ` for details. - Http3ProtocolOptions *v3.Http3ProtocolOptions `protobuf:"bytes,3,opt,name=http3_protocol_options,json=http3ProtocolOptions,proto3,oneof"` -} - -func (*HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions) isHttpProtocolOptions_ExplicitHttpConfig_ProtocolConfig() { -} - -func (*HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions) isHttpProtocolOptions_ExplicitHttpConfig_ProtocolConfig() { -} - -func (*HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions) isHttpProtocolOptions_ExplicitHttpConfig_ProtocolConfig() { -} - -// If this is used, the cluster can use either of the configured protocols, and -// will use whichever protocol was used by the downstream connection. -// -// If HTTP/3 is configured for downstream and not configured for upstream, -// HTTP/3 requests will fail over to HTTP/2. -type HttpProtocolOptions_UseDownstreamHttpConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - HttpProtocolOptions *v3.Http1ProtocolOptions `protobuf:"bytes,1,opt,name=http_protocol_options,json=httpProtocolOptions,proto3" json:"http_protocol_options,omitempty"` - Http2ProtocolOptions *v3.Http2ProtocolOptions `protobuf:"bytes,2,opt,name=http2_protocol_options,json=http2ProtocolOptions,proto3" json:"http2_protocol_options,omitempty"` - // .. warning:: - // - // QUIC upstream support is currently not ready for internet use. - // Please see :ref:`here ` for details. - Http3ProtocolOptions *v3.Http3ProtocolOptions `protobuf:"bytes,3,opt,name=http3_protocol_options,json=http3ProtocolOptions,proto3" json:"http3_protocol_options,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HttpProtocolOptions_UseDownstreamHttpConfig) Reset() { - *x = HttpProtocolOptions_UseDownstreamHttpConfig{} - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HttpProtocolOptions_UseDownstreamHttpConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpProtocolOptions_UseDownstreamHttpConfig) ProtoMessage() {} - -func (x *HttpProtocolOptions_UseDownstreamHttpConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpProtocolOptions_UseDownstreamHttpConfig.ProtoReflect.Descriptor instead. -func (*HttpProtocolOptions_UseDownstreamHttpConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *HttpProtocolOptions_UseDownstreamHttpConfig) GetHttpProtocolOptions() *v3.Http1ProtocolOptions { - if x != nil { - return x.HttpProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions_UseDownstreamHttpConfig) GetHttp2ProtocolOptions() *v3.Http2ProtocolOptions { - if x != nil { - return x.Http2ProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions_UseDownstreamHttpConfig) GetHttp3ProtocolOptions() *v3.Http3ProtocolOptions { - if x != nil { - return x.Http3ProtocolOptions - } - return nil -} - -// If this is used, the cluster can use either HTTP/1 or HTTP/2, and will use whichever -// protocol is negotiated by ALPN with the upstream. -// Clusters configured with “AutoHttpConfig“ will use the highest available -// protocol; HTTP/2 if supported, otherwise HTTP/1. -// If the upstream does not support ALPN, “AutoHttpConfig“ will fail over to HTTP/1. -// This can only be used with transport sockets which support ALPN. Using a -// transport socket which does not support ALPN will result in configuration -// failure. The transport layer may be configured with custom ALPN, but the default ALPN -// for the cluster (or if custom ALPN fails) will be "h2,http/1.1". -type HttpProtocolOptions_AutoHttpConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - HttpProtocolOptions *v3.Http1ProtocolOptions `protobuf:"bytes,1,opt,name=http_protocol_options,json=httpProtocolOptions,proto3" json:"http_protocol_options,omitempty"` - Http2ProtocolOptions *v3.Http2ProtocolOptions `protobuf:"bytes,2,opt,name=http2_protocol_options,json=http2ProtocolOptions,proto3" json:"http2_protocol_options,omitempty"` - // Unlike HTTP/1 and HTTP/2, HTTP/3 will not be configured unless it is - // present, and (soon) only if there is an indication of server side - // support. - // See :ref:`here ` for more information on - // when HTTP/3 will be used, and when Envoy will fail over to TCP. - // - // .. warning:: - // - // QUIC upstream support is currently not ready for internet use. - // Please see :ref:`here ` for details. - Http3ProtocolOptions *v3.Http3ProtocolOptions `protobuf:"bytes,3,opt,name=http3_protocol_options,json=http3ProtocolOptions,proto3" json:"http3_protocol_options,omitempty"` - // The presence of alternate protocols cache options causes the use of the - // alternate protocols cache, which is responsible for parsing and caching - // HTTP Alt-Svc headers. This enables the use of HTTP/3 for origins that - // advertise supporting it. - // - // .. note:: - // - // This is required when HTTP/3 is enabled. - AlternateProtocolsCacheOptions *v3.AlternateProtocolsCacheOptions `protobuf:"bytes,4,opt,name=alternate_protocols_cache_options,json=alternateProtocolsCacheOptions,proto3" json:"alternate_protocols_cache_options,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HttpProtocolOptions_AutoHttpConfig) Reset() { - *x = HttpProtocolOptions_AutoHttpConfig{} - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HttpProtocolOptions_AutoHttpConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpProtocolOptions_AutoHttpConfig) ProtoMessage() {} - -func (x *HttpProtocolOptions_AutoHttpConfig) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpProtocolOptions_AutoHttpConfig.ProtoReflect.Descriptor instead. -func (*HttpProtocolOptions_AutoHttpConfig) Descriptor() ([]byte, []int) { - return file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescGZIP(), []int{0, 2} -} - -func (x *HttpProtocolOptions_AutoHttpConfig) GetHttpProtocolOptions() *v3.Http1ProtocolOptions { - if x != nil { - return x.HttpProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions_AutoHttpConfig) GetHttp2ProtocolOptions() *v3.Http2ProtocolOptions { - if x != nil { - return x.Http2ProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions_AutoHttpConfig) GetHttp3ProtocolOptions() *v3.Http3ProtocolOptions { - if x != nil { - return x.Http3ProtocolOptions - } - return nil -} - -func (x *HttpProtocolOptions_AutoHttpConfig) GetAlternateProtocolsCacheOptions() *v3.AlternateProtocolsCacheOptions { - if x != nil { - return x.AlternateProtocolsCacheOptions - } - return nil -} - -type HttpProtocolOptions_OutlierDetection struct { - state protoimpl.MessageState `protogen:"open.v1"` - // If specified, only responses matching the matcher will be treated by outlier detection as errors. - // If not specified, only 5xx codes are treated by outlier detection as errors. - ErrorMatcher *v33.MatchPredicate `protobuf:"bytes,1,opt,name=error_matcher,json=errorMatcher,proto3" json:"error_matcher,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HttpProtocolOptions_OutlierDetection) Reset() { - *x = HttpProtocolOptions_OutlierDetection{} - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HttpProtocolOptions_OutlierDetection) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpProtocolOptions_OutlierDetection) ProtoMessage() {} - -func (x *HttpProtocolOptions_OutlierDetection) ProtoReflect() protoreflect.Message { - mi := &file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpProtocolOptions_OutlierDetection.ProtoReflect.Descriptor instead. -func (*HttpProtocolOptions_OutlierDetection) Descriptor() ([]byte, []int) { - return file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescGZIP(), []int{0, 3} -} - -func (x *HttpProtocolOptions_OutlierDetection) GetErrorMatcher() *v33.MatchPredicate { - if x != nil { - return x.ErrorMatcher - } - return nil -} - -var File_envoy_extensions_upstreams_http_v3_http_protocol_options_proto protoreflect.FileDescriptor - -const file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDesc = "" + - "\n" + - ">envoy/extensions/upstreams/http/v3/http_protocol_options.proto\x12\"envoy.extensions.upstreams.http.v3\x1a,envoy/config/common/matcher/v3/matcher.proto\x1a$envoy/config/core/v3/extension.proto\x1a#envoy/config/core/v3/protocol.proto\x1a,envoy/config/route/v3/route_components.proto\x1aYenvoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"\xb3\x13\n" + - "\x13HttpProtocolOptions\x12j\n" + - "\x1ccommon_http_protocol_options\x18\x01 \x01(\v2).envoy.config.core.v3.HttpProtocolOptionsR\x19commonHttpProtocolOptions\x12v\n" + - "\x1eupstream_http_protocol_options\x18\x02 \x01(\v21.envoy.config.core.v3.UpstreamHttpProtocolOptionsR\x1bupstreamHttpProtocolOptions\x12~\n" + - "\x14explicit_http_config\x18\x03 \x01(\v2J.envoy.extensions.upstreams.http.v3.HttpProtocolOptions.ExplicitHttpConfigH\x00R\x12explicitHttpConfig\x12\x96\x01\n" + - "\x1euse_downstream_protocol_config\x18\x04 \x01(\v2O.envoy.extensions.upstreams.http.v3.HttpProtocolOptions.UseDownstreamHttpConfigH\x00R\x1buseDownstreamProtocolConfig\x12i\n" + - "\vauto_config\x18\x05 \x01(\v2F.envoy.extensions.upstreams.http.v3.HttpProtocolOptions.AutoHttpConfigH\x00R\n" + - "autoConfig\x12j\n" + - "\fhttp_filters\x18\x06 \x03(\v2G.envoy.extensions.filters.network.http_connection_manager.v3.HttpFilterR\vhttpFilters\x12d\n" + - "\x18header_validation_config\x18\a \x01(\v2*.envoy.config.core.v3.TypedExtensionConfigR\x16headerValidationConfig\x12u\n" + - "\x11outlier_detection\x18\b \x01(\v2H.envoy.extensions.upstreams.http.v3.HttpProtocolOptions.OutlierDetectionR\x10outlierDetection\x12n\n" + - "\x17request_mirror_policies\x18\t \x03(\v26.envoy.config.route.v3.RouteAction.RequestMirrorPolicyR\x15requestMirrorPolicies\x12N\n" + - "\vhash_policy\x18\n" + - " \x03(\v2-.envoy.config.route.v3.RouteAction.HashPolicyR\n" + - "hashPolicy\x12E\n" + - "\fretry_policy\x18\v \x01(\v2\".envoy.config.route.v3.RetryPolicyR\vretryPolicy\x1a\xd6\x02\n" + - "\x12ExplicitHttpConfig\x12`\n" + - "\x15http_protocol_options\x18\x01 \x01(\v2*.envoy.config.core.v3.Http1ProtocolOptionsH\x00R\x13httpProtocolOptions\x12b\n" + - "\x16http2_protocol_options\x18\x02 \x01(\v2*.envoy.config.core.v3.Http2ProtocolOptionsH\x00R\x14http2ProtocolOptions\x12b\n" + - "\x16http3_protocol_options\x18\x03 \x01(\v2*.envoy.config.core.v3.Http3ProtocolOptionsH\x00R\x14http3ProtocolOptionsB\x16\n" + - "\x0fprotocol_config\x12\x03\xf8B\x01\x1a\xbd\x02\n" + - "\x17UseDownstreamHttpConfig\x12^\n" + - "\x15http_protocol_options\x18\x01 \x01(\v2*.envoy.config.core.v3.Http1ProtocolOptionsR\x13httpProtocolOptions\x12`\n" + - "\x16http2_protocol_options\x18\x02 \x01(\v2*.envoy.config.core.v3.Http2ProtocolOptionsR\x14http2ProtocolOptions\x12`\n" + - "\x16http3_protocol_options\x18\x03 \x01(\v2*.envoy.config.core.v3.Http3ProtocolOptionsR\x14http3ProtocolOptions\x1a\xb5\x03\n" + - "\x0eAutoHttpConfig\x12^\n" + - "\x15http_protocol_options\x18\x01 \x01(\v2*.envoy.config.core.v3.Http1ProtocolOptionsR\x13httpProtocolOptions\x12`\n" + - "\x16http2_protocol_options\x18\x02 \x01(\v2*.envoy.config.core.v3.Http2ProtocolOptionsR\x14http2ProtocolOptions\x12`\n" + - "\x16http3_protocol_options\x18\x03 \x01(\v2*.envoy.config.core.v3.Http3ProtocolOptionsR\x14http3ProtocolOptions\x12\x7f\n" + - "!alternate_protocols_cache_options\x18\x04 \x01(\v24.envoy.config.core.v3.AlternateProtocolsCacheOptionsR\x1ealternateProtocolsCacheOptions\x1aq\n" + - "\x10OutlierDetection\x12]\n" + - "\rerror_matcher\x18\x01 \x01(\v2..envoy.config.common.matcher.v3.MatchPredicateB\b\xfaB\x05\x8a\x01\x02\x10\x01R\ferrorMatcherB \n" + - "\x19upstream_protocol_options\x12\x03\xf8B\x01B\xa8\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "0io.envoyproxy.envoy.extensions.upstreams.http.v3B\x18HttpProtocolOptionsProtoP\x01ZPgithub.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3;httpv3b\x06proto3" - -var ( - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescOnce sync.Once - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescData []byte -) - -func file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescGZIP() []byte { - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescOnce.Do(func() { - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDesc), len(file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDesc))) - }) - return file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDescData -} - -var file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_goTypes = []any{ - (*HttpProtocolOptions)(nil), // 0: envoy.extensions.upstreams.http.v3.HttpProtocolOptions - (*HttpProtocolOptions_ExplicitHttpConfig)(nil), // 1: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.ExplicitHttpConfig - (*HttpProtocolOptions_UseDownstreamHttpConfig)(nil), // 2: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.UseDownstreamHttpConfig - (*HttpProtocolOptions_AutoHttpConfig)(nil), // 3: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.AutoHttpConfig - (*HttpProtocolOptions_OutlierDetection)(nil), // 4: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.OutlierDetection - (*v3.HttpProtocolOptions)(nil), // 5: envoy.config.core.v3.HttpProtocolOptions - (*v3.UpstreamHttpProtocolOptions)(nil), // 6: envoy.config.core.v3.UpstreamHttpProtocolOptions - (*v31.HttpFilter)(nil), // 7: envoy.extensions.filters.network.http_connection_manager.v3.HttpFilter - (*v3.TypedExtensionConfig)(nil), // 8: envoy.config.core.v3.TypedExtensionConfig - (*v32.RouteAction_RequestMirrorPolicy)(nil), // 9: envoy.config.route.v3.RouteAction.RequestMirrorPolicy - (*v32.RouteAction_HashPolicy)(nil), // 10: envoy.config.route.v3.RouteAction.HashPolicy - (*v32.RetryPolicy)(nil), // 11: envoy.config.route.v3.RetryPolicy - (*v3.Http1ProtocolOptions)(nil), // 12: envoy.config.core.v3.Http1ProtocolOptions - (*v3.Http2ProtocolOptions)(nil), // 13: envoy.config.core.v3.Http2ProtocolOptions - (*v3.Http3ProtocolOptions)(nil), // 14: envoy.config.core.v3.Http3ProtocolOptions - (*v3.AlternateProtocolsCacheOptions)(nil), // 15: envoy.config.core.v3.AlternateProtocolsCacheOptions - (*v33.MatchPredicate)(nil), // 16: envoy.config.common.matcher.v3.MatchPredicate -} -var file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_depIdxs = []int32{ - 5, // 0: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.common_http_protocol_options:type_name -> envoy.config.core.v3.HttpProtocolOptions - 6, // 1: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.upstream_http_protocol_options:type_name -> envoy.config.core.v3.UpstreamHttpProtocolOptions - 1, // 2: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.explicit_http_config:type_name -> envoy.extensions.upstreams.http.v3.HttpProtocolOptions.ExplicitHttpConfig - 2, // 3: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.use_downstream_protocol_config:type_name -> envoy.extensions.upstreams.http.v3.HttpProtocolOptions.UseDownstreamHttpConfig - 3, // 4: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.auto_config:type_name -> envoy.extensions.upstreams.http.v3.HttpProtocolOptions.AutoHttpConfig - 7, // 5: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.http_filters:type_name -> envoy.extensions.filters.network.http_connection_manager.v3.HttpFilter - 8, // 6: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.header_validation_config:type_name -> envoy.config.core.v3.TypedExtensionConfig - 4, // 7: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.outlier_detection:type_name -> envoy.extensions.upstreams.http.v3.HttpProtocolOptions.OutlierDetection - 9, // 8: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.request_mirror_policies:type_name -> envoy.config.route.v3.RouteAction.RequestMirrorPolicy - 10, // 9: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.hash_policy:type_name -> envoy.config.route.v3.RouteAction.HashPolicy - 11, // 10: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.retry_policy:type_name -> envoy.config.route.v3.RetryPolicy - 12, // 11: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.ExplicitHttpConfig.http_protocol_options:type_name -> envoy.config.core.v3.Http1ProtocolOptions - 13, // 12: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.ExplicitHttpConfig.http2_protocol_options:type_name -> envoy.config.core.v3.Http2ProtocolOptions - 14, // 13: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.ExplicitHttpConfig.http3_protocol_options:type_name -> envoy.config.core.v3.Http3ProtocolOptions - 12, // 14: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.UseDownstreamHttpConfig.http_protocol_options:type_name -> envoy.config.core.v3.Http1ProtocolOptions - 13, // 15: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.UseDownstreamHttpConfig.http2_protocol_options:type_name -> envoy.config.core.v3.Http2ProtocolOptions - 14, // 16: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.UseDownstreamHttpConfig.http3_protocol_options:type_name -> envoy.config.core.v3.Http3ProtocolOptions - 12, // 17: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.AutoHttpConfig.http_protocol_options:type_name -> envoy.config.core.v3.Http1ProtocolOptions - 13, // 18: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.AutoHttpConfig.http2_protocol_options:type_name -> envoy.config.core.v3.Http2ProtocolOptions - 14, // 19: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.AutoHttpConfig.http3_protocol_options:type_name -> envoy.config.core.v3.Http3ProtocolOptions - 15, // 20: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.AutoHttpConfig.alternate_protocols_cache_options:type_name -> envoy.config.core.v3.AlternateProtocolsCacheOptions - 16, // 21: envoy.extensions.upstreams.http.v3.HttpProtocolOptions.OutlierDetection.error_matcher:type_name -> envoy.config.common.matcher.v3.MatchPredicate - 22, // [22:22] is the sub-list for method output_type - 22, // [22:22] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name -} - -func init() { file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_init() } -func file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_init() { - if File_envoy_extensions_upstreams_http_v3_http_protocol_options_proto != nil { - return - } - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[0].OneofWrappers = []any{ - (*HttpProtocolOptions_ExplicitHttpConfig_)(nil), - (*HttpProtocolOptions_UseDownstreamProtocolConfig)(nil), - (*HttpProtocolOptions_AutoConfig)(nil), - } - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes[1].OneofWrappers = []any{ - (*HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions)(nil), - (*HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions)(nil), - (*HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDesc), len(file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_rawDesc)), - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_goTypes, - DependencyIndexes: file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_depIdxs, - MessageInfos: file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_msgTypes, - }.Build() - File_envoy_extensions_upstreams_http_v3_http_protocol_options_proto = out.File - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_goTypes = nil - file_envoy_extensions_upstreams_http_v3_http_protocol_options_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options.pb.validate.go deleted file mode 100644 index af784a173..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options.pb.validate.go +++ /dev/null @@ -1,1335 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/extensions/upstreams/http/v3/http_protocol_options.proto - -package httpv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on HttpProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *HttpProtocolOptions) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpProtocolOptions with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HttpProtocolOptionsMultiError, or nil if none found. -func (m *HttpProtocolOptions) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpProtocolOptions) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetCommonHttpProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "CommonHttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "CommonHttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCommonHttpProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "CommonHttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetUpstreamHttpProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "UpstreamHttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "UpstreamHttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUpstreamHttpProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "UpstreamHttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetHttpFilters() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("HttpFilters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("HttpFilters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("HttpFilters[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetHeaderValidationConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "HeaderValidationConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "HeaderValidationConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeaderValidationConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "HeaderValidationConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetOutlierDetection()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "OutlierDetection", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "OutlierDetection", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOutlierDetection()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "OutlierDetection", - reason: "embedded message failed validation", - cause: err, - } - } - } - - for idx, item := range m.GetRequestMirrorPolicies() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("RequestMirrorPolicies[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - for idx, item := range m.GetHashPolicy() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("HashPolicy[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("HashPolicy[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: fmt.Sprintf("HashPolicy[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if all { - switch v := interface{}(m.GetRetryPolicy()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "RetryPolicy", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofUpstreamProtocolOptionsPresent := false - switch v := m.UpstreamProtocolOptions.(type) { - case *HttpProtocolOptions_ExplicitHttpConfig_: - if v == nil { - err := HttpProtocolOptionsValidationError{ - field: "UpstreamProtocolOptions", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofUpstreamProtocolOptionsPresent = true - - if all { - switch v := interface{}(m.GetExplicitHttpConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "ExplicitHttpConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "ExplicitHttpConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExplicitHttpConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "ExplicitHttpConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HttpProtocolOptions_UseDownstreamProtocolConfig: - if v == nil { - err := HttpProtocolOptionsValidationError{ - field: "UpstreamProtocolOptions", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofUpstreamProtocolOptionsPresent = true - - if all { - switch v := interface{}(m.GetUseDownstreamProtocolConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "UseDownstreamProtocolConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "UseDownstreamProtocolConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetUseDownstreamProtocolConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "UseDownstreamProtocolConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HttpProtocolOptions_AutoConfig: - if v == nil { - err := HttpProtocolOptionsValidationError{ - field: "UpstreamProtocolOptions", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofUpstreamProtocolOptionsPresent = true - - if all { - switch v := interface{}(m.GetAutoConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "AutoConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptionsValidationError{ - field: "AutoConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAutoConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptionsValidationError{ - field: "AutoConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofUpstreamProtocolOptionsPresent { - err := HttpProtocolOptionsValidationError{ - field: "UpstreamProtocolOptions", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpProtocolOptionsMultiError(errors) - } - - return nil -} - -// HttpProtocolOptionsMultiError is an error wrapping multiple validation -// errors returned by HttpProtocolOptions.ValidateAll() if the designated -// constraints aren't met. -type HttpProtocolOptionsMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpProtocolOptionsMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpProtocolOptionsMultiError) AllErrors() []error { return m } - -// HttpProtocolOptionsValidationError is the validation error returned by -// HttpProtocolOptions.Validate if the designated constraints aren't met. -type HttpProtocolOptionsValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpProtocolOptionsValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpProtocolOptionsValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpProtocolOptionsValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpProtocolOptionsValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpProtocolOptionsValidationError) ErrorName() string { - return "HttpProtocolOptionsValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpProtocolOptionsValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpProtocolOptions.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpProtocolOptionsValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpProtocolOptionsValidationError{} - -// Validate checks the field values on HttpProtocolOptions_ExplicitHttpConfig -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *HttpProtocolOptions_ExplicitHttpConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// HttpProtocolOptions_ExplicitHttpConfig with the rules defined in the proto -// definition for this message. If any rules are violated, the result is a -// list of violation errors wrapped in -// HttpProtocolOptions_ExplicitHttpConfigMultiError, or nil if none found. -func (m *HttpProtocolOptions_ExplicitHttpConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - oneofProtocolConfigPresent := false - switch v := m.ProtocolConfig.(type) { - case *HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions: - if v == nil { - err := HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "ProtocolConfig", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofProtocolConfigPresent = true - - if all { - switch v := interface{}(m.GetHttpProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions: - if v == nil { - err := HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "ProtocolConfig", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofProtocolConfigPresent = true - - if all { - switch v := interface{}(m.GetHttp2ProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions: - if v == nil { - err := HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "ProtocolConfig", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofProtocolConfigPresent = true - - if all { - switch v := interface{}(m.GetHttp3ProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp3ProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofProtocolConfigPresent { - err := HttpProtocolOptions_ExplicitHttpConfigValidationError{ - field: "ProtocolConfig", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return HttpProtocolOptions_ExplicitHttpConfigMultiError(errors) - } - - return nil -} - -// HttpProtocolOptions_ExplicitHttpConfigMultiError is an error wrapping -// multiple validation errors returned by -// HttpProtocolOptions_ExplicitHttpConfig.ValidateAll() if the designated -// constraints aren't met. -type HttpProtocolOptions_ExplicitHttpConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpProtocolOptions_ExplicitHttpConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpProtocolOptions_ExplicitHttpConfigMultiError) AllErrors() []error { return m } - -// HttpProtocolOptions_ExplicitHttpConfigValidationError is the validation -// error returned by HttpProtocolOptions_ExplicitHttpConfig.Validate if the -// designated constraints aren't met. -type HttpProtocolOptions_ExplicitHttpConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) ErrorName() string { - return "HttpProtocolOptions_ExplicitHttpConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpProtocolOptions_ExplicitHttpConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpProtocolOptions_ExplicitHttpConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpProtocolOptions_ExplicitHttpConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpProtocolOptions_ExplicitHttpConfigValidationError{} - -// Validate checks the field values on -// HttpProtocolOptions_UseDownstreamHttpConfig with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpProtocolOptions_UseDownstreamHttpConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on -// HttpProtocolOptions_UseDownstreamHttpConfig with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in -// HttpProtocolOptions_UseDownstreamHttpConfigMultiError, or nil if none found. -func (m *HttpProtocolOptions_UseDownstreamHttpConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpProtocolOptions_UseDownstreamHttpConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHttpProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHttp2ProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHttp3ProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp3ProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_UseDownstreamHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return HttpProtocolOptions_UseDownstreamHttpConfigMultiError(errors) - } - - return nil -} - -// HttpProtocolOptions_UseDownstreamHttpConfigMultiError is an error wrapping -// multiple validation errors returned by -// HttpProtocolOptions_UseDownstreamHttpConfig.ValidateAll() if the designated -// constraints aren't met. -type HttpProtocolOptions_UseDownstreamHttpConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpProtocolOptions_UseDownstreamHttpConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpProtocolOptions_UseDownstreamHttpConfigMultiError) AllErrors() []error { return m } - -// HttpProtocolOptions_UseDownstreamHttpConfigValidationError is the validation -// error returned by HttpProtocolOptions_UseDownstreamHttpConfig.Validate if -// the designated constraints aren't met. -type HttpProtocolOptions_UseDownstreamHttpConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) ErrorName() string { - return "HttpProtocolOptions_UseDownstreamHttpConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpProtocolOptions_UseDownstreamHttpConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpProtocolOptions_UseDownstreamHttpConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpProtocolOptions_UseDownstreamHttpConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpProtocolOptions_UseDownstreamHttpConfigValidationError{} - -// Validate checks the field values on HttpProtocolOptions_AutoHttpConfig with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *HttpProtocolOptions_AutoHttpConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpProtocolOptions_AutoHttpConfig -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// HttpProtocolOptions_AutoHttpConfigMultiError, or nil if none found. -func (m *HttpProtocolOptions_AutoHttpConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpProtocolOptions_AutoHttpConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHttpProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttpProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "HttpProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHttp2ProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp2ProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "Http2ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHttp3ProtocolOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHttp3ProtocolOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "Http3ProtocolOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetAlternateProtocolsCacheOptions()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "AlternateProtocolsCacheOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "AlternateProtocolsCacheOptions", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAlternateProtocolsCacheOptions()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_AutoHttpConfigValidationError{ - field: "AlternateProtocolsCacheOptions", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return HttpProtocolOptions_AutoHttpConfigMultiError(errors) - } - - return nil -} - -// HttpProtocolOptions_AutoHttpConfigMultiError is an error wrapping multiple -// validation errors returned by -// HttpProtocolOptions_AutoHttpConfig.ValidateAll() if the designated -// constraints aren't met. -type HttpProtocolOptions_AutoHttpConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpProtocolOptions_AutoHttpConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpProtocolOptions_AutoHttpConfigMultiError) AllErrors() []error { return m } - -// HttpProtocolOptions_AutoHttpConfigValidationError is the validation error -// returned by HttpProtocolOptions_AutoHttpConfig.Validate if the designated -// constraints aren't met. -type HttpProtocolOptions_AutoHttpConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpProtocolOptions_AutoHttpConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpProtocolOptions_AutoHttpConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpProtocolOptions_AutoHttpConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpProtocolOptions_AutoHttpConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpProtocolOptions_AutoHttpConfigValidationError) ErrorName() string { - return "HttpProtocolOptions_AutoHttpConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpProtocolOptions_AutoHttpConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpProtocolOptions_AutoHttpConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpProtocolOptions_AutoHttpConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpProtocolOptions_AutoHttpConfigValidationError{} - -// Validate checks the field values on HttpProtocolOptions_OutlierDetection -// with the rules defined in the proto definition for this message. If any -// rules are violated, the first error encountered is returned, or nil if -// there are no violations. -func (m *HttpProtocolOptions_OutlierDetection) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpProtocolOptions_OutlierDetection -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// HttpProtocolOptions_OutlierDetectionMultiError, or nil if none found. -func (m *HttpProtocolOptions_OutlierDetection) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpProtocolOptions_OutlierDetection) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetErrorMatcher() == nil { - err := HttpProtocolOptions_OutlierDetectionValidationError{ - field: "ErrorMatcher", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetErrorMatcher()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpProtocolOptions_OutlierDetectionValidationError{ - field: "ErrorMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpProtocolOptions_OutlierDetectionValidationError{ - field: "ErrorMatcher", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetErrorMatcher()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpProtocolOptions_OutlierDetectionValidationError{ - field: "ErrorMatcher", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return HttpProtocolOptions_OutlierDetectionMultiError(errors) - } - - return nil -} - -// HttpProtocolOptions_OutlierDetectionMultiError is an error wrapping multiple -// validation errors returned by -// HttpProtocolOptions_OutlierDetection.ValidateAll() if the designated -// constraints aren't met. -type HttpProtocolOptions_OutlierDetectionMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpProtocolOptions_OutlierDetectionMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpProtocolOptions_OutlierDetectionMultiError) AllErrors() []error { return m } - -// HttpProtocolOptions_OutlierDetectionValidationError is the validation error -// returned by HttpProtocolOptions_OutlierDetection.Validate if the designated -// constraints aren't met. -type HttpProtocolOptions_OutlierDetectionValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpProtocolOptions_OutlierDetectionValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpProtocolOptions_OutlierDetectionValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpProtocolOptions_OutlierDetectionValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpProtocolOptions_OutlierDetectionValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpProtocolOptions_OutlierDetectionValidationError) ErrorName() string { - return "HttpProtocolOptions_OutlierDetectionValidationError" -} - -// Error satisfies the builtin error interface -func (e HttpProtocolOptions_OutlierDetectionValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpProtocolOptions_OutlierDetection.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpProtocolOptions_OutlierDetectionValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpProtocolOptions_OutlierDetectionValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options_vtproto.pb.go deleted file mode 100644 index 3d727e817..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3/http_protocol_options_vtproto.pb.go +++ /dev/null @@ -1,1066 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/extensions/upstreams/http/v3/http_protocol_options.proto - -package httpv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *HttpProtocolOptions_ExplicitHttpConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.ProtocolConfig.(*HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.ProtocolConfig.(*HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.ProtocolConfig.(*HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.HttpProtocolOptions != nil { - if vtmsg, ok := interface{}(m.HttpProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.HttpProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Http2ProtocolOptions != nil { - if vtmsg, ok := interface{}(m.Http2ProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Http2ProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Http3ProtocolOptions != nil { - if vtmsg, ok := interface{}(m.Http3ProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Http3ProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *HttpProtocolOptions_UseDownstreamHttpConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpProtocolOptions_UseDownstreamHttpConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_UseDownstreamHttpConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Http3ProtocolOptions != nil { - if vtmsg, ok := interface{}(m.Http3ProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Http3ProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1a - } - if m.Http2ProtocolOptions != nil { - if vtmsg, ok := interface{}(m.Http2ProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Http2ProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if m.HttpProtocolOptions != nil { - if vtmsg, ok := interface{}(m.HttpProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.HttpProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HttpProtocolOptions_AutoHttpConfig) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpProtocolOptions_AutoHttpConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_AutoHttpConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.AlternateProtocolsCacheOptions != nil { - if vtmsg, ok := interface{}(m.AlternateProtocolsCacheOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.AlternateProtocolsCacheOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x22 - } - if m.Http3ProtocolOptions != nil { - if vtmsg, ok := interface{}(m.Http3ProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Http3ProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1a - } - if m.Http2ProtocolOptions != nil { - if vtmsg, ok := interface{}(m.Http2ProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Http2ProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if m.HttpProtocolOptions != nil { - if vtmsg, ok := interface{}(m.HttpProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.HttpProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HttpProtocolOptions_OutlierDetection) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpProtocolOptions_OutlierDetection) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_OutlierDetection) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ErrorMatcher != nil { - if vtmsg, ok := interface{}(m.ErrorMatcher).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.ErrorMatcher) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HttpProtocolOptions) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpProtocolOptions) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.RetryPolicy != nil { - if vtmsg, ok := interface{}(m.RetryPolicy).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.RetryPolicy) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x5a - } - if len(m.HashPolicy) > 0 { - for iNdEx := len(m.HashPolicy) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.HashPolicy[iNdEx]).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.HashPolicy[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x52 - } - } - if len(m.RequestMirrorPolicies) > 0 { - for iNdEx := len(m.RequestMirrorPolicies) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.RequestMirrorPolicies[iNdEx]).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.RequestMirrorPolicies[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x4a - } - } - if m.OutlierDetection != nil { - size, err := m.OutlierDetection.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if m.HeaderValidationConfig != nil { - if vtmsg, ok := interface{}(m.HeaderValidationConfig).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.HeaderValidationConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x3a - } - if len(m.HttpFilters) > 0 { - for iNdEx := len(m.HttpFilters) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.HttpFilters[iNdEx]).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.HttpFilters[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x32 - } - } - if msg, ok := m.UpstreamProtocolOptions.(*HttpProtocolOptions_AutoConfig); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.UpstreamProtocolOptions.(*HttpProtocolOptions_UseDownstreamProtocolConfig); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.UpstreamProtocolOptions.(*HttpProtocolOptions_ExplicitHttpConfig_); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if m.UpstreamHttpProtocolOptions != nil { - if vtmsg, ok := interface{}(m.UpstreamHttpProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.UpstreamHttpProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if m.CommonHttpProtocolOptions != nil { - if vtmsg, ok := interface{}(m.CommonHttpProtocolOptions).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.CommonHttpProtocolOptions) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ExplicitHttpConfig != nil { - size, err := m.ExplicitHttpConfig.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *HttpProtocolOptions_UseDownstreamProtocolConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_UseDownstreamProtocolConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.UseDownstreamProtocolConfig != nil { - size, err := m.UseDownstreamProtocolConfig.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *HttpProtocolOptions_AutoConfig) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpProtocolOptions_AutoConfig) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.AutoConfig != nil { - size, err := m.AutoConfig.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x2a - } - return len(dAtA) - i, nil -} -func (m *HttpProtocolOptions_ExplicitHttpConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.ProtocolConfig.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_HttpProtocolOptions) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HttpProtocolOptions != nil { - if size, ok := interface{}(m.HttpProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.HttpProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *HttpProtocolOptions_ExplicitHttpConfig_Http2ProtocolOptions) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Http2ProtocolOptions != nil { - if size, ok := interface{}(m.Http2ProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Http2ProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *HttpProtocolOptions_ExplicitHttpConfig_Http3ProtocolOptions) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Http3ProtocolOptions != nil { - if size, ok := interface{}(m.Http3ProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Http3ProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *HttpProtocolOptions_UseDownstreamHttpConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HttpProtocolOptions != nil { - if size, ok := interface{}(m.HttpProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.HttpProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Http2ProtocolOptions != nil { - if size, ok := interface{}(m.Http2ProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Http2ProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Http3ProtocolOptions != nil { - if size, ok := interface{}(m.Http3ProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Http3ProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *HttpProtocolOptions_AutoHttpConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HttpProtocolOptions != nil { - if size, ok := interface{}(m.HttpProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.HttpProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Http2ProtocolOptions != nil { - if size, ok := interface{}(m.Http2ProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Http2ProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Http3ProtocolOptions != nil { - if size, ok := interface{}(m.Http3ProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Http3ProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.AlternateProtocolsCacheOptions != nil { - if size, ok := interface{}(m.AlternateProtocolsCacheOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.AlternateProtocolsCacheOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *HttpProtocolOptions_OutlierDetection) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ErrorMatcher != nil { - if size, ok := interface{}(m.ErrorMatcher).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.ErrorMatcher) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *HttpProtocolOptions) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CommonHttpProtocolOptions != nil { - if size, ok := interface{}(m.CommonHttpProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.CommonHttpProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.UpstreamHttpProtocolOptions != nil { - if size, ok := interface{}(m.UpstreamHttpProtocolOptions).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.UpstreamHttpProtocolOptions) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if vtmsg, ok := m.UpstreamProtocolOptions.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - if len(m.HttpFilters) > 0 { - for _, e := range m.HttpFilters { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.HeaderValidationConfig != nil { - if size, ok := interface{}(m.HeaderValidationConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.HeaderValidationConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.OutlierDetection != nil { - l = m.OutlierDetection.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.RequestMirrorPolicies) > 0 { - for _, e := range m.RequestMirrorPolicies { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.HashPolicy) > 0 { - for _, e := range m.HashPolicy { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.RetryPolicy != nil { - if size, ok := interface{}(m.RetryPolicy).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.RetryPolicy) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *HttpProtocolOptions_ExplicitHttpConfig_) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ExplicitHttpConfig != nil { - l = m.ExplicitHttpConfig.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *HttpProtocolOptions_UseDownstreamProtocolConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UseDownstreamProtocolConfig != nil { - l = m.UseDownstreamProtocolConfig.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *HttpProtocolOptions_AutoConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AutoConfig != nil { - l = m.AutoConfig.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds.pb.go deleted file mode 100644 index 2acaf47ed..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds.pb.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/cluster/v3/cds.proto - -package clusterv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file. -type CdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CdsDummy) Reset() { - *x = CdsDummy{} - mi := &file_envoy_service_cluster_v3_cds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CdsDummy) ProtoMessage() {} - -func (x *CdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_cluster_v3_cds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CdsDummy.ProtoReflect.Descriptor instead. -func (*CdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_cluster_v3_cds_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_cluster_v3_cds_proto protoreflect.FileDescriptor - -const file_envoy_service_cluster_v3_cds_proto_rawDesc = "" + - "\n" + - "\"envoy/service/cluster/v3/cds.proto\x12\x18envoy.service.cluster.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\"(\n" + - "\bCdsDummy:\x1c\x9aň\x1e\x17\n" + - "\x15envoy.api.v2.CdsDummy2\xc7\x03\n" + - "\x17ClusterDiscoveryService\x12s\n" + - "\x0eStreamClusters\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12|\n" + - "\rDeltaClusters\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12\x8f\x01\n" + - "\rFetchClusters\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/v3/discovery:clusters\x1a'\x8a\xa4\x96\xf3\a!\n" + - "\x1fenvoy.config.cluster.v3.ClusterB\x87\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "&io.envoyproxy.envoy.service.cluster.v3B\bCdsProtoP\x01ZIgithub.com/envoyproxy/go-control-plane/envoy/service/cluster/v3;clusterv3b\x06proto3" - -var ( - file_envoy_service_cluster_v3_cds_proto_rawDescOnce sync.Once - file_envoy_service_cluster_v3_cds_proto_rawDescData []byte -) - -func file_envoy_service_cluster_v3_cds_proto_rawDescGZIP() []byte { - file_envoy_service_cluster_v3_cds_proto_rawDescOnce.Do(func() { - file_envoy_service_cluster_v3_cds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_cluster_v3_cds_proto_rawDesc), len(file_envoy_service_cluster_v3_cds_proto_rawDesc))) - }) - return file_envoy_service_cluster_v3_cds_proto_rawDescData -} - -var file_envoy_service_cluster_v3_cds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_cluster_v3_cds_proto_goTypes = []any{ - (*CdsDummy)(nil), // 0: envoy.service.cluster.v3.CdsDummy - (*v3.DiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DiscoveryResponse - (*v3.DeltaDiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_cluster_v3_cds_proto_depIdxs = []int32{ - 1, // 0: envoy.service.cluster.v3.ClusterDiscoveryService.StreamClusters:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 1: envoy.service.cluster.v3.ClusterDiscoveryService.DeltaClusters:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 1, // 2: envoy.service.cluster.v3.ClusterDiscoveryService.FetchClusters:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 3, // 3: envoy.service.cluster.v3.ClusterDiscoveryService.StreamClusters:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 4: envoy.service.cluster.v3.ClusterDiscoveryService.DeltaClusters:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 3, // 5: envoy.service.cluster.v3.ClusterDiscoveryService.FetchClusters:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_cluster_v3_cds_proto_init() } -func file_envoy_service_cluster_v3_cds_proto_init() { - if File_envoy_service_cluster_v3_cds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_cluster_v3_cds_proto_rawDesc), len(file_envoy_service_cluster_v3_cds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_cluster_v3_cds_proto_goTypes, - DependencyIndexes: file_envoy_service_cluster_v3_cds_proto_depIdxs, - MessageInfos: file_envoy_service_cluster_v3_cds_proto_msgTypes, - }.Build() - File_envoy_service_cluster_v3_cds_proto = out.File - file_envoy_service_cluster_v3_cds_proto_goTypes = nil - file_envoy_service_cluster_v3_cds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds.pb.validate.go deleted file mode 100644 index d4bd0834b..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/cluster/v3/cds.proto - -package clusterv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on CdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CdsDummyMultiError, or nil -// if none found. -func (m *CdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *CdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return CdsDummyMultiError(errors) - } - - return nil -} - -// CdsDummyMultiError is an error wrapping multiple validation errors returned -// by CdsDummy.ValidateAll() if the designated constraints aren't met. -type CdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CdsDummyMultiError) AllErrors() []error { return m } - -// CdsDummyValidationError is the validation error returned by -// CdsDummy.Validate if the designated constraints aren't met. -type CdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CdsDummyValidationError) ErrorName() string { return "CdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e CdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds_grpc.pb.go deleted file mode 100644 index cfa87521a..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds_grpc.pb.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/cluster/v3/cds.proto - -package clusterv3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - ClusterDiscoveryService_StreamClusters_FullMethodName = "/envoy.service.cluster.v3.ClusterDiscoveryService/StreamClusters" - ClusterDiscoveryService_DeltaClusters_FullMethodName = "/envoy.service.cluster.v3.ClusterDiscoveryService/DeltaClusters" - ClusterDiscoveryService_FetchClusters_FullMethodName = "/envoy.service.cluster.v3.ClusterDiscoveryService/FetchClusters" -) - -// ClusterDiscoveryServiceClient is the client API for ClusterDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ClusterDiscoveryServiceClient interface { - StreamClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_StreamClustersClient, error) - DeltaClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_DeltaClustersClient, error) - FetchClusters(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type clusterDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewClusterDiscoveryServiceClient(cc grpc.ClientConnInterface) ClusterDiscoveryServiceClient { - return &clusterDiscoveryServiceClient{cc} -} - -func (c *clusterDiscoveryServiceClient) StreamClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_StreamClustersClient, error) { - stream, err := c.cc.NewStream(ctx, &ClusterDiscoveryService_ServiceDesc.Streams[0], ClusterDiscoveryService_StreamClusters_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &clusterDiscoveryServiceStreamClustersClient{stream} - return x, nil -} - -type ClusterDiscoveryService_StreamClustersClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type clusterDiscoveryServiceStreamClustersClient struct { - grpc.ClientStream -} - -func (x *clusterDiscoveryServiceStreamClustersClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceStreamClustersClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *clusterDiscoveryServiceClient) DeltaClusters(ctx context.Context, opts ...grpc.CallOption) (ClusterDiscoveryService_DeltaClustersClient, error) { - stream, err := c.cc.NewStream(ctx, &ClusterDiscoveryService_ServiceDesc.Streams[1], ClusterDiscoveryService_DeltaClusters_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &clusterDiscoveryServiceDeltaClustersClient{stream} - return x, nil -} - -type ClusterDiscoveryService_DeltaClustersClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type clusterDiscoveryServiceDeltaClustersClient struct { - grpc.ClientStream -} - -func (x *clusterDiscoveryServiceDeltaClustersClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceDeltaClustersClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *clusterDiscoveryServiceClient) FetchClusters(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, ClusterDiscoveryService_FetchClusters_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ClusterDiscoveryServiceServer is the server API for ClusterDiscoveryService service. -// All implementations should embed UnimplementedClusterDiscoveryServiceServer -// for forward compatibility -type ClusterDiscoveryServiceServer interface { - StreamClusters(ClusterDiscoveryService_StreamClustersServer) error - DeltaClusters(ClusterDiscoveryService_DeltaClustersServer) error - FetchClusters(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedClusterDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedClusterDiscoveryServiceServer struct { -} - -func (UnimplementedClusterDiscoveryServiceServer) StreamClusters(ClusterDiscoveryService_StreamClustersServer) error { - return status.Errorf(codes.Unimplemented, "method StreamClusters not implemented") -} -func (UnimplementedClusterDiscoveryServiceServer) DeltaClusters(ClusterDiscoveryService_DeltaClustersServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaClusters not implemented") -} -func (UnimplementedClusterDiscoveryServiceServer) FetchClusters(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchClusters not implemented") -} - -// UnsafeClusterDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ClusterDiscoveryServiceServer will -// result in compilation errors. -type UnsafeClusterDiscoveryServiceServer interface { - mustEmbedUnimplementedClusterDiscoveryServiceServer() -} - -func RegisterClusterDiscoveryServiceServer(s grpc.ServiceRegistrar, srv ClusterDiscoveryServiceServer) { - s.RegisterService(&ClusterDiscoveryService_ServiceDesc, srv) -} - -func _ClusterDiscoveryService_StreamClusters_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ClusterDiscoveryServiceServer).StreamClusters(&clusterDiscoveryServiceStreamClustersServer{stream}) -} - -type ClusterDiscoveryService_StreamClustersServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type clusterDiscoveryServiceStreamClustersServer struct { - grpc.ServerStream -} - -func (x *clusterDiscoveryServiceStreamClustersServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceStreamClustersServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ClusterDiscoveryService_DeltaClusters_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ClusterDiscoveryServiceServer).DeltaClusters(&clusterDiscoveryServiceDeltaClustersServer{stream}) -} - -type ClusterDiscoveryService_DeltaClustersServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type clusterDiscoveryServiceDeltaClustersServer struct { - grpc.ServerStream -} - -func (x *clusterDiscoveryServiceDeltaClustersServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *clusterDiscoveryServiceDeltaClustersServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ClusterDiscoveryService_FetchClusters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClusterDiscoveryServiceServer).FetchClusters(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ClusterDiscoveryService_FetchClusters_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClusterDiscoveryServiceServer).FetchClusters(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ClusterDiscoveryService_ServiceDesc is the grpc.ServiceDesc for ClusterDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ClusterDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.cluster.v3.ClusterDiscoveryService", - HandlerType: (*ClusterDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchClusters", - Handler: _ClusterDiscoveryService_FetchClusters_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamClusters", - Handler: _ClusterDiscoveryService_StreamClusters_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaClusters", - Handler: _ClusterDiscoveryService_DeltaClusters_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/cluster/v3/cds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds_vtproto.pb.go deleted file mode 100644 index d80727e4e..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3/cds_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/cluster/v3/cds.proto - -package clusterv3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *CdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *CdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds.pb.go deleted file mode 100644 index 226eed6d7..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds.pb.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/endpoint/v3/eds.proto - -package endpointv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file. -type EdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EdsDummy) Reset() { - *x = EdsDummy{} - mi := &file_envoy_service_endpoint_v3_eds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EdsDummy) ProtoMessage() {} - -func (x *EdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_endpoint_v3_eds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EdsDummy.ProtoReflect.Descriptor instead. -func (*EdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_endpoint_v3_eds_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_endpoint_v3_eds_proto protoreflect.FileDescriptor - -const file_envoy_service_endpoint_v3_eds_proto_rawDesc = "" + - "\n" + - "#envoy/service/endpoint/v3/eds.proto\x12\x19envoy.service.endpoint.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\"(\n" + - "\bEdsDummy:\x1c\x9aň\x1e\x17\n" + - "\x15envoy.api.v2.EdsDummy2\xdb\x03\n" + - "\x18EndpointDiscoveryService\x12t\n" + - "\x0fStreamEndpoints\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12}\n" + - "\x0eDeltaEndpoints\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12\x91\x01\n" + - "\x0eFetchEndpoints\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/v3/discovery:endpoints\x1a6\x8a\xa4\x96\xf3\a0\n" + - ".envoy.config.endpoint.v3.ClusterLoadAssignmentB\x8a\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "'io.envoyproxy.envoy.service.endpoint.v3B\bEdsProtoP\x01ZKgithub.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3;endpointv3b\x06proto3" - -var ( - file_envoy_service_endpoint_v3_eds_proto_rawDescOnce sync.Once - file_envoy_service_endpoint_v3_eds_proto_rawDescData []byte -) - -func file_envoy_service_endpoint_v3_eds_proto_rawDescGZIP() []byte { - file_envoy_service_endpoint_v3_eds_proto_rawDescOnce.Do(func() { - file_envoy_service_endpoint_v3_eds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_endpoint_v3_eds_proto_rawDesc), len(file_envoy_service_endpoint_v3_eds_proto_rawDesc))) - }) - return file_envoy_service_endpoint_v3_eds_proto_rawDescData -} - -var file_envoy_service_endpoint_v3_eds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_endpoint_v3_eds_proto_goTypes = []any{ - (*EdsDummy)(nil), // 0: envoy.service.endpoint.v3.EdsDummy - (*v3.DiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DiscoveryResponse - (*v3.DeltaDiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_endpoint_v3_eds_proto_depIdxs = []int32{ - 1, // 0: envoy.service.endpoint.v3.EndpointDiscoveryService.StreamEndpoints:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 1: envoy.service.endpoint.v3.EndpointDiscoveryService.DeltaEndpoints:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 1, // 2: envoy.service.endpoint.v3.EndpointDiscoveryService.FetchEndpoints:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 3, // 3: envoy.service.endpoint.v3.EndpointDiscoveryService.StreamEndpoints:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 4: envoy.service.endpoint.v3.EndpointDiscoveryService.DeltaEndpoints:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 3, // 5: envoy.service.endpoint.v3.EndpointDiscoveryService.FetchEndpoints:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_endpoint_v3_eds_proto_init() } -func file_envoy_service_endpoint_v3_eds_proto_init() { - if File_envoy_service_endpoint_v3_eds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_endpoint_v3_eds_proto_rawDesc), len(file_envoy_service_endpoint_v3_eds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_endpoint_v3_eds_proto_goTypes, - DependencyIndexes: file_envoy_service_endpoint_v3_eds_proto_depIdxs, - MessageInfos: file_envoy_service_endpoint_v3_eds_proto_msgTypes, - }.Build() - File_envoy_service_endpoint_v3_eds_proto = out.File - file_envoy_service_endpoint_v3_eds_proto_goTypes = nil - file_envoy_service_endpoint_v3_eds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds.pb.validate.go deleted file mode 100644 index dd80787d9..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/endpoint/v3/eds.proto - -package endpointv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on EdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *EdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in EdsDummyMultiError, or nil -// if none found. -func (m *EdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *EdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return EdsDummyMultiError(errors) - } - - return nil -} - -// EdsDummyMultiError is an error wrapping multiple validation errors returned -// by EdsDummy.ValidateAll() if the designated constraints aren't met. -type EdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EdsDummyMultiError) AllErrors() []error { return m } - -// EdsDummyValidationError is the validation error returned by -// EdsDummy.Validate if the designated constraints aren't met. -type EdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EdsDummyValidationError) ErrorName() string { return "EdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e EdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds_grpc.pb.go deleted file mode 100644 index 1462834b8..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds_grpc.pb.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/endpoint/v3/eds.proto - -package endpointv3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - EndpointDiscoveryService_StreamEndpoints_FullMethodName = "/envoy.service.endpoint.v3.EndpointDiscoveryService/StreamEndpoints" - EndpointDiscoveryService_DeltaEndpoints_FullMethodName = "/envoy.service.endpoint.v3.EndpointDiscoveryService/DeltaEndpoints" - EndpointDiscoveryService_FetchEndpoints_FullMethodName = "/envoy.service.endpoint.v3.EndpointDiscoveryService/FetchEndpoints" -) - -// EndpointDiscoveryServiceClient is the client API for EndpointDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type EndpointDiscoveryServiceClient interface { - // The resource_names field in DiscoveryRequest specifies a list of clusters - // to subscribe to updates for. - StreamEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_StreamEndpointsClient, error) - DeltaEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_DeltaEndpointsClient, error) - FetchEndpoints(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type endpointDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewEndpointDiscoveryServiceClient(cc grpc.ClientConnInterface) EndpointDiscoveryServiceClient { - return &endpointDiscoveryServiceClient{cc} -} - -func (c *endpointDiscoveryServiceClient) StreamEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_StreamEndpointsClient, error) { - stream, err := c.cc.NewStream(ctx, &EndpointDiscoveryService_ServiceDesc.Streams[0], EndpointDiscoveryService_StreamEndpoints_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &endpointDiscoveryServiceStreamEndpointsClient{stream} - return x, nil -} - -type EndpointDiscoveryService_StreamEndpointsClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type endpointDiscoveryServiceStreamEndpointsClient struct { - grpc.ClientStream -} - -func (x *endpointDiscoveryServiceStreamEndpointsClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceStreamEndpointsClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *endpointDiscoveryServiceClient) DeltaEndpoints(ctx context.Context, opts ...grpc.CallOption) (EndpointDiscoveryService_DeltaEndpointsClient, error) { - stream, err := c.cc.NewStream(ctx, &EndpointDiscoveryService_ServiceDesc.Streams[1], EndpointDiscoveryService_DeltaEndpoints_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &endpointDiscoveryServiceDeltaEndpointsClient{stream} - return x, nil -} - -type EndpointDiscoveryService_DeltaEndpointsClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type endpointDiscoveryServiceDeltaEndpointsClient struct { - grpc.ClientStream -} - -func (x *endpointDiscoveryServiceDeltaEndpointsClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceDeltaEndpointsClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *endpointDiscoveryServiceClient) FetchEndpoints(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, EndpointDiscoveryService_FetchEndpoints_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// EndpointDiscoveryServiceServer is the server API for EndpointDiscoveryService service. -// All implementations should embed UnimplementedEndpointDiscoveryServiceServer -// for forward compatibility -type EndpointDiscoveryServiceServer interface { - // The resource_names field in DiscoveryRequest specifies a list of clusters - // to subscribe to updates for. - StreamEndpoints(EndpointDiscoveryService_StreamEndpointsServer) error - DeltaEndpoints(EndpointDiscoveryService_DeltaEndpointsServer) error - FetchEndpoints(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedEndpointDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedEndpointDiscoveryServiceServer struct { -} - -func (UnimplementedEndpointDiscoveryServiceServer) StreamEndpoints(EndpointDiscoveryService_StreamEndpointsServer) error { - return status.Errorf(codes.Unimplemented, "method StreamEndpoints not implemented") -} -func (UnimplementedEndpointDiscoveryServiceServer) DeltaEndpoints(EndpointDiscoveryService_DeltaEndpointsServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaEndpoints not implemented") -} -func (UnimplementedEndpointDiscoveryServiceServer) FetchEndpoints(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchEndpoints not implemented") -} - -// UnsafeEndpointDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to EndpointDiscoveryServiceServer will -// result in compilation errors. -type UnsafeEndpointDiscoveryServiceServer interface { - mustEmbedUnimplementedEndpointDiscoveryServiceServer() -} - -func RegisterEndpointDiscoveryServiceServer(s grpc.ServiceRegistrar, srv EndpointDiscoveryServiceServer) { - s.RegisterService(&EndpointDiscoveryService_ServiceDesc, srv) -} - -func _EndpointDiscoveryService_StreamEndpoints_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(EndpointDiscoveryServiceServer).StreamEndpoints(&endpointDiscoveryServiceStreamEndpointsServer{stream}) -} - -type EndpointDiscoveryService_StreamEndpointsServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type endpointDiscoveryServiceStreamEndpointsServer struct { - grpc.ServerStream -} - -func (x *endpointDiscoveryServiceStreamEndpointsServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceStreamEndpointsServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _EndpointDiscoveryService_DeltaEndpoints_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(EndpointDiscoveryServiceServer).DeltaEndpoints(&endpointDiscoveryServiceDeltaEndpointsServer{stream}) -} - -type EndpointDiscoveryService_DeltaEndpointsServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type endpointDiscoveryServiceDeltaEndpointsServer struct { - grpc.ServerStream -} - -func (x *endpointDiscoveryServiceDeltaEndpointsServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *endpointDiscoveryServiceDeltaEndpointsServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _EndpointDiscoveryService_FetchEndpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(EndpointDiscoveryServiceServer).FetchEndpoints(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: EndpointDiscoveryService_FetchEndpoints_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(EndpointDiscoveryServiceServer).FetchEndpoints(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// EndpointDiscoveryService_ServiceDesc is the grpc.ServiceDesc for EndpointDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var EndpointDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.endpoint.v3.EndpointDiscoveryService", - HandlerType: (*EndpointDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchEndpoints", - Handler: _EndpointDiscoveryService_FetchEndpoints_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamEndpoints", - Handler: _EndpointDiscoveryService_StreamEndpoints_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaEndpoints", - Handler: _EndpointDiscoveryService_DeltaEndpoints_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/endpoint/v3/eds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds_vtproto.pb.go deleted file mode 100644 index 7d039deb3..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/eds_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/endpoint/v3/eds.proto - -package endpointv3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *EdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *EdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *EdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds.pb.go deleted file mode 100644 index d7532c549..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds.pb.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/endpoint/v3/leds.proto - -package endpointv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file. -type LedsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LedsDummy) Reset() { - *x = LedsDummy{} - mi := &file_envoy_service_endpoint_v3_leds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LedsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LedsDummy) ProtoMessage() {} - -func (x *LedsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_endpoint_v3_leds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LedsDummy.ProtoReflect.Descriptor instead. -func (*LedsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_endpoint_v3_leds_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_endpoint_v3_leds_proto protoreflect.FileDescriptor - -const file_envoy_service_endpoint_v3_leds_proto_rawDesc = "" + - "\n" + - "$envoy/service/endpoint/v3/leds.proto\x12\x19envoy.service.endpoint.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\"\v\n" + - "\tLedsDummy2\xd7\x01\n" + - " LocalityEndpointDiscoveryService\x12\x85\x01\n" + - "\x16DeltaLocalityEndpoints\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x1a+\x8a\xa4\x96\xf3\a%\n" + - "#envoy.config.endpoint.v3.LbEndpointB\x8b\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "'io.envoyproxy.envoy.service.endpoint.v3B\tLedsProtoP\x01ZKgithub.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3;endpointv3b\x06proto3" - -var ( - file_envoy_service_endpoint_v3_leds_proto_rawDescOnce sync.Once - file_envoy_service_endpoint_v3_leds_proto_rawDescData []byte -) - -func file_envoy_service_endpoint_v3_leds_proto_rawDescGZIP() []byte { - file_envoy_service_endpoint_v3_leds_proto_rawDescOnce.Do(func() { - file_envoy_service_endpoint_v3_leds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_endpoint_v3_leds_proto_rawDesc), len(file_envoy_service_endpoint_v3_leds_proto_rawDesc))) - }) - return file_envoy_service_endpoint_v3_leds_proto_rawDescData -} - -var file_envoy_service_endpoint_v3_leds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_endpoint_v3_leds_proto_goTypes = []any{ - (*LedsDummy)(nil), // 0: envoy.service.endpoint.v3.LedsDummy - (*v3.DeltaDiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DeltaDiscoveryResponse)(nil), // 2: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_endpoint_v3_leds_proto_depIdxs = []int32{ - 1, // 0: envoy.service.endpoint.v3.LocalityEndpointDiscoveryService.DeltaLocalityEndpoints:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 2, // 1: envoy.service.endpoint.v3.LocalityEndpointDiscoveryService.DeltaLocalityEndpoints:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_endpoint_v3_leds_proto_init() } -func file_envoy_service_endpoint_v3_leds_proto_init() { - if File_envoy_service_endpoint_v3_leds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_endpoint_v3_leds_proto_rawDesc), len(file_envoy_service_endpoint_v3_leds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_endpoint_v3_leds_proto_goTypes, - DependencyIndexes: file_envoy_service_endpoint_v3_leds_proto_depIdxs, - MessageInfos: file_envoy_service_endpoint_v3_leds_proto_msgTypes, - }.Build() - File_envoy_service_endpoint_v3_leds_proto = out.File - file_envoy_service_endpoint_v3_leds_proto_goTypes = nil - file_envoy_service_endpoint_v3_leds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds.pb.validate.go deleted file mode 100644 index d392aa607..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/endpoint/v3/leds.proto - -package endpointv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on LedsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *LedsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on LedsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in LedsDummyMultiError, or nil -// if none found. -func (m *LedsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *LedsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return LedsDummyMultiError(errors) - } - - return nil -} - -// LedsDummyMultiError is an error wrapping multiple validation errors returned -// by LedsDummy.ValidateAll() if the designated constraints aren't met. -type LedsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m LedsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m LedsDummyMultiError) AllErrors() []error { return m } - -// LedsDummyValidationError is the validation error returned by -// LedsDummy.Validate if the designated constraints aren't met. -type LedsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e LedsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e LedsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e LedsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e LedsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e LedsDummyValidationError) ErrorName() string { return "LedsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e LedsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sLedsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = LedsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = LedsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds_grpc.pb.go deleted file mode 100644 index 5785b8013..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds_grpc.pb.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/endpoint/v3/leds.proto - -package endpointv3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - LocalityEndpointDiscoveryService_DeltaLocalityEndpoints_FullMethodName = "/envoy.service.endpoint.v3.LocalityEndpointDiscoveryService/DeltaLocalityEndpoints" -) - -// LocalityEndpointDiscoveryServiceClient is the client API for LocalityEndpointDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type LocalityEndpointDiscoveryServiceClient interface { - // The resource_names_subscribe resource_names_unsubscribe fields in DeltaDiscoveryRequest - // specify a list of glob collections to subscribe to updates for. - DeltaLocalityEndpoints(ctx context.Context, opts ...grpc.CallOption) (LocalityEndpointDiscoveryService_DeltaLocalityEndpointsClient, error) -} - -type localityEndpointDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewLocalityEndpointDiscoveryServiceClient(cc grpc.ClientConnInterface) LocalityEndpointDiscoveryServiceClient { - return &localityEndpointDiscoveryServiceClient{cc} -} - -func (c *localityEndpointDiscoveryServiceClient) DeltaLocalityEndpoints(ctx context.Context, opts ...grpc.CallOption) (LocalityEndpointDiscoveryService_DeltaLocalityEndpointsClient, error) { - stream, err := c.cc.NewStream(ctx, &LocalityEndpointDiscoveryService_ServiceDesc.Streams[0], LocalityEndpointDiscoveryService_DeltaLocalityEndpoints_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &localityEndpointDiscoveryServiceDeltaLocalityEndpointsClient{stream} - return x, nil -} - -type LocalityEndpointDiscoveryService_DeltaLocalityEndpointsClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type localityEndpointDiscoveryServiceDeltaLocalityEndpointsClient struct { - grpc.ClientStream -} - -func (x *localityEndpointDiscoveryServiceDeltaLocalityEndpointsClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *localityEndpointDiscoveryServiceDeltaLocalityEndpointsClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// LocalityEndpointDiscoveryServiceServer is the server API for LocalityEndpointDiscoveryService service. -// All implementations should embed UnimplementedLocalityEndpointDiscoveryServiceServer -// for forward compatibility -type LocalityEndpointDiscoveryServiceServer interface { - // The resource_names_subscribe resource_names_unsubscribe fields in DeltaDiscoveryRequest - // specify a list of glob collections to subscribe to updates for. - DeltaLocalityEndpoints(LocalityEndpointDiscoveryService_DeltaLocalityEndpointsServer) error -} - -// UnimplementedLocalityEndpointDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedLocalityEndpointDiscoveryServiceServer struct { -} - -func (UnimplementedLocalityEndpointDiscoveryServiceServer) DeltaLocalityEndpoints(LocalityEndpointDiscoveryService_DeltaLocalityEndpointsServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaLocalityEndpoints not implemented") -} - -// UnsafeLocalityEndpointDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to LocalityEndpointDiscoveryServiceServer will -// result in compilation errors. -type UnsafeLocalityEndpointDiscoveryServiceServer interface { - mustEmbedUnimplementedLocalityEndpointDiscoveryServiceServer() -} - -func RegisterLocalityEndpointDiscoveryServiceServer(s grpc.ServiceRegistrar, srv LocalityEndpointDiscoveryServiceServer) { - s.RegisterService(&LocalityEndpointDiscoveryService_ServiceDesc, srv) -} - -func _LocalityEndpointDiscoveryService_DeltaLocalityEndpoints_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(LocalityEndpointDiscoveryServiceServer).DeltaLocalityEndpoints(&localityEndpointDiscoveryServiceDeltaLocalityEndpointsServer{stream}) -} - -type LocalityEndpointDiscoveryService_DeltaLocalityEndpointsServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type localityEndpointDiscoveryServiceDeltaLocalityEndpointsServer struct { - grpc.ServerStream -} - -func (x *localityEndpointDiscoveryServiceDeltaLocalityEndpointsServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *localityEndpointDiscoveryServiceDeltaLocalityEndpointsServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// LocalityEndpointDiscoveryService_ServiceDesc is the grpc.ServiceDesc for LocalityEndpointDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var LocalityEndpointDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.endpoint.v3.LocalityEndpointDiscoveryService", - HandlerType: (*LocalityEndpointDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "DeltaLocalityEndpoints", - Handler: _LocalityEndpointDiscoveryService_DeltaLocalityEndpoints_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/endpoint/v3/leds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds_vtproto.pb.go deleted file mode 100644 index c93ddebce..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3/leds_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/endpoint/v3/leds.proto - -package endpointv3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *LedsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LedsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *LedsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *LedsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor.pb.go deleted file mode 100644 index c89cd76aa..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor.pb.go +++ /dev/null @@ -1,1898 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/ext_proc/v3/external_processor.proto - -package ext_procv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/cncf/xds/go/xds/annotations/v3" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v31 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3" - v32 "github.com/envoyproxy/go-control-plane/envoy/type/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// The status of the response. -type CommonResponse_ResponseStatus int32 - -const ( - // Apply the mutation instructions in this message to the - // request or response, and then continue processing the filter - // stream as normal. This is the default. - CommonResponse_CONTINUE CommonResponse_ResponseStatus = 0 - // Apply the specified header mutation, replace the body with the body - // specified in the body mutation (if present), and do not send any - // further messages for this request or response even if the processing - // mode is configured to do so. - // - // When used in response to a request_headers or response_headers message, - // this status makes it possible to either completely replace the body - // while discarding the original body, or to add a body to a message that - // formerly did not have one. - // - // In other words, this response makes it possible to turn an HTTP GET - // into a POST, PUT, or PATCH. - // - // Not supported if the body send mode is “GRPC“. - CommonResponse_CONTINUE_AND_REPLACE CommonResponse_ResponseStatus = 1 -) - -// Enum value maps for CommonResponse_ResponseStatus. -var ( - CommonResponse_ResponseStatus_name = map[int32]string{ - 0: "CONTINUE", - 1: "CONTINUE_AND_REPLACE", - } - CommonResponse_ResponseStatus_value = map[string]int32{ - "CONTINUE": 0, - "CONTINUE_AND_REPLACE": 1, - } -) - -func (x CommonResponse_ResponseStatus) Enum() *CommonResponse_ResponseStatus { - p := new(CommonResponse_ResponseStatus) - *p = x - return p -} - -func (x CommonResponse_ResponseStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CommonResponse_ResponseStatus) Descriptor() protoreflect.EnumDescriptor { - return file_envoy_service_ext_proc_v3_external_processor_proto_enumTypes[0].Descriptor() -} - -func (CommonResponse_ResponseStatus) Type() protoreflect.EnumType { - return &file_envoy_service_ext_proc_v3_external_processor_proto_enumTypes[0] -} - -func (x CommonResponse_ResponseStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CommonResponse_ResponseStatus.Descriptor instead. -func (CommonResponse_ResponseStatus) EnumDescriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{10, 0} -} - -// This message specifies the filter protocol configurations which will be sent to the ext_proc -// server in a :ref:`ProcessingRequest `. -// If the server does not support these protocol configurations, it may choose to close the gRPC stream. -// If the server supports these protocol configurations, it should respond based on the API specifications. -type ProtocolConfiguration struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Specify the filter configuration :ref:`request_body_mode - // ` - RequestBodyMode v3.ProcessingMode_BodySendMode `protobuf:"varint,1,opt,name=request_body_mode,json=requestBodyMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_BodySendMode" json:"request_body_mode,omitempty"` - // Specify the filter configuration :ref:`response_body_mode - // ` - ResponseBodyMode v3.ProcessingMode_BodySendMode `protobuf:"varint,2,opt,name=response_body_mode,json=responseBodyMode,proto3,enum=envoy.extensions.filters.http.ext_proc.v3.ProcessingMode_BodySendMode" json:"response_body_mode,omitempty"` - // Specify the filter configuration :ref:`send_body_without_waiting_for_header_response - // ` - // If the client is waiting for a header response from the server, setting “true“ means the client will send body to the server - // as they arrive. Setting “false“ means the client will buffer the arrived data and not send it to the server immediately. - SendBodyWithoutWaitingForHeaderResponse bool `protobuf:"varint,3,opt,name=send_body_without_waiting_for_header_response,json=sendBodyWithoutWaitingForHeaderResponse,proto3" json:"send_body_without_waiting_for_header_response,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProtocolConfiguration) Reset() { - *x = ProtocolConfiguration{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProtocolConfiguration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProtocolConfiguration) ProtoMessage() {} - -func (x *ProtocolConfiguration) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProtocolConfiguration.ProtoReflect.Descriptor instead. -func (*ProtocolConfiguration) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{0} -} - -func (x *ProtocolConfiguration) GetRequestBodyMode() v3.ProcessingMode_BodySendMode { - if x != nil { - return x.RequestBodyMode - } - return v3.ProcessingMode_BodySendMode(0) -} - -func (x *ProtocolConfiguration) GetResponseBodyMode() v3.ProcessingMode_BodySendMode { - if x != nil { - return x.ResponseBodyMode - } - return v3.ProcessingMode_BodySendMode(0) -} - -func (x *ProtocolConfiguration) GetSendBodyWithoutWaitingForHeaderResponse() bool { - if x != nil { - return x.SendBodyWithoutWaitingForHeaderResponse - } - return false -} - -// This represents the different types of messages that the data plane can send -// to an external processing server. -// [#next-free-field: 12] -type ProcessingRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Each request message will include one of the following sub-messages. Which - // ones are set for a particular HTTP request/response depend on the - // processing mode. - // - // Types that are valid to be assigned to Request: - // - // *ProcessingRequest_RequestHeaders - // *ProcessingRequest_ResponseHeaders - // *ProcessingRequest_RequestBody - // *ProcessingRequest_ResponseBody - // *ProcessingRequest_RequestTrailers - // *ProcessingRequest_ResponseTrailers - Request isProcessingRequest_Request `protobuf_oneof:"request"` - // Dynamic metadata associated with the request. - MetadataContext *v31.Metadata `protobuf:"bytes,8,opt,name=metadata_context,json=metadataContext,proto3" json:"metadata_context,omitempty"` - // The values of properties selected by the “request_attributes“ - // or “response_attributes“ list in the configuration. Each entry - // in the list is populated from the standard - // :ref:`attributes ` supported in the data plane. - Attributes map[string]*structpb.Struct `protobuf:"bytes,9,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // Specify whether the filter that sent this request is running in :ref:`observability_mode - // ` - // and defaults to false. - // - // - A value of “false“ indicates that the server must respond - // to this message by either sending back a matching ProcessingResponse message, - // or by closing the stream. - // - A value of “true“ indicates that the server should not respond to this message, as any - // responses will be ignored. However, it may still close the stream to indicate that no more messages - // are needed. - ObservabilityMode bool `protobuf:"varint,10,opt,name=observability_mode,json=observabilityMode,proto3" json:"observability_mode,omitempty"` - // Specify the filter protocol configurations to be sent to the server. - // “protocol_config“ is only encoded in the first “ProcessingRequest“ message from the client to the server. - ProtocolConfig *ProtocolConfiguration `protobuf:"bytes,11,opt,name=protocol_config,json=protocolConfig,proto3" json:"protocol_config,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProcessingRequest) Reset() { - *x = ProcessingRequest{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProcessingRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProcessingRequest) ProtoMessage() {} - -func (x *ProcessingRequest) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProcessingRequest.ProtoReflect.Descriptor instead. -func (*ProcessingRequest) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{1} -} - -func (x *ProcessingRequest) GetRequest() isProcessingRequest_Request { - if x != nil { - return x.Request - } - return nil -} - -func (x *ProcessingRequest) GetRequestHeaders() *HttpHeaders { - if x != nil { - if x, ok := x.Request.(*ProcessingRequest_RequestHeaders); ok { - return x.RequestHeaders - } - } - return nil -} - -func (x *ProcessingRequest) GetResponseHeaders() *HttpHeaders { - if x != nil { - if x, ok := x.Request.(*ProcessingRequest_ResponseHeaders); ok { - return x.ResponseHeaders - } - } - return nil -} - -func (x *ProcessingRequest) GetRequestBody() *HttpBody { - if x != nil { - if x, ok := x.Request.(*ProcessingRequest_RequestBody); ok { - return x.RequestBody - } - } - return nil -} - -func (x *ProcessingRequest) GetResponseBody() *HttpBody { - if x != nil { - if x, ok := x.Request.(*ProcessingRequest_ResponseBody); ok { - return x.ResponseBody - } - } - return nil -} - -func (x *ProcessingRequest) GetRequestTrailers() *HttpTrailers { - if x != nil { - if x, ok := x.Request.(*ProcessingRequest_RequestTrailers); ok { - return x.RequestTrailers - } - } - return nil -} - -func (x *ProcessingRequest) GetResponseTrailers() *HttpTrailers { - if x != nil { - if x, ok := x.Request.(*ProcessingRequest_ResponseTrailers); ok { - return x.ResponseTrailers - } - } - return nil -} - -func (x *ProcessingRequest) GetMetadataContext() *v31.Metadata { - if x != nil { - return x.MetadataContext - } - return nil -} - -func (x *ProcessingRequest) GetAttributes() map[string]*structpb.Struct { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *ProcessingRequest) GetObservabilityMode() bool { - if x != nil { - return x.ObservabilityMode - } - return false -} - -func (x *ProcessingRequest) GetProtocolConfig() *ProtocolConfiguration { - if x != nil { - return x.ProtocolConfig - } - return nil -} - -type isProcessingRequest_Request interface { - isProcessingRequest_Request() -} - -type ProcessingRequest_RequestHeaders struct { - // Information about the HTTP request headers, as well as peer info and additional - // properties. Unless “observability_mode“ is “true“, the server must send back a - // HeaderResponse message, an ImmediateResponse message, or close the stream. - RequestHeaders *HttpHeaders `protobuf:"bytes,2,opt,name=request_headers,json=requestHeaders,proto3,oneof"` -} - -type ProcessingRequest_ResponseHeaders struct { - // Information about the HTTP response headers, as well as peer info and additional - // properties. Unless “observability_mode“ is “true“, the server must send back a - // HeaderResponse message or close the stream. - ResponseHeaders *HttpHeaders `protobuf:"bytes,3,opt,name=response_headers,json=responseHeaders,proto3,oneof"` -} - -type ProcessingRequest_RequestBody struct { - // A chunk of the HTTP request body. Unless “observability_mode“ is true, the server must send back - // a BodyResponse message, an ImmediateResponse message, or close the stream. - RequestBody *HttpBody `protobuf:"bytes,4,opt,name=request_body,json=requestBody,proto3,oneof"` -} - -type ProcessingRequest_ResponseBody struct { - // A chunk of the HTTP response body. Unless “observability_mode“ is “true“, the server must send back - // a BodyResponse message or close the stream. - ResponseBody *HttpBody `protobuf:"bytes,5,opt,name=response_body,json=responseBody,proto3,oneof"` -} - -type ProcessingRequest_RequestTrailers struct { - // The HTTP trailers for the request path. Unless “observability_mode“ is “true“, the server - // must send back a TrailerResponse message or close the stream. - // - // This message is only sent if the trailers processing mode is set to “SEND“ and - // the original downstream request has trailers. - RequestTrailers *HttpTrailers `protobuf:"bytes,6,opt,name=request_trailers,json=requestTrailers,proto3,oneof"` -} - -type ProcessingRequest_ResponseTrailers struct { - // The HTTP trailers for the response path. Unless “observability_mode“ is “true“, the server - // must send back a TrailerResponse message or close the stream. - // - // This message is only sent if the trailers processing mode is set to “SEND“ and - // the original upstream response has trailers. - ResponseTrailers *HttpTrailers `protobuf:"bytes,7,opt,name=response_trailers,json=responseTrailers,proto3,oneof"` -} - -func (*ProcessingRequest_RequestHeaders) isProcessingRequest_Request() {} - -func (*ProcessingRequest_ResponseHeaders) isProcessingRequest_Request() {} - -func (*ProcessingRequest_RequestBody) isProcessingRequest_Request() {} - -func (*ProcessingRequest_ResponseBody) isProcessingRequest_Request() {} - -func (*ProcessingRequest_RequestTrailers) isProcessingRequest_Request() {} - -func (*ProcessingRequest_ResponseTrailers) isProcessingRequest_Request() {} - -// This represents the different types of messages the server may send back to the data plane -// when the “observability_mode“ field in the received ProcessingRequest is set to false. -// -// - If the corresponding “BodySendMode“ in the -// :ref:`processing_mode ` -// is not set to “FULL_DUPLEX_STREAMED“, then for every received ProcessingRequest, -// the server must send back exactly one ProcessingResponse message. -// - If it is set to “FULL_DUPLEX_STREAMED“, the server must follow the API defined -// for this mode to send the ProcessingResponse messages. -// -// [#next-free-field: 13] -type ProcessingResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The response type that is sent by the server. - // - // Types that are valid to be assigned to Response: - // - // *ProcessingResponse_RequestHeaders - // *ProcessingResponse_ResponseHeaders - // *ProcessingResponse_RequestBody - // *ProcessingResponse_ResponseBody - // *ProcessingResponse_RequestTrailers - // *ProcessingResponse_ResponseTrailers - // *ProcessingResponse_ImmediateResponse - // *ProcessingResponse_StreamedImmediateResponse - Response isProcessingResponse_Response `protobuf_oneof:"response"` - // Optional metadata that will be emitted as dynamic metadata to be consumed by - // following filters. This metadata will be placed in the namespace(s) specified by the top-level - // field name(s) of the struct. - DynamicMetadata *structpb.Struct `protobuf:"bytes,8,opt,name=dynamic_metadata,json=dynamicMetadata,proto3" json:"dynamic_metadata,omitempty"` - // Override how parts of the HTTP request and response are processed - // for the duration of this particular request/response only. Servers - // may use this to intelligently control how requests are processed - // based on the headers and other metadata that they see. - // This field is only applicable when servers responding to the header requests. - // If it is set in the response to the body or trailer requests, it will be ignored by the data plane. - // It is also ignored by the data plane when the ext_proc filter config - // :ref:`allow_mode_override - // ` - // is set to false, or - // :ref:`send_body_without_waiting_for_header_response - // ` - // is set to true. - ModeOverride *v3.ProcessingMode `protobuf:"bytes,9,opt,name=mode_override,json=modeOverride,proto3" json:"mode_override,omitempty"` - // [#not-implemented-hide:] - // Used only in “FULL_DUPLEX_STREAMED“ and “GRPC“ body send modes. - // Instructs the data plane to stop sending body data and to send a - // half-close on the ext_proc stream. The ext_proc server should then echo - // back all subsequent body contents as-is until it sees the client's - // half-close, at which point the ext_proc server can terminate the stream - // with an OK status. This provides a safe way for the ext_proc server - // to indicate that it does not need to see the rest of the stream; - // without this, the ext_proc server could not terminate the stream - // early, because it would wind up dropping any body contents that the - // client had already sent before it saw the ext_proc stream termination. - RequestDrain bool `protobuf:"varint,12,opt,name=request_drain,json=requestDrain,proto3" json:"request_drain,omitempty"` - // When ext_proc server receives a request message, in case it needs more - // time to process the message, it sends back a ProcessingResponse message - // with a new timeout value. When the data plane receives this response - // message, it ignores other fields in the response, just stop the original - // timer, which has the timeout value specified in - // :ref:`message_timeout - // ` - // and start a new timer with this “override_message_timeout“ value and keep the - // data plane ext_proc filter state machine intact. - // Has to be >= 1ms and <= - // :ref:`max_message_timeout ` - // Such message can be sent at most once in a particular data plane ext_proc filter processing state. - // To enable this API, one has to set “max_message_timeout“ to a number >= 1ms. - OverrideMessageTimeout *durationpb.Duration `protobuf:"bytes,10,opt,name=override_message_timeout,json=overrideMessageTimeout,proto3" json:"override_message_timeout,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProcessingResponse) Reset() { - *x = ProcessingResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProcessingResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProcessingResponse) ProtoMessage() {} - -func (x *ProcessingResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProcessingResponse.ProtoReflect.Descriptor instead. -func (*ProcessingResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{2} -} - -func (x *ProcessingResponse) GetResponse() isProcessingResponse_Response { - if x != nil { - return x.Response - } - return nil -} - -func (x *ProcessingResponse) GetRequestHeaders() *HeadersResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_RequestHeaders); ok { - return x.RequestHeaders - } - } - return nil -} - -func (x *ProcessingResponse) GetResponseHeaders() *HeadersResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_ResponseHeaders); ok { - return x.ResponseHeaders - } - } - return nil -} - -func (x *ProcessingResponse) GetRequestBody() *BodyResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_RequestBody); ok { - return x.RequestBody - } - } - return nil -} - -func (x *ProcessingResponse) GetResponseBody() *BodyResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_ResponseBody); ok { - return x.ResponseBody - } - } - return nil -} - -func (x *ProcessingResponse) GetRequestTrailers() *TrailersResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_RequestTrailers); ok { - return x.RequestTrailers - } - } - return nil -} - -func (x *ProcessingResponse) GetResponseTrailers() *TrailersResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_ResponseTrailers); ok { - return x.ResponseTrailers - } - } - return nil -} - -func (x *ProcessingResponse) GetImmediateResponse() *ImmediateResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_ImmediateResponse); ok { - return x.ImmediateResponse - } - } - return nil -} - -func (x *ProcessingResponse) GetStreamedImmediateResponse() *StreamedImmediateResponse { - if x != nil { - if x, ok := x.Response.(*ProcessingResponse_StreamedImmediateResponse); ok { - return x.StreamedImmediateResponse - } - } - return nil -} - -func (x *ProcessingResponse) GetDynamicMetadata() *structpb.Struct { - if x != nil { - return x.DynamicMetadata - } - return nil -} - -func (x *ProcessingResponse) GetModeOverride() *v3.ProcessingMode { - if x != nil { - return x.ModeOverride - } - return nil -} - -func (x *ProcessingResponse) GetRequestDrain() bool { - if x != nil { - return x.RequestDrain - } - return false -} - -func (x *ProcessingResponse) GetOverrideMessageTimeout() *durationpb.Duration { - if x != nil { - return x.OverrideMessageTimeout - } - return nil -} - -type isProcessingResponse_Response interface { - isProcessingResponse_Response() -} - -type ProcessingResponse_RequestHeaders struct { - // The server must send back this message in response to a message with the - // “request_headers“ field set. - RequestHeaders *HeadersResponse `protobuf:"bytes,1,opt,name=request_headers,json=requestHeaders,proto3,oneof"` -} - -type ProcessingResponse_ResponseHeaders struct { - // The server must send back this message in response to a message with the - // “response_headers“ field set. - ResponseHeaders *HeadersResponse `protobuf:"bytes,2,opt,name=response_headers,json=responseHeaders,proto3,oneof"` -} - -type ProcessingResponse_RequestBody struct { - // The server must send back this message in response to a message with - // the “request_body“ field set. - RequestBody *BodyResponse `protobuf:"bytes,3,opt,name=request_body,json=requestBody,proto3,oneof"` -} - -type ProcessingResponse_ResponseBody struct { - // The server must send back this message in response to a message with - // the “response_body“ field set. - ResponseBody *BodyResponse `protobuf:"bytes,4,opt,name=response_body,json=responseBody,proto3,oneof"` -} - -type ProcessingResponse_RequestTrailers struct { - // The server must send back this message in response to a message with - // the “request_trailers“ field set. - RequestTrailers *TrailersResponse `protobuf:"bytes,5,opt,name=request_trailers,json=requestTrailers,proto3,oneof"` -} - -type ProcessingResponse_ResponseTrailers struct { - // The server must send back this message in response to a message with - // the “response_trailers“ field set. - ResponseTrailers *TrailersResponse `protobuf:"bytes,6,opt,name=response_trailers,json=responseTrailers,proto3,oneof"` -} - -type ProcessingResponse_ImmediateResponse struct { - // If specified, attempt to create a locally generated response, send it - // downstream, and stop processing additional filters and ignore any - // additional messages received from the remote server for this request or - // response. If a response has already started -- for example, if this - // message is sent response to a “response_body“ message -- then - // this will either ship the reply directly to the downstream codec, - // or reset the stream. - ImmediateResponse *ImmediateResponse `protobuf:"bytes,7,opt,name=immediate_response,json=immediateResponse,proto3,oneof"` -} - -type ProcessingResponse_StreamedImmediateResponse struct { - // The server sends back this message to initiate or continue local response streaming. - // The server must initiate local response streaming with the “headers_response“ in response to a ProcessingRequest - // with the “request_headers“ only. - // The server may follow up with multiple messages containing “body_response“. The server must indicate - // end of stream by setting “end_of_stream“ to “true“ in the “headers_response“ - // or “body_response“ message or by sending a “trailers_response“ message. - // The client may send a “request_body“ or “request_trailers“ to the server depending on configuration. - // The streaming local response can only be sent when the “request_header_mode“ in the filter - // :ref:`processing_mode ` - // is set to “SEND“. The ext_proc server should not send StreamedImmediateResponse if it did not observe request headers, - // as it will result in the race with the upstream server response and reset of the client request. - // Presently only the FULL_DUPLEX_STREAMED or NONE body modes are supported. - StreamedImmediateResponse *StreamedImmediateResponse `protobuf:"bytes,11,opt,name=streamed_immediate_response,json=streamedImmediateResponse,proto3,oneof"` -} - -func (*ProcessingResponse_RequestHeaders) isProcessingResponse_Response() {} - -func (*ProcessingResponse_ResponseHeaders) isProcessingResponse_Response() {} - -func (*ProcessingResponse_RequestBody) isProcessingResponse_Response() {} - -func (*ProcessingResponse_ResponseBody) isProcessingResponse_Response() {} - -func (*ProcessingResponse_RequestTrailers) isProcessingResponse_Response() {} - -func (*ProcessingResponse_ResponseTrailers) isProcessingResponse_Response() {} - -func (*ProcessingResponse_ImmediateResponse) isProcessingResponse_Response() {} - -func (*ProcessingResponse_StreamedImmediateResponse) isProcessingResponse_Response() {} - -// This message is sent to the external server when the HTTP request and responses -// are first received. -type HttpHeaders struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The HTTP request headers. All header keys will be - // lower-cased, because HTTP header keys are case-insensitive. - // The header value is encoded in the - // :ref:`raw_value ` field. - Headers *v31.HeaderMap `protobuf:"bytes,1,opt,name=headers,proto3" json:"headers,omitempty"` - // [#not-implemented-hide:] - // This field is deprecated and not implemented. Attributes will be sent in - // the top-level :ref:`attributes ` field. - Trailers *v31.HeaderMap `protobuf:"bytes,1,opt,name=trailers,proto3" json:"trailers,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HttpTrailers) Reset() { - *x = HttpTrailers{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HttpTrailers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HttpTrailers) ProtoMessage() {} - -func (x *HttpTrailers) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HttpTrailers.ProtoReflect.Descriptor instead. -func (*HttpTrailers) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{5} -} - -func (x *HttpTrailers) GetTrailers() *v31.HeaderMap { - if x != nil { - return x.Trailers - } - return nil -} - -// This message is sent by the external server to the data plane after “HttpHeaders“ was -// sent to it. -type HeadersResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Details the modifications (if any) to be made by the data plane to the current - // request/response. - Response *CommonResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HeadersResponse) Reset() { - *x = HeadersResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HeadersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeadersResponse) ProtoMessage() {} - -func (x *HeadersResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeadersResponse.ProtoReflect.Descriptor instead. -func (*HeadersResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{6} -} - -func (x *HeadersResponse) GetResponse() *CommonResponse { - if x != nil { - return x.Response - } - return nil -} - -// This message is sent by the external server to the data plane after “HttpBody“ was -// sent to it. -type BodyResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Details the modifications (if any) to be made by the data plane to the current - // request/response. - Response *CommonResponse `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BodyResponse) Reset() { - *x = BodyResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BodyResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BodyResponse) ProtoMessage() {} - -func (x *BodyResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BodyResponse.ProtoReflect.Descriptor instead. -func (*BodyResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{7} -} - -func (x *BodyResponse) GetResponse() *CommonResponse { - if x != nil { - return x.Response - } - return nil -} - -// This message is sent by the external server to the data plane after “HttpTrailers“ was -// sent to it. -type TrailersResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Details the modifications (if any) to be made by the data plane to the current - // request/response trailers. - HeaderMutation *HeaderMutation `protobuf:"bytes,1,opt,name=header_mutation,json=headerMutation,proto3" json:"header_mutation,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TrailersResponse) Reset() { - *x = TrailersResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TrailersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TrailersResponse) ProtoMessage() {} - -func (x *TrailersResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TrailersResponse.ProtoReflect.Descriptor instead. -func (*TrailersResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{8} -} - -func (x *TrailersResponse) GetHeaderMutation() *HeaderMutation { - if x != nil { - return x.HeaderMutation - } - return nil -} - -// This message is sent by the external server to the data plane after “HttpHeaders“ -// to initiate local response streaming. The server may follow up with multiple messages containing “body_response“. -// The server must indicate end of stream by setting “end_of_stream“ to “true“ in the “headers_response“ -// or “body_response“ message or by sending a “trailers_response“ message. -type StreamedImmediateResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to Response: - // - // *StreamedImmediateResponse_HeadersResponse - // *StreamedImmediateResponse_BodyResponse - // *StreamedImmediateResponse_TrailersResponse - Response isStreamedImmediateResponse_Response `protobuf_oneof:"response"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StreamedImmediateResponse) Reset() { - *x = StreamedImmediateResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StreamedImmediateResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamedImmediateResponse) ProtoMessage() {} - -func (x *StreamedImmediateResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StreamedImmediateResponse.ProtoReflect.Descriptor instead. -func (*StreamedImmediateResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{9} -} - -func (x *StreamedImmediateResponse) GetResponse() isStreamedImmediateResponse_Response { - if x != nil { - return x.Response - } - return nil -} - -func (x *StreamedImmediateResponse) GetHeadersResponse() *HttpHeaders { - if x != nil { - if x, ok := x.Response.(*StreamedImmediateResponse_HeadersResponse); ok { - return x.HeadersResponse - } - } - return nil -} - -func (x *StreamedImmediateResponse) GetBodyResponse() *StreamedBodyResponse { - if x != nil { - if x, ok := x.Response.(*StreamedImmediateResponse_BodyResponse); ok { - return x.BodyResponse - } - } - return nil -} - -func (x *StreamedImmediateResponse) GetTrailersResponse() *v31.HeaderMap { - if x != nil { - if x, ok := x.Response.(*StreamedImmediateResponse_TrailersResponse); ok { - return x.TrailersResponse - } - } - return nil -} - -type isStreamedImmediateResponse_Response interface { - isStreamedImmediateResponse_Response() -} - -type StreamedImmediateResponse_HeadersResponse struct { - // Response headers to be sent downstream. The ":status" header must be set. - HeadersResponse *HttpHeaders `protobuf:"bytes,1,opt,name=headers_response,json=headersResponse,proto3,oneof"` -} - -type StreamedImmediateResponse_BodyResponse struct { - // Response body to be sent downstream. - BodyResponse *StreamedBodyResponse `protobuf:"bytes,2,opt,name=body_response,json=bodyResponse,proto3,oneof"` -} - -type StreamedImmediateResponse_TrailersResponse struct { - // Response trailers to be sent downstream. - TrailersResponse *v31.HeaderMap `protobuf:"bytes,3,opt,name=trailers_response,json=trailersResponse,proto3,oneof"` -} - -func (*StreamedImmediateResponse_HeadersResponse) isStreamedImmediateResponse_Response() {} - -func (*StreamedImmediateResponse_BodyResponse) isStreamedImmediateResponse_Response() {} - -func (*StreamedImmediateResponse_TrailersResponse) isStreamedImmediateResponse_Response() {} - -// This message contains common fields between header and body responses. -// [#next-free-field: 6] -type CommonResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // If set, provide additional direction on how the data plane should - // handle the rest of the HTTP filter chain. - Status CommonResponse_ResponseStatus `protobuf:"varint,1,opt,name=status,proto3,enum=envoy.service.ext_proc.v3.CommonResponse_ResponseStatus" json:"status,omitempty"` - // Instructions on how to manipulate the headers. When responding to an - // HttpBody request, header mutations will only take effect if - // the current processing mode for the body is BUFFERED. - HeaderMutation *HeaderMutation `protobuf:"bytes,2,opt,name=header_mutation,json=headerMutation,proto3" json:"header_mutation,omitempty"` - // Replace the body of the last message sent to the remote server on this - // stream. If responding to an HttpBody request, simply replace or clear - // the body chunk that was sent with that request. Body mutations may take - // effect in response either to “header“ or “body“ messages. When it is - // in response to “header“ messages, it only take effect if the - // :ref:`status ` - // is set to CONTINUE_AND_REPLACE. - BodyMutation *BodyMutation `protobuf:"bytes,3,opt,name=body_mutation,json=bodyMutation,proto3" json:"body_mutation,omitempty"` - // [#not-implemented-hide:] - // Add new trailers to the message. This may be used when responding to either a - // HttpHeaders or HttpBody message, but only if this message is returned - // along with the CONTINUE_AND_REPLACE status. - // The header value is encoded in the - // :ref:`raw_value ` field. - Trailers *v31.HeaderMap `protobuf:"bytes,4,opt,name=trailers,proto3" json:"trailers,omitempty"` - // Clear the route cache for the current client request. This is necessary - // if the remote server modified headers that are used to calculate the route. - // This field is ignored in the response direction. This field is also ignored - // if the data plane ext_proc filter is in the upstream filter chain. - ClearRouteCache bool `protobuf:"varint,5,opt,name=clear_route_cache,json=clearRouteCache,proto3" json:"clear_route_cache,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CommonResponse) Reset() { - *x = CommonResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CommonResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommonResponse) ProtoMessage() {} - -func (x *CommonResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommonResponse.ProtoReflect.Descriptor instead. -func (*CommonResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{10} -} - -func (x *CommonResponse) GetStatus() CommonResponse_ResponseStatus { - if x != nil { - return x.Status - } - return CommonResponse_CONTINUE -} - -func (x *CommonResponse) GetHeaderMutation() *HeaderMutation { - if x != nil { - return x.HeaderMutation - } - return nil -} - -func (x *CommonResponse) GetBodyMutation() *BodyMutation { - if x != nil { - return x.BodyMutation - } - return nil -} - -func (x *CommonResponse) GetTrailers() *v31.HeaderMap { - if x != nil { - return x.Trailers - } - return nil -} - -func (x *CommonResponse) GetClearRouteCache() bool { - if x != nil { - return x.ClearRouteCache - } - return false -} - -// This message causes the filter to attempt to create a locally -// generated response, send it downstream, stop processing -// additional filters, and ignore any additional messages received -// from the remote server for this request or response. If a response -// has already started, then this will either ship the reply directly -// to the downstream codec, or reset the stream. -// [#next-free-field: 6] -type ImmediateResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The response code to return. - Status *v32.HttpStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - // Apply changes to the default headers, which will include content-type. - Headers *HeaderMutation `protobuf:"bytes,2,opt,name=headers,proto3" json:"headers,omitempty"` - // The message body to return with the response which is sent using the - // text/plain content type, or encoded in the grpc-message header. - Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` - // If set, then include a gRPC status trailer. - GrpcStatus *GrpcStatus `protobuf:"bytes,4,opt,name=grpc_status,json=grpcStatus,proto3" json:"grpc_status,omitempty"` - // A string detailing why this local reply was sent, which may be included - // in log and debug output (e.g. this populates the %RESPONSE_CODE_DETAILS% - // command operator field for use in access logging). - Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ImmediateResponse) Reset() { - *x = ImmediateResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ImmediateResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImmediateResponse) ProtoMessage() {} - -func (x *ImmediateResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImmediateResponse.ProtoReflect.Descriptor instead. -func (*ImmediateResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{11} -} - -func (x *ImmediateResponse) GetStatus() *v32.HttpStatus { - if x != nil { - return x.Status - } - return nil -} - -func (x *ImmediateResponse) GetHeaders() *HeaderMutation { - if x != nil { - return x.Headers - } - return nil -} - -func (x *ImmediateResponse) GetBody() []byte { - if x != nil { - return x.Body - } - return nil -} - -func (x *ImmediateResponse) GetGrpcStatus() *GrpcStatus { - if x != nil { - return x.GrpcStatus - } - return nil -} - -func (x *ImmediateResponse) GetDetails() string { - if x != nil { - return x.Details - } - return "" -} - -// This message specifies a gRPC status for an ImmediateResponse message. -type GrpcStatus struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The actual gRPC status. - Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GrpcStatus) Reset() { - *x = GrpcStatus{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GrpcStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GrpcStatus) ProtoMessage() {} - -func (x *GrpcStatus) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GrpcStatus.ProtoReflect.Descriptor instead. -func (*GrpcStatus) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{12} -} - -func (x *GrpcStatus) GetStatus() uint32 { - if x != nil { - return x.Status - } - return 0 -} - -// Change HTTP headers or trailers by appending, replacing, or removing -// headers. -type HeaderMutation struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Add or replace HTTP headers. Attempts to set the value of - // any “x-envoy“ header, and attempts to set the “:method“, - // “:authority“, “:scheme“, or “host“ headers will be ignored. - // The header value is encoded in the - // :ref:`raw_value ` field. - SetHeaders []*v31.HeaderValueOption `protobuf:"bytes,1,rep,name=set_headers,json=setHeaders,proto3" json:"set_headers,omitempty"` - // Remove these HTTP headers. Attempts to remove system headers -- - // any header starting with “:“, plus “host“ -- will be ignored. - RemoveHeaders []string `protobuf:"bytes,2,rep,name=remove_headers,json=removeHeaders,proto3" json:"remove_headers,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HeaderMutation) Reset() { - *x = HeaderMutation{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HeaderMutation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeaderMutation) ProtoMessage() {} - -func (x *HeaderMutation) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HeaderMutation.ProtoReflect.Descriptor instead. -func (*HeaderMutation) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{13} -} - -func (x *HeaderMutation) GetSetHeaders() []*v31.HeaderValueOption { - if x != nil { - return x.SetHeaders - } - return nil -} - -func (x *HeaderMutation) GetRemoveHeaders() []string { - if x != nil { - return x.RemoveHeaders - } - return nil -} - -// The body response message corresponding to “FULL_DUPLEX_STREAMED“ or “GRPC“ body modes. -type StreamedBodyResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // In “FULL_DUPLEX_STREAMED“ body send mode, contains the body response chunk that will be - // passed to the upstream/downstream by the data plane. In “GRPC“ body send mode, contains - // a serialized gRPC message to be passed to the upstream/downstream by the data plane. - Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // The server sets this flag to true if it has received a body request with - // :ref:`end_of_stream ` set to true, - // and this is the last chunk of body responses. - // Note that in “GRPC“ body send mode, this allows the ext_proc - // server to tell the data plane to send a half close after a client - // message, which will result in discarding any other messages sent by - // the client application. - EndOfStream bool `protobuf:"varint,2,opt,name=end_of_stream,json=endOfStream,proto3" json:"end_of_stream,omitempty"` - // This field is used in “GRPC“ body send mode when “end_of_stream“ is - // true and “body“ is empty. Those values would normally indicate an - // empty message on the stream with the end-of-stream bit set. - // However, if the half-close happens after the last message on the - // stream was already sent, then this field will be true to indicate an - // end-of-stream with *no* message (as opposed to an empty message). - EndOfStreamWithoutMessage bool `protobuf:"varint,3,opt,name=end_of_stream_without_message,json=endOfStreamWithoutMessage,proto3" json:"end_of_stream_without_message,omitempty"` - // This field is used in “GRPC“ body send mode to indicate whether - // the message is compressed. This will never be set to true by gRPC - // but may be set to true by a proxy like Envoy. - GrpcMessageCompressed bool `protobuf:"varint,4,opt,name=grpc_message_compressed,json=grpcMessageCompressed,proto3" json:"grpc_message_compressed,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StreamedBodyResponse) Reset() { - *x = StreamedBodyResponse{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StreamedBodyResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamedBodyResponse) ProtoMessage() {} - -func (x *StreamedBodyResponse) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StreamedBodyResponse.ProtoReflect.Descriptor instead. -func (*StreamedBodyResponse) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{14} -} - -func (x *StreamedBodyResponse) GetBody() []byte { - if x != nil { - return x.Body - } - return nil -} - -func (x *StreamedBodyResponse) GetEndOfStream() bool { - if x != nil { - return x.EndOfStream - } - return false -} - -func (x *StreamedBodyResponse) GetEndOfStreamWithoutMessage() bool { - if x != nil { - return x.EndOfStreamWithoutMessage - } - return false -} - -func (x *StreamedBodyResponse) GetGrpcMessageCompressed() bool { - if x != nil { - return x.GrpcMessageCompressed - } - return false -} - -// This message specifies the body mutation the server sends to the data plane. -type BodyMutation struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The type of mutation for the body. - // - // Types that are valid to be assigned to Mutation: - // - // *BodyMutation_Body - // *BodyMutation_ClearBody - // *BodyMutation_StreamedResponse - Mutation isBodyMutation_Mutation `protobuf_oneof:"mutation"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BodyMutation) Reset() { - *x = BodyMutation{} - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BodyMutation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BodyMutation) ProtoMessage() {} - -func (x *BodyMutation) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BodyMutation.ProtoReflect.Descriptor instead. -func (*BodyMutation) Descriptor() ([]byte, []int) { - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP(), []int{15} -} - -func (x *BodyMutation) GetMutation() isBodyMutation_Mutation { - if x != nil { - return x.Mutation - } - return nil -} - -func (x *BodyMutation) GetBody() []byte { - if x != nil { - if x, ok := x.Mutation.(*BodyMutation_Body); ok { - return x.Body - } - } - return nil -} - -func (x *BodyMutation) GetClearBody() bool { - if x != nil { - if x, ok := x.Mutation.(*BodyMutation_ClearBody); ok { - return x.ClearBody - } - } - return false -} - -func (x *BodyMutation) GetStreamedResponse() *StreamedBodyResponse { - if x != nil { - if x, ok := x.Mutation.(*BodyMutation_StreamedResponse); ok { - return x.StreamedResponse - } - } - return nil -} - -type isBodyMutation_Mutation interface { - isBodyMutation_Mutation() -} - -type BodyMutation_Body struct { - // The entire body to replace. - // Should only be used when the corresponding “BodySendMode“ in the - // :ref:`processing_mode ` - // is not set to “FULL_DUPLEX_STREAMED“ or “GRPC“. - Body []byte `protobuf:"bytes,1,opt,name=body,proto3,oneof"` -} - -type BodyMutation_ClearBody struct { - // Clear the corresponding body chunk. - // Should only be used when the corresponding “BodySendMode“ in the - // :ref:`processing_mode ` - // is not set to “FULL_DUPLEX_STREAMED“ or “GRPC“. - // Clear the corresponding body chunk. - ClearBody bool `protobuf:"varint,2,opt,name=clear_body,json=clearBody,proto3,oneof"` -} - -type BodyMutation_StreamedResponse struct { - // Must be used when the corresponding “BodySendMode“ in the - // :ref:`processing_mode ` - // is set to “FULL_DUPLEX_STREAMED“ or “GRPC“. - StreamedResponse *StreamedBodyResponse `protobuf:"bytes,3,opt,name=streamed_response,json=streamedResponse,proto3,oneof"` -} - -func (*BodyMutation_Body) isBodyMutation_Mutation() {} - -func (*BodyMutation_ClearBody) isBodyMutation_Mutation() {} - -func (*BodyMutation_StreamedResponse) isBodyMutation_Mutation() {} - -var File_envoy_service_ext_proc_v3_external_processor_proto protoreflect.FileDescriptor - -const file_envoy_service_ext_proc_v3_external_processor_proto_rawDesc = "" + - "\n" + - "2envoy/service/ext_proc/v3/external_processor.proto\x12\x19envoy.service.ext_proc.v3\x1a\x1fenvoy/config/core/v3/base.proto\x1a?envoy/extensions/filters/http/ext_proc/v3/processing_mode.proto\x1a\x1fenvoy/type/v3/http_status.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fxds/annotations/v3/status.proto\x1a#envoy/annotations/deprecation.proto\x1a\x1dudpa/annotations/status.proto\x1a\x17validate/validate.proto\"\xf5\x02\n" + - "\x15ProtocolConfiguration\x12|\n" + - "\x11request_body_mode\x18\x01 \x01(\x0e2F.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x0frequestBodyMode\x12~\n" + - "\x12response_body_mode\x18\x02 \x01(\x0e2F.envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendModeB\b\xfaB\x05\x82\x01\x02\x10\x01R\x10responseBodyMode\x12^\n" + - "-send_body_without_waiting_for_header_response\x18\x03 \x01(\bR'sendBodyWithoutWaitingForHeaderResponse\"\xac\a\n" + - "\x11ProcessingRequest\x12Q\n" + - "\x0frequest_headers\x18\x02 \x01(\v2&.envoy.service.ext_proc.v3.HttpHeadersH\x00R\x0erequestHeaders\x12S\n" + - "\x10response_headers\x18\x03 \x01(\v2&.envoy.service.ext_proc.v3.HttpHeadersH\x00R\x0fresponseHeaders\x12H\n" + - "\frequest_body\x18\x04 \x01(\v2#.envoy.service.ext_proc.v3.HttpBodyH\x00R\vrequestBody\x12J\n" + - "\rresponse_body\x18\x05 \x01(\v2#.envoy.service.ext_proc.v3.HttpBodyH\x00R\fresponseBody\x12T\n" + - "\x10request_trailers\x18\x06 \x01(\v2'.envoy.service.ext_proc.v3.HttpTrailersH\x00R\x0frequestTrailers\x12V\n" + - "\x11response_trailers\x18\a \x01(\v2'.envoy.service.ext_proc.v3.HttpTrailersH\x00R\x10responseTrailers\x12I\n" + - "\x10metadata_context\x18\b \x01(\v2\x1e.envoy.config.core.v3.MetadataR\x0fmetadataContext\x12\\\n" + - "\n" + - "attributes\x18\t \x03(\v2<.envoy.service.ext_proc.v3.ProcessingRequest.AttributesEntryR\n" + - "attributes\x12-\n" + - "\x12observability_mode\x18\n" + - " \x01(\bR\x11observabilityMode\x12Y\n" + - "\x0fprotocol_config\x18\v \x01(\v20.envoy.service.ext_proc.v3.ProtocolConfigurationR\x0eprotocolConfig\x1aV\n" + - "\x0fAttributesEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12-\n" + - "\x05value\x18\x02 \x01(\v2\x17.google.protobuf.StructR\x05value:\x028\x01B\x0e\n" + - "\arequest\x12\x03\xf8B\x01J\x04\b\x01\x10\x02R\n" + - "async_mode\"\x9e\b\n" + - "\x12ProcessingResponse\x12U\n" + - "\x0frequest_headers\x18\x01 \x01(\v2*.envoy.service.ext_proc.v3.HeadersResponseH\x00R\x0erequestHeaders\x12W\n" + - "\x10response_headers\x18\x02 \x01(\v2*.envoy.service.ext_proc.v3.HeadersResponseH\x00R\x0fresponseHeaders\x12L\n" + - "\frequest_body\x18\x03 \x01(\v2'.envoy.service.ext_proc.v3.BodyResponseH\x00R\vrequestBody\x12N\n" + - "\rresponse_body\x18\x04 \x01(\v2'.envoy.service.ext_proc.v3.BodyResponseH\x00R\fresponseBody\x12X\n" + - "\x10request_trailers\x18\x05 \x01(\v2+.envoy.service.ext_proc.v3.TrailersResponseH\x00R\x0frequestTrailers\x12Z\n" + - "\x11response_trailers\x18\x06 \x01(\v2+.envoy.service.ext_proc.v3.TrailersResponseH\x00R\x10responseTrailers\x12]\n" + - "\x12immediate_response\x18\a \x01(\v2,.envoy.service.ext_proc.v3.ImmediateResponseH\x00R\x11immediateResponse\x12v\n" + - "\x1bstreamed_immediate_response\x18\v \x01(\v24.envoy.service.ext_proc.v3.StreamedImmediateResponseH\x00R\x19streamedImmediateResponse\x12B\n" + - "\x10dynamic_metadata\x18\b \x01(\v2\x17.google.protobuf.StructR\x0fdynamicMetadata\x12^\n" + - "\rmode_override\x18\t \x01(\v29.envoy.extensions.filters.http.ext_proc.v3.ProcessingModeR\fmodeOverride\x12#\n" + - "\rrequest_drain\x18\f \x01(\bR\frequestDrain\x12S\n" + - "\x18override_message_timeout\x18\n" + - " \x01(\v2\x19.google.protobuf.DurationR\x16overrideMessageTimeoutB\x0f\n" + - "\bresponse\x12\x03\xf8B\x01\"\xa9\x02\n" + - "\vHttpHeaders\x129\n" + - "\aheaders\x18\x01 \x01(\v2\x1f.envoy.config.core.v3.HeaderMapR\aheaders\x12c\n" + - "\n" + - "attributes\x18\x02 \x03(\v26.envoy.service.ext_proc.v3.HttpHeaders.AttributesEntryB\v\x92dž\xd8\x04\x033.0\x18\x01R\n" + - "attributes\x12\"\n" + - "\rend_of_stream\x18\x03 \x01(\bR\vendOfStream\x1aV\n" + - "\x0fAttributesEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12-\n" + - "\x05value\x18\x02 \x01(\v2\x17.google.protobuf.StructR\x05value:\x028\x01\"\xbc\x01\n" + - "\bHttpBody\x12\x12\n" + - "\x04body\x18\x01 \x01(\fR\x04body\x12\"\n" + - "\rend_of_stream\x18\x02 \x01(\bR\vendOfStream\x12@\n" + - "\x1dend_of_stream_without_message\x18\x03 \x01(\bR\x19endOfStreamWithoutMessage\x126\n" + - "\x17grpc_message_compressed\x18\x04 \x01(\bR\x15grpcMessageCompressed\"K\n" + - "\fHttpTrailers\x12;\n" + - "\btrailers\x18\x01 \x01(\v2\x1f.envoy.config.core.v3.HeaderMapR\btrailers\"X\n" + - "\x0fHeadersResponse\x12E\n" + - "\bresponse\x18\x01 \x01(\v2).envoy.service.ext_proc.v3.CommonResponseR\bresponse\"U\n" + - "\fBodyResponse\x12E\n" + - "\bresponse\x18\x01 \x01(\v2).envoy.service.ext_proc.v3.CommonResponseR\bresponse\"f\n" + - "\x10TrailersResponse\x12R\n" + - "\x0fheader_mutation\x18\x01 \x01(\v2).envoy.service.ext_proc.v3.HeaderMutationR\x0eheaderMutation\"\xa4\x02\n" + - "\x19StreamedImmediateResponse\x12S\n" + - "\x10headers_response\x18\x01 \x01(\v2&.envoy.service.ext_proc.v3.HttpHeadersH\x00R\x0fheadersResponse\x12V\n" + - "\rbody_response\x18\x02 \x01(\v2/.envoy.service.ext_proc.v3.StreamedBodyResponseH\x00R\fbodyResponse\x12N\n" + - "\x11trailers_response\x18\x03 \x01(\v2\x1f.envoy.config.core.v3.HeaderMapH\x00R\x10trailersResponseB\n" + - "\n" + - "\bresponse\"\xb1\x03\n" + - "\x0eCommonResponse\x12Z\n" + - "\x06status\x18\x01 \x01(\x0e28.envoy.service.ext_proc.v3.CommonResponse.ResponseStatusB\b\xfaB\x05\x82\x01\x02\x10\x01R\x06status\x12R\n" + - "\x0fheader_mutation\x18\x02 \x01(\v2).envoy.service.ext_proc.v3.HeaderMutationR\x0eheaderMutation\x12L\n" + - "\rbody_mutation\x18\x03 \x01(\v2'.envoy.service.ext_proc.v3.BodyMutationR\fbodyMutation\x12;\n" + - "\btrailers\x18\x04 \x01(\v2\x1f.envoy.config.core.v3.HeaderMapR\btrailers\x12*\n" + - "\x11clear_route_cache\x18\x05 \x01(\bR\x0fclearRouteCache\"8\n" + - "\x0eResponseStatus\x12\f\n" + - "\bCONTINUE\x10\x00\x12\x18\n" + - "\x14CONTINUE_AND_REPLACE\x10\x01\"\x8b\x02\n" + - "\x11ImmediateResponse\x12;\n" + - "\x06status\x18\x01 \x01(\v2\x19.envoy.type.v3.HttpStatusB\b\xfaB\x05\x8a\x01\x02\x10\x01R\x06status\x12C\n" + - "\aheaders\x18\x02 \x01(\v2).envoy.service.ext_proc.v3.HeaderMutationR\aheaders\x12\x12\n" + - "\x04body\x18\x03 \x01(\fR\x04body\x12F\n" + - "\vgrpc_status\x18\x04 \x01(\v2%.envoy.service.ext_proc.v3.GrpcStatusR\n" + - "grpcStatus\x12\x18\n" + - "\adetails\x18\x05 \x01(\tR\adetails\"$\n" + - "\n" + - "GrpcStatus\x12\x16\n" + - "\x06status\x18\x01 \x01(\rR\x06status\"\x81\x01\n" + - "\x0eHeaderMutation\x12H\n" + - "\vset_headers\x18\x01 \x03(\v2'.envoy.config.core.v3.HeaderValueOptionR\n" + - "setHeaders\x12%\n" + - "\x0eremove_headers\x18\x02 \x03(\tR\rremoveHeaders\"\xc8\x01\n" + - "\x14StreamedBodyResponse\x12\x12\n" + - "\x04body\x18\x01 \x01(\fR\x04body\x12\"\n" + - "\rend_of_stream\x18\x02 \x01(\bR\vendOfStream\x12@\n" + - "\x1dend_of_stream_without_message\x18\x03 \x01(\bR\x19endOfStreamWithoutMessage\x126\n" + - "\x17grpc_message_compressed\x18\x04 \x01(\bR\x15grpcMessageCompressed\"\xbb\x01\n" + - "\fBodyMutation\x12\x14\n" + - "\x04body\x18\x01 \x01(\fH\x00R\x04body\x12\x1f\n" + - "\n" + - "clear_body\x18\x02 \x01(\bH\x00R\tclearBody\x12h\n" + - "\x11streamed_response\x18\x03 \x01(\v2/.envoy.service.ext_proc.v3.StreamedBodyResponseB\b\xd2Ƥ\xe1\x06\x02\b\x01H\x00R\x10streamedResponseB\n" + - "\n" + - "\bmutation2\x81\x01\n" + - "\x11ExternalProcessor\x12l\n" + - "\aProcess\x12,.envoy.service.ext_proc.v3.ProcessingRequest\x1a-.envoy.service.ext_proc.v3.ProcessingResponse\"\x00(\x010\x01B\x98\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "'io.envoyproxy.envoy.service.ext_proc.v3B\x16ExternalProcessorProtoP\x01ZKgithub.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3;ext_procv3b\x06proto3" - -var ( - file_envoy_service_ext_proc_v3_external_processor_proto_rawDescOnce sync.Once - file_envoy_service_ext_proc_v3_external_processor_proto_rawDescData []byte -) - -func file_envoy_service_ext_proc_v3_external_processor_proto_rawDescGZIP() []byte { - file_envoy_service_ext_proc_v3_external_processor_proto_rawDescOnce.Do(func() { - file_envoy_service_ext_proc_v3_external_processor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_ext_proc_v3_external_processor_proto_rawDesc), len(file_envoy_service_ext_proc_v3_external_processor_proto_rawDesc))) - }) - return file_envoy_service_ext_proc_v3_external_processor_proto_rawDescData -} - -var file_envoy_service_ext_proc_v3_external_processor_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes = make([]protoimpl.MessageInfo, 18) -var file_envoy_service_ext_proc_v3_external_processor_proto_goTypes = []any{ - (CommonResponse_ResponseStatus)(0), // 0: envoy.service.ext_proc.v3.CommonResponse.ResponseStatus - (*ProtocolConfiguration)(nil), // 1: envoy.service.ext_proc.v3.ProtocolConfiguration - (*ProcessingRequest)(nil), // 2: envoy.service.ext_proc.v3.ProcessingRequest - (*ProcessingResponse)(nil), // 3: envoy.service.ext_proc.v3.ProcessingResponse - (*HttpHeaders)(nil), // 4: envoy.service.ext_proc.v3.HttpHeaders - (*HttpBody)(nil), // 5: envoy.service.ext_proc.v3.HttpBody - (*HttpTrailers)(nil), // 6: envoy.service.ext_proc.v3.HttpTrailers - (*HeadersResponse)(nil), // 7: envoy.service.ext_proc.v3.HeadersResponse - (*BodyResponse)(nil), // 8: envoy.service.ext_proc.v3.BodyResponse - (*TrailersResponse)(nil), // 9: envoy.service.ext_proc.v3.TrailersResponse - (*StreamedImmediateResponse)(nil), // 10: envoy.service.ext_proc.v3.StreamedImmediateResponse - (*CommonResponse)(nil), // 11: envoy.service.ext_proc.v3.CommonResponse - (*ImmediateResponse)(nil), // 12: envoy.service.ext_proc.v3.ImmediateResponse - (*GrpcStatus)(nil), // 13: envoy.service.ext_proc.v3.GrpcStatus - (*HeaderMutation)(nil), // 14: envoy.service.ext_proc.v3.HeaderMutation - (*StreamedBodyResponse)(nil), // 15: envoy.service.ext_proc.v3.StreamedBodyResponse - (*BodyMutation)(nil), // 16: envoy.service.ext_proc.v3.BodyMutation - nil, // 17: envoy.service.ext_proc.v3.ProcessingRequest.AttributesEntry - nil, // 18: envoy.service.ext_proc.v3.HttpHeaders.AttributesEntry - (v3.ProcessingMode_BodySendMode)(0), // 19: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendMode - (*v31.Metadata)(nil), // 20: envoy.config.core.v3.Metadata - (*structpb.Struct)(nil), // 21: google.protobuf.Struct - (*v3.ProcessingMode)(nil), // 22: envoy.extensions.filters.http.ext_proc.v3.ProcessingMode - (*durationpb.Duration)(nil), // 23: google.protobuf.Duration - (*v31.HeaderMap)(nil), // 24: envoy.config.core.v3.HeaderMap - (*v32.HttpStatus)(nil), // 25: envoy.type.v3.HttpStatus - (*v31.HeaderValueOption)(nil), // 26: envoy.config.core.v3.HeaderValueOption -} -var file_envoy_service_ext_proc_v3_external_processor_proto_depIdxs = []int32{ - 19, // 0: envoy.service.ext_proc.v3.ProtocolConfiguration.request_body_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendMode - 19, // 1: envoy.service.ext_proc.v3.ProtocolConfiguration.response_body_mode:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode.BodySendMode - 4, // 2: envoy.service.ext_proc.v3.ProcessingRequest.request_headers:type_name -> envoy.service.ext_proc.v3.HttpHeaders - 4, // 3: envoy.service.ext_proc.v3.ProcessingRequest.response_headers:type_name -> envoy.service.ext_proc.v3.HttpHeaders - 5, // 4: envoy.service.ext_proc.v3.ProcessingRequest.request_body:type_name -> envoy.service.ext_proc.v3.HttpBody - 5, // 5: envoy.service.ext_proc.v3.ProcessingRequest.response_body:type_name -> envoy.service.ext_proc.v3.HttpBody - 6, // 6: envoy.service.ext_proc.v3.ProcessingRequest.request_trailers:type_name -> envoy.service.ext_proc.v3.HttpTrailers - 6, // 7: envoy.service.ext_proc.v3.ProcessingRequest.response_trailers:type_name -> envoy.service.ext_proc.v3.HttpTrailers - 20, // 8: envoy.service.ext_proc.v3.ProcessingRequest.metadata_context:type_name -> envoy.config.core.v3.Metadata - 17, // 9: envoy.service.ext_proc.v3.ProcessingRequest.attributes:type_name -> envoy.service.ext_proc.v3.ProcessingRequest.AttributesEntry - 1, // 10: envoy.service.ext_proc.v3.ProcessingRequest.protocol_config:type_name -> envoy.service.ext_proc.v3.ProtocolConfiguration - 7, // 11: envoy.service.ext_proc.v3.ProcessingResponse.request_headers:type_name -> envoy.service.ext_proc.v3.HeadersResponse - 7, // 12: envoy.service.ext_proc.v3.ProcessingResponse.response_headers:type_name -> envoy.service.ext_proc.v3.HeadersResponse - 8, // 13: envoy.service.ext_proc.v3.ProcessingResponse.request_body:type_name -> envoy.service.ext_proc.v3.BodyResponse - 8, // 14: envoy.service.ext_proc.v3.ProcessingResponse.response_body:type_name -> envoy.service.ext_proc.v3.BodyResponse - 9, // 15: envoy.service.ext_proc.v3.ProcessingResponse.request_trailers:type_name -> envoy.service.ext_proc.v3.TrailersResponse - 9, // 16: envoy.service.ext_proc.v3.ProcessingResponse.response_trailers:type_name -> envoy.service.ext_proc.v3.TrailersResponse - 12, // 17: envoy.service.ext_proc.v3.ProcessingResponse.immediate_response:type_name -> envoy.service.ext_proc.v3.ImmediateResponse - 10, // 18: envoy.service.ext_proc.v3.ProcessingResponse.streamed_immediate_response:type_name -> envoy.service.ext_proc.v3.StreamedImmediateResponse - 21, // 19: envoy.service.ext_proc.v3.ProcessingResponse.dynamic_metadata:type_name -> google.protobuf.Struct - 22, // 20: envoy.service.ext_proc.v3.ProcessingResponse.mode_override:type_name -> envoy.extensions.filters.http.ext_proc.v3.ProcessingMode - 23, // 21: envoy.service.ext_proc.v3.ProcessingResponse.override_message_timeout:type_name -> google.protobuf.Duration - 24, // 22: envoy.service.ext_proc.v3.HttpHeaders.headers:type_name -> envoy.config.core.v3.HeaderMap - 18, // 23: envoy.service.ext_proc.v3.HttpHeaders.attributes:type_name -> envoy.service.ext_proc.v3.HttpHeaders.AttributesEntry - 24, // 24: envoy.service.ext_proc.v3.HttpTrailers.trailers:type_name -> envoy.config.core.v3.HeaderMap - 11, // 25: envoy.service.ext_proc.v3.HeadersResponse.response:type_name -> envoy.service.ext_proc.v3.CommonResponse - 11, // 26: envoy.service.ext_proc.v3.BodyResponse.response:type_name -> envoy.service.ext_proc.v3.CommonResponse - 14, // 27: envoy.service.ext_proc.v3.TrailersResponse.header_mutation:type_name -> envoy.service.ext_proc.v3.HeaderMutation - 4, // 28: envoy.service.ext_proc.v3.StreamedImmediateResponse.headers_response:type_name -> envoy.service.ext_proc.v3.HttpHeaders - 15, // 29: envoy.service.ext_proc.v3.StreamedImmediateResponse.body_response:type_name -> envoy.service.ext_proc.v3.StreamedBodyResponse - 24, // 30: envoy.service.ext_proc.v3.StreamedImmediateResponse.trailers_response:type_name -> envoy.config.core.v3.HeaderMap - 0, // 31: envoy.service.ext_proc.v3.CommonResponse.status:type_name -> envoy.service.ext_proc.v3.CommonResponse.ResponseStatus - 14, // 32: envoy.service.ext_proc.v3.CommonResponse.header_mutation:type_name -> envoy.service.ext_proc.v3.HeaderMutation - 16, // 33: envoy.service.ext_proc.v3.CommonResponse.body_mutation:type_name -> envoy.service.ext_proc.v3.BodyMutation - 24, // 34: envoy.service.ext_proc.v3.CommonResponse.trailers:type_name -> envoy.config.core.v3.HeaderMap - 25, // 35: envoy.service.ext_proc.v3.ImmediateResponse.status:type_name -> envoy.type.v3.HttpStatus - 14, // 36: envoy.service.ext_proc.v3.ImmediateResponse.headers:type_name -> envoy.service.ext_proc.v3.HeaderMutation - 13, // 37: envoy.service.ext_proc.v3.ImmediateResponse.grpc_status:type_name -> envoy.service.ext_proc.v3.GrpcStatus - 26, // 38: envoy.service.ext_proc.v3.HeaderMutation.set_headers:type_name -> envoy.config.core.v3.HeaderValueOption - 15, // 39: envoy.service.ext_proc.v3.BodyMutation.streamed_response:type_name -> envoy.service.ext_proc.v3.StreamedBodyResponse - 21, // 40: envoy.service.ext_proc.v3.ProcessingRequest.AttributesEntry.value:type_name -> google.protobuf.Struct - 21, // 41: envoy.service.ext_proc.v3.HttpHeaders.AttributesEntry.value:type_name -> google.protobuf.Struct - 2, // 42: envoy.service.ext_proc.v3.ExternalProcessor.Process:input_type -> envoy.service.ext_proc.v3.ProcessingRequest - 3, // 43: envoy.service.ext_proc.v3.ExternalProcessor.Process:output_type -> envoy.service.ext_proc.v3.ProcessingResponse - 43, // [43:44] is the sub-list for method output_type - 42, // [42:43] is the sub-list for method input_type - 42, // [42:42] is the sub-list for extension type_name - 42, // [42:42] is the sub-list for extension extendee - 0, // [0:42] is the sub-list for field type_name -} - -func init() { file_envoy_service_ext_proc_v3_external_processor_proto_init() } -func file_envoy_service_ext_proc_v3_external_processor_proto_init() { - if File_envoy_service_ext_proc_v3_external_processor_proto != nil { - return - } - file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[1].OneofWrappers = []any{ - (*ProcessingRequest_RequestHeaders)(nil), - (*ProcessingRequest_ResponseHeaders)(nil), - (*ProcessingRequest_RequestBody)(nil), - (*ProcessingRequest_ResponseBody)(nil), - (*ProcessingRequest_RequestTrailers)(nil), - (*ProcessingRequest_ResponseTrailers)(nil), - } - file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[2].OneofWrappers = []any{ - (*ProcessingResponse_RequestHeaders)(nil), - (*ProcessingResponse_ResponseHeaders)(nil), - (*ProcessingResponse_RequestBody)(nil), - (*ProcessingResponse_ResponseBody)(nil), - (*ProcessingResponse_RequestTrailers)(nil), - (*ProcessingResponse_ResponseTrailers)(nil), - (*ProcessingResponse_ImmediateResponse)(nil), - (*ProcessingResponse_StreamedImmediateResponse)(nil), - } - file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[9].OneofWrappers = []any{ - (*StreamedImmediateResponse_HeadersResponse)(nil), - (*StreamedImmediateResponse_BodyResponse)(nil), - (*StreamedImmediateResponse_TrailersResponse)(nil), - } - file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes[15].OneofWrappers = []any{ - (*BodyMutation_Body)(nil), - (*BodyMutation_ClearBody)(nil), - (*BodyMutation_StreamedResponse)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_ext_proc_v3_external_processor_proto_rawDesc), len(file_envoy_service_ext_proc_v3_external_processor_proto_rawDesc)), - NumEnums: 1, - NumMessages: 18, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_ext_proc_v3_external_processor_proto_goTypes, - DependencyIndexes: file_envoy_service_ext_proc_v3_external_processor_proto_depIdxs, - EnumInfos: file_envoy_service_ext_proc_v3_external_processor_proto_enumTypes, - MessageInfos: file_envoy_service_ext_proc_v3_external_processor_proto_msgTypes, - }.Build() - File_envoy_service_ext_proc_v3_external_processor_proto = out.File - file_envoy_service_ext_proc_v3_external_processor_proto_goTypes = nil - file_envoy_service_ext_proc_v3_external_processor_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor.pb.validate.go deleted file mode 100644 index 6725377ac..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor.pb.validate.go +++ /dev/null @@ -1,3131 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/ext_proc/v3/external_processor.proto - -package ext_procv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" - - v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort - - _ = v3.ProcessingMode_BodySendMode(0) -) - -// Validate checks the field values on ProtocolConfiguration with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ProtocolConfiguration) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ProtocolConfiguration with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ProtocolConfigurationMultiError, or nil if none found. -func (m *ProtocolConfiguration) ValidateAll() error { - return m.validate(true) -} - -func (m *ProtocolConfiguration) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := v3.ProcessingMode_BodySendMode_name[int32(m.GetRequestBodyMode())]; !ok { - err := ProtocolConfigurationValidationError{ - field: "RequestBodyMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if _, ok := v3.ProcessingMode_BodySendMode_name[int32(m.GetResponseBodyMode())]; !ok { - err := ProtocolConfigurationValidationError{ - field: "ResponseBodyMode", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - // no validation rules for SendBodyWithoutWaitingForHeaderResponse - - if len(errors) > 0 { - return ProtocolConfigurationMultiError(errors) - } - - return nil -} - -// ProtocolConfigurationMultiError is an error wrapping multiple validation -// errors returned by ProtocolConfiguration.ValidateAll() if the designated -// constraints aren't met. -type ProtocolConfigurationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ProtocolConfigurationMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ProtocolConfigurationMultiError) AllErrors() []error { return m } - -// ProtocolConfigurationValidationError is the validation error returned by -// ProtocolConfiguration.Validate if the designated constraints aren't met. -type ProtocolConfigurationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ProtocolConfigurationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ProtocolConfigurationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ProtocolConfigurationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ProtocolConfigurationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ProtocolConfigurationValidationError) ErrorName() string { - return "ProtocolConfigurationValidationError" -} - -// Error satisfies the builtin error interface -func (e ProtocolConfigurationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sProtocolConfiguration.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ProtocolConfigurationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ProtocolConfigurationValidationError{} - -// Validate checks the field values on ProcessingRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ProcessingRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ProcessingRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ProcessingRequestMultiError, or nil if none found. -func (m *ProcessingRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ProcessingRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetMetadataContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "MetadataContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "MetadataContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetMetadataContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "MetadataContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - { - sorted_keys := make([]string, len(m.GetAttributes())) - i := 0 - for key := range m.GetAttributes() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetAttributes()[key] - _ = val - - // no validation rules for Attributes[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: fmt.Sprintf("Attributes[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: fmt.Sprintf("Attributes[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: fmt.Sprintf("Attributes[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - // no validation rules for ObservabilityMode - - if all { - switch v := interface{}(m.GetProtocolConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ProtocolConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ProtocolConfig", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetProtocolConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "ProtocolConfig", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofRequestPresent := false - switch v := m.Request.(type) { - case *ProcessingRequest_RequestHeaders: - if v == nil { - err := ProcessingRequestValidationError{ - field: "Request", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofRequestPresent = true - - if all { - switch v := interface{}(m.GetRequestHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingRequest_ResponseHeaders: - if v == nil { - err := ProcessingRequestValidationError{ - field: "Request", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofRequestPresent = true - - if all { - switch v := interface{}(m.GetResponseHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ResponseHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ResponseHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponseHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "ResponseHeaders", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingRequest_RequestBody: - if v == nil { - err := ProcessingRequestValidationError{ - field: "Request", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofRequestPresent = true - - if all { - switch v := interface{}(m.GetRequestBody()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "RequestBody", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "RequestBody", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestBody()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "RequestBody", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingRequest_ResponseBody: - if v == nil { - err := ProcessingRequestValidationError{ - field: "Request", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofRequestPresent = true - - if all { - switch v := interface{}(m.GetResponseBody()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ResponseBody", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ResponseBody", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponseBody()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "ResponseBody", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingRequest_RequestTrailers: - if v == nil { - err := ProcessingRequestValidationError{ - field: "Request", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofRequestPresent = true - - if all { - switch v := interface{}(m.GetRequestTrailers()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "RequestTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "RequestTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestTrailers()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "RequestTrailers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingRequest_ResponseTrailers: - if v == nil { - err := ProcessingRequestValidationError{ - field: "Request", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofRequestPresent = true - - if all { - switch v := interface{}(m.GetResponseTrailers()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ResponseTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingRequestValidationError{ - field: "ResponseTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponseTrailers()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingRequestValidationError{ - field: "ResponseTrailers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofRequestPresent { - err := ProcessingRequestValidationError{ - field: "Request", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ProcessingRequestMultiError(errors) - } - - return nil -} - -// ProcessingRequestMultiError is an error wrapping multiple validation errors -// returned by ProcessingRequest.ValidateAll() if the designated constraints -// aren't met. -type ProcessingRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ProcessingRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ProcessingRequestMultiError) AllErrors() []error { return m } - -// ProcessingRequestValidationError is the validation error returned by -// ProcessingRequest.Validate if the designated constraints aren't met. -type ProcessingRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ProcessingRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ProcessingRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ProcessingRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ProcessingRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ProcessingRequestValidationError) ErrorName() string { - return "ProcessingRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ProcessingRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sProcessingRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ProcessingRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ProcessingRequestValidationError{} - -// Validate checks the field values on ProcessingResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ProcessingResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ProcessingResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ProcessingResponseMultiError, or nil if none found. -func (m *ProcessingResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ProcessingResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetDynamicMetadata()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "DynamicMetadata", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetModeOverride()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ModeOverride", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ModeOverride", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetModeOverride()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "ModeOverride", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for RequestDrain - - if all { - switch v := interface{}(m.GetOverrideMessageTimeout()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "OverrideMessageTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "OverrideMessageTimeout", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOverrideMessageTimeout()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "OverrideMessageTimeout", - reason: "embedded message failed validation", - cause: err, - } - } - } - - oneofResponsePresent := false - switch v := m.Response.(type) { - case *ProcessingResponse_RequestHeaders: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetRequestHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "RequestHeaders", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingResponse_ResponseHeaders: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetResponseHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ResponseHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ResponseHeaders", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponseHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "ResponseHeaders", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingResponse_RequestBody: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetRequestBody()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "RequestBody", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "RequestBody", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestBody()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "RequestBody", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingResponse_ResponseBody: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetResponseBody()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ResponseBody", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ResponseBody", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponseBody()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "ResponseBody", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingResponse_RequestTrailers: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetRequestTrailers()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "RequestTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "RequestTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRequestTrailers()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "RequestTrailers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingResponse_ResponseTrailers: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetResponseTrailers()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ResponseTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ResponseTrailers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponseTrailers()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "ResponseTrailers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingResponse_ImmediateResponse: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetImmediateResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ImmediateResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "ImmediateResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetImmediateResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "ImmediateResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ProcessingResponse_StreamedImmediateResponse: - if v == nil { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - oneofResponsePresent = true - - if all { - switch v := interface{}(m.GetStreamedImmediateResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "StreamedImmediateResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ProcessingResponseValidationError{ - field: "StreamedImmediateResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStreamedImmediateResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ProcessingResponseValidationError{ - field: "StreamedImmediateResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - if !oneofResponsePresent { - err := ProcessingResponseValidationError{ - field: "Response", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if len(errors) > 0 { - return ProcessingResponseMultiError(errors) - } - - return nil -} - -// ProcessingResponseMultiError is an error wrapping multiple validation errors -// returned by ProcessingResponse.ValidateAll() if the designated constraints -// aren't met. -type ProcessingResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ProcessingResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ProcessingResponseMultiError) AllErrors() []error { return m } - -// ProcessingResponseValidationError is the validation error returned by -// ProcessingResponse.Validate if the designated constraints aren't met. -type ProcessingResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ProcessingResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ProcessingResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ProcessingResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ProcessingResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ProcessingResponseValidationError) ErrorName() string { - return "ProcessingResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ProcessingResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sProcessingResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ProcessingResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ProcessingResponseValidationError{} - -// Validate checks the field values on HttpHeaders with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpHeaders) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpHeaders with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HttpHeadersMultiError, or -// nil if none found. -func (m *HttpHeaders) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpHeaders) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpHeadersValidationError{ - field: "Headers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpHeadersValidationError{ - field: "Headers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpHeadersValidationError{ - field: "Headers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - { - sorted_keys := make([]string, len(m.GetAttributes())) - i := 0 - for key := range m.GetAttributes() { - sorted_keys[i] = key - i++ - } - sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) - for _, key := range sorted_keys { - val := m.GetAttributes()[key] - _ = val - - // no validation rules for Attributes[key] - - if all { - switch v := interface{}(val).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpHeadersValidationError{ - field: fmt.Sprintf("Attributes[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpHeadersValidationError{ - field: fmt.Sprintf("Attributes[%v]", key), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(val).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpHeadersValidationError{ - field: fmt.Sprintf("Attributes[%v]", key), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - } - - // no validation rules for EndOfStream - - if len(errors) > 0 { - return HttpHeadersMultiError(errors) - } - - return nil -} - -// HttpHeadersMultiError is an error wrapping multiple validation errors -// returned by HttpHeaders.ValidateAll() if the designated constraints aren't met. -type HttpHeadersMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpHeadersMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpHeadersMultiError) AllErrors() []error { return m } - -// HttpHeadersValidationError is the validation error returned by -// HttpHeaders.Validate if the designated constraints aren't met. -type HttpHeadersValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpHeadersValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpHeadersValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpHeadersValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpHeadersValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpHeadersValidationError) ErrorName() string { return "HttpHeadersValidationError" } - -// Error satisfies the builtin error interface -func (e HttpHeadersValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpHeaders.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpHeadersValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpHeadersValidationError{} - -// Validate checks the field values on HttpBody with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpBody) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpBody with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HttpBodyMultiError, or nil -// if none found. -func (m *HttpBody) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpBody) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Body - - // no validation rules for EndOfStream - - // no validation rules for EndOfStreamWithoutMessage - - // no validation rules for GrpcMessageCompressed - - if len(errors) > 0 { - return HttpBodyMultiError(errors) - } - - return nil -} - -// HttpBodyMultiError is an error wrapping multiple validation errors returned -// by HttpBody.ValidateAll() if the designated constraints aren't met. -type HttpBodyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpBodyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpBodyMultiError) AllErrors() []error { return m } - -// HttpBodyValidationError is the validation error returned by -// HttpBody.Validate if the designated constraints aren't met. -type HttpBodyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpBodyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpBodyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpBodyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpBodyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpBodyValidationError) ErrorName() string { return "HttpBodyValidationError" } - -// Error satisfies the builtin error interface -func (e HttpBodyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpBody.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpBodyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpBodyValidationError{} - -// Validate checks the field values on HttpTrailers with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HttpTrailers) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HttpTrailers with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HttpTrailersMultiError, or -// nil if none found. -func (m *HttpTrailers) ValidateAll() error { - return m.validate(true) -} - -func (m *HttpTrailers) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTrailers()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HttpTrailersValidationError{ - field: "Trailers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HttpTrailersValidationError{ - field: "Trailers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTrailers()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HttpTrailersValidationError{ - field: "Trailers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return HttpTrailersMultiError(errors) - } - - return nil -} - -// HttpTrailersMultiError is an error wrapping multiple validation errors -// returned by HttpTrailers.ValidateAll() if the designated constraints aren't met. -type HttpTrailersMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HttpTrailersMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HttpTrailersMultiError) AllErrors() []error { return m } - -// HttpTrailersValidationError is the validation error returned by -// HttpTrailers.Validate if the designated constraints aren't met. -type HttpTrailersValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HttpTrailersValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HttpTrailersValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HttpTrailersValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HttpTrailersValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HttpTrailersValidationError) ErrorName() string { return "HttpTrailersValidationError" } - -// Error satisfies the builtin error interface -func (e HttpTrailersValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHttpTrailers.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HttpTrailersValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HttpTrailersValidationError{} - -// Validate checks the field values on HeadersResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *HeadersResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeadersResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// HeadersResponseMultiError, or nil if none found. -func (m *HeadersResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *HeadersResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeadersResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeadersResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeadersResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return HeadersResponseMultiError(errors) - } - - return nil -} - -// HeadersResponseMultiError is an error wrapping multiple validation errors -// returned by HeadersResponse.ValidateAll() if the designated constraints -// aren't met. -type HeadersResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeadersResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeadersResponseMultiError) AllErrors() []error { return m } - -// HeadersResponseValidationError is the validation error returned by -// HeadersResponse.Validate if the designated constraints aren't met. -type HeadersResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeadersResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeadersResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeadersResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeadersResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeadersResponseValidationError) ErrorName() string { return "HeadersResponseValidationError" } - -// Error satisfies the builtin error interface -func (e HeadersResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeadersResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeadersResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeadersResponseValidationError{} - -// Validate checks the field values on BodyResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *BodyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BodyResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in BodyResponseMultiError, or -// nil if none found. -func (m *BodyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *BodyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BodyResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BodyResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BodyResponseValidationError{ - field: "Response", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return BodyResponseMultiError(errors) - } - - return nil -} - -// BodyResponseMultiError is an error wrapping multiple validation errors -// returned by BodyResponse.ValidateAll() if the designated constraints aren't met. -type BodyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BodyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BodyResponseMultiError) AllErrors() []error { return m } - -// BodyResponseValidationError is the validation error returned by -// BodyResponse.Validate if the designated constraints aren't met. -type BodyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BodyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BodyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BodyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BodyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BodyResponseValidationError) ErrorName() string { return "BodyResponseValidationError" } - -// Error satisfies the builtin error interface -func (e BodyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBodyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BodyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BodyResponseValidationError{} - -// Validate checks the field values on TrailersResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *TrailersResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TrailersResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TrailersResponseMultiError, or nil if none found. -func (m *TrailersResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *TrailersResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetHeaderMutation()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TrailersResponseValidationError{ - field: "HeaderMutation", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TrailersResponseValidationError{ - field: "HeaderMutation", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeaderMutation()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TrailersResponseValidationError{ - field: "HeaderMutation", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return TrailersResponseMultiError(errors) - } - - return nil -} - -// TrailersResponseMultiError is an error wrapping multiple validation errors -// returned by TrailersResponse.ValidateAll() if the designated constraints -// aren't met. -type TrailersResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TrailersResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TrailersResponseMultiError) AllErrors() []error { return m } - -// TrailersResponseValidationError is the validation error returned by -// TrailersResponse.Validate if the designated constraints aren't met. -type TrailersResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TrailersResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TrailersResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TrailersResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TrailersResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TrailersResponseValidationError) ErrorName() string { return "TrailersResponseValidationError" } - -// Error satisfies the builtin error interface -func (e TrailersResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTrailersResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TrailersResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TrailersResponseValidationError{} - -// Validate checks the field values on StreamedImmediateResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *StreamedImmediateResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StreamedImmediateResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// StreamedImmediateResponseMultiError, or nil if none found. -func (m *StreamedImmediateResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *StreamedImmediateResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.Response.(type) { - case *StreamedImmediateResponse_HeadersResponse: - if v == nil { - err := StreamedImmediateResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHeadersResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StreamedImmediateResponseValidationError{ - field: "HeadersResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StreamedImmediateResponseValidationError{ - field: "HeadersResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeadersResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StreamedImmediateResponseValidationError{ - field: "HeadersResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *StreamedImmediateResponse_BodyResponse: - if v == nil { - err := StreamedImmediateResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetBodyResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StreamedImmediateResponseValidationError{ - field: "BodyResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StreamedImmediateResponseValidationError{ - field: "BodyResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetBodyResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StreamedImmediateResponseValidationError{ - field: "BodyResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *StreamedImmediateResponse_TrailersResponse: - if v == nil { - err := StreamedImmediateResponseValidationError{ - field: "Response", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTrailersResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, StreamedImmediateResponseValidationError{ - field: "TrailersResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, StreamedImmediateResponseValidationError{ - field: "TrailersResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTrailersResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return StreamedImmediateResponseValidationError{ - field: "TrailersResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return StreamedImmediateResponseMultiError(errors) - } - - return nil -} - -// StreamedImmediateResponseMultiError is an error wrapping multiple validation -// errors returned by StreamedImmediateResponse.ValidateAll() if the -// designated constraints aren't met. -type StreamedImmediateResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StreamedImmediateResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StreamedImmediateResponseMultiError) AllErrors() []error { return m } - -// StreamedImmediateResponseValidationError is the validation error returned by -// StreamedImmediateResponse.Validate if the designated constraints aren't met. -type StreamedImmediateResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StreamedImmediateResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StreamedImmediateResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StreamedImmediateResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StreamedImmediateResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StreamedImmediateResponseValidationError) ErrorName() string { - return "StreamedImmediateResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e StreamedImmediateResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStreamedImmediateResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StreamedImmediateResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StreamedImmediateResponseValidationError{} - -// Validate checks the field values on CommonResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CommonResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CommonResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CommonResponseMultiError, -// or nil if none found. -func (m *CommonResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *CommonResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if _, ok := CommonResponse_ResponseStatus_name[int32(m.GetStatus())]; !ok { - err := CommonResponseValidationError{ - field: "Status", - reason: "value must be one of the defined enum values", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetHeaderMutation()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CommonResponseValidationError{ - field: "HeaderMutation", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CommonResponseValidationError{ - field: "HeaderMutation", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeaderMutation()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CommonResponseValidationError{ - field: "HeaderMutation", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetBodyMutation()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CommonResponseValidationError{ - field: "BodyMutation", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CommonResponseValidationError{ - field: "BodyMutation", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetBodyMutation()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CommonResponseValidationError{ - field: "BodyMutation", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetTrailers()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CommonResponseValidationError{ - field: "Trailers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CommonResponseValidationError{ - field: "Trailers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTrailers()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CommonResponseValidationError{ - field: "Trailers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for ClearRouteCache - - if len(errors) > 0 { - return CommonResponseMultiError(errors) - } - - return nil -} - -// CommonResponseMultiError is an error wrapping multiple validation errors -// returned by CommonResponse.ValidateAll() if the designated constraints -// aren't met. -type CommonResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CommonResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CommonResponseMultiError) AllErrors() []error { return m } - -// CommonResponseValidationError is the validation error returned by -// CommonResponse.Validate if the designated constraints aren't met. -type CommonResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CommonResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CommonResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CommonResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CommonResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CommonResponseValidationError) ErrorName() string { return "CommonResponseValidationError" } - -// Error satisfies the builtin error interface -func (e CommonResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCommonResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CommonResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CommonResponseValidationError{} - -// Validate checks the field values on ImmediateResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ImmediateResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ImmediateResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ImmediateResponseMultiError, or nil if none found. -func (m *ImmediateResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ImmediateResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.GetStatus() == nil { - err := ImmediateResponseValidationError{ - field: "Status", - reason: "value is required", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetStatus()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ImmediateResponseValidationError{ - field: "Status", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ImmediateResponseValidationError{ - field: "Status", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ImmediateResponseValidationError{ - field: "Status", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetHeaders()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ImmediateResponseValidationError{ - field: "Headers", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ImmediateResponseValidationError{ - field: "Headers", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetHeaders()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ImmediateResponseValidationError{ - field: "Headers", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Body - - if all { - switch v := interface{}(m.GetGrpcStatus()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ImmediateResponseValidationError{ - field: "GrpcStatus", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ImmediateResponseValidationError{ - field: "GrpcStatus", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGrpcStatus()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ImmediateResponseValidationError{ - field: "GrpcStatus", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Details - - if len(errors) > 0 { - return ImmediateResponseMultiError(errors) - } - - return nil -} - -// ImmediateResponseMultiError is an error wrapping multiple validation errors -// returned by ImmediateResponse.ValidateAll() if the designated constraints -// aren't met. -type ImmediateResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ImmediateResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ImmediateResponseMultiError) AllErrors() []error { return m } - -// ImmediateResponseValidationError is the validation error returned by -// ImmediateResponse.Validate if the designated constraints aren't met. -type ImmediateResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ImmediateResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ImmediateResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ImmediateResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ImmediateResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ImmediateResponseValidationError) ErrorName() string { - return "ImmediateResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ImmediateResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sImmediateResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ImmediateResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ImmediateResponseValidationError{} - -// Validate checks the field values on GrpcStatus with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GrpcStatus) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GrpcStatus with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GrpcStatusMultiError, or -// nil if none found. -func (m *GrpcStatus) ValidateAll() error { - return m.validate(true) -} - -func (m *GrpcStatus) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Status - - if len(errors) > 0 { - return GrpcStatusMultiError(errors) - } - - return nil -} - -// GrpcStatusMultiError is an error wrapping multiple validation errors -// returned by GrpcStatus.ValidateAll() if the designated constraints aren't met. -type GrpcStatusMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GrpcStatusMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GrpcStatusMultiError) AllErrors() []error { return m } - -// GrpcStatusValidationError is the validation error returned by -// GrpcStatus.Validate if the designated constraints aren't met. -type GrpcStatusValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GrpcStatusValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GrpcStatusValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GrpcStatusValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GrpcStatusValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GrpcStatusValidationError) ErrorName() string { return "GrpcStatusValidationError" } - -// Error satisfies the builtin error interface -func (e GrpcStatusValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGrpcStatus.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GrpcStatusValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GrpcStatusValidationError{} - -// Validate checks the field values on HeaderMutation with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *HeaderMutation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on HeaderMutation with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in HeaderMutationMultiError, -// or nil if none found. -func (m *HeaderMutation) ValidateAll() error { - return m.validate(true) -} - -func (m *HeaderMutation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetSetHeaders() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, HeaderMutationValidationError{ - field: fmt.Sprintf("SetHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, HeaderMutationValidationError{ - field: fmt.Sprintf("SetHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return HeaderMutationValidationError{ - field: fmt.Sprintf("SetHeaders[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return HeaderMutationMultiError(errors) - } - - return nil -} - -// HeaderMutationMultiError is an error wrapping multiple validation errors -// returned by HeaderMutation.ValidateAll() if the designated constraints -// aren't met. -type HeaderMutationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m HeaderMutationMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m HeaderMutationMultiError) AllErrors() []error { return m } - -// HeaderMutationValidationError is the validation error returned by -// HeaderMutation.Validate if the designated constraints aren't met. -type HeaderMutationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e HeaderMutationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e HeaderMutationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e HeaderMutationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e HeaderMutationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e HeaderMutationValidationError) ErrorName() string { return "HeaderMutationValidationError" } - -// Error satisfies the builtin error interface -func (e HeaderMutationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sHeaderMutation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = HeaderMutationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = HeaderMutationValidationError{} - -// Validate checks the field values on StreamedBodyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *StreamedBodyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on StreamedBodyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// StreamedBodyResponseMultiError, or nil if none found. -func (m *StreamedBodyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *StreamedBodyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Body - - // no validation rules for EndOfStream - - // no validation rules for EndOfStreamWithoutMessage - - // no validation rules for GrpcMessageCompressed - - if len(errors) > 0 { - return StreamedBodyResponseMultiError(errors) - } - - return nil -} - -// StreamedBodyResponseMultiError is an error wrapping multiple validation -// errors returned by StreamedBodyResponse.ValidateAll() if the designated -// constraints aren't met. -type StreamedBodyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m StreamedBodyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m StreamedBodyResponseMultiError) AllErrors() []error { return m } - -// StreamedBodyResponseValidationError is the validation error returned by -// StreamedBodyResponse.Validate if the designated constraints aren't met. -type StreamedBodyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e StreamedBodyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e StreamedBodyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e StreamedBodyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e StreamedBodyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e StreamedBodyResponseValidationError) ErrorName() string { - return "StreamedBodyResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e StreamedBodyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sStreamedBodyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = StreamedBodyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = StreamedBodyResponseValidationError{} - -// Validate checks the field values on BodyMutation with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *BodyMutation) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BodyMutation with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in BodyMutationMultiError, or -// nil if none found. -func (m *BodyMutation) ValidateAll() error { - return m.validate(true) -} - -func (m *BodyMutation) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.Mutation.(type) { - case *BodyMutation_Body: - if v == nil { - err := BodyMutationValidationError{ - field: "Mutation", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for Body - case *BodyMutation_ClearBody: - if v == nil { - err := BodyMutationValidationError{ - field: "Mutation", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for ClearBody - case *BodyMutation_StreamedResponse: - if v == nil { - err := BodyMutationValidationError{ - field: "Mutation", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetStreamedResponse()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BodyMutationValidationError{ - field: "StreamedResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BodyMutationValidationError{ - field: "StreamedResponse", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetStreamedResponse()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BodyMutationValidationError{ - field: "StreamedResponse", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return BodyMutationMultiError(errors) - } - - return nil -} - -// BodyMutationMultiError is an error wrapping multiple validation errors -// returned by BodyMutation.ValidateAll() if the designated constraints aren't met. -type BodyMutationMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BodyMutationMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BodyMutationMultiError) AllErrors() []error { return m } - -// BodyMutationValidationError is the validation error returned by -// BodyMutation.Validate if the designated constraints aren't met. -type BodyMutationValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BodyMutationValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BodyMutationValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BodyMutationValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BodyMutationValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BodyMutationValidationError) ErrorName() string { return "BodyMutationValidationError" } - -// Error satisfies the builtin error interface -func (e BodyMutationValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBodyMutation.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BodyMutationValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BodyMutationValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor_grpc.pb.go deleted file mode 100644 index ef6c91c1d..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor_grpc.pb.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/ext_proc/v3/external_processor.proto - -package ext_procv3 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - ExternalProcessor_Process_FullMethodName = "/envoy.service.ext_proc.v3.ExternalProcessor/Process" -) - -// ExternalProcessorClient is the client API for ExternalProcessor service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ExternalProcessorClient interface { - // This begins the bidirectional stream that the data plane will use to - // give the server control over what the filter does. The actual - // protocol is described by the ProcessingRequest and ProcessingResponse - // messages below. - Process(ctx context.Context, opts ...grpc.CallOption) (ExternalProcessor_ProcessClient, error) -} - -type externalProcessorClient struct { - cc grpc.ClientConnInterface -} - -func NewExternalProcessorClient(cc grpc.ClientConnInterface) ExternalProcessorClient { - return &externalProcessorClient{cc} -} - -func (c *externalProcessorClient) Process(ctx context.Context, opts ...grpc.CallOption) (ExternalProcessor_ProcessClient, error) { - stream, err := c.cc.NewStream(ctx, &ExternalProcessor_ServiceDesc.Streams[0], ExternalProcessor_Process_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &externalProcessorProcessClient{stream} - return x, nil -} - -type ExternalProcessor_ProcessClient interface { - Send(*ProcessingRequest) error - Recv() (*ProcessingResponse, error) - grpc.ClientStream -} - -type externalProcessorProcessClient struct { - grpc.ClientStream -} - -func (x *externalProcessorProcessClient) Send(m *ProcessingRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *externalProcessorProcessClient) Recv() (*ProcessingResponse, error) { - m := new(ProcessingResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ExternalProcessorServer is the server API for ExternalProcessor service. -// All implementations should embed UnimplementedExternalProcessorServer -// for forward compatibility -type ExternalProcessorServer interface { - // This begins the bidirectional stream that the data plane will use to - // give the server control over what the filter does. The actual - // protocol is described by the ProcessingRequest and ProcessingResponse - // messages below. - Process(ExternalProcessor_ProcessServer) error -} - -// UnimplementedExternalProcessorServer should be embedded to have forward compatible implementations. -type UnimplementedExternalProcessorServer struct { -} - -func (UnimplementedExternalProcessorServer) Process(ExternalProcessor_ProcessServer) error { - return status.Errorf(codes.Unimplemented, "method Process not implemented") -} - -// UnsafeExternalProcessorServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ExternalProcessorServer will -// result in compilation errors. -type UnsafeExternalProcessorServer interface { - mustEmbedUnimplementedExternalProcessorServer() -} - -func RegisterExternalProcessorServer(s grpc.ServiceRegistrar, srv ExternalProcessorServer) { - s.RegisterService(&ExternalProcessor_ServiceDesc, srv) -} - -func _ExternalProcessor_Process_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ExternalProcessorServer).Process(&externalProcessorProcessServer{stream}) -} - -type ExternalProcessor_ProcessServer interface { - Send(*ProcessingResponse) error - Recv() (*ProcessingRequest, error) - grpc.ServerStream -} - -type externalProcessorProcessServer struct { - grpc.ServerStream -} - -func (x *externalProcessorProcessServer) Send(m *ProcessingResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *externalProcessorProcessServer) Recv() (*ProcessingRequest, error) { - m := new(ProcessingRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ExternalProcessor_ServiceDesc is the grpc.ServiceDesc for ExternalProcessor service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ExternalProcessor_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.ext_proc.v3.ExternalProcessor", - HandlerType: (*ExternalProcessorServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Process", - Handler: _ExternalProcessor_Process_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/ext_proc/v3/external_processor.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor_vtproto.pb.go deleted file mode 100644 index 0dbfdcf81..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3/external_processor_vtproto.pb.go +++ /dev/null @@ -1,2269 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/ext_proc/v3/external_processor.proto - -package ext_procv3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - durationpb "github.com/planetscale/vtprotobuf/types/known/durationpb" - structpb "github.com/planetscale/vtprotobuf/types/known/structpb" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *ProtocolConfiguration) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProtocolConfiguration) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProtocolConfiguration) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.SendBodyWithoutWaitingForHeaderResponse { - i-- - if m.SendBodyWithoutWaitingForHeaderResponse { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.ResponseBodyMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ResponseBodyMode)) - i-- - dAtA[i] = 0x10 - } - if m.RequestBodyMode != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.RequestBodyMode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ProcessingRequest) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProcessingRequest) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingRequest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ProtocolConfig != nil { - size, err := m.ProtocolConfig.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x5a - } - if m.ObservabilityMode { - i-- - if m.ObservabilityMode { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x50 - } - if len(m.Attributes) > 0 { - for k := range m.Attributes { - v := m.Attributes[k] - baseI := i - size, err := (*structpb.Struct)(v).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x4a - } - } - if m.MetadataContext != nil { - if vtmsg, ok := interface{}(m.MetadataContext).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.MetadataContext) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x42 - } - if msg, ok := m.Request.(*ProcessingRequest_ResponseTrailers); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Request.(*ProcessingRequest_RequestTrailers); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Request.(*ProcessingRequest_ResponseBody); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Request.(*ProcessingRequest_RequestBody); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Request.(*ProcessingRequest_ResponseHeaders); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Request.(*ProcessingRequest_RequestHeaders); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *ProcessingRequest_RequestHeaders) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingRequest_RequestHeaders) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestHeaders != nil { - size, err := m.RequestHeaders.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *ProcessingRequest_ResponseHeaders) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingRequest_ResponseHeaders) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseHeaders != nil { - size, err := m.ResponseHeaders.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *ProcessingRequest_RequestBody) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingRequest_RequestBody) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestBody != nil { - size, err := m.RequestBody.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *ProcessingRequest_ResponseBody) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingRequest_ResponseBody) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseBody != nil { - size, err := m.ResponseBody.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x2a - } - return len(dAtA) - i, nil -} -func (m *ProcessingRequest_RequestTrailers) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingRequest_RequestTrailers) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestTrailers != nil { - size, err := m.RequestTrailers.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x32 - } - return len(dAtA) - i, nil -} -func (m *ProcessingRequest_ResponseTrailers) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingRequest_ResponseTrailers) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseTrailers != nil { - size, err := m.ResponseTrailers.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x3a - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProcessingResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.RequestDrain { - i-- - if m.RequestDrain { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x60 - } - if msg, ok := m.Response.(*ProcessingResponse_StreamedImmediateResponse); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if m.OverrideMessageTimeout != nil { - size, err := (*durationpb.Duration)(m.OverrideMessageTimeout).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if m.ModeOverride != nil { - if vtmsg, ok := interface{}(m.ModeOverride).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.ModeOverride) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x4a - } - if m.DynamicMetadata != nil { - size, err := (*structpb.Struct)(m.DynamicMetadata).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if msg, ok := m.Response.(*ProcessingResponse_ImmediateResponse); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*ProcessingResponse_ResponseTrailers); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*ProcessingResponse_RequestTrailers); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*ProcessingResponse_ResponseBody); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*ProcessingResponse_RequestBody); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*ProcessingResponse_ResponseHeaders); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*ProcessingResponse_RequestHeaders); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *ProcessingResponse_RequestHeaders) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_RequestHeaders) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestHeaders != nil { - size, err := m.RequestHeaders.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse_ResponseHeaders) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_ResponseHeaders) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseHeaders != nil { - size, err := m.ResponseHeaders.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse_RequestBody) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_RequestBody) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestBody != nil { - size, err := m.RequestBody.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse_ResponseBody) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_ResponseBody) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseBody != nil { - size, err := m.ResponseBody.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse_RequestTrailers) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_RequestTrailers) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RequestTrailers != nil { - size, err := m.RequestTrailers.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x2a - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse_ResponseTrailers) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_ResponseTrailers) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ResponseTrailers != nil { - size, err := m.ResponseTrailers.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x32 - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse_ImmediateResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_ImmediateResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ImmediateResponse != nil { - size, err := m.ImmediateResponse.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x3a - } - return len(dAtA) - i, nil -} -func (m *ProcessingResponse_StreamedImmediateResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ProcessingResponse_StreamedImmediateResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.StreamedImmediateResponse != nil { - size, err := m.StreamedImmediateResponse.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x5a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x5a - } - return len(dAtA) - i, nil -} -func (m *HttpHeaders) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpHeaders) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpHeaders) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.EndOfStream { - i-- - if m.EndOfStream { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Attributes) > 0 { - for k := range m.Attributes { - v := m.Attributes[k] - baseI := i - size, err := (*structpb.Struct)(v).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - } - } - if m.Headers != nil { - if vtmsg, ok := interface{}(m.Headers).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Headers) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HttpBody) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpBody) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpBody) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.GrpcMessageCompressed { - i-- - if m.GrpcMessageCompressed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.EndOfStreamWithoutMessage { - i-- - if m.EndOfStreamWithoutMessage { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.EndOfStream { - i-- - if m.EndOfStream { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Body) > 0 { - i -= len(m.Body) - copy(dAtA[i:], m.Body) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Body))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HttpTrailers) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HttpTrailers) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HttpTrailers) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Trailers != nil { - if vtmsg, ok := interface{}(m.Trailers).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Trailers) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HeadersResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeadersResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HeadersResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Response != nil { - size, err := m.Response.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BodyResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BodyResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *BodyResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Response != nil { - size, err := m.Response.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TrailersResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TrailersResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *TrailersResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.HeaderMutation != nil { - size, err := m.HeaderMutation.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *StreamedImmediateResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StreamedImmediateResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StreamedImmediateResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.Response.(*StreamedImmediateResponse_TrailersResponse); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*StreamedImmediateResponse_BodyResponse); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Response.(*StreamedImmediateResponse_HeadersResponse); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *StreamedImmediateResponse_HeadersResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StreamedImmediateResponse_HeadersResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.HeadersResponse != nil { - size, err := m.HeadersResponse.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *StreamedImmediateResponse_BodyResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StreamedImmediateResponse_BodyResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.BodyResponse != nil { - size, err := m.BodyResponse.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *StreamedImmediateResponse_TrailersResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StreamedImmediateResponse_TrailersResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.TrailersResponse != nil { - if vtmsg, ok := interface{}(m.TrailersResponse).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.TrailersResponse) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *CommonResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CommonResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CommonResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ClearRouteCache { - i-- - if m.ClearRouteCache { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.Trailers != nil { - if vtmsg, ok := interface{}(m.Trailers).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Trailers) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x22 - } - if m.BodyMutation != nil { - size, err := m.BodyMutation.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.HeaderMutation != nil { - size, err := m.HeaderMutation.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Status != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ImmediateResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ImmediateResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *ImmediateResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Details))) - i-- - dAtA[i] = 0x2a - } - if m.GrpcStatus != nil { - size, err := m.GrpcStatus.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if len(m.Body) > 0 { - i -= len(m.Body) - copy(dAtA[i:], m.Body) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Body))) - i-- - dAtA[i] = 0x1a - } - if m.Headers != nil { - size, err := m.Headers.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Status != nil { - if vtmsg, ok := interface{}(m.Status).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Status) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GrpcStatus) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GrpcStatus) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *GrpcStatus) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Status != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *HeaderMutation) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeaderMutation) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *HeaderMutation) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.RemoveHeaders) > 0 { - for iNdEx := len(m.RemoveHeaders) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RemoveHeaders[iNdEx]) - copy(dAtA[i:], m.RemoveHeaders[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.RemoveHeaders[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.SetHeaders) > 0 { - for iNdEx := len(m.SetHeaders) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.SetHeaders[iNdEx]).(interface { - MarshalToSizedBufferVTStrict([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.SetHeaders[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *StreamedBodyResponse) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StreamedBodyResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *StreamedBodyResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.GrpcMessageCompressed { - i-- - if m.GrpcMessageCompressed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.EndOfStreamWithoutMessage { - i-- - if m.EndOfStreamWithoutMessage { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.EndOfStream { - i-- - if m.EndOfStream { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Body) > 0 { - i -= len(m.Body) - copy(dAtA[i:], m.Body) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Body))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BodyMutation) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BodyMutation) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *BodyMutation) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if msg, ok := m.Mutation.(*BodyMutation_StreamedResponse); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Mutation.(*BodyMutation_ClearBody); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if msg, ok := m.Mutation.(*BodyMutation_Body); ok { - size, err := msg.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *BodyMutation_Body) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *BodyMutation_Body) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.Body) - copy(dAtA[i:], m.Body) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Body))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} -func (m *BodyMutation_ClearBody) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *BodyMutation_ClearBody) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - i-- - if m.ClearBody { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - return len(dAtA) - i, nil -} -func (m *BodyMutation_StreamedResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *BodyMutation_StreamedResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - i := len(dAtA) - if m.StreamedResponse != nil { - size, err := m.StreamedResponse.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } else { - i = protohelpers.EncodeVarint(dAtA, i, 0) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *ProtocolConfiguration) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestBodyMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.RequestBodyMode)) - } - if m.ResponseBodyMode != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ResponseBodyMode)) - } - if m.SendBodyWithoutWaitingForHeaderResponse { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ProcessingRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Request.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - if m.MetadataContext != nil { - if size, ok := interface{}(m.MetadataContext).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.MetadataContext) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Attributes) > 0 { - for k, v := range m.Attributes { - _ = k - _ = v - l = 0 - if v != nil { - l = (*structpb.Struct)(v).SizeVT() - } - l += 1 + protohelpers.SizeOfVarint(uint64(l)) - mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l - n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) - } - } - if m.ObservabilityMode { - n += 2 - } - if m.ProtocolConfig != nil { - l = m.ProtocolConfig.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ProcessingRequest_RequestHeaders) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestHeaders != nil { - l = m.RequestHeaders.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingRequest_ResponseHeaders) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseHeaders != nil { - l = m.ResponseHeaders.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingRequest_RequestBody) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestBody != nil { - l = m.RequestBody.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingRequest_ResponseBody) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseBody != nil { - l = m.ResponseBody.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingRequest_RequestTrailers) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestTrailers != nil { - l = m.RequestTrailers.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingRequest_ResponseTrailers) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseTrailers != nil { - l = m.ResponseTrailers.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Response.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - if m.DynamicMetadata != nil { - l = (*structpb.Struct)(m.DynamicMetadata).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ModeOverride != nil { - if size, ok := interface{}(m.ModeOverride).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.ModeOverride) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.OverrideMessageTimeout != nil { - l = (*durationpb.Duration)(m.OverrideMessageTimeout).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.RequestDrain { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ProcessingResponse_RequestHeaders) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestHeaders != nil { - l = m.RequestHeaders.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse_ResponseHeaders) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseHeaders != nil { - l = m.ResponseHeaders.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse_RequestBody) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestBody != nil { - l = m.RequestBody.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse_ResponseBody) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseBody != nil { - l = m.ResponseBody.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse_RequestTrailers) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestTrailers != nil { - l = m.RequestTrailers.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse_ResponseTrailers) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ResponseTrailers != nil { - l = m.ResponseTrailers.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse_ImmediateResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ImmediateResponse != nil { - l = m.ImmediateResponse.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *ProcessingResponse_StreamedImmediateResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.StreamedImmediateResponse != nil { - l = m.StreamedImmediateResponse.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *HttpHeaders) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Headers != nil { - if size, ok := interface{}(m.Headers).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Headers) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Attributes) > 0 { - for k, v := range m.Attributes { - _ = k - _ = v - l = 0 - if v != nil { - l = (*structpb.Struct)(v).SizeVT() - } - l += 1 + protohelpers.SizeOfVarint(uint64(l)) - mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l - n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) - } - } - if m.EndOfStream { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *HttpBody) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Body) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.EndOfStream { - n += 2 - } - if m.EndOfStreamWithoutMessage { - n += 2 - } - if m.GrpcMessageCompressed { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *HttpTrailers) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Trailers != nil { - if size, ok := interface{}(m.Trailers).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Trailers) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *HeadersResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Response != nil { - l = m.Response.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *BodyResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Response != nil { - l = m.Response.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *TrailersResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HeaderMutation != nil { - l = m.HeaderMutation.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *StreamedImmediateResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Response.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *StreamedImmediateResponse_HeadersResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HeadersResponse != nil { - l = m.HeadersResponse.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *StreamedImmediateResponse_BodyResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BodyResponse != nil { - l = m.BodyResponse.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *StreamedImmediateResponse_TrailersResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TrailersResponse != nil { - if size, ok := interface{}(m.TrailersResponse).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.TrailersResponse) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} -func (m *CommonResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) - } - if m.HeaderMutation != nil { - l = m.HeaderMutation.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.BodyMutation != nil { - l = m.BodyMutation.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Trailers != nil { - if size, ok := interface{}(m.Trailers).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Trailers) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ClearRouteCache { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ImmediateResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != nil { - if size, ok := interface{}(m.Status).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Status) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Headers != nil { - l = m.Headers.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Body) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.GrpcStatus != nil { - l = m.GrpcStatus.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Details) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *GrpcStatus) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Status)) - } - n += len(m.unknownFields) - return n -} - -func (m *HeaderMutation) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SetHeaders) > 0 { - for _, e := range m.SetHeaders { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.RemoveHeaders) > 0 { - for _, s := range m.RemoveHeaders { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *StreamedBodyResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Body) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.EndOfStream { - n += 2 - } - if m.EndOfStreamWithoutMessage { - n += 2 - } - if m.GrpcMessageCompressed { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *BodyMutation) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Mutation.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *BodyMutation_Body) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Body) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - return n -} -func (m *BodyMutation_ClearBody) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 2 - return n -} -func (m *BodyMutation_StreamedResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.StreamedResponse != nil { - l = m.StreamedResponse.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } else { - n += 2 - } - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery.pb.go deleted file mode 100644 index 51a9b0160..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery.pb.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/extension/v3/config_discovery.proto - -package extensionv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue -// with importing services: https://github.com/google/protobuf/issues/4221 and -// protoxform to upgrade the file. -type EcdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EcdsDummy) Reset() { - *x = EcdsDummy{} - mi := &file_envoy_service_extension_v3_config_discovery_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EcdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EcdsDummy) ProtoMessage() {} - -func (x *EcdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_extension_v3_config_discovery_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EcdsDummy.ProtoReflect.Descriptor instead. -func (*EcdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_extension_v3_config_discovery_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_extension_v3_config_discovery_proto protoreflect.FileDescriptor - -const file_envoy_service_extension_v3_config_discovery_proto_rawDesc = "" + - "\n" + - "1envoy/service/extension/v3/config_discovery.proto\x12\x1aenvoy.service.extension.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\"\v\n" + - "\tEcdsDummy2\xfb\x03\n" + - "\x1fExtensionConfigDiscoveryService\x12{\n" + - "\x16StreamExtensionConfigs\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12\x84\x01\n" + - "\x15DeltaExtensionConfigs\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12\xa0\x01\n" + - "\x15FetchExtensionConfigs\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"*\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/v3/discovery:extension_configs\x1a1\x8a\xa4\x96\xf3\a+\n" + - ")envoy.config.core.v3.TypedExtensionConfigB\x99\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "(io.envoyproxy.envoy.service.extension.v3B\x14ConfigDiscoveryProtoP\x01ZMgithub.com/envoyproxy/go-control-plane/envoy/service/extension/v3;extensionv3b\x06proto3" - -var ( - file_envoy_service_extension_v3_config_discovery_proto_rawDescOnce sync.Once - file_envoy_service_extension_v3_config_discovery_proto_rawDescData []byte -) - -func file_envoy_service_extension_v3_config_discovery_proto_rawDescGZIP() []byte { - file_envoy_service_extension_v3_config_discovery_proto_rawDescOnce.Do(func() { - file_envoy_service_extension_v3_config_discovery_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_extension_v3_config_discovery_proto_rawDesc), len(file_envoy_service_extension_v3_config_discovery_proto_rawDesc))) - }) - return file_envoy_service_extension_v3_config_discovery_proto_rawDescData -} - -var file_envoy_service_extension_v3_config_discovery_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_extension_v3_config_discovery_proto_goTypes = []any{ - (*EcdsDummy)(nil), // 0: envoy.service.extension.v3.EcdsDummy - (*v3.DiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DiscoveryResponse - (*v3.DeltaDiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_extension_v3_config_discovery_proto_depIdxs = []int32{ - 1, // 0: envoy.service.extension.v3.ExtensionConfigDiscoveryService.StreamExtensionConfigs:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 1: envoy.service.extension.v3.ExtensionConfigDiscoveryService.DeltaExtensionConfigs:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 1, // 2: envoy.service.extension.v3.ExtensionConfigDiscoveryService.FetchExtensionConfigs:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 3, // 3: envoy.service.extension.v3.ExtensionConfigDiscoveryService.StreamExtensionConfigs:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 4: envoy.service.extension.v3.ExtensionConfigDiscoveryService.DeltaExtensionConfigs:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 3, // 5: envoy.service.extension.v3.ExtensionConfigDiscoveryService.FetchExtensionConfigs:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_extension_v3_config_discovery_proto_init() } -func file_envoy_service_extension_v3_config_discovery_proto_init() { - if File_envoy_service_extension_v3_config_discovery_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_extension_v3_config_discovery_proto_rawDesc), len(file_envoy_service_extension_v3_config_discovery_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_extension_v3_config_discovery_proto_goTypes, - DependencyIndexes: file_envoy_service_extension_v3_config_discovery_proto_depIdxs, - MessageInfos: file_envoy_service_extension_v3_config_discovery_proto_msgTypes, - }.Build() - File_envoy_service_extension_v3_config_discovery_proto = out.File - file_envoy_service_extension_v3_config_discovery_proto_goTypes = nil - file_envoy_service_extension_v3_config_discovery_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery.pb.validate.go deleted file mode 100644 index b3a8c29b8..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/extension/v3/config_discovery.proto - -package extensionv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on EcdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *EcdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EcdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in EcdsDummyMultiError, or nil -// if none found. -func (m *EcdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *EcdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return EcdsDummyMultiError(errors) - } - - return nil -} - -// EcdsDummyMultiError is an error wrapping multiple validation errors returned -// by EcdsDummy.ValidateAll() if the designated constraints aren't met. -type EcdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EcdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EcdsDummyMultiError) AllErrors() []error { return m } - -// EcdsDummyValidationError is the validation error returned by -// EcdsDummy.Validate if the designated constraints aren't met. -type EcdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EcdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EcdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EcdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EcdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EcdsDummyValidationError) ErrorName() string { return "EcdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e EcdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEcdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EcdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EcdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery_grpc.pb.go deleted file mode 100644 index d80b66816..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery_grpc.pb.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/extension/v3/config_discovery.proto - -package extensionv3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - ExtensionConfigDiscoveryService_StreamExtensionConfigs_FullMethodName = "/envoy.service.extension.v3.ExtensionConfigDiscoveryService/StreamExtensionConfigs" - ExtensionConfigDiscoveryService_DeltaExtensionConfigs_FullMethodName = "/envoy.service.extension.v3.ExtensionConfigDiscoveryService/DeltaExtensionConfigs" - ExtensionConfigDiscoveryService_FetchExtensionConfigs_FullMethodName = "/envoy.service.extension.v3.ExtensionConfigDiscoveryService/FetchExtensionConfigs" -) - -// ExtensionConfigDiscoveryServiceClient is the client API for ExtensionConfigDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ExtensionConfigDiscoveryServiceClient interface { - StreamExtensionConfigs(ctx context.Context, opts ...grpc.CallOption) (ExtensionConfigDiscoveryService_StreamExtensionConfigsClient, error) - DeltaExtensionConfigs(ctx context.Context, opts ...grpc.CallOption) (ExtensionConfigDiscoveryService_DeltaExtensionConfigsClient, error) - FetchExtensionConfigs(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type extensionConfigDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewExtensionConfigDiscoveryServiceClient(cc grpc.ClientConnInterface) ExtensionConfigDiscoveryServiceClient { - return &extensionConfigDiscoveryServiceClient{cc} -} - -func (c *extensionConfigDiscoveryServiceClient) StreamExtensionConfigs(ctx context.Context, opts ...grpc.CallOption) (ExtensionConfigDiscoveryService_StreamExtensionConfigsClient, error) { - stream, err := c.cc.NewStream(ctx, &ExtensionConfigDiscoveryService_ServiceDesc.Streams[0], ExtensionConfigDiscoveryService_StreamExtensionConfigs_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &extensionConfigDiscoveryServiceStreamExtensionConfigsClient{stream} - return x, nil -} - -type ExtensionConfigDiscoveryService_StreamExtensionConfigsClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type extensionConfigDiscoveryServiceStreamExtensionConfigsClient struct { - grpc.ClientStream -} - -func (x *extensionConfigDiscoveryServiceStreamExtensionConfigsClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *extensionConfigDiscoveryServiceStreamExtensionConfigsClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *extensionConfigDiscoveryServiceClient) DeltaExtensionConfigs(ctx context.Context, opts ...grpc.CallOption) (ExtensionConfigDiscoveryService_DeltaExtensionConfigsClient, error) { - stream, err := c.cc.NewStream(ctx, &ExtensionConfigDiscoveryService_ServiceDesc.Streams[1], ExtensionConfigDiscoveryService_DeltaExtensionConfigs_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &extensionConfigDiscoveryServiceDeltaExtensionConfigsClient{stream} - return x, nil -} - -type ExtensionConfigDiscoveryService_DeltaExtensionConfigsClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type extensionConfigDiscoveryServiceDeltaExtensionConfigsClient struct { - grpc.ClientStream -} - -func (x *extensionConfigDiscoveryServiceDeltaExtensionConfigsClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *extensionConfigDiscoveryServiceDeltaExtensionConfigsClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *extensionConfigDiscoveryServiceClient) FetchExtensionConfigs(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, ExtensionConfigDiscoveryService_FetchExtensionConfigs_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ExtensionConfigDiscoveryServiceServer is the server API for ExtensionConfigDiscoveryService service. -// All implementations should embed UnimplementedExtensionConfigDiscoveryServiceServer -// for forward compatibility -type ExtensionConfigDiscoveryServiceServer interface { - StreamExtensionConfigs(ExtensionConfigDiscoveryService_StreamExtensionConfigsServer) error - DeltaExtensionConfigs(ExtensionConfigDiscoveryService_DeltaExtensionConfigsServer) error - FetchExtensionConfigs(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedExtensionConfigDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedExtensionConfigDiscoveryServiceServer struct { -} - -func (UnimplementedExtensionConfigDiscoveryServiceServer) StreamExtensionConfigs(ExtensionConfigDiscoveryService_StreamExtensionConfigsServer) error { - return status.Errorf(codes.Unimplemented, "method StreamExtensionConfigs not implemented") -} -func (UnimplementedExtensionConfigDiscoveryServiceServer) DeltaExtensionConfigs(ExtensionConfigDiscoveryService_DeltaExtensionConfigsServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaExtensionConfigs not implemented") -} -func (UnimplementedExtensionConfigDiscoveryServiceServer) FetchExtensionConfigs(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchExtensionConfigs not implemented") -} - -// UnsafeExtensionConfigDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ExtensionConfigDiscoveryServiceServer will -// result in compilation errors. -type UnsafeExtensionConfigDiscoveryServiceServer interface { - mustEmbedUnimplementedExtensionConfigDiscoveryServiceServer() -} - -func RegisterExtensionConfigDiscoveryServiceServer(s grpc.ServiceRegistrar, srv ExtensionConfigDiscoveryServiceServer) { - s.RegisterService(&ExtensionConfigDiscoveryService_ServiceDesc, srv) -} - -func _ExtensionConfigDiscoveryService_StreamExtensionConfigs_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ExtensionConfigDiscoveryServiceServer).StreamExtensionConfigs(&extensionConfigDiscoveryServiceStreamExtensionConfigsServer{stream}) -} - -type ExtensionConfigDiscoveryService_StreamExtensionConfigsServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type extensionConfigDiscoveryServiceStreamExtensionConfigsServer struct { - grpc.ServerStream -} - -func (x *extensionConfigDiscoveryServiceStreamExtensionConfigsServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *extensionConfigDiscoveryServiceStreamExtensionConfigsServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ExtensionConfigDiscoveryService_DeltaExtensionConfigs_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ExtensionConfigDiscoveryServiceServer).DeltaExtensionConfigs(&extensionConfigDiscoveryServiceDeltaExtensionConfigsServer{stream}) -} - -type ExtensionConfigDiscoveryService_DeltaExtensionConfigsServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type extensionConfigDiscoveryServiceDeltaExtensionConfigsServer struct { - grpc.ServerStream -} - -func (x *extensionConfigDiscoveryServiceDeltaExtensionConfigsServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *extensionConfigDiscoveryServiceDeltaExtensionConfigsServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ExtensionConfigDiscoveryService_FetchExtensionConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ExtensionConfigDiscoveryServiceServer).FetchExtensionConfigs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ExtensionConfigDiscoveryService_FetchExtensionConfigs_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ExtensionConfigDiscoveryServiceServer).FetchExtensionConfigs(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ExtensionConfigDiscoveryService_ServiceDesc is the grpc.ServiceDesc for ExtensionConfigDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ExtensionConfigDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.extension.v3.ExtensionConfigDiscoveryService", - HandlerType: (*ExtensionConfigDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchExtensionConfigs", - Handler: _ExtensionConfigDiscoveryService_FetchExtensionConfigs_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamExtensionConfigs", - Handler: _ExtensionConfigDiscoveryService_StreamExtensionConfigs_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaExtensionConfigs", - Handler: _ExtensionConfigDiscoveryService_DeltaExtensionConfigs_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/extension/v3/config_discovery.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery_vtproto.pb.go deleted file mode 100644 index 21098542f..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/extension/v3/config_discovery_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/extension/v3/config_discovery.proto - -package extensionv3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *EcdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EcdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *EcdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *EcdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds.pb.go deleted file mode 100644 index 4c6ce428b..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds.pb.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/listener/v3/lds.proto - -package listenerv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file. -type LdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LdsDummy) Reset() { - *x = LdsDummy{} - mi := &file_envoy_service_listener_v3_lds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LdsDummy) ProtoMessage() {} - -func (x *LdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_listener_v3_lds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LdsDummy.ProtoReflect.Descriptor instead. -func (*LdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_listener_v3_lds_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_listener_v3_lds_proto protoreflect.FileDescriptor - -const file_envoy_service_listener_v3_lds_proto_rawDesc = "" + - "\n" + - "#envoy/service/listener/v3/lds.proto\x12\x19envoy.service.listener.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\"(\n" + - "\bLdsDummy:\x1c\x9aň\x1e\x17\n" + - "\x15envoy.api.v2.LdsDummy2\xce\x03\n" + - "\x18ListenerDiscoveryService\x12}\n" + - "\x0eDeltaListeners\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12t\n" + - "\x0fStreamListeners\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12\x91\x01\n" + - "\x0eFetchListeners\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\"\x82\xd3\xe4\x93\x02\x1c:\x01*\"\x17/v3/discovery:listeners\x1a)\x8a\xa4\x96\xf3\a#\n" + - "!envoy.config.listener.v3.ListenerB\x8a\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "'io.envoyproxy.envoy.service.listener.v3B\bLdsProtoP\x01ZKgithub.com/envoyproxy/go-control-plane/envoy/service/listener/v3;listenerv3b\x06proto3" - -var ( - file_envoy_service_listener_v3_lds_proto_rawDescOnce sync.Once - file_envoy_service_listener_v3_lds_proto_rawDescData []byte -) - -func file_envoy_service_listener_v3_lds_proto_rawDescGZIP() []byte { - file_envoy_service_listener_v3_lds_proto_rawDescOnce.Do(func() { - file_envoy_service_listener_v3_lds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_listener_v3_lds_proto_rawDesc), len(file_envoy_service_listener_v3_lds_proto_rawDesc))) - }) - return file_envoy_service_listener_v3_lds_proto_rawDescData -} - -var file_envoy_service_listener_v3_lds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_listener_v3_lds_proto_goTypes = []any{ - (*LdsDummy)(nil), // 0: envoy.service.listener.v3.LdsDummy - (*v3.DeltaDiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DeltaDiscoveryResponse - (*v3.DiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DiscoveryResponse -} -var file_envoy_service_listener_v3_lds_proto_depIdxs = []int32{ - 1, // 0: envoy.service.listener.v3.ListenerDiscoveryService.DeltaListeners:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 2, // 1: envoy.service.listener.v3.ListenerDiscoveryService.StreamListeners:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 2: envoy.service.listener.v3.ListenerDiscoveryService.FetchListeners:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 3, // 3: envoy.service.listener.v3.ListenerDiscoveryService.DeltaListeners:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 4, // 4: envoy.service.listener.v3.ListenerDiscoveryService.StreamListeners:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 5: envoy.service.listener.v3.ListenerDiscoveryService.FetchListeners:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_listener_v3_lds_proto_init() } -func file_envoy_service_listener_v3_lds_proto_init() { - if File_envoy_service_listener_v3_lds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_listener_v3_lds_proto_rawDesc), len(file_envoy_service_listener_v3_lds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_listener_v3_lds_proto_goTypes, - DependencyIndexes: file_envoy_service_listener_v3_lds_proto_depIdxs, - MessageInfos: file_envoy_service_listener_v3_lds_proto_msgTypes, - }.Build() - File_envoy_service_listener_v3_lds_proto = out.File - file_envoy_service_listener_v3_lds_proto_goTypes = nil - file_envoy_service_listener_v3_lds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds.pb.validate.go deleted file mode 100644 index 7d5427c2e..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/listener/v3/lds.proto - -package listenerv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on LdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *LdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on LdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in LdsDummyMultiError, or nil -// if none found. -func (m *LdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *LdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return LdsDummyMultiError(errors) - } - - return nil -} - -// LdsDummyMultiError is an error wrapping multiple validation errors returned -// by LdsDummy.ValidateAll() if the designated constraints aren't met. -type LdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m LdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m LdsDummyMultiError) AllErrors() []error { return m } - -// LdsDummyValidationError is the validation error returned by -// LdsDummy.Validate if the designated constraints aren't met. -type LdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e LdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e LdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e LdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e LdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e LdsDummyValidationError) ErrorName() string { return "LdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e LdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sLdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = LdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = LdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds_grpc.pb.go deleted file mode 100644 index f35cf5e8d..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds_grpc.pb.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/listener/v3/lds.proto - -package listenerv3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - ListenerDiscoveryService_DeltaListeners_FullMethodName = "/envoy.service.listener.v3.ListenerDiscoveryService/DeltaListeners" - ListenerDiscoveryService_StreamListeners_FullMethodName = "/envoy.service.listener.v3.ListenerDiscoveryService/StreamListeners" - ListenerDiscoveryService_FetchListeners_FullMethodName = "/envoy.service.listener.v3.ListenerDiscoveryService/FetchListeners" -) - -// ListenerDiscoveryServiceClient is the client API for ListenerDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ListenerDiscoveryServiceClient interface { - DeltaListeners(ctx context.Context, opts ...grpc.CallOption) (ListenerDiscoveryService_DeltaListenersClient, error) - StreamListeners(ctx context.Context, opts ...grpc.CallOption) (ListenerDiscoveryService_StreamListenersClient, error) - FetchListeners(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type listenerDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewListenerDiscoveryServiceClient(cc grpc.ClientConnInterface) ListenerDiscoveryServiceClient { - return &listenerDiscoveryServiceClient{cc} -} - -func (c *listenerDiscoveryServiceClient) DeltaListeners(ctx context.Context, opts ...grpc.CallOption) (ListenerDiscoveryService_DeltaListenersClient, error) { - stream, err := c.cc.NewStream(ctx, &ListenerDiscoveryService_ServiceDesc.Streams[0], ListenerDiscoveryService_DeltaListeners_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &listenerDiscoveryServiceDeltaListenersClient{stream} - return x, nil -} - -type ListenerDiscoveryService_DeltaListenersClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type listenerDiscoveryServiceDeltaListenersClient struct { - grpc.ClientStream -} - -func (x *listenerDiscoveryServiceDeltaListenersClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *listenerDiscoveryServiceDeltaListenersClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *listenerDiscoveryServiceClient) StreamListeners(ctx context.Context, opts ...grpc.CallOption) (ListenerDiscoveryService_StreamListenersClient, error) { - stream, err := c.cc.NewStream(ctx, &ListenerDiscoveryService_ServiceDesc.Streams[1], ListenerDiscoveryService_StreamListeners_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &listenerDiscoveryServiceStreamListenersClient{stream} - return x, nil -} - -type ListenerDiscoveryService_StreamListenersClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type listenerDiscoveryServiceStreamListenersClient struct { - grpc.ClientStream -} - -func (x *listenerDiscoveryServiceStreamListenersClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *listenerDiscoveryServiceStreamListenersClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *listenerDiscoveryServiceClient) FetchListeners(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, ListenerDiscoveryService_FetchListeners_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ListenerDiscoveryServiceServer is the server API for ListenerDiscoveryService service. -// All implementations should embed UnimplementedListenerDiscoveryServiceServer -// for forward compatibility -type ListenerDiscoveryServiceServer interface { - DeltaListeners(ListenerDiscoveryService_DeltaListenersServer) error - StreamListeners(ListenerDiscoveryService_StreamListenersServer) error - FetchListeners(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedListenerDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedListenerDiscoveryServiceServer struct { -} - -func (UnimplementedListenerDiscoveryServiceServer) DeltaListeners(ListenerDiscoveryService_DeltaListenersServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaListeners not implemented") -} -func (UnimplementedListenerDiscoveryServiceServer) StreamListeners(ListenerDiscoveryService_StreamListenersServer) error { - return status.Errorf(codes.Unimplemented, "method StreamListeners not implemented") -} -func (UnimplementedListenerDiscoveryServiceServer) FetchListeners(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchListeners not implemented") -} - -// UnsafeListenerDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ListenerDiscoveryServiceServer will -// result in compilation errors. -type UnsafeListenerDiscoveryServiceServer interface { - mustEmbedUnimplementedListenerDiscoveryServiceServer() -} - -func RegisterListenerDiscoveryServiceServer(s grpc.ServiceRegistrar, srv ListenerDiscoveryServiceServer) { - s.RegisterService(&ListenerDiscoveryService_ServiceDesc, srv) -} - -func _ListenerDiscoveryService_DeltaListeners_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ListenerDiscoveryServiceServer).DeltaListeners(&listenerDiscoveryServiceDeltaListenersServer{stream}) -} - -type ListenerDiscoveryService_DeltaListenersServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type listenerDiscoveryServiceDeltaListenersServer struct { - grpc.ServerStream -} - -func (x *listenerDiscoveryServiceDeltaListenersServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *listenerDiscoveryServiceDeltaListenersServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ListenerDiscoveryService_StreamListeners_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ListenerDiscoveryServiceServer).StreamListeners(&listenerDiscoveryServiceStreamListenersServer{stream}) -} - -type ListenerDiscoveryService_StreamListenersServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type listenerDiscoveryServiceStreamListenersServer struct { - grpc.ServerStream -} - -func (x *listenerDiscoveryServiceStreamListenersServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *listenerDiscoveryServiceStreamListenersServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ListenerDiscoveryService_FetchListeners_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ListenerDiscoveryServiceServer).FetchListeners(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ListenerDiscoveryService_FetchListeners_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ListenerDiscoveryServiceServer).FetchListeners(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ListenerDiscoveryService_ServiceDesc is the grpc.ServiceDesc for ListenerDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ListenerDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.listener.v3.ListenerDiscoveryService", - HandlerType: (*ListenerDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchListeners", - Handler: _ListenerDiscoveryService_FetchListeners_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "DeltaListeners", - Handler: _ListenerDiscoveryService_DeltaListeners_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "StreamListeners", - Handler: _ListenerDiscoveryService_StreamListeners_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/listener/v3/lds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds_vtproto.pb.go deleted file mode 100644 index ff06a463b..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/listener/v3/lds_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/listener/v3/lds.proto - -package listenerv3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *LdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *LdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *LdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds.pb.go deleted file mode 100644 index a2010f325..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds.pb.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/route/v3/rds.proto - -package routev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file. -type RdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RdsDummy) Reset() { - *x = RdsDummy{} - mi := &file_envoy_service_route_v3_rds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RdsDummy) ProtoMessage() {} - -func (x *RdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_route_v3_rds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RdsDummy.ProtoReflect.Descriptor instead. -func (*RdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_route_v3_rds_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_route_v3_rds_proto protoreflect.FileDescriptor - -const file_envoy_service_route_v3_rds_proto_rawDesc = "" + - "\n" + - " envoy/service/route/v3/rds.proto\x12\x16envoy.service.route.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\"(\n" + - "\bRdsDummy:\x1c\x9aň\x1e\x17\n" + - "\x15envoy.api.v2.RdsDummy2\xc6\x03\n" + - "\x15RouteDiscoveryService\x12q\n" + - "\fStreamRoutes\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12z\n" + - "\vDeltaRoutes\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12\x8b\x01\n" + - "\vFetchRoutes\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/v3/discovery:routes\x1a0\x8a\xa4\x96\xf3\a*\n" + - "(envoy.config.route.v3.RouteConfiguration2\xcb\x01\n" + - "\x1bVirtualHostDiscoveryService\x12\x80\x01\n" + - "\x11DeltaVirtualHosts\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x1a)\x8a\xa4\x96\xf3\a#\n" + - "!envoy.config.route.v3.VirtualHostB\x81\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "$io.envoyproxy.envoy.service.route.v3B\bRdsProtoP\x01ZEgithub.com/envoyproxy/go-control-plane/envoy/service/route/v3;routev3b\x06proto3" - -var ( - file_envoy_service_route_v3_rds_proto_rawDescOnce sync.Once - file_envoy_service_route_v3_rds_proto_rawDescData []byte -) - -func file_envoy_service_route_v3_rds_proto_rawDescGZIP() []byte { - file_envoy_service_route_v3_rds_proto_rawDescOnce.Do(func() { - file_envoy_service_route_v3_rds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_route_v3_rds_proto_rawDesc), len(file_envoy_service_route_v3_rds_proto_rawDesc))) - }) - return file_envoy_service_route_v3_rds_proto_rawDescData -} - -var file_envoy_service_route_v3_rds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_route_v3_rds_proto_goTypes = []any{ - (*RdsDummy)(nil), // 0: envoy.service.route.v3.RdsDummy - (*v3.DiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DiscoveryResponse - (*v3.DeltaDiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_route_v3_rds_proto_depIdxs = []int32{ - 1, // 0: envoy.service.route.v3.RouteDiscoveryService.StreamRoutes:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 1: envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 1, // 2: envoy.service.route.v3.RouteDiscoveryService.FetchRoutes:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 3: envoy.service.route.v3.VirtualHostDiscoveryService.DeltaVirtualHosts:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 3, // 4: envoy.service.route.v3.RouteDiscoveryService.StreamRoutes:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 5: envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 3, // 6: envoy.service.route.v3.RouteDiscoveryService.FetchRoutes:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 7: envoy.service.route.v3.VirtualHostDiscoveryService.DeltaVirtualHosts:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_route_v3_rds_proto_init() } -func file_envoy_service_route_v3_rds_proto_init() { - if File_envoy_service_route_v3_rds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_route_v3_rds_proto_rawDesc), len(file_envoy_service_route_v3_rds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 2, - }, - GoTypes: file_envoy_service_route_v3_rds_proto_goTypes, - DependencyIndexes: file_envoy_service_route_v3_rds_proto_depIdxs, - MessageInfos: file_envoy_service_route_v3_rds_proto_msgTypes, - }.Build() - File_envoy_service_route_v3_rds_proto = out.File - file_envoy_service_route_v3_rds_proto_goTypes = nil - file_envoy_service_route_v3_rds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds.pb.validate.go deleted file mode 100644 index abd885056..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/route/v3/rds.proto - -package routev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on RdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RdsDummyMultiError, or nil -// if none found. -func (m *RdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *RdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RdsDummyMultiError(errors) - } - - return nil -} - -// RdsDummyMultiError is an error wrapping multiple validation errors returned -// by RdsDummy.ValidateAll() if the designated constraints aren't met. -type RdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RdsDummyMultiError) AllErrors() []error { return m } - -// RdsDummyValidationError is the validation error returned by -// RdsDummy.Validate if the designated constraints aren't met. -type RdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RdsDummyValidationError) ErrorName() string { return "RdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e RdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds_grpc.pb.go deleted file mode 100644 index ff605c827..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds_grpc.pb.go +++ /dev/null @@ -1,367 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/route/v3/rds.proto - -package routev3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - RouteDiscoveryService_StreamRoutes_FullMethodName = "/envoy.service.route.v3.RouteDiscoveryService/StreamRoutes" - RouteDiscoveryService_DeltaRoutes_FullMethodName = "/envoy.service.route.v3.RouteDiscoveryService/DeltaRoutes" - RouteDiscoveryService_FetchRoutes_FullMethodName = "/envoy.service.route.v3.RouteDiscoveryService/FetchRoutes" -) - -// RouteDiscoveryServiceClient is the client API for RouteDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type RouteDiscoveryServiceClient interface { - StreamRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_StreamRoutesClient, error) - DeltaRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_DeltaRoutesClient, error) - FetchRoutes(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type routeDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewRouteDiscoveryServiceClient(cc grpc.ClientConnInterface) RouteDiscoveryServiceClient { - return &routeDiscoveryServiceClient{cc} -} - -func (c *routeDiscoveryServiceClient) StreamRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_StreamRoutesClient, error) { - stream, err := c.cc.NewStream(ctx, &RouteDiscoveryService_ServiceDesc.Streams[0], RouteDiscoveryService_StreamRoutes_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &routeDiscoveryServiceStreamRoutesClient{stream} - return x, nil -} - -type RouteDiscoveryService_StreamRoutesClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type routeDiscoveryServiceStreamRoutesClient struct { - grpc.ClientStream -} - -func (x *routeDiscoveryServiceStreamRoutesClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *routeDiscoveryServiceStreamRoutesClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *routeDiscoveryServiceClient) DeltaRoutes(ctx context.Context, opts ...grpc.CallOption) (RouteDiscoveryService_DeltaRoutesClient, error) { - stream, err := c.cc.NewStream(ctx, &RouteDiscoveryService_ServiceDesc.Streams[1], RouteDiscoveryService_DeltaRoutes_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &routeDiscoveryServiceDeltaRoutesClient{stream} - return x, nil -} - -type RouteDiscoveryService_DeltaRoutesClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type routeDiscoveryServiceDeltaRoutesClient struct { - grpc.ClientStream -} - -func (x *routeDiscoveryServiceDeltaRoutesClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *routeDiscoveryServiceDeltaRoutesClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *routeDiscoveryServiceClient) FetchRoutes(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, RouteDiscoveryService_FetchRoutes_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RouteDiscoveryServiceServer is the server API for RouteDiscoveryService service. -// All implementations should embed UnimplementedRouteDiscoveryServiceServer -// for forward compatibility -type RouteDiscoveryServiceServer interface { - StreamRoutes(RouteDiscoveryService_StreamRoutesServer) error - DeltaRoutes(RouteDiscoveryService_DeltaRoutesServer) error - FetchRoutes(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedRouteDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedRouteDiscoveryServiceServer struct { -} - -func (UnimplementedRouteDiscoveryServiceServer) StreamRoutes(RouteDiscoveryService_StreamRoutesServer) error { - return status.Errorf(codes.Unimplemented, "method StreamRoutes not implemented") -} -func (UnimplementedRouteDiscoveryServiceServer) DeltaRoutes(RouteDiscoveryService_DeltaRoutesServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaRoutes not implemented") -} -func (UnimplementedRouteDiscoveryServiceServer) FetchRoutes(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchRoutes not implemented") -} - -// UnsafeRouteDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to RouteDiscoveryServiceServer will -// result in compilation errors. -type UnsafeRouteDiscoveryServiceServer interface { - mustEmbedUnimplementedRouteDiscoveryServiceServer() -} - -func RegisterRouteDiscoveryServiceServer(s grpc.ServiceRegistrar, srv RouteDiscoveryServiceServer) { - s.RegisterService(&RouteDiscoveryService_ServiceDesc, srv) -} - -func _RouteDiscoveryService_StreamRoutes_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(RouteDiscoveryServiceServer).StreamRoutes(&routeDiscoveryServiceStreamRoutesServer{stream}) -} - -type RouteDiscoveryService_StreamRoutesServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type routeDiscoveryServiceStreamRoutesServer struct { - grpc.ServerStream -} - -func (x *routeDiscoveryServiceStreamRoutesServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *routeDiscoveryServiceStreamRoutesServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _RouteDiscoveryService_DeltaRoutes_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(RouteDiscoveryServiceServer).DeltaRoutes(&routeDiscoveryServiceDeltaRoutesServer{stream}) -} - -type RouteDiscoveryService_DeltaRoutesServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type routeDiscoveryServiceDeltaRoutesServer struct { - grpc.ServerStream -} - -func (x *routeDiscoveryServiceDeltaRoutesServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *routeDiscoveryServiceDeltaRoutesServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _RouteDiscoveryService_FetchRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RouteDiscoveryServiceServer).FetchRoutes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RouteDiscoveryService_FetchRoutes_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RouteDiscoveryServiceServer).FetchRoutes(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// RouteDiscoveryService_ServiceDesc is the grpc.ServiceDesc for RouteDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var RouteDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.route.v3.RouteDiscoveryService", - HandlerType: (*RouteDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchRoutes", - Handler: _RouteDiscoveryService_FetchRoutes_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamRoutes", - Handler: _RouteDiscoveryService_StreamRoutes_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaRoutes", - Handler: _RouteDiscoveryService_DeltaRoutes_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/route/v3/rds.proto", -} - -const ( - VirtualHostDiscoveryService_DeltaVirtualHosts_FullMethodName = "/envoy.service.route.v3.VirtualHostDiscoveryService/DeltaVirtualHosts" -) - -// VirtualHostDiscoveryServiceClient is the client API for VirtualHostDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type VirtualHostDiscoveryServiceClient interface { - DeltaVirtualHosts(ctx context.Context, opts ...grpc.CallOption) (VirtualHostDiscoveryService_DeltaVirtualHostsClient, error) -} - -type virtualHostDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewVirtualHostDiscoveryServiceClient(cc grpc.ClientConnInterface) VirtualHostDiscoveryServiceClient { - return &virtualHostDiscoveryServiceClient{cc} -} - -func (c *virtualHostDiscoveryServiceClient) DeltaVirtualHosts(ctx context.Context, opts ...grpc.CallOption) (VirtualHostDiscoveryService_DeltaVirtualHostsClient, error) { - stream, err := c.cc.NewStream(ctx, &VirtualHostDiscoveryService_ServiceDesc.Streams[0], VirtualHostDiscoveryService_DeltaVirtualHosts_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &virtualHostDiscoveryServiceDeltaVirtualHostsClient{stream} - return x, nil -} - -type VirtualHostDiscoveryService_DeltaVirtualHostsClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type virtualHostDiscoveryServiceDeltaVirtualHostsClient struct { - grpc.ClientStream -} - -func (x *virtualHostDiscoveryServiceDeltaVirtualHostsClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *virtualHostDiscoveryServiceDeltaVirtualHostsClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// VirtualHostDiscoveryServiceServer is the server API for VirtualHostDiscoveryService service. -// All implementations should embed UnimplementedVirtualHostDiscoveryServiceServer -// for forward compatibility -type VirtualHostDiscoveryServiceServer interface { - DeltaVirtualHosts(VirtualHostDiscoveryService_DeltaVirtualHostsServer) error -} - -// UnimplementedVirtualHostDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedVirtualHostDiscoveryServiceServer struct { -} - -func (UnimplementedVirtualHostDiscoveryServiceServer) DeltaVirtualHosts(VirtualHostDiscoveryService_DeltaVirtualHostsServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaVirtualHosts not implemented") -} - -// UnsafeVirtualHostDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to VirtualHostDiscoveryServiceServer will -// result in compilation errors. -type UnsafeVirtualHostDiscoveryServiceServer interface { - mustEmbedUnimplementedVirtualHostDiscoveryServiceServer() -} - -func RegisterVirtualHostDiscoveryServiceServer(s grpc.ServiceRegistrar, srv VirtualHostDiscoveryServiceServer) { - s.RegisterService(&VirtualHostDiscoveryService_ServiceDesc, srv) -} - -func _VirtualHostDiscoveryService_DeltaVirtualHosts_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(VirtualHostDiscoveryServiceServer).DeltaVirtualHosts(&virtualHostDiscoveryServiceDeltaVirtualHostsServer{stream}) -} - -type VirtualHostDiscoveryService_DeltaVirtualHostsServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type virtualHostDiscoveryServiceDeltaVirtualHostsServer struct { - grpc.ServerStream -} - -func (x *virtualHostDiscoveryServiceDeltaVirtualHostsServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *virtualHostDiscoveryServiceDeltaVirtualHostsServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// VirtualHostDiscoveryService_ServiceDesc is the grpc.ServiceDesc for VirtualHostDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var VirtualHostDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.route.v3.VirtualHostDiscoveryService", - HandlerType: (*VirtualHostDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "DeltaVirtualHosts", - Handler: _VirtualHostDiscoveryService_DeltaVirtualHosts_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/route/v3/rds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds_vtproto.pb.go deleted file mode 100644 index a87519710..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/rds_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/route/v3/rds.proto - -package routev3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *RdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *RdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *RdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds.pb.go deleted file mode 100644 index 67fddf617..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds.pb.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/route/v3/srds.proto - -package routev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file. -type SrdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SrdsDummy) Reset() { - *x = SrdsDummy{} - mi := &file_envoy_service_route_v3_srds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SrdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SrdsDummy) ProtoMessage() {} - -func (x *SrdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_route_v3_srds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SrdsDummy.ProtoReflect.Descriptor instead. -func (*SrdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_route_v3_srds_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_route_v3_srds_proto protoreflect.FileDescriptor - -const file_envoy_service_route_v3_srds_proto_rawDesc = "" + - "\n" + - "!envoy/service/route/v3/srds.proto\x12\x16envoy.service.route.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\"*\n" + - "\tSrdsDummy:\x1d\x9aň\x1e\x18\n" + - "\x16envoy.api.v2.SrdsDummy2\xed\x03\n" + - "\x1cScopedRoutesDiscoveryService\x12w\n" + - "\x12StreamScopedRoutes\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12\x80\x01\n" + - "\x11DeltaScopedRoutes\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12\x98\x01\n" + - "\x11FetchScopedRoutes\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"&\x82\xd3\xe4\x93\x02 :\x01*\"\x1b/v3/discovery:scoped-routes\x1a6\x8a\xa4\x96\xf3\a0\n" + - ".envoy.config.route.v3.ScopedRouteConfigurationB\x82\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "$io.envoyproxy.envoy.service.route.v3B\tSrdsProtoP\x01ZEgithub.com/envoyproxy/go-control-plane/envoy/service/route/v3;routev3b\x06proto3" - -var ( - file_envoy_service_route_v3_srds_proto_rawDescOnce sync.Once - file_envoy_service_route_v3_srds_proto_rawDescData []byte -) - -func file_envoy_service_route_v3_srds_proto_rawDescGZIP() []byte { - file_envoy_service_route_v3_srds_proto_rawDescOnce.Do(func() { - file_envoy_service_route_v3_srds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_route_v3_srds_proto_rawDesc), len(file_envoy_service_route_v3_srds_proto_rawDesc))) - }) - return file_envoy_service_route_v3_srds_proto_rawDescData -} - -var file_envoy_service_route_v3_srds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_route_v3_srds_proto_goTypes = []any{ - (*SrdsDummy)(nil), // 0: envoy.service.route.v3.SrdsDummy - (*v3.DiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DiscoveryResponse - (*v3.DeltaDiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_route_v3_srds_proto_depIdxs = []int32{ - 1, // 0: envoy.service.route.v3.ScopedRoutesDiscoveryService.StreamScopedRoutes:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 1: envoy.service.route.v3.ScopedRoutesDiscoveryService.DeltaScopedRoutes:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 1, // 2: envoy.service.route.v3.ScopedRoutesDiscoveryService.FetchScopedRoutes:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 3, // 3: envoy.service.route.v3.ScopedRoutesDiscoveryService.StreamScopedRoutes:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 4: envoy.service.route.v3.ScopedRoutesDiscoveryService.DeltaScopedRoutes:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 3, // 5: envoy.service.route.v3.ScopedRoutesDiscoveryService.FetchScopedRoutes:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_route_v3_srds_proto_init() } -func file_envoy_service_route_v3_srds_proto_init() { - if File_envoy_service_route_v3_srds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_route_v3_srds_proto_rawDesc), len(file_envoy_service_route_v3_srds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_route_v3_srds_proto_goTypes, - DependencyIndexes: file_envoy_service_route_v3_srds_proto_depIdxs, - MessageInfos: file_envoy_service_route_v3_srds_proto_msgTypes, - }.Build() - File_envoy_service_route_v3_srds_proto = out.File - file_envoy_service_route_v3_srds_proto_goTypes = nil - file_envoy_service_route_v3_srds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds.pb.validate.go deleted file mode 100644 index 4cacab822..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/route/v3/srds.proto - -package routev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on SrdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *SrdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SrdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in SrdsDummyMultiError, or nil -// if none found. -func (m *SrdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *SrdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return SrdsDummyMultiError(errors) - } - - return nil -} - -// SrdsDummyMultiError is an error wrapping multiple validation errors returned -// by SrdsDummy.ValidateAll() if the designated constraints aren't met. -type SrdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SrdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SrdsDummyMultiError) AllErrors() []error { return m } - -// SrdsDummyValidationError is the validation error returned by -// SrdsDummy.Validate if the designated constraints aren't met. -type SrdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SrdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SrdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SrdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SrdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SrdsDummyValidationError) ErrorName() string { return "SrdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e SrdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSrdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SrdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SrdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds_grpc.pb.go deleted file mode 100644 index af33acd9d..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds_grpc.pb.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/route/v3/srds.proto - -package routev3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - ScopedRoutesDiscoveryService_StreamScopedRoutes_FullMethodName = "/envoy.service.route.v3.ScopedRoutesDiscoveryService/StreamScopedRoutes" - ScopedRoutesDiscoveryService_DeltaScopedRoutes_FullMethodName = "/envoy.service.route.v3.ScopedRoutesDiscoveryService/DeltaScopedRoutes" - ScopedRoutesDiscoveryService_FetchScopedRoutes_FullMethodName = "/envoy.service.route.v3.ScopedRoutesDiscoveryService/FetchScopedRoutes" -) - -// ScopedRoutesDiscoveryServiceClient is the client API for ScopedRoutesDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ScopedRoutesDiscoveryServiceClient interface { - StreamScopedRoutes(ctx context.Context, opts ...grpc.CallOption) (ScopedRoutesDiscoveryService_StreamScopedRoutesClient, error) - DeltaScopedRoutes(ctx context.Context, opts ...grpc.CallOption) (ScopedRoutesDiscoveryService_DeltaScopedRoutesClient, error) - FetchScopedRoutes(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type scopedRoutesDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewScopedRoutesDiscoveryServiceClient(cc grpc.ClientConnInterface) ScopedRoutesDiscoveryServiceClient { - return &scopedRoutesDiscoveryServiceClient{cc} -} - -func (c *scopedRoutesDiscoveryServiceClient) StreamScopedRoutes(ctx context.Context, opts ...grpc.CallOption) (ScopedRoutesDiscoveryService_StreamScopedRoutesClient, error) { - stream, err := c.cc.NewStream(ctx, &ScopedRoutesDiscoveryService_ServiceDesc.Streams[0], ScopedRoutesDiscoveryService_StreamScopedRoutes_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &scopedRoutesDiscoveryServiceStreamScopedRoutesClient{stream} - return x, nil -} - -type ScopedRoutesDiscoveryService_StreamScopedRoutesClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type scopedRoutesDiscoveryServiceStreamScopedRoutesClient struct { - grpc.ClientStream -} - -func (x *scopedRoutesDiscoveryServiceStreamScopedRoutesClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *scopedRoutesDiscoveryServiceStreamScopedRoutesClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *scopedRoutesDiscoveryServiceClient) DeltaScopedRoutes(ctx context.Context, opts ...grpc.CallOption) (ScopedRoutesDiscoveryService_DeltaScopedRoutesClient, error) { - stream, err := c.cc.NewStream(ctx, &ScopedRoutesDiscoveryService_ServiceDesc.Streams[1], ScopedRoutesDiscoveryService_DeltaScopedRoutes_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &scopedRoutesDiscoveryServiceDeltaScopedRoutesClient{stream} - return x, nil -} - -type ScopedRoutesDiscoveryService_DeltaScopedRoutesClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type scopedRoutesDiscoveryServiceDeltaScopedRoutesClient struct { - grpc.ClientStream -} - -func (x *scopedRoutesDiscoveryServiceDeltaScopedRoutesClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *scopedRoutesDiscoveryServiceDeltaScopedRoutesClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *scopedRoutesDiscoveryServiceClient) FetchScopedRoutes(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, ScopedRoutesDiscoveryService_FetchScopedRoutes_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ScopedRoutesDiscoveryServiceServer is the server API for ScopedRoutesDiscoveryService service. -// All implementations should embed UnimplementedScopedRoutesDiscoveryServiceServer -// for forward compatibility -type ScopedRoutesDiscoveryServiceServer interface { - StreamScopedRoutes(ScopedRoutesDiscoveryService_StreamScopedRoutesServer) error - DeltaScopedRoutes(ScopedRoutesDiscoveryService_DeltaScopedRoutesServer) error - FetchScopedRoutes(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedScopedRoutesDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedScopedRoutesDiscoveryServiceServer struct { -} - -func (UnimplementedScopedRoutesDiscoveryServiceServer) StreamScopedRoutes(ScopedRoutesDiscoveryService_StreamScopedRoutesServer) error { - return status.Errorf(codes.Unimplemented, "method StreamScopedRoutes not implemented") -} -func (UnimplementedScopedRoutesDiscoveryServiceServer) DeltaScopedRoutes(ScopedRoutesDiscoveryService_DeltaScopedRoutesServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaScopedRoutes not implemented") -} -func (UnimplementedScopedRoutesDiscoveryServiceServer) FetchScopedRoutes(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchScopedRoutes not implemented") -} - -// UnsafeScopedRoutesDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ScopedRoutesDiscoveryServiceServer will -// result in compilation errors. -type UnsafeScopedRoutesDiscoveryServiceServer interface { - mustEmbedUnimplementedScopedRoutesDiscoveryServiceServer() -} - -func RegisterScopedRoutesDiscoveryServiceServer(s grpc.ServiceRegistrar, srv ScopedRoutesDiscoveryServiceServer) { - s.RegisterService(&ScopedRoutesDiscoveryService_ServiceDesc, srv) -} - -func _ScopedRoutesDiscoveryService_StreamScopedRoutes_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ScopedRoutesDiscoveryServiceServer).StreamScopedRoutes(&scopedRoutesDiscoveryServiceStreamScopedRoutesServer{stream}) -} - -type ScopedRoutesDiscoveryService_StreamScopedRoutesServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type scopedRoutesDiscoveryServiceStreamScopedRoutesServer struct { - grpc.ServerStream -} - -func (x *scopedRoutesDiscoveryServiceStreamScopedRoutesServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *scopedRoutesDiscoveryServiceStreamScopedRoutesServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ScopedRoutesDiscoveryService_DeltaScopedRoutes_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ScopedRoutesDiscoveryServiceServer).DeltaScopedRoutes(&scopedRoutesDiscoveryServiceDeltaScopedRoutesServer{stream}) -} - -type ScopedRoutesDiscoveryService_DeltaScopedRoutesServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type scopedRoutesDiscoveryServiceDeltaScopedRoutesServer struct { - grpc.ServerStream -} - -func (x *scopedRoutesDiscoveryServiceDeltaScopedRoutesServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *scopedRoutesDiscoveryServiceDeltaScopedRoutesServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _ScopedRoutesDiscoveryService_FetchScopedRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ScopedRoutesDiscoveryServiceServer).FetchScopedRoutes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ScopedRoutesDiscoveryService_FetchScopedRoutes_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ScopedRoutesDiscoveryServiceServer).FetchScopedRoutes(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ScopedRoutesDiscoveryService_ServiceDesc is the grpc.ServiceDesc for ScopedRoutesDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ScopedRoutesDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.route.v3.ScopedRoutesDiscoveryService", - HandlerType: (*ScopedRoutesDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchScopedRoutes", - Handler: _ScopedRoutesDiscoveryService_FetchScopedRoutes_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamScopedRoutes", - Handler: _ScopedRoutesDiscoveryService_StreamScopedRoutes_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaScopedRoutes", - Handler: _ScopedRoutesDiscoveryService_DeltaScopedRoutes_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/route/v3/srds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds_vtproto.pb.go deleted file mode 100644 index daab714ae..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/route/v3/srds_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/route/v3/srds.proto - -package routev3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *SrdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SrdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *SrdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *SrdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds.pb.go deleted file mode 100644 index e6fc95a2b..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds.pb.go +++ /dev/null @@ -1,200 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/runtime/v3/rtds.proto - -package runtimev3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "github.com/envoyproxy/protoc-gen-validate/validate" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 -type RtdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RtdsDummy) Reset() { - *x = RtdsDummy{} - mi := &file_envoy_service_runtime_v3_rtds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RtdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RtdsDummy) ProtoMessage() {} - -func (x *RtdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_runtime_v3_rtds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RtdsDummy.ProtoReflect.Descriptor instead. -func (*RtdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_runtime_v3_rtds_proto_rawDescGZIP(), []int{0} -} - -// RTDS resource type. This describes a layer in the runtime virtual filesystem. -type Runtime struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Runtime resource name. This makes the Runtime a self-describing xDS - // resource. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Layer *structpb.Struct `protobuf:"bytes,2,opt,name=layer,proto3" json:"layer,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Runtime) Reset() { - *x = Runtime{} - mi := &file_envoy_service_runtime_v3_rtds_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Runtime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Runtime) ProtoMessage() {} - -func (x *Runtime) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_runtime_v3_rtds_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Runtime.ProtoReflect.Descriptor instead. -func (*Runtime) Descriptor() ([]byte, []int) { - return file_envoy_service_runtime_v3_rtds_proto_rawDescGZIP(), []int{1} -} - -func (x *Runtime) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Runtime) GetLayer() *structpb.Struct { - if x != nil { - return x.Layer - } - return nil -} - -var File_envoy_service_runtime_v3_rtds_proto protoreflect.FileDescriptor - -const file_envoy_service_runtime_v3_rtds_proto_rawDesc = "" + - "\n" + - "#envoy/service/runtime/v3/rtds.proto\x12\x18envoy.service.runtime.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\x1a\x17validate/validate.proto\"8\n" + - "\tRtdsDummy:+\x9aň\x1e&\n" + - "$envoy.service.discovery.v2.RtdsDummy\"\x80\x01\n" + - "\aRuntime\x12\x1b\n" + - "\x04name\x18\x01 \x01(\tB\a\xfaB\x04r\x02\x10\x01R\x04name\x12-\n" + - "\x05layer\x18\x02 \x01(\v2\x17.google.protobuf.StructR\x05layer:)\x9aň\x1e$\n" + - "\"envoy.service.discovery.v2.Runtime2\xc4\x03\n" + - "\x17RuntimeDiscoveryService\x12r\n" + - "\rStreamRuntime\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12{\n" + - "\fDeltaRuntime\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12\x8d\x01\n" + - "\fFetchRuntime\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v3/discovery:runtime\x1a(\x8a\xa4\x96\xf3\a\"\n" + - " envoy.service.runtime.v3.RuntimeB\x88\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "&io.envoyproxy.envoy.service.runtime.v3B\tRtdsProtoP\x01ZIgithub.com/envoyproxy/go-control-plane/envoy/service/runtime/v3;runtimev3b\x06proto3" - -var ( - file_envoy_service_runtime_v3_rtds_proto_rawDescOnce sync.Once - file_envoy_service_runtime_v3_rtds_proto_rawDescData []byte -) - -func file_envoy_service_runtime_v3_rtds_proto_rawDescGZIP() []byte { - file_envoy_service_runtime_v3_rtds_proto_rawDescOnce.Do(func() { - file_envoy_service_runtime_v3_rtds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_runtime_v3_rtds_proto_rawDesc), len(file_envoy_service_runtime_v3_rtds_proto_rawDesc))) - }) - return file_envoy_service_runtime_v3_rtds_proto_rawDescData -} - -var file_envoy_service_runtime_v3_rtds_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_envoy_service_runtime_v3_rtds_proto_goTypes = []any{ - (*RtdsDummy)(nil), // 0: envoy.service.runtime.v3.RtdsDummy - (*Runtime)(nil), // 1: envoy.service.runtime.v3.Runtime - (*structpb.Struct)(nil), // 2: google.protobuf.Struct - (*v3.DiscoveryRequest)(nil), // 3: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryRequest)(nil), // 4: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 5: envoy.service.discovery.v3.DiscoveryResponse - (*v3.DeltaDiscoveryResponse)(nil), // 6: envoy.service.discovery.v3.DeltaDiscoveryResponse -} -var file_envoy_service_runtime_v3_rtds_proto_depIdxs = []int32{ - 2, // 0: envoy.service.runtime.v3.Runtime.layer:type_name -> google.protobuf.Struct - 3, // 1: envoy.service.runtime.v3.RuntimeDiscoveryService.StreamRuntime:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 4, // 2: envoy.service.runtime.v3.RuntimeDiscoveryService.DeltaRuntime:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 3, // 3: envoy.service.runtime.v3.RuntimeDiscoveryService.FetchRuntime:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 5, // 4: envoy.service.runtime.v3.RuntimeDiscoveryService.StreamRuntime:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 6, // 5: envoy.service.runtime.v3.RuntimeDiscoveryService.DeltaRuntime:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 5, // 6: envoy.service.runtime.v3.RuntimeDiscoveryService.FetchRuntime:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // [4:7] is the sub-list for method output_type - 1, // [1:4] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_envoy_service_runtime_v3_rtds_proto_init() } -func file_envoy_service_runtime_v3_rtds_proto_init() { - if File_envoy_service_runtime_v3_rtds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_runtime_v3_rtds_proto_rawDesc), len(file_envoy_service_runtime_v3_rtds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_runtime_v3_rtds_proto_goTypes, - DependencyIndexes: file_envoy_service_runtime_v3_rtds_proto_depIdxs, - MessageInfos: file_envoy_service_runtime_v3_rtds_proto_msgTypes, - }.Build() - File_envoy_service_runtime_v3_rtds_proto = out.File - file_envoy_service_runtime_v3_rtds_proto_goTypes = nil - file_envoy_service_runtime_v3_rtds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds.pb.validate.go deleted file mode 100644 index ea88287b0..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds.pb.validate.go +++ /dev/null @@ -1,274 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/runtime/v3/rtds.proto - -package runtimev3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on RtdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *RtdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RtdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in RtdsDummyMultiError, or nil -// if none found. -func (m *RtdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *RtdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return RtdsDummyMultiError(errors) - } - - return nil -} - -// RtdsDummyMultiError is an error wrapping multiple validation errors returned -// by RtdsDummy.ValidateAll() if the designated constraints aren't met. -type RtdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RtdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RtdsDummyMultiError) AllErrors() []error { return m } - -// RtdsDummyValidationError is the validation error returned by -// RtdsDummy.Validate if the designated constraints aren't met. -type RtdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RtdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RtdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RtdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RtdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RtdsDummyValidationError) ErrorName() string { return "RtdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e RtdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRtdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RtdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RtdsDummyValidationError{} - -// Validate checks the field values on Runtime with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Runtime) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Runtime with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in RuntimeMultiError, or nil if none found. -func (m *Runtime) ValidateAll() error { - return m.validate(true) -} - -func (m *Runtime) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if utf8.RuneCountInString(m.GetName()) < 1 { - err := RuntimeValidationError{ - field: "Name", - reason: "value length must be at least 1 runes", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetLayer()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RuntimeValidationError{ - field: "Layer", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RuntimeValidationError{ - field: "Layer", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLayer()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RuntimeValidationError{ - field: "Layer", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return RuntimeMultiError(errors) - } - - return nil -} - -// RuntimeMultiError is an error wrapping multiple validation errors returned -// by Runtime.ValidateAll() if the designated constraints aren't met. -type RuntimeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RuntimeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RuntimeMultiError) AllErrors() []error { return m } - -// RuntimeValidationError is the validation error returned by Runtime.Validate -// if the designated constraints aren't met. -type RuntimeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RuntimeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RuntimeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RuntimeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RuntimeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RuntimeValidationError) ErrorName() string { return "RuntimeValidationError" } - -// Error satisfies the builtin error interface -func (e RuntimeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRuntime.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RuntimeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RuntimeValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds_grpc.pb.go deleted file mode 100644 index c3cc8aa04..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds_grpc.pb.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/runtime/v3/rtds.proto - -package runtimev3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - RuntimeDiscoveryService_StreamRuntime_FullMethodName = "/envoy.service.runtime.v3.RuntimeDiscoveryService/StreamRuntime" - RuntimeDiscoveryService_DeltaRuntime_FullMethodName = "/envoy.service.runtime.v3.RuntimeDiscoveryService/DeltaRuntime" - RuntimeDiscoveryService_FetchRuntime_FullMethodName = "/envoy.service.runtime.v3.RuntimeDiscoveryService/FetchRuntime" -) - -// RuntimeDiscoveryServiceClient is the client API for RuntimeDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type RuntimeDiscoveryServiceClient interface { - StreamRuntime(ctx context.Context, opts ...grpc.CallOption) (RuntimeDiscoveryService_StreamRuntimeClient, error) - DeltaRuntime(ctx context.Context, opts ...grpc.CallOption) (RuntimeDiscoveryService_DeltaRuntimeClient, error) - FetchRuntime(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type runtimeDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewRuntimeDiscoveryServiceClient(cc grpc.ClientConnInterface) RuntimeDiscoveryServiceClient { - return &runtimeDiscoveryServiceClient{cc} -} - -func (c *runtimeDiscoveryServiceClient) StreamRuntime(ctx context.Context, opts ...grpc.CallOption) (RuntimeDiscoveryService_StreamRuntimeClient, error) { - stream, err := c.cc.NewStream(ctx, &RuntimeDiscoveryService_ServiceDesc.Streams[0], RuntimeDiscoveryService_StreamRuntime_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &runtimeDiscoveryServiceStreamRuntimeClient{stream} - return x, nil -} - -type RuntimeDiscoveryService_StreamRuntimeClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type runtimeDiscoveryServiceStreamRuntimeClient struct { - grpc.ClientStream -} - -func (x *runtimeDiscoveryServiceStreamRuntimeClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *runtimeDiscoveryServiceStreamRuntimeClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *runtimeDiscoveryServiceClient) DeltaRuntime(ctx context.Context, opts ...grpc.CallOption) (RuntimeDiscoveryService_DeltaRuntimeClient, error) { - stream, err := c.cc.NewStream(ctx, &RuntimeDiscoveryService_ServiceDesc.Streams[1], RuntimeDiscoveryService_DeltaRuntime_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &runtimeDiscoveryServiceDeltaRuntimeClient{stream} - return x, nil -} - -type RuntimeDiscoveryService_DeltaRuntimeClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type runtimeDiscoveryServiceDeltaRuntimeClient struct { - grpc.ClientStream -} - -func (x *runtimeDiscoveryServiceDeltaRuntimeClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *runtimeDiscoveryServiceDeltaRuntimeClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *runtimeDiscoveryServiceClient) FetchRuntime(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, RuntimeDiscoveryService_FetchRuntime_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RuntimeDiscoveryServiceServer is the server API for RuntimeDiscoveryService service. -// All implementations should embed UnimplementedRuntimeDiscoveryServiceServer -// for forward compatibility -type RuntimeDiscoveryServiceServer interface { - StreamRuntime(RuntimeDiscoveryService_StreamRuntimeServer) error - DeltaRuntime(RuntimeDiscoveryService_DeltaRuntimeServer) error - FetchRuntime(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedRuntimeDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedRuntimeDiscoveryServiceServer struct { -} - -func (UnimplementedRuntimeDiscoveryServiceServer) StreamRuntime(RuntimeDiscoveryService_StreamRuntimeServer) error { - return status.Errorf(codes.Unimplemented, "method StreamRuntime not implemented") -} -func (UnimplementedRuntimeDiscoveryServiceServer) DeltaRuntime(RuntimeDiscoveryService_DeltaRuntimeServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaRuntime not implemented") -} -func (UnimplementedRuntimeDiscoveryServiceServer) FetchRuntime(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchRuntime not implemented") -} - -// UnsafeRuntimeDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to RuntimeDiscoveryServiceServer will -// result in compilation errors. -type UnsafeRuntimeDiscoveryServiceServer interface { - mustEmbedUnimplementedRuntimeDiscoveryServiceServer() -} - -func RegisterRuntimeDiscoveryServiceServer(s grpc.ServiceRegistrar, srv RuntimeDiscoveryServiceServer) { - s.RegisterService(&RuntimeDiscoveryService_ServiceDesc, srv) -} - -func _RuntimeDiscoveryService_StreamRuntime_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(RuntimeDiscoveryServiceServer).StreamRuntime(&runtimeDiscoveryServiceStreamRuntimeServer{stream}) -} - -type RuntimeDiscoveryService_StreamRuntimeServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type runtimeDiscoveryServiceStreamRuntimeServer struct { - grpc.ServerStream -} - -func (x *runtimeDiscoveryServiceStreamRuntimeServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *runtimeDiscoveryServiceStreamRuntimeServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _RuntimeDiscoveryService_DeltaRuntime_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(RuntimeDiscoveryServiceServer).DeltaRuntime(&runtimeDiscoveryServiceDeltaRuntimeServer{stream}) -} - -type RuntimeDiscoveryService_DeltaRuntimeServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type runtimeDiscoveryServiceDeltaRuntimeServer struct { - grpc.ServerStream -} - -func (x *runtimeDiscoveryServiceDeltaRuntimeServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *runtimeDiscoveryServiceDeltaRuntimeServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _RuntimeDiscoveryService_FetchRuntime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RuntimeDiscoveryServiceServer).FetchRuntime(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: RuntimeDiscoveryService_FetchRuntime_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RuntimeDiscoveryServiceServer).FetchRuntime(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// RuntimeDiscoveryService_ServiceDesc is the grpc.ServiceDesc for RuntimeDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var RuntimeDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.runtime.v3.RuntimeDiscoveryService", - HandlerType: (*RuntimeDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchRuntime", - Handler: _RuntimeDiscoveryService_FetchRuntime_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamRuntime", - Handler: _RuntimeDiscoveryService_StreamRuntime_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "DeltaRuntime", - Handler: _RuntimeDiscoveryService_DeltaRuntime_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/runtime/v3/rtds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds_vtproto.pb.go deleted file mode 100644 index 9a0f757a8..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3/rtds_vtproto.pb.go +++ /dev/null @@ -1,131 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/runtime/v3/rtds.proto - -package runtimev3 - -import ( - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - structpb "github.com/planetscale/vtprotobuf/types/known/structpb" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *RtdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RtdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *RtdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *Runtime) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Runtime) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Runtime) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Layer != nil { - size, err := (*structpb.Struct)(m.Layer).MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RtdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} - -func (m *Runtime) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Layer != nil { - l = (*structpb.Struct)(m.Layer).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds.pb.go deleted file mode 100644 index 03b704658..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds.pb.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v6.33.2 -// source: envoy/service/secret/v3/sds.proto - -package secretv3 - -import ( - _ "github.com/cncf/xds/go/udpa/annotations" - _ "github.com/envoyproxy/go-control-plane/envoy/annotations" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing -// services: https://github.com/google/protobuf/issues/4221 -type SdsDummy struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SdsDummy) Reset() { - *x = SdsDummy{} - mi := &file_envoy_service_secret_v3_sds_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SdsDummy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SdsDummy) ProtoMessage() {} - -func (x *SdsDummy) ProtoReflect() protoreflect.Message { - mi := &file_envoy_service_secret_v3_sds_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SdsDummy.ProtoReflect.Descriptor instead. -func (*SdsDummy) Descriptor() ([]byte, []int) { - return file_envoy_service_secret_v3_sds_proto_rawDescGZIP(), []int{0} -} - -var File_envoy_service_secret_v3_sds_proto protoreflect.FileDescriptor - -const file_envoy_service_secret_v3_sds_proto_rawDesc = "" + - "\n" + - "!envoy/service/secret/v3/sds.proto\x12\x17envoy.service.secret.v3\x1a*envoy/service/discovery/v3/discovery.proto\x1a\x1cgoogle/api/annotations.proto\x1a envoy/annotations/resource.proto\x1a\x1dudpa/annotations/status.proto\x1a!udpa/annotations/versioning.proto\"6\n" + - "\bSdsDummy:*\x9aň\x1e%\n" + - "#envoy.service.discovery.v2.SdsDummy2\xd3\x03\n" + - "\x16SecretDiscoveryService\x12{\n" + - "\fDeltaSecrets\x121.envoy.service.discovery.v3.DeltaDiscoveryRequest\x1a2.envoy.service.discovery.v3.DeltaDiscoveryResponse\"\x00(\x010\x01\x12r\n" + - "\rStreamSecrets\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\"\x00(\x010\x01\x12\x8d\x01\n" + - "\fFetchSecrets\x12,.envoy.service.discovery.v3.DiscoveryRequest\x1a-.envoy.service.discovery.v3.DiscoveryResponse\" \x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v3/discovery:secrets\x1a8\x8a\xa4\x96\xf3\a2\n" + - "0envoy.extensions.transport_sockets.tls.v3.SecretB\x84\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" + - "%io.envoyproxy.envoy.service.secret.v3B\bSdsProtoP\x01ZGgithub.com/envoyproxy/go-control-plane/envoy/service/secret/v3;secretv3b\x06proto3" - -var ( - file_envoy_service_secret_v3_sds_proto_rawDescOnce sync.Once - file_envoy_service_secret_v3_sds_proto_rawDescData []byte -) - -func file_envoy_service_secret_v3_sds_proto_rawDescGZIP() []byte { - file_envoy_service_secret_v3_sds_proto_rawDescOnce.Do(func() { - file_envoy_service_secret_v3_sds_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_service_secret_v3_sds_proto_rawDesc), len(file_envoy_service_secret_v3_sds_proto_rawDesc))) - }) - return file_envoy_service_secret_v3_sds_proto_rawDescData -} - -var file_envoy_service_secret_v3_sds_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_envoy_service_secret_v3_sds_proto_goTypes = []any{ - (*SdsDummy)(nil), // 0: envoy.service.secret.v3.SdsDummy - (*v3.DeltaDiscoveryRequest)(nil), // 1: envoy.service.discovery.v3.DeltaDiscoveryRequest - (*v3.DiscoveryRequest)(nil), // 2: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DeltaDiscoveryResponse)(nil), // 3: envoy.service.discovery.v3.DeltaDiscoveryResponse - (*v3.DiscoveryResponse)(nil), // 4: envoy.service.discovery.v3.DiscoveryResponse -} -var file_envoy_service_secret_v3_sds_proto_depIdxs = []int32{ - 1, // 0: envoy.service.secret.v3.SecretDiscoveryService.DeltaSecrets:input_type -> envoy.service.discovery.v3.DeltaDiscoveryRequest - 2, // 1: envoy.service.secret.v3.SecretDiscoveryService.StreamSecrets:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 2, // 2: envoy.service.secret.v3.SecretDiscoveryService.FetchSecrets:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 3, // 3: envoy.service.secret.v3.SecretDiscoveryService.DeltaSecrets:output_type -> envoy.service.discovery.v3.DeltaDiscoveryResponse - 4, // 4: envoy.service.secret.v3.SecretDiscoveryService.StreamSecrets:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 4, // 5: envoy.service.secret.v3.SecretDiscoveryService.FetchSecrets:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_envoy_service_secret_v3_sds_proto_init() } -func file_envoy_service_secret_v3_sds_proto_init() { - if File_envoy_service_secret_v3_sds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_service_secret_v3_sds_proto_rawDesc), len(file_envoy_service_secret_v3_sds_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_envoy_service_secret_v3_sds_proto_goTypes, - DependencyIndexes: file_envoy_service_secret_v3_sds_proto_depIdxs, - MessageInfos: file_envoy_service_secret_v3_sds_proto_msgTypes, - }.Build() - File_envoy_service_secret_v3_sds_proto = out.File - file_envoy_service_secret_v3_sds_proto_goTypes = nil - file_envoy_service_secret_v3_sds_proto_depIdxs = nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds.pb.validate.go deleted file mode 100644 index 9039a65ce..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds.pb.validate.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build !disable_pgv -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: envoy/service/secret/v3/sds.proto - -package secretv3 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on SdsDummy with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *SdsDummy) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SdsDummy with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in SdsDummyMultiError, or nil -// if none found. -func (m *SdsDummy) ValidateAll() error { - return m.validate(true) -} - -func (m *SdsDummy) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return SdsDummyMultiError(errors) - } - - return nil -} - -// SdsDummyMultiError is an error wrapping multiple validation errors returned -// by SdsDummy.ValidateAll() if the designated constraints aren't met. -type SdsDummyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SdsDummyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SdsDummyMultiError) AllErrors() []error { return m } - -// SdsDummyValidationError is the validation error returned by -// SdsDummy.Validate if the designated constraints aren't met. -type SdsDummyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SdsDummyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SdsDummyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SdsDummyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SdsDummyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SdsDummyValidationError) ErrorName() string { return "SdsDummyValidationError" } - -// Error satisfies the builtin error interface -func (e SdsDummyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSdsDummy.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SdsDummyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SdsDummyValidationError{} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds_grpc.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds_grpc.pb.go deleted file mode 100644 index 01eaae41a..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds_grpc.pb.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v6.33.2 -// source: envoy/service/secret/v3/sds.proto - -package secretv3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - SecretDiscoveryService_DeltaSecrets_FullMethodName = "/envoy.service.secret.v3.SecretDiscoveryService/DeltaSecrets" - SecretDiscoveryService_StreamSecrets_FullMethodName = "/envoy.service.secret.v3.SecretDiscoveryService/StreamSecrets" - SecretDiscoveryService_FetchSecrets_FullMethodName = "/envoy.service.secret.v3.SecretDiscoveryService/FetchSecrets" -) - -// SecretDiscoveryServiceClient is the client API for SecretDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type SecretDiscoveryServiceClient interface { - DeltaSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretDiscoveryService_DeltaSecretsClient, error) - StreamSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretDiscoveryService_StreamSecretsClient, error) - FetchSecrets(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type secretDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewSecretDiscoveryServiceClient(cc grpc.ClientConnInterface) SecretDiscoveryServiceClient { - return &secretDiscoveryServiceClient{cc} -} - -func (c *secretDiscoveryServiceClient) DeltaSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretDiscoveryService_DeltaSecretsClient, error) { - stream, err := c.cc.NewStream(ctx, &SecretDiscoveryService_ServiceDesc.Streams[0], SecretDiscoveryService_DeltaSecrets_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &secretDiscoveryServiceDeltaSecretsClient{stream} - return x, nil -} - -type SecretDiscoveryService_DeltaSecretsClient interface { - Send(*v3.DeltaDiscoveryRequest) error - Recv() (*v3.DeltaDiscoveryResponse, error) - grpc.ClientStream -} - -type secretDiscoveryServiceDeltaSecretsClient struct { - grpc.ClientStream -} - -func (x *secretDiscoveryServiceDeltaSecretsClient) Send(m *v3.DeltaDiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *secretDiscoveryServiceDeltaSecretsClient) Recv() (*v3.DeltaDiscoveryResponse, error) { - m := new(v3.DeltaDiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *secretDiscoveryServiceClient) StreamSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretDiscoveryService_StreamSecretsClient, error) { - stream, err := c.cc.NewStream(ctx, &SecretDiscoveryService_ServiceDesc.Streams[1], SecretDiscoveryService_StreamSecrets_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &secretDiscoveryServiceStreamSecretsClient{stream} - return x, nil -} - -type SecretDiscoveryService_StreamSecretsClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type secretDiscoveryServiceStreamSecretsClient struct { - grpc.ClientStream -} - -func (x *secretDiscoveryServiceStreamSecretsClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *secretDiscoveryServiceStreamSecretsClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *secretDiscoveryServiceClient) FetchSecrets(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, SecretDiscoveryService_FetchSecrets_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SecretDiscoveryServiceServer is the server API for SecretDiscoveryService service. -// All implementations should embed UnimplementedSecretDiscoveryServiceServer -// for forward compatibility -type SecretDiscoveryServiceServer interface { - DeltaSecrets(SecretDiscoveryService_DeltaSecretsServer) error - StreamSecrets(SecretDiscoveryService_StreamSecretsServer) error - FetchSecrets(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedSecretDiscoveryServiceServer should be embedded to have forward compatible implementations. -type UnimplementedSecretDiscoveryServiceServer struct { -} - -func (UnimplementedSecretDiscoveryServiceServer) DeltaSecrets(SecretDiscoveryService_DeltaSecretsServer) error { - return status.Errorf(codes.Unimplemented, "method DeltaSecrets not implemented") -} -func (UnimplementedSecretDiscoveryServiceServer) StreamSecrets(SecretDiscoveryService_StreamSecretsServer) error { - return status.Errorf(codes.Unimplemented, "method StreamSecrets not implemented") -} -func (UnimplementedSecretDiscoveryServiceServer) FetchSecrets(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchSecrets not implemented") -} - -// UnsafeSecretDiscoveryServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to SecretDiscoveryServiceServer will -// result in compilation errors. -type UnsafeSecretDiscoveryServiceServer interface { - mustEmbedUnimplementedSecretDiscoveryServiceServer() -} - -func RegisterSecretDiscoveryServiceServer(s grpc.ServiceRegistrar, srv SecretDiscoveryServiceServer) { - s.RegisterService(&SecretDiscoveryService_ServiceDesc, srv) -} - -func _SecretDiscoveryService_DeltaSecrets_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SecretDiscoveryServiceServer).DeltaSecrets(&secretDiscoveryServiceDeltaSecretsServer{stream}) -} - -type SecretDiscoveryService_DeltaSecretsServer interface { - Send(*v3.DeltaDiscoveryResponse) error - Recv() (*v3.DeltaDiscoveryRequest, error) - grpc.ServerStream -} - -type secretDiscoveryServiceDeltaSecretsServer struct { - grpc.ServerStream -} - -func (x *secretDiscoveryServiceDeltaSecretsServer) Send(m *v3.DeltaDiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *secretDiscoveryServiceDeltaSecretsServer) Recv() (*v3.DeltaDiscoveryRequest, error) { - m := new(v3.DeltaDiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _SecretDiscoveryService_StreamSecrets_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SecretDiscoveryServiceServer).StreamSecrets(&secretDiscoveryServiceStreamSecretsServer{stream}) -} - -type SecretDiscoveryService_StreamSecretsServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type secretDiscoveryServiceStreamSecretsServer struct { - grpc.ServerStream -} - -func (x *secretDiscoveryServiceStreamSecretsServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *secretDiscoveryServiceStreamSecretsServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _SecretDiscoveryService_FetchSecrets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SecretDiscoveryServiceServer).FetchSecrets(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: SecretDiscoveryService_FetchSecrets_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SecretDiscoveryServiceServer).FetchSecrets(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// SecretDiscoveryService_ServiceDesc is the grpc.ServiceDesc for SecretDiscoveryService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var SecretDiscoveryService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "envoy.service.secret.v3.SecretDiscoveryService", - HandlerType: (*SecretDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchSecrets", - Handler: _SecretDiscoveryService_FetchSecrets_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "DeltaSecrets", - Handler: _SecretDiscoveryService_DeltaSecrets_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "StreamSecrets", - Handler: _SecretDiscoveryService_StreamSecrets_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "envoy/service/secret/v3/sds.proto", -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds_vtproto.pb.go deleted file mode 100644 index c3e3d8eb0..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/envoy/service/secret/v3/sds_vtproto.pb.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build vtprotobuf -// +build vtprotobuf - -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// source: envoy/service/secret/v3/sds.proto - -package secretv3 - -import ( - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *SdsDummy) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SdsDummy) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *SdsDummy) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *SdsDummy) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/types/types.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/types/types.go deleted file mode 100644 index 83e01de04..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/types/types.go +++ /dev/null @@ -1,57 +0,0 @@ -package types //nolint:revive // var-naming: avoid meaningless package names - -import ( - "time" - - "google.golang.org/protobuf/proto" -) - -// Resource is the base interface for the xDS payload. -type Resource interface { - proto.Message -} - -// ResourceWithTTL is a Resource with an optional TTL. -type ResourceWithTTL struct { - Resource Resource - TTL *time.Duration -} - -// ResourceWithName provides a name for out-of-tree resources. -type ResourceWithName interface { - proto.Message - GetName() string -} - -// MarshaledResource is an alias for the serialized binary array. -type MarshaledResource = []byte - -// SkipFetchError is the error returned when the cache fetch is short -// circuited due to the client's version already being up-to-date. -type SkipFetchError struct{} - -// Error satisfies the error interface -func (e SkipFetchError) Error() string { - return "skip fetch: version up to date" -} - -// ResponseType enumeration of supported response types -type ResponseType int - -// NOTE: The order of this enum MATTERS! -// https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#aggregated-discovery-service -// ADS expects things to be returned in a specific order. -// See the following issue for details: https://github.com/envoyproxy/go-control-plane/issues/526 -const ( - Cluster ResponseType = iota - Endpoint - Listener - Route - ScopedRoute - VirtualHost - Secret - Runtime - ExtensionConfig - RateLimitConfig - UnknownType // token to count the total number of supported types -) diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/cache.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/cache.go deleted file mode 100644 index 18eac629a..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/cache.go +++ /dev/null @@ -1,567 +0,0 @@ -// Copyright 2018 Envoyproxy 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. - -// Package cache defines a configuration cache for the server. -package cache - -import ( - "context" - "errors" - "fmt" - "sync/atomic" - - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" - "google.golang.org/protobuf/types/known/durationpb" - - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" -) - -// Request is an alias for the discovery request type. -type Request = discovery.DiscoveryRequest - -// DeltaRequest is an alias for the delta discovery request type. -type DeltaRequest = discovery.DeltaDiscoveryRequest - -// Subscription stores the server view of the client state for a given resource type. -// This allows proper implementation of stateful aspects of the protocol (e.g. returning only some updated resources). -// Though the methods may return mutable parts of the state for performance reasons, -// the cache is expected to consider this state as immutable and thread safe between a watch creation and its cancellation. -type Subscription interface { - // ReturnedResources returns the list of resources the client currently knows and their associated versions. - // The versions are: - // - delta protocol: version of the specific resource set in the response. - // - sotw protocol: version of the global response when the resource was last sent. - // The returned map must not be altered by the Cache. - ReturnedResources() map[string]string - - // SubscribedResources returns the list of resources currently subscribed to by the client for the type. - // For delta it keeps track of subscription updates across requests - // For sotw it is a normalized view of the last request resources - // The returned map must not be altered by the Cache. - SubscribedResources() map[string]struct{} - - // IsWildcard returns whether the client has a wildcard watch. - // This considers subtleties related to the current migration of wildcard definitions within the protocol. - // More details on the behavior of wildcard are present at https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#how-the-client-specifies-what-resources-to-return - IsWildcard() bool -} - -// ConfigWatcher requests watches for configuration resources by a node, last -// applied version identifier, and resource names hint. The watch should send -// the responses when they are ready. The watch can be canceled by the -// consumer, in effect terminating the watch for the request. -// ConfigWatcher implementation must be thread-safe. -type ConfigWatcher interface { - // CreateWatch returns a new open watch from a non-empty request. - // This is the entrypoint to propagate configuration changes the - // provided Response channel. State from the gRPC server is utilized - // to make sure consuming cache implementations can see what the server has sent to clients. - // - // An individual consumer normally issues a single open watch by each type URL. - // - // The provided channel produces requested resources as responses, once they are available. - // - // Cancel is an optional function to release resources in the producer. If - // provided, the consumer may call this function multiple times. - CreateWatch(*Request, Subscription, chan Response) (cancel func(), err error) - - // CreateDeltaWatch returns a new open incremental xDS watch. - // This is the entrypoint to propagate configuration changes the - // provided DeltaResponse channel. State from the gRPC server is utilized - // to make sure consuming cache implementations can see what the server has sent to clients. - // - // The provided channel produces requested resources as responses, or spontaneous updates in accordance - // with the incremental xDS specification. - // - // Cancel is an optional function to release resources in the producer. If - // provided, the consumer may call this function multiple times. - CreateDeltaWatch(*DeltaRequest, Subscription, chan DeltaResponse) (cancel func(), err error) -} - -// ConfigFetcher fetches configuration resources from cache -type ConfigFetcher interface { - // Fetch implements the polling method of the config cache using a non-empty request. - Fetch(context.Context, *Request) (Response, error) -} - -// Cache is a generic config cache with a watcher. -type Cache interface { - ConfigWatcher - ConfigFetcher -} - -// Response is a wrapper around Envoy's DiscoveryResponse. -type Response interface { - // GetDiscoveryResponse returns the Constructed DiscoveryResponse. - GetDiscoveryResponse() (*discovery.DiscoveryResponse, error) - - // GetRequest returns the request that created the watch that we're now responding to. - // This is provided to allow the caller to correlate the response with a request. - // Generally this will be the latest request seen on the stream for the specific type. - GetRequest() *discovery.DiscoveryRequest - - // GetVersion returns the version in the Response. - // The version can be a property of the resources, allowing for optimizations in subsequent calls, - // or simply an internal property of the cache which can be used for debugging. - // The cache implementation should be able to determine if it can provide such optimization. - // Deprecated: use GetResponseVersion instead - GetVersion() (string, error) - - // GetResponseVersion returns the version in the Response. - // The version can be a property of the resources, allowing for optimizations in subsequent calls, - // or simply an internal property of the cache which can be used for debugging. - // The cache implementation should be able to determine if it can provide such optimization. - GetResponseVersion() string - - // GetReturnedResources returns the map of resources and their versions returned in the subscription. - // It may include more resources than directly set in the response to consider the full state of the client. - // The caller is expected to provide this unchanged to the next call to CreateWatch as part of the subscription. - GetReturnedResources() map[string]string - - // GetContext returns the context provided during response creation. - GetContext() context.Context -} - -// DeltaResponse is a wrapper around Envoy's DeltaDiscoveryResponse. -type DeltaResponse interface { - // GetDeltaDiscoveryResponse returns the constructed DeltaDiscoveryResponse. - GetDeltaDiscoveryResponse() (*discovery.DeltaDiscoveryResponse, error) - - // GetDeltaRequest returns the request that created the watch that we're now responding to. - // This is provided to allow the caller to correlate the response with a request. - // Generally this will be the latest request seen on the stream for the specific type. - GetDeltaRequest() *discovery.DeltaDiscoveryRequest - - // GetSystemVersion returns the version in the DeltaResponse. - // The version in delta response is not indicative of the resources included, - // but an internal property of the cache which can be used for debugging. - // Deprecated: use GetResponseVersion instead - GetSystemVersion() (string, error) - - // GetResponseVersion returns the version in the DeltaResponse. - // The version in delta response is not indicative of the resources included, - // but an internal property of the cache which can be used for debugging. - GetResponseVersion() string - - // GetNextVersionMap provides the version map of the internal cache. - // The version map consists of updated version mappings after this response is applied. - // Deprecated: use GetReturnedResources instead - GetNextVersionMap() map[string]string - - // GetReturnedResources provides the version map of the internal cache. - // The version map consists of updated version mappings after this response is applied. - GetReturnedResources() map[string]string - - // GetContext returns the context provided during response creation. - GetContext() context.Context -} - -// RawResponse is a pre-serialized xDS response containing the raw resources to -// be included in the final Discovery Response. -type RawResponse struct { - // Request is the original request. - Request *discovery.DiscoveryRequest - - // Version of the resources as tracked by the cache for the given type. - // Proxy responds with this version as an acknowledgement. - Version string - - // resources to be included in the response. - resources []*cachedResource - - // returnedResources tracks the resources returned for the subscription and the version when it was last returned, - // including previously returned ones when using non-full state resources. - // It allows the cache to know what the client knows. The server will transparently forward this - // across requests, and the cache is responsible for its interpretation. - returnedResources map[string]string - - // Whether this is a heartbeat response. For xDS versions that support TTL, this - // will be converted into a response that doesn't contain the actual resource protobuf. - // This allows for more lightweight updates that server only to update the TTL timer. - Heartbeat bool - - // Context provided at the time of response creation. This allows associating additional - // information with a generated response. - Ctx context.Context - - // marshaledResponse holds an atomic reference to the serialized discovery response. - marshaledResponse atomic.Pointer[discovery.DiscoveryResponse] -} - -// RawDeltaResponse is a pre-serialized xDS response that utilizes the delta discovery request/response objects. -type RawDeltaResponse struct { - // Request is the latest delta request on the stream. - DeltaRequest *discovery.DeltaDiscoveryRequest - - // SystemVersionInfo holds the currently applied response system version and should be used for debugging purposes only. - SystemVersionInfo string - - // resources to be included in the response. - resources []*cachedResource - - // removedResources is a list of resource aliases which should be dropped by the consuming client. - removedResources []string - - // returnedResources tracks the resources returned for the subscription and the version when it was last returned, - // including previously returned ones when using non-full state resources. - // It allows the cache to know what the client knows. The server will transparently forward this - // across requests, and the cache is responsible for its interpretation. - returnedResources map[string]string - - // Context provided at the time of response creation. This allows associating additional - // information with a generated response. - Ctx context.Context - - // Marshaled Resources to be included in the response. - marshaledResponse atomic.Pointer[discovery.DeltaDiscoveryResponse] -} - -var ( - _ Response = &RawResponse{} - _ DeltaResponse = &RawDeltaResponse{} -) - -// PassthroughResponse is a pre constructed xDS response that need not go through marshaling transformations. -type PassthroughResponse struct { - // Request is the original request. - Request *discovery.DiscoveryRequest - - // The discovery response that needs to be sent as is, without any marshaling transformations. - DiscoveryResponse *discovery.DiscoveryResponse - - ctx context.Context - - // ReturnedResources tracks the resources returned for the subscription and the version when it was last returned, - // including previously returned ones when using non-full state resources. - // It allows the cache to know what the client knows. The server will transparently forward this - // across requests, and the cache is responsible for its interpretation. - ReturnedResources map[string]string -} - -// DeltaPassthroughResponse is a pre constructed xDS response that need not go through marshaling transformations. -type DeltaPassthroughResponse struct { - // Request is the latest delta request on the stream - DeltaRequest *discovery.DeltaDiscoveryRequest - - // NextVersionMap consists of updated version mappings after this response is applied - NextVersionMap map[string]string - - // This discovery response that needs to be sent as is, without any marshaling transformations - DeltaDiscoveryResponse *discovery.DeltaDiscoveryResponse - - ctx context.Context -} - -var ( - _ Response = &PassthroughResponse{} - _ DeltaResponse = &DeltaPassthroughResponse{} -) - -func NewTestRawResponse(req *discovery.DiscoveryRequest, version string, resources []types.ResourceWithTTL) *RawResponse { - cachedRes := []*cachedResource{} - for _, res := range resources { - newRes := newCachedResource(GetResourceName(res.Resource), res.Resource, version) - newRes.ttl = res.TTL - cachedRes = append(cachedRes, newRes) - } - return &RawResponse{ - Request: req, - Version: version, - resources: cachedRes, - } -} - -func NewTestRawDeltaResponse(req *discovery.DeltaDiscoveryRequest, version string, resources []types.ResourceWithTTL, removedResources []string, nextVersionMap map[string]string) *RawDeltaResponse { - cachedRes := []*cachedResource{} - for _, res := range resources { - name := GetResourceName(res.Resource) - newRes := newCachedResource(name, res.Resource, nextVersionMap[name]) - newRes.ttl = res.TTL - cachedRes = append(cachedRes, newRes) - } - return &RawDeltaResponse{ - DeltaRequest: req, - SystemVersionInfo: version, - resources: cachedRes, - removedResources: removedResources, - returnedResources: nextVersionMap, - } -} - -// GetDiscoveryResponse performs the marshaling the first time its called and uses the cached response subsequently. -// This is necessary because the marshaled response does not change across the calls. -// This caching behavior is important in high throughput scenarios because grpc marshaling has a cost and it drives the cpu utilization under load. -func (r *RawResponse) GetDiscoveryResponse() (*discovery.DiscoveryResponse, error) { - marshaledResponse := r.marshaledResponse.Load() - if marshaledResponse != nil { - return marshaledResponse, nil - } - - marshaledResources := make([]*anypb.Any, 0, len(r.resources)) - for _, resource := range r.resources { - marshaledResource, err := r.marshalTTLResource(resource) - if err != nil { - return nil, fmt.Errorf("processing %s: %w", GetResourceName(resource.resource), err) - } - marshaledResources = append(marshaledResources, marshaledResource) - } - - marshaledResponse = &discovery.DiscoveryResponse{ - VersionInfo: r.Version, - Resources: marshaledResources, - TypeUrl: r.GetRequest().GetTypeUrl(), - } - r.marshaledResponse.Store(marshaledResponse) - - return marshaledResponse, nil -} - -// GetRawResources is used internally within go-control-plane. Its interface and content may change -func (r *RawResponse) GetRawResources() []types.ResourceWithTTL { - resources := make([]types.ResourceWithTTL, 0, len(r.resources)) - for _, res := range r.resources { - resources = append(resources, types.ResourceWithTTL{Resource: res.resource, TTL: res.ttl}) - } - return resources -} - -func (r *RawResponse) GetReturnedResources() map[string]string { - return r.returnedResources -} - -// GetDeltaDiscoveryResponse performs the marshaling the first time its called and uses the cached response subsequently. -// We can do this because the marshaled response does not change across the calls. -// This caching behavior is important in high throughput scenarios because grpc marshaling has a cost and it drives the cpu utilization under load. -func (r *RawDeltaResponse) GetDeltaDiscoveryResponse() (*discovery.DeltaDiscoveryResponse, error) { - marshaledResponse := r.marshaledResponse.Load() - if marshaledResponse != nil { - return marshaledResponse, nil - } - - marshaledResources := make([]*discovery.Resource, 0, len(r.resources)) - for _, resource := range r.resources { - marshaledResource, err := resource.getMarshaledResource() - if err != nil { - return nil, fmt.Errorf("processing %s: %w", resource.name, err) - } - version, err := resource.getResourceVersion() - if err != nil { - return nil, fmt.Errorf("processing version of %s: %w", resource.name, err) - } - marshaledResources = append(marshaledResources, &discovery.Resource{ - Name: resource.name, - Resource: &anypb.Any{ - TypeUrl: r.GetDeltaRequest().GetTypeUrl(), - Value: marshaledResource, - }, - Version: version, - }) - } - - marshaledResponse = &discovery.DeltaDiscoveryResponse{ - Resources: marshaledResources, - RemovedResources: r.removedResources, - TypeUrl: r.GetDeltaRequest().GetTypeUrl(), - SystemVersionInfo: r.SystemVersionInfo, - } - r.marshaledResponse.Store(marshaledResponse) - - return marshaledResponse, nil -} - -// GetRawResources is used internally within go-control-plane. Its interface and content may change -func (r *RawDeltaResponse) GetRawResources() []types.ResourceWithTTL { - resources := make([]types.ResourceWithTTL, 0, len(r.resources)) - for _, res := range r.resources { - resources = append(resources, types.ResourceWithTTL{Resource: res.resource, TTL: res.ttl}) - } - return resources -} - -// GetRequest returns the original Discovery Request. -func (r *RawResponse) GetRequest() *discovery.DiscoveryRequest { - return r.Request -} - -func (r *RawResponse) GetContext() context.Context { - return r.Ctx -} - -// GetDeltaRequest returns the original DeltaRequest. -func (r *RawDeltaResponse) GetDeltaRequest() *discovery.DeltaDiscoveryRequest { - return r.DeltaRequest -} - -// GetVersion returns the response version. -// Deprecated: use GetResponseVersion instead -func (r *RawResponse) GetVersion() (string, error) { - return r.GetResponseVersion(), nil -} - -// GetResponseVersion returns the response version. -func (r *RawResponse) GetResponseVersion() string { - return r.Version -} - -// GetSystemVersion returns the raw SystemVersion. -// Deprecated: use GetResponseVersion instead -func (r *RawDeltaResponse) GetSystemVersion() (string, error) { - return r.GetResponseVersion(), nil -} - -// GetResponseVersion returns the response version. -func (r *RawDeltaResponse) GetResponseVersion() string { - return r.SystemVersionInfo -} - -// GetNextVersionMap returns the version map which consists of updated version mappings after this response is applied. -// Deprecated: use GetReturnedResources instead -func (r *RawDeltaResponse) GetNextVersionMap() map[string]string { - return r.GetReturnedResources() -} - -// GetReturnedResources returns the version map which consists of updated version mappings after this response is applied. -func (r *RawDeltaResponse) GetReturnedResources() map[string]string { - return r.returnedResources -} - -func (r *RawDeltaResponse) GetContext() context.Context { - return r.Ctx -} - -var deltaResourceTypeURL = "type.googleapis.com/" + string(proto.MessageName(&discovery.Resource{})) - -func (r *RawResponse) marshalTTLResource(resource *cachedResource) (*anypb.Any, error) { - buildResource := func() (*anypb.Any, error) { - marshaled, err := resource.getMarshaledResource() - if err != nil { - return nil, fmt.Errorf("marshaling: %w", err) - } - return &anypb.Any{ - TypeUrl: r.GetRequest().GetTypeUrl(), - Value: marshaled, - }, nil - } - - if resource.ttl == nil { - return buildResource() - } - - wrappedResource := &discovery.Resource{ - Name: GetResourceName(resource.resource), - Ttl: durationpb.New(*resource.ttl), - } - - if !r.Heartbeat { - rsrc, err := buildResource() - if err != nil { - return nil, err - } - wrappedResource.Resource = rsrc - } - - marshaled, err := MarshalResource(wrappedResource) - if err != nil { - return nil, fmt.Errorf("marshaling discovery resource: %w", err) - } - - return &anypb.Any{ - TypeUrl: deltaResourceTypeURL, - Value: marshaled, - }, nil -} - -// GetDiscoveryResponse returns the final passthrough Discovery Response. -func (r *PassthroughResponse) GetDiscoveryResponse() (*discovery.DiscoveryResponse, error) { - return r.DiscoveryResponse, nil -} - -func (r *PassthroughResponse) GetReturnedResources() map[string]string { - return r.ReturnedResources -} - -// GetDeltaDiscoveryResponse returns the final passthrough Delta Discovery Response. -func (r *DeltaPassthroughResponse) GetDeltaDiscoveryResponse() (*discovery.DeltaDiscoveryResponse, error) { - return r.DeltaDiscoveryResponse, nil -} - -// GetRequest returns the original Discovery Request. -func (r *PassthroughResponse) GetRequest() *discovery.DiscoveryRequest { - return r.Request -} - -// GetDeltaRequest returns the original Delta Discovery Request. -func (r *DeltaPassthroughResponse) GetDeltaRequest() *discovery.DeltaDiscoveryRequest { - return r.DeltaRequest -} - -// GetVersion returns the response version. -// Deprecated: use GetResponseVersion instead -func (r *PassthroughResponse) GetVersion() (string, error) { - discoveryResponse, _ := r.GetDiscoveryResponse() - if discoveryResponse != nil { - return discoveryResponse.GetVersionInfo(), nil - } - return "", errors.New("DiscoveryResponse is nil") -} - -// GetResponseVersion returns the response version, or empty if not set. -func (r *PassthroughResponse) GetResponseVersion() string { - discoveryResponse, _ := r.GetDiscoveryResponse() - if discoveryResponse != nil { - return discoveryResponse.GetVersionInfo() - } - return "" -} - -func (r *PassthroughResponse) GetContext() context.Context { - return r.ctx -} - -// GetSystemVersion returns the response version. -// Deprecated: use GetResponseVersion instead -func (r *DeltaPassthroughResponse) GetSystemVersion() (string, error) { - deltaDiscoveryResponse, _ := r.GetDeltaDiscoveryResponse() - if deltaDiscoveryResponse != nil { - return deltaDiscoveryResponse.GetSystemVersionInfo(), nil - } - return "", errors.New("DeltaDiscoveryResponse is nil") -} - -// GetResponseVersion returns the response version, or empty if not set. -func (r *DeltaPassthroughResponse) GetResponseVersion() string { - deltaDiscoveryResponse, _ := r.GetDeltaDiscoveryResponse() - if deltaDiscoveryResponse != nil { - return deltaDiscoveryResponse.GetSystemVersionInfo() - } - return "" -} - -// GetNextVersionMap returns the version map from a DeltaPassthroughResponse. -// Deprecated: use GetReturnedResources instead -func (r *DeltaPassthroughResponse) GetNextVersionMap() map[string]string { - return r.NextVersionMap -} - -// GetReturnedResources returns the version map from a DeltaPassthroughResponse. -func (r *DeltaPassthroughResponse) GetReturnedResources() map[string]string { - return r.NextVersionMap -} - -func (r *DeltaPassthroughResponse) GetContext() context.Context { - return r.ctx -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/cached_resource.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/cached_resource.go deleted file mode 100644 index 35d6ef8c2..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/cached_resource.go +++ /dev/null @@ -1,69 +0,0 @@ -package cache - -import ( - "fmt" - "sync" - "time" - - "github.com/envoyproxy/go-control-plane/pkg/cache/types" -) - -// cachedResource is used to track resources added by the user in the cache. -// It contains the resource itself and its associated version (currently in two different modes). -type cachedResource struct { - name string - - // resource must not be modified once the cachedResource is created. - resource types.Resource - ttl *time.Duration - - // cacheVersion is the version of the cache at the time of last update, used in sotw. - cacheVersion string - - marshalFunc func() ([]byte, error) - computeResourceVersionFunc func() (string, error) -} - -func newCachedResource(name string, res types.Resource, cacheVersion string) *cachedResource { - marshalFunc := sync.OnceValues(func() ([]byte, error) { - return MarshalResource(res) - }) - return &cachedResource{ - name: name, - resource: res, - cacheVersion: cacheVersion, - marshalFunc: marshalFunc, - computeResourceVersionFunc: sync.OnceValues(func() (string, error) { - marshaled, err := marshalFunc() - if err != nil { - return "", fmt.Errorf("marshaling resource: %w", err) - } - return HashResource(marshaled), nil - }), - } -} - -func newCachedResourceWithTTL(name string, res types.ResourceWithTTL, cacheVersion string) *cachedResource { - cachedRes := newCachedResource(name, res.Resource, cacheVersion) - cachedRes.ttl = res.TTL - return cachedRes -} - -// getMarshaledResource lazily marshals the resource and returns the bytes. -func (c *cachedResource) getMarshaledResource() ([]byte, error) { - return c.marshalFunc() -} - -// getResourceVersion lazily hashes the resource and returns the stable hash used to track version changes. -func (c *cachedResource) getResourceVersion() (string, error) { - return c.computeResourceVersionFunc() -} - -// getVersion returns the requested version. -func (c *cachedResource) getVersion(useResourceVersion bool) (string, error) { - if !useResourceVersion { - return c.cacheVersion, nil - } - - return c.getResourceVersion() -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/delta.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/delta.go deleted file mode 100644 index eae71706e..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/delta.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2020 Envoyproxy 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. - -package cache - -import ( - "context" - - "github.com/envoyproxy/go-control-plane/pkg/cache/types" -) - -// groups together resource-related arguments for the createDeltaResponse function -type resourceContainer struct { - resourceMap map[string]types.Resource - versionMap map[string]string -} - -func createDeltaResponse(ctx context.Context, req *DeltaRequest, sub Subscription, resources resourceContainer, cacheVersion string) *RawDeltaResponse { - // variables to build our response with - var nextVersionMap map[string]string - var filtered []*cachedResource - var toRemove []string - - // If we are handling a wildcard request, we want to respond with all resources - switch { - case sub.IsWildcard(): - if len(sub.ReturnedResources()) == 0 { - filtered = make([]*cachedResource, 0, len(resources.resourceMap)) - } - nextVersionMap = make(map[string]string, len(resources.resourceMap)) - for name, r := range resources.resourceMap { - // Since we've already precomputed the version hashes of the new snapshot, - // we can just set it here to be used for comparison later - version := resources.versionMap[name] - nextVersionMap[name] = version - prevVersion, found := sub.ReturnedResources()[name] - if !found || (prevVersion != version) { - filtered = append(filtered, newCachedResource(name, r, version)) - } - } - - // Compute resources for removal - // The resource version can be set to "" here to trigger a removal even if never returned before - for name := range sub.ReturnedResources() { - if _, ok := resources.resourceMap[name]; !ok { - toRemove = append(toRemove, name) - } - } - default: - nextVersionMap = make(map[string]string, len(sub.SubscribedResources())) - // state.GetResourceVersions() may include resources no longer subscribed - // In the current code this gets silently cleaned when updating the version map - for name := range sub.SubscribedResources() { - prevVersion, found := sub.ReturnedResources()[name] - if r, ok := resources.resourceMap[name]; ok { - nextVersion := resources.versionMap[name] - if prevVersion != nextVersion { - filtered = append(filtered, newCachedResource(name, r, nextVersion)) - } - nextVersionMap[name] = nextVersion - } else if found { - toRemove = append(toRemove, name) - } - } - } - - return &RawDeltaResponse{ - DeltaRequest: req, - resources: filtered, - removedResources: toRemove, - returnedResources: nextVersionMap, - SystemVersionInfo: cacheVersion, - Ctx: ctx, - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/linear.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/linear.go deleted file mode 100644 index 51fbae8e8..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/linear.go +++ /dev/null @@ -1,603 +0,0 @@ -// Copyright 2020 Envoyproxy 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. - -package cache - -import ( - "context" - "errors" - "fmt" - "maps" - "strconv" - "strings" - "sync" - - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/log" -) - -type watch interface { - // isDelta indicates whether the watch is a delta one. - // It should not be used to take functional decisions, but is still currently used pending final changes. - // It can be used to generate statistics. - isDelta() bool - // useResourceVersion indicates whether versions returned in the response are built using resource versions instead of cache update versions. - useResourceVersion() bool - // sendFullStateResponses requires that all resources matching the request, with no regards to which ones actually updated, must be provided in the response. - // As a consequence, sending a response with no resources has a functional meaning of no matching resources available. - sendFullStateResponses() bool - - getSubscription() Subscription - // buildResponse computes the actual WatchResponse object to be sent on the watch. - buildResponse(updatedResources []*cachedResource, removedResources []string, returnedVersions map[string]string, version string) WatchResponse - // sendResponse sends the response for the watch. - // It must be called at most once. - sendResponse(resp WatchResponse) -} - -type watches map[uint64]watch - -func newWatches() watches { - return make(watches) -} - -// LinearCache supports collections of opaque resources. This cache has a -// single collection indexed by resource names and manages resource versions -// internally. It implements the cache interface for a single type URL and -// should be combined with other caches via type URL muxing. It can be used to -// supply EDS entries, for example, uniformly across a fleet of proxies. -type LinearCache struct { - // typeURL provides the type of resources managed by the cache. - // This information is used to reject requests watching another type, as well as to make - // decisions based on resource type (e.g. whether sotw must return full-state). - typeURL string - - // resources contains all resources currently set in the cache and associated versions. - resources map[string]*cachedResource - - // resourceWatches keeps track of watches currently opened specifically tracking a resource. - // It does not contain wildcard watches. - // It can contain resources not present in resources. - resourceWatches map[string]watches - // wildcardWatches keeps track of all wildcard watches currently opened. - wildcardWatches watches - // currentWatchID is used to index new watches. - currentWatchID uint64 - - // version is the current version of the cache. It is incremented each time resources are updated. - version uint64 - // versionPrefix is used to modify the version returned to clients, and can be used to uniquely identify - // cache instances and avoid issues of version reuse. - versionPrefix string - - watchCount int - - log log.Logger - - mu sync.RWMutex -} - -var _ Cache = &LinearCache{} - -// Options for modifying the behavior of the linear cache. -type LinearCacheOption func(*LinearCache) - -// WithVersionPrefix sets a version prefix of the form "prefixN" in the version info. -// Version prefix can be used to distinguish replicated instances of the cache, in case -// a client re-connects to another instance. -func WithVersionPrefix(prefix string) LinearCacheOption { - return func(cache *LinearCache) { - cache.versionPrefix = prefix - } -} - -// WithInitialResources initializes the initial set of resources. -func WithInitialResources(resources map[string]types.Resource) LinearCacheOption { - return func(cache *LinearCache) { - for name, resource := range resources { - cache.resources[name] = newCachedResource(name, resource, "") - } - } -} - -func WithLogger(log log.Logger) LinearCacheOption { - return func(cache *LinearCache) { - cache.log = log - } -} - -// NewLinearCache creates a new cache. See the comments on the struct definition. -func NewLinearCache(typeURL string, opts ...LinearCacheOption) *LinearCache { - out := &LinearCache{ - typeURL: typeURL, - resources: make(map[string]*cachedResource), - resourceWatches: make(map[string]watches), - wildcardWatches: newWatches(), - version: 0, - currentWatchID: 0, - log: log.NewDefaultLogger(), - } - for _, opt := range opts { - opt(out) - } - for _, resource := range out.resources { - resource.cacheVersion = out.getVersion() - } - return out -} - -// computeResourceChange compares the subscription known resources and the cache current state to compute the list of resources -// which have changed and should be notified to the user. -// -// The useResourceVersion argument defines what version type to use for resources: -// - if set to false versions are based on when resources were updated in the cache. -// - if set to true versions are a stable property of the resource, with no regard to when it was added to the cache. -func (cache *LinearCache) computeResourceChange(sub Subscription, useResourceVersion bool) (updated, removed []string, err error) { - var changedResources []string - var removedResources []string - - knownVersions := sub.ReturnedResources() - - if sub.IsWildcard() { - for resourceName, resource := range cache.resources { - knownVersion, ok := knownVersions[resourceName] - if !ok { - // This resource is not yet known by the client (new resource added in the cache or newly subscribed). - changedResources = append(changedResources, resourceName) - } else { - resourceVersion, err := resource.getVersion(useResourceVersion) - if err != nil { - return nil, nil, fmt.Errorf("failed to compute version of %s: %w", resourceName, err) - } - if knownVersion != resourceVersion { - // The client knows an outdated version. - changedResources = append(changedResources, resourceName) - } - } - } - - // Negative check to identify resources that have been removed in the cache. - // Sotw does not support returning "deletions", but in the case of full state resources - // a response must then be returned. - for resourceName := range knownVersions { - if _, ok := cache.resources[resourceName]; !ok { - removedResources = append(removedResources, resourceName) - } - } - } else { - for resourceName := range sub.SubscribedResources() { - res, exists := cache.resources[resourceName] - knownVersion, known := knownVersions[resourceName] - if !exists { - if known { - // This resource was removed from the cache. If the type requires full state - // we need to return a response. - removedResources = append(removedResources, resourceName) - } - continue - } - - if !known { - // This resource is not yet known by the client (new resource added in the cache or newly subscribed). - changedResources = append(changedResources, resourceName) - } else { - resourceVersion, err := res.getVersion(useResourceVersion) - if err != nil { - return nil, nil, fmt.Errorf("failed to compute version of %s: %w", resourceName, err) - } - if knownVersion != resourceVersion { - // The client knows an outdated version. - changedResources = append(changedResources, resourceName) - } - } - } - - for resourceName := range knownVersions { - // If the subscription no longer watches a resource, - // we mark it as unknown on the client side to ensure it will be resent to the client if subscribing again later on. - if _, ok := sub.SubscribedResources()[resourceName]; !ok { - removedResources = append(removedResources, resourceName) - } - } - } - - return changedResources, removedResources, nil -} - -func (cache *LinearCache) computeResponse(watch watch, replyEvenIfEmpty bool) (WatchResponse, error) { - sub := watch.getSubscription() - changedResources, removedResources, err := cache.computeResourceChange(sub, watch.useResourceVersion()) - if err != nil { - return nil, err - } - - if len(changedResources) == 0 && len(removedResources) == 0 && !replyEvenIfEmpty { - // Nothing changed. - return nil, nil - } - - // In sotw the list of resources to actually return depends on: - // - whether the type requires full-state in each reply (lds and cds). - // - whether the request is wildcard. - // resourcesToReturn will include all the resource names to reply based on the changes detected. - var resourcesToReturn []string - switch { - // For lds and cds, answers will always include all existing subscribed resources, with no regard to which resource was changed or removed. - // For other types, the response only includes updated resources (sotw cannot notify for deletion). - case !watch.sendFullStateResponses(): - // TODO(valerian-roche): remove this leak of delta/sotw behavior here. - if !watch.isDelta() && !replyEvenIfEmpty && len(changedResources) == 0 { - // If the request is not the initial one, and the type does not require full updates, - // do not return if nothing is to be set. - // For full-state resources an empty response does have a semantic meaning. - return nil, nil - } - // changedResources is already filtered based on the subscription. - resourcesToReturn = changedResources - - case sub.IsWildcard(): - // Include all resources for the type. - resourcesToReturn = make([]string, 0, len(cache.resources)) - for resourceName := range cache.resources { - resourcesToReturn = append(resourcesToReturn, resourceName) - } - - default: - // Include all resources matching the subscription, with no concern on whether it has been updated or not. - requestedResources := sub.SubscribedResources() - // The linear cache could be very large (e.g. containing all potential CLAs) - // Therefore drives on the subscription requested resources. - resourcesToReturn = make([]string, 0, len(requestedResources)) - for resourceName := range requestedResources { - if _, ok := cache.resources[resourceName]; ok { - resourcesToReturn = append(resourcesToReturn, resourceName) - } - } - } - - // returnedVersions includes all resources currently known to the subscription and their version. - // Clone the current returned versions. The cache should not alter the subscription - returnedVersions := maps.Clone(sub.ReturnedResources()) - - resources := make([]*cachedResource, 0, len(resourcesToReturn)) - for _, resourceName := range resourcesToReturn { - cachedResource := cache.resources[resourceName] - resources = append(resources, cachedResource) - version, err := cachedResource.getVersion(watch.useResourceVersion()) - if err != nil { - return nil, fmt.Errorf("failed to compute version of %s: %w", resourceName, err) - } - returnedVersions[resourceName] = version - } - - // Cleanup resources no longer existing in the cache or no longer subscribed. - // In sotw we cannot return those if not full state, - // but this ensures we detect unsubscription then resubscription. - for _, resourceName := range removedResources { - delete(returnedVersions, resourceName) - } - - return watch.buildResponse(resources, removedResources, returnedVersions, cache.getVersion()), nil -} - -func (cache *LinearCache) notifyAll(modified []string) error { - // Gather the list of watches impacted by the modified resources. - resourceWatches := newWatches() - for _, name := range modified { - maps.Copy(resourceWatches, cache.resourceWatches[name]) - } - - // non-wildcard watches - for watchID, watch := range resourceWatches { - response, err := cache.computeResponse(watch, false) - if err != nil { - return err - } - - if response != nil { - watch.sendResponse(response) - cache.removeWatch(watchID, watch.getSubscription()) - } else { - cache.log.Infof("[Linear cache] Watch %d detected as triggered but no change was found", watchID) - } - } - - for watchID, watch := range cache.wildcardWatches { - response, err := cache.computeResponse(watch, false) - if err != nil { - return err - } - - if response != nil { - watch.sendResponse(response) - cache.removeWildcardWatch(watchID) - } else { - cache.log.Infof("[Linear cache] Wildcard watch %d detected as triggered but no change was found", watchID) - } - } - - return nil -} - -// UpdateResource updates a resource in the collection. -func (cache *LinearCache) UpdateResource(name string, res types.Resource) error { - if res == nil { - return errors.New("nil resource") - } - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.version++ - cache.resources[name] = newCachedResource(name, res, cache.getVersion()) - - return cache.notifyAll([]string{name}) -} - -// DeleteResource removes a resource in the collection. -func (cache *LinearCache) DeleteResource(name string) error { - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.version++ - delete(cache.resources, name) - - return cache.notifyAll([]string{name}) -} - -// UpdateResources updates/deletes a list of resources in the cache. -// Calling UpdateResources instead of iterating on UpdateResource and DeleteResource -// is significantly more efficient when using delta or wildcard watches. -func (cache *LinearCache) UpdateResources(toUpdate map[string]types.Resource, toDelete []string) error { - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.version++ - version := cache.getVersion() - modified := make([]string, 0, len(toUpdate)+len(toDelete)) - for name, resource := range toUpdate { - cache.resources[name] = newCachedResource(name, resource, version) - modified = append(modified, name) - } - for _, name := range toDelete { - delete(cache.resources, name) - modified = append(modified, name) - } - - return cache.notifyAll(modified) -} - -// SetResources replaces current resources with a new set of resources. -// Given the use of lazy serialization, if most resources are actually the same -// using UpdateResources instead will be much more efficient. -func (cache *LinearCache) SetResources(resources map[string]types.Resource) { - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.version++ - version := cache.getVersion() - - modified := make([]string, 0, len(resources)) - // Collect deleted resource names. - for name := range cache.resources { - if _, found := resources[name]; !found { - delete(cache.resources, name) - modified = append(modified, name) - } - } - - // We assume all resources passed to SetResources are changed. - // Otherwise we would have to do proto.Equal on resources which is pretty expensive operation - for name, resource := range resources { - cache.resources[name] = newCachedResource(name, resource, version) - modified = append(modified, name) - } - - if err := cache.notifyAll(modified); err != nil { - cache.log.Errorf("Failed to notify watches: %s", err.Error()) - } -} - -// GetResources returns current resources stored in the cache -func (cache *LinearCache) GetResources() map[string]types.Resource { - cache.mu.RLock() - defer cache.mu.RUnlock() - - // create a copy of our internal storage to avoid data races - // involving mutations of our backing map - resources := make(map[string]types.Resource, len(cache.resources)) - for k, v := range cache.resources { - resources[k] = v.resource - } - return resources -} - -// The implementations of sotw and delta watches handling is nearly identical. The main distinctions are: -// - handling of version in sotw when the request is the first of a subscription. Delta has a proper handling based on the request providing known versions. -// - building the initial resource versions in delta if they've not been computed yet. -// - computeSotwResponse and computeDeltaResponse has slightly different implementations due to sotw requirements to return full state for certain resources only. -func (cache *LinearCache) CreateWatch(request *Request, sub Subscription, value chan Response) (func(), error) { - if request.GetTypeUrl() != cache.typeURL { - return nil, fmt.Errorf("request type %s does not match cache type %s", request.GetTypeUrl(), cache.typeURL) - } - - // If the request does not include a version the client considers it has no current state. - // In this case we will always reply to allow proper initialization of dependencies in the client. - replyEvenIfEmpty := request.GetVersionInfo() == "" - if !strings.HasPrefix(request.GetVersionInfo(), cache.versionPrefix) { - // If the version of the request does not match the cache prefix, we will send a response in all cases to match the legacy behavior. - replyEvenIfEmpty = true - cache.log.Debugf("[linear cache] received watch with version %s not matching the cache prefix %s. Will return all known resources", request.GetVersionInfo(), cache.versionPrefix) - } - - // A major difference between delta and sotw is the ability to not resend everything when connecting to a new control-plane - // In delta the request provides the version of the resources it does know, even if the request is wildcard or does request more resources - // In sotw the request only provides the global version of the control-plane, and there is no way for the control-plane to know if resources have - // been added since in the requested resources. In the context of generalized wildcard, even wildcard could be new, and taking the assumption - // that wildcard implies that the client already knows all resources at the given version is no longer true. - // We could optimize the reconnection case here if: - // - we take the assumption that clients will not start requesting wildcard while providing a version. We could then ignore requests providing the resources. - // - we use the version as some form of hash of resources known, and we can then consider it as a way to correctly verify whether all resources are unchanged. - // For now it is not done as: - // - for the first case, while the protocol documentation does not explicitly mention the case, it does not mark it impossible and explicitly references unsubscribing from wildcard. - // - for the second one we could likely do it with little difficulty if need be, but if users rely on the current monotonic version it could impact their callbacks implementations. - watch := ResponseWatch{ - Request: request, - Response: value, - subscription: sub, - fullStateResponses: ResourceRequiresFullStateInSotw(cache.typeURL), - } - - cache.mu.Lock() - defer cache.mu.Unlock() - - response, err := cache.computeResponse(watch, replyEvenIfEmpty) - if err != nil { - return nil, fmt.Errorf("failed to compute the watch respnse: %w", err) - } - if response != nil { - cache.log.Debugf("[linear cache] replying to the watch with resources %v (subscription values %v, known %v)", response.GetReturnedResources(), sub.SubscribedResources(), sub.ReturnedResources()) - watch.sendResponse(response) - return func() {}, nil - } - - return cache.trackWatch(watch), nil -} - -func (cache *LinearCache) CreateDeltaWatch(request *DeltaRequest, sub Subscription, value chan DeltaResponse) (func(), error) { - if request.GetTypeUrl() != cache.typeURL { - return nil, fmt.Errorf("request type %s does not match cache type %s", request.GetTypeUrl(), cache.typeURL) - } - - watch := DeltaResponseWatch{Request: request, Response: value, subscription: sub} - - // On first request on a wildcard subscription, envoy does expect a response to come in to - // conclude initialization. - replyEvenIfEmpty := sub.IsWildcard() && request.GetResponseNonce() == "" - - cache.mu.Lock() - defer cache.mu.Unlock() - - response, err := cache.computeResponse(watch, replyEvenIfEmpty) - if err != nil { - return nil, fmt.Errorf("failed to compute the watch respnse: %w", err) - } - - if response != nil { - cache.log.Debugf("[linear cache] replying to the delta watch (subscription values %v, known %v)", sub.SubscribedResources(), sub.ReturnedResources()) - watch.sendResponse(response) - return nil, nil - } - - return cache.trackWatch(watch), nil -} - -func (cache *LinearCache) nextWatchID() uint64 { - cache.currentWatchID++ - if cache.currentWatchID == 0 { - panic("watch id count overflow") - } - return cache.currentWatchID -} - -// Must be called under lock -func (cache *LinearCache) trackWatch(watch watch) func() { - cache.watchCount++ - - watchID := cache.nextWatchID() - sub := watch.getSubscription() - - if sub.IsWildcard() { - cache.log.Infof("[linear cache] open watch %d (delta: %t) for %s all resources", watchID, watch.isDelta(), cache.typeURL) - cache.log.Debugf("[linear cache] subscription details for watch %d: known versions %v, system version %q", watchID, sub.ReturnedResources(), cache.getVersion()) - cache.wildcardWatches[watchID] = watch - return func() { - cache.mu.Lock() - defer cache.mu.Unlock() - cache.removeWildcardWatch(watchID) - } - } - - cache.log.Infof("[linear cache] open watch %d (delta: %t) for %s resources %v", watchID, watch.isDelta(), cache.typeURL, sub.SubscribedResources()) - cache.log.Debugf("[linear cache] subscription details for watch %d: known versions %v, system version %q", watchID, sub.ReturnedResources(), cache.getVersion()) - for name := range sub.SubscribedResources() { - watches, exists := cache.resourceWatches[name] - if !exists { - watches = newWatches() - cache.resourceWatches[name] = watches - } - watches[watchID] = watch - } - return func() { - cache.mu.Lock() - defer cache.mu.Unlock() - cache.removeWatch(watchID, sub) - } -} - -// Must be called under lock -func (cache *LinearCache) removeWildcardWatch(watchID uint64) { - cache.watchCount-- - delete(cache.wildcardWatches, watchID) -} - -// Must be called under lock -func (cache *LinearCache) removeWatch(watchID uint64, sub Subscription) { - // Make sure we clean the watch for ALL resources it might be associated with, - // as the channel will no longer be listened to - for resource := range sub.SubscribedResources() { - resourceWatches := cache.resourceWatches[resource] - delete(resourceWatches, watchID) - if len(resourceWatches) == 0 { - delete(cache.resourceWatches, resource) - } - } - cache.watchCount-- -} - -func (cache *LinearCache) getVersion() string { - return cache.versionPrefix + strconv.FormatUint(cache.version, 10) -} - -func (cache *LinearCache) Fetch(context.Context, *Request) (Response, error) { - return nil, errors.New("fetch is not implemented by LinearCache") -} - -// NumResources returns the number of resources currently in the cache. -// As GetResources is building a clone it is expensive to get metrics otherwise. -func (cache *LinearCache) NumResources() int { - cache.mu.RLock() - defer cache.mu.RUnlock() - return len(cache.resources) -} - -// NumWatches returns the number of active watches for a resource name, including wildcard ones. -func (cache *LinearCache) NumWatches(name string) int { - cache.mu.RLock() - defer cache.mu.RUnlock() - return len(cache.resourceWatches[name]) + len(cache.wildcardWatches) -} - -// NumWildcardWatches returns the number of wildcard watches. -func (cache *LinearCache) NumWildcardWatches() int { - cache.mu.RLock() - defer cache.mu.RUnlock() - return len(cache.wildcardWatches) -} - -// NumCacheWatches returns the number of active watches on the cache in general. -func (cache *LinearCache) NumCacheWatches() int { - cache.mu.RLock() - defer cache.mu.RUnlock() - return cache.watchCount -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/mux.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/mux.go deleted file mode 100644 index b255131de..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/mux.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2020 Envoyproxy 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. - -package cache - -import ( - "context" - "fmt" -) - -// MuxCache multiplexes across several caches using a classification function. -// If there is no matching cache for a classification result, the cache -// responds with an empty closed channel, which effectively terminates the -// stream on the server. It might be preferred to respond with a "nil" channel -// instead which will leave the stream open in case the stream is aggregated by -// making sure there is always a matching cache. -type MuxCache struct { - // Classification functions. - Classify func(*Request) string - ClassifyDelta func(*DeltaRequest) string - // Muxed caches. - Caches map[string]Cache -} - -var _ Cache = &MuxCache{} - -func (mux *MuxCache) CreateWatch(request *Request, sub Subscription, value chan Response) (func(), error) { - key := mux.Classify(request) - cache, exists := mux.Caches[key] - if !exists { - return nil, fmt.Errorf("no cache defined for key %s", key) - } - return cache.CreateWatch(request, sub, value) -} - -func (mux *MuxCache) CreateDeltaWatch(request *DeltaRequest, sub Subscription, value chan DeltaResponse) (func(), error) { - key := mux.ClassifyDelta(request) - cache, exists := mux.Caches[key] - if !exists { - return nil, fmt.Errorf("no cache defined for key %s", key) - } - return cache.CreateDeltaWatch(request, sub, value) -} - -func (mux *MuxCache) Fetch(ctx context.Context, request *Request) (Response, error) { - key := mux.Classify(request) - cache, exists := mux.Caches[key] - if !exists { - return nil, fmt.Errorf("no cache defined for key %s", key) - } - // Not all caches may implement Fetch; we delegate to the selected cache and if - // it does not implement Fetch, it will return an error. - return cache.Fetch(ctx, request) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/order.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/order.go deleted file mode 100644 index c416946e8..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/order.go +++ /dev/null @@ -1,24 +0,0 @@ -package cache - -// Key is an internal sorting data structure we can use to -// order responses by Type and their associated watch IDs. -type key struct { - ID int64 - TypeURL string -} - -// Keys implements Go's sorting.Sort interface -type keys []key - -func (k keys) Len() int { - return len(k) -} - -// Less compares the typeURL and determines what order things should be sent. -func (k keys) Less(i, j int) bool { - return GetResponseType(k[i].TypeURL) < GetResponseType(k[j].TypeURL) -} - -func (k keys) Swap(i, j int) { - k[i], k[j] = k[j], k[i] -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/resource.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/resource.go deleted file mode 100644 index ee20d1f2e..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/resource.go +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2018 Envoyproxy 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. - -package cache - -import ( - "crypto/sha256" - "encoding/hex" - "fmt" - - "google.golang.org/protobuf/proto" - - cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" - endpoint "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" - listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" - route "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" - runtime "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" -) - -// GetResponseType returns the enumeration for a valid xDS type URL. -func GetResponseType(typeURL resource.Type) types.ResponseType { - switch typeURL { - case resource.EndpointType: - return types.Endpoint - case resource.ClusterType: - return types.Cluster - case resource.RouteType: - return types.Route - case resource.ScopedRouteType: - return types.ScopedRoute - case resource.VirtualHostType: - return types.VirtualHost - case resource.ListenerType: - return types.Listener - case resource.SecretType: - return types.Secret - case resource.RuntimeType: - return types.Runtime - case resource.ExtensionConfigType: - return types.ExtensionConfig - case resource.RateLimitConfigType: - return types.RateLimitConfig - } - return types.UnknownType -} - -// GetResponseTypeURL returns the type url for a valid enum. -func GetResponseTypeURL(responseType types.ResponseType) (string, error) { - switch responseType { - case types.Endpoint: - return resource.EndpointType, nil - case types.Cluster: - return resource.ClusterType, nil - case types.Route: - return resource.RouteType, nil - case types.ScopedRoute: - return resource.ScopedRouteType, nil - case types.VirtualHost: - return resource.VirtualHostType, nil - case types.Listener: - return resource.ListenerType, nil - case types.Secret: - return resource.SecretType, nil - case types.Runtime: - return resource.RuntimeType, nil - case types.ExtensionConfig: - return resource.ExtensionConfigType, nil - case types.RateLimitConfig: - return resource.RateLimitConfigType, nil - default: - return "", fmt.Errorf("couldn't map response type %v to known resource type", responseType) - } -} - -// GetResourceName returns the resource name for a valid xDS response type. -func GetResourceName(res types.Resource) string { - switch v := res.(type) { - case *endpoint.ClusterLoadAssignment: - return v.GetClusterName() - case types.ResourceWithName: - return v.GetName() - default: - return "" - } -} - -// ResourceRequiresFullStateInSotw indicates whether when building the reply in Sotw, -// the response must include all existing resources or can return only the modified ones -func ResourceRequiresFullStateInSotw(typeURL resource.Type) bool { - // From https://www.envoyproxy.io/docs/envoy/v1.28.0/api-docs/xds_protocol#grouping-resources-into-responses, - // when using sotw the control-plane MUST return all requested resources (or simply all if wildcard) - // for some types. This is relied on by xds-grpc which is explicitly requesting clusters and listeners - // but expects to receive all existing resources for those types. Missing clusters or listeners are - // considered deleted. - switch typeURL { - case resource.ClusterType: - return true - case resource.ListenerType: - return true - default: - return false - } -} - -// GetResourceName returns the resource names for a list of valid xDS response types. -func GetResourceNames(resources []types.ResourceWithTTL) []string { - out := make([]string, len(resources)) - for i, r := range resources { - out[i] = GetResourceName(r.Resource) - } - return out -} - -// getCachedResourceNames returns the resource names for a list of valid xDS response types. -func getCachedResourceNames(resources []*cachedResource) []string { - out := make([]string, len(resources)) - for i, r := range resources { - out[i] = GetResourceName(r.resource) - } - return out -} - -// MarshalResource converts the Resource to MarshaledResource. -func MarshalResource(resource types.Resource) (types.MarshaledResource, error) { - return proto.MarshalOptions{Deterministic: true}.Marshal(resource) -} - -// GetResourceReferences returns a map of dependent resources keyed by resource type, given a map of resources. -// (EDS cluster names for CDS, RDS/SRDS routes names for LDS, RDS route names for SRDS). -func GetResourceReferences(resources map[string]types.ResourceWithTTL) map[resource.Type]map[string]bool { - out := make(map[resource.Type]map[string]bool) - getResourceReferences(resources, out) - - return out -} - -// GetAllResourceReferences returns a map of dependent resources keyed by resources type, given all resources. -func GetAllResourceReferences(resourceGroups [types.UnknownType]Resources) map[resource.Type]map[string]bool { - ret := map[resource.Type]map[string]bool{} - - // We only check resources that we expect to have references to other resources. - responseTypesWithReferences := map[types.ResponseType]struct{}{ - types.Cluster: {}, - types.Listener: {}, - types.ScopedRoute: {}, - } - - for responseType, resourceGroup := range resourceGroups { - if _, ok := responseTypesWithReferences[types.ResponseType(responseType)]; ok { - items := resourceGroup.Items - getResourceReferences(items, ret) - } - } - - return ret -} - -func getResourceReferences(resources map[string]types.ResourceWithTTL, out map[resource.Type]map[string]bool) { - for _, res := range resources { - if res.Resource == nil { - continue - } - - switch v := res.Resource.(type) { - case *endpoint.ClusterLoadAssignment: - // No dependencies. - case *cluster.Cluster: - getClusterReferences(v, out) - case *route.RouteConfiguration: - // References to clusters in both routes (and listeners) are not included - // in the result, because the clusters are retrieved in bulk currently, - // and not by name. - case *route.ScopedRouteConfiguration: - getScopedRouteReferences(v, out) - case *listener.Listener: - getListenerReferences(v, out) - case *runtime.Runtime: - // no dependencies - } - } -} - -func mapMerge(dst, src map[string]bool) { - for k, v := range src { - dst[k] = v - } -} - -// Clusters will reference either the endpoint's cluster name or ServiceName override. -func getClusterReferences(src *cluster.Cluster, out map[resource.Type]map[string]bool) { - endpoints := map[string]bool{} - - switch typ := src.GetClusterDiscoveryType().(type) { - case *cluster.Cluster_Type: - if typ.Type == cluster.Cluster_EDS { - if src.GetEdsClusterConfig() != nil && src.GetEdsClusterConfig().GetServiceName() != "" { - endpoints[src.GetEdsClusterConfig().GetServiceName()] = true - } else { - endpoints[src.GetName()] = true - } - } - } - - if len(endpoints) > 0 { - if _, ok := out[resource.EndpointType]; !ok { - out[resource.EndpointType] = map[string]bool{} - } - - mapMerge(out[resource.EndpointType], endpoints) - } -} - -// HTTP listeners will either reference ScopedRoutes or Routes. -func getListenerReferences(src *listener.Listener, out map[resource.Type]map[string]bool) { - routes := map[string]bool{} - - // Extract route configuration names from HTTP connection manager. - for _, chain := range src.GetFilterChains() { - getListenerReferencesFromChain(chain, routes) - } - - if src.GetDefaultFilterChain() != nil { - getListenerReferencesFromChain(src.GetDefaultFilterChain(), routes) - } - - if len(routes) > 0 { - if _, ok := out[resource.RouteType]; !ok { - out[resource.RouteType] = map[string]bool{} - } - - mapMerge(out[resource.RouteType], routes) - } -} - -func getListenerReferencesFromChain(chain *listener.FilterChain, routes map[string]bool) { - // If we are using RDS, add the referenced the route name. - // If the scoped route mapping is embedded, add the referenced route resource names. - for _, filter := range chain.GetFilters() { - config := resource.GetHTTPConnectionManager(filter) - if config == nil { - continue - } - - if name := config.GetRds().GetRouteConfigName(); name != "" { - routes[name] = true - } - - for _, s := range config.GetScopedRoutes().GetScopedRouteConfigurationsList().GetScopedRouteConfigurations() { - routes[s.GetRouteConfigurationName()] = true - } - } -} - -func getScopedRouteReferences(src *route.ScopedRouteConfiguration, out map[resource.Type]map[string]bool) { - routes := map[string]bool{} - - // For a scoped route configuration, the dependent resource is the RouteConfigurationName. - routes[src.GetRouteConfigurationName()] = true - - if len(routes) > 0 { - if _, ok := out[resource.RouteType]; !ok { - out[resource.RouteType] = map[string]bool{} - } - - mapMerge(out[resource.RouteType], routes) - } -} - -// HashResource will take a resource and create a SHA256 hash sum out of the marshaled bytes -func HashResource(resource []byte) string { - hasher := sha256.New() - hasher.Write(resource) - - return hex.EncodeToString(hasher.Sum(nil)) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/resources.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/resources.go deleted file mode 100644 index 60f0ea09f..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/resources.go +++ /dev/null @@ -1,47 +0,0 @@ -package cache - -import "github.com/envoyproxy/go-control-plane/pkg/cache/types" - -// Resources is a versioned group of resources. -type Resources struct { - // Version information. - Version string - - // Items in the group indexed by name. - Items map[string]types.ResourceWithTTL -} - -// IndexResourcesByName creates a map from the resource name to the resource. -func IndexResourcesByName(items []types.ResourceWithTTL) map[string]types.ResourceWithTTL { - indexed := make(map[string]types.ResourceWithTTL, len(items)) - for _, item := range items { - indexed[GetResourceName(item.Resource)] = item - } - return indexed -} - -// IndexRawResourcesByName creates a map from the resource name to the resource. -func IndexRawResourcesByName(items []types.Resource) map[string]types.Resource { - indexed := make(map[string]types.Resource, len(items)) - for _, item := range items { - indexed[GetResourceName(item)] = item - } - return indexed -} - -// NewResources creates a new resource group. -func NewResources(version string, items []types.Resource) Resources { - itemsWithTTL := make([]types.ResourceWithTTL, 0, len(items)) - for _, item := range items { - itemsWithTTL = append(itemsWithTTL, types.ResourceWithTTL{Resource: item}) - } - return NewResourcesWithTTL(version, itemsWithTTL) -} - -// NewResourcesWithTTL creates a new resource group. -func NewResourcesWithTTL(version string, items []types.ResourceWithTTL) Resources { - return Resources{ - Version: version, - Items: IndexResourcesByName(items), - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/simple.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/simple.go deleted file mode 100644 index 210ef1a46..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/simple.go +++ /dev/null @@ -1,687 +0,0 @@ -// Copyright 2018 Envoyproxy 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. - -package cache - -import ( - "context" - "fmt" - "maps" - "slices" - "sync" - "sync/atomic" - "time" - - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/log" -) - -// ResourceSnapshot is an abstract snapshot of a collection of resources that -// can be stored in a SnapshotCache. This enables applications to use the -// SnapshotCache watch machinery with their own resource types. Most -// applications will use Snapshot. -type ResourceSnapshot interface { - // GetVersion should return the current version of the resource indicated - // by typeURL. The version string that is returned is opaque and should - // only be compared for equality. - GetVersion(typeURL string) string - - // GetResourcesAndTTL returns all resources of the type indicted by - // typeURL, together with their TTL. - GetResourcesAndTTL(typeURL string) map[string]types.ResourceWithTTL - - // GetResources returns all resources of the type indicted by - // typeURL. This is identical to GetResourcesAndTTL, except that - // the TTL is omitted. - GetResources(typeURL string) map[string]types.Resource - - // ConstructVersionMap is a hint that a delta watch will soon make a - // call to GetVersionMap. The snapshot should construct an internal - // opaque version string for each collection of resource types. - ConstructVersionMap() error - - // GetVersionMap returns a map of resource name to resource version for - // all the resources of type indicated by typeURL. - GetVersionMap(typeURL string) map[string]string -} - -// SnapshotCache is a snapshot-based cache that maintains a single versioned -// snapshot of responses per node. SnapshotCache consistently replies with the -// latest snapshot. For the protocol to work correctly in ADS mode, EDS/RDS -// requests are responded only when all resources in the snapshot xDS response -// are named as part of the request. It is expected that the CDS response names -// all EDS clusters, and the LDS response names all RDS routes in a snapshot, -// to ensure that Envoy makes the request for all EDS clusters or RDS routes -// eventually. -// -// SnapshotCache can operate as a REST or regular xDS backend. The snapshot -// can be partial, e.g. only include RDS or EDS resources. -type SnapshotCache interface { - Cache - - // SetSnapshot sets a response snapshot for a node. For ADS, the snapshots - // should have distinct versions and be internally consistent (e.g. all - // referenced resources must be included in the snapshot). - // - // This method will cause the server to respond to all open watches, for which - // the version differs from the snapshot version. - SetSnapshot(ctx context.Context, node string, snapshot ResourceSnapshot) error - - // GetSnapshots gets the snapshot for a node. - GetSnapshot(node string) (ResourceSnapshot, error) - - // ClearSnapshot removes all status and snapshot information associated with a node. - ClearSnapshot(node string) - - // GetStatusInfo retrieves status information for a node ID. - GetStatusInfo(string) StatusInfo - - // GetStatusKeys retrieves node IDs for all statuses. - GetStatusKeys() []string -} - -type snapshotCache struct { - // watchCount and deltaWatchCount are atomic counters incremented for each watch respectively. They need to - // be the first fields in the struct to guarantee 64-bit alignment, - // which is a requirement for atomic operations on 64-bit operands to work on - // 32-bit machines. - watchCount int64 - deltaWatchCount int64 - - log log.Logger - - // ads flag to hold responses until all resources are named - ads bool - - // snapshots are cached resources indexed by node IDs - snapshots map[string]ResourceSnapshot - - // status information for all nodes indexed by node IDs - status map[string]*statusInfo - - // hash is the hashing function for Envoy nodes - hash NodeHash - - mu sync.RWMutex -} - -// NewSnapshotCache initializes a simple cache. -// -// ADS flag forces a delay in responding to streaming requests until all -// resources are explicitly named in the request. This avoids the problem of a -// partial request over a single stream for a subset of resources which would -// require generating a fresh version for acknowledgement. ADS flag requires -// snapshot consistency. For non-ADS case (and fetch), multiple partial -// requests are sent across multiple streams and re-using the snapshot version -// is OK. -// -// Logger is optional. -func NewSnapshotCache(ads bool, hash NodeHash, logger log.Logger) SnapshotCache { - return newSnapshotCache(ads, hash, logger) -} - -func newSnapshotCache(ads bool, hash NodeHash, logger log.Logger) *snapshotCache { - if logger == nil { - logger = log.NewDefaultLogger() - } - - cache := &snapshotCache{ - log: logger, - ads: ads, - snapshots: make(map[string]ResourceSnapshot), - status: make(map[string]*statusInfo), - hash: hash, - } - - return cache -} - -// NewSnapshotCacheWithHeartbeating initializes a simple cache that sends periodic heartbeat -// responses for resources with a TTL. -// -// ADS flag forces a delay in responding to streaming requests until all -// resources are explicitly named in the request. This avoids the problem of a -// partial request over a single stream for a subset of resources which would -// require generating a fresh version for acknowledgement. ADS flag requires -// snapshot consistency. For non-ADS case (and fetch), multiple partial -// requests are sent across multiple streams and re-using the snapshot version -// is OK. -// -// Logger is optional. -// -// The context provides a way to cancel the heartbeating routine, while the heartbeatInterval -// parameter controls how often heartbeating occurs. -func NewSnapshotCacheWithHeartbeating(ctx context.Context, ads bool, hash NodeHash, logger log.Logger, heartbeatInterval time.Duration) SnapshotCache { - cache := newSnapshotCache(ads, hash, logger) - go func() { - t := time.NewTicker(heartbeatInterval) - - for { - select { - case <-t.C: - cache.mu.Lock() - for node := range cache.status { - // TODO(snowp): Omit heartbeats if a real response has been sent recently. - cache.sendHeartbeats(ctx, node) - } - cache.mu.Unlock() - case <-ctx.Done(): - return - } - } - }() - return cache -} - -func (cache *snapshotCache) sendHeartbeats(ctx context.Context, node string) { - snapshot, ok := cache.snapshots[node] - if !ok { - return - } - - if info, ok := cache.status[node]; ok { - info.mu.Lock() - for id, watch := range info.watches { - // Respond with the current version regardless of whether the version has changed. - version := snapshot.GetVersion(watch.Request.GetTypeUrl()) - resources := snapshot.GetResourcesAndTTL(watch.Request.GetTypeUrl()) - - // TODO(snowp): Construct this once per type instead of once per watch. - resourcesWithTTL := map[string]types.ResourceWithTTL{} - for k, v := range resources { - if v.TTL != nil { - resourcesWithTTL[k] = v - } - } - - if len(resourcesWithTTL) == 0 { - continue - } - cache.log.Debugf("respond open watch %d %v with heartbeat for version %q", id, watch.Request.GetResourceNames(), version) - err := cache.respond(ctx, watch, resourcesWithTTL, version, true) - if err != nil { - cache.log.Errorf("received error when attempting to respond to watches: %v", err) - } - - // The watch must be deleted and we must rely on the client to ack this response to create a new watch. - delete(info.watches, id) - } - info.mu.Unlock() - } -} - -// SetSnapshotCache updates a snapshot for a node. -func (cache *snapshotCache) SetSnapshot(ctx context.Context, node string, snapshot ResourceSnapshot) error { - cache.mu.Lock() - defer cache.mu.Unlock() - - cache.log.Debugf("setting snapshot for node %s", node) - // update the existing entry - cache.snapshots[node] = snapshot - - // trigger existing watches for which version changed - if info, ok := cache.status[node]; ok { - info.mu.Lock() - defer info.mu.Unlock() - - // Respond to SOTW watches for the node. - if err := cache.respondSOTWWatches(ctx, info, snapshot); err != nil { - return err - } - - // Respond to delta watches for the node. - return cache.respondDeltaWatches(ctx, info, snapshot) - } - - return nil -} - -func (cache *snapshotCache) respondSOTWWatches(ctx context.Context, info *statusInfo, snapshot ResourceSnapshot) error { - // responder callback for SOTW watches - respond := func(watch ResponseWatch, id int64) error { - version := snapshot.GetVersion(watch.Request.GetTypeUrl()) - if version != watch.Request.GetVersionInfo() { - cache.log.Debugf("respond open watch %d %s %v with new version %q", id, watch.Request.GetTypeUrl(), watch.Request.GetResourceNames(), version) - resources := snapshot.GetResourcesAndTTL(watch.Request.GetTypeUrl()) - err := cache.respond(ctx, watch, resources, version, false) - if err != nil { - return err - } - // discard the watch - delete(info.watches, id) - } - return nil - } - - // If ADS is enabled we need to order response watches so we guarantee - // sending them in the correct order. Go's default implementation - // of maps are randomized order when ranged over. - if cache.ads { - info.orderResponseWatches() - for _, key := range info.orderedWatches { - err := respond(info.watches[key.ID], key.ID) - if err != nil { - return err - } - } - } else { - for id, watch := range info.watches { - err := respond(watch, id) - if err != nil { - return err - } - } - } - - return nil -} - -func (cache *snapshotCache) respondDeltaWatches(ctx context.Context, info *statusInfo, snapshot ResourceSnapshot) error { - // We only calculate version hashes when using delta. We don't - // want to do this when using SOTW so we can avoid unnecessary - // computational cost if not using delta. - if len(info.deltaWatches) == 0 { - return nil - } - - err := snapshot.ConstructVersionMap() - if err != nil { - return err - } - - // If ADS is enabled we need to order response delta watches so we guarantee - // sending them in the correct order. Go's default implementation - // of maps are randomized order when ranged over. - if cache.ads { - info.orderResponseDeltaWatches() - for _, key := range info.orderedDeltaWatches { - watch := info.deltaWatches[key.ID] - res, err := cache.respondDelta( - ctx, - snapshot, - watch.Request, - watch.Response, - watch.subscription, - ) - if err != nil { - return err - } - // If we detect a nil response here, that means there has been no state change - // so we don't want to respond or remove any existing resource watches - if res != nil { - delete(info.deltaWatches, key.ID) - } - } - } else { - for id, watch := range info.deltaWatches { - res, err := cache.respondDelta( - ctx, - snapshot, - watch.Request, - watch.Response, - watch.subscription, - ) - if err != nil { - return err - } - // If we detect a nil response here, that means there has been no state change - // so we don't want to respond or remove any existing resource watches - if res != nil { - delete(info.deltaWatches, id) - } - } - } - return nil -} - -// GetSnapshot gets the snapshot for a node, and returns an error if not found. -func (cache *snapshotCache) GetSnapshot(node string) (ResourceSnapshot, error) { - cache.mu.RLock() - defer cache.mu.RUnlock() - - snap, ok := cache.snapshots[node] - if !ok { - return nil, fmt.Errorf("no snapshot found for node %s", node) - } - return snap, nil -} - -// ClearSnapshot clears snapshot and info for a node. -func (cache *snapshotCache) ClearSnapshot(node string) { - cache.mu.Lock() - defer cache.mu.Unlock() - - delete(cache.snapshots, node) - delete(cache.status, node) -} - -// nameSet creates a map from a string slice to value true. -func nameSet(names []string) map[string]bool { - set := make(map[string]bool, len(names)) - for _, name := range names { - set[name] = true - } - return set -} - -// superset checks that all resources are listed in the names set. -func superset(names map[string]bool, resources map[string]types.ResourceWithTTL) error { - for resourceName := range resources { - if _, exists := names[resourceName]; !exists { - return fmt.Errorf("%q not listed", resourceName) - } - } - return nil -} - -// CreateWatch returns a watch for an xDS request. A nil function may be -// returned if an error occurs. -func (cache *snapshotCache) CreateWatch(request *Request, sub Subscription, value chan Response) (func(), error) { - nodeID := cache.hash.ID(request.GetNode()) - - cache.mu.Lock() - defer cache.mu.Unlock() - - info, ok := cache.status[nodeID] - if !ok { - info = newStatusInfo(request.GetNode()) - cache.status[nodeID] = info - } - - // update last watch request time - info.mu.Lock() - info.lastWatchRequestTime = time.Now() - info.mu.Unlock() - - createWatch := func(watch ResponseWatch) func() { - watchID := cache.nextWatchID() - cache.log.Debugf("open watch %d for %s %v from nodeID %q, version %q", watchID, request.GetTypeUrl(), sub.SubscribedResources(), nodeID, request.GetVersionInfo()) - info.mu.Lock() - info.watches[watchID] = watch - info.mu.Unlock() - return cache.cancelWatch(nodeID, watchID) - } - - watch := ResponseWatch{Request: request, Response: value, subscription: sub, fullStateResponses: ResourceRequiresFullStateInSotw(request.GetTypeUrl())} - - snapshot, exists := cache.snapshots[nodeID] - if !exists { - return createWatch(watch), nil - } - - version := snapshot.GetVersion(request.GetTypeUrl()) - resources := snapshot.GetResourcesAndTTL(request.GetTypeUrl()) - - if request.GetVersionInfo() == version { - // Retrieve whether there are resources in the cache requested and currently unknown to the client. - knownResourceNames := sub.ReturnedResources() - shouldRespond := false - if !sub.IsWildcard() { - // Check if there is a subscribed resource available and not yet returned, - // for instance if it is newly subscribed. - for r := range sub.SubscribedResources() { - if _, ok := knownResourceNames[r]; !ok { - if _, ok := resources[r]; ok { - shouldRespond = true - break - } - } - } - } else { - // Check if a resource present in the snapshot is currently not returned, - // for instance if the subscription is newly wildcard. - for r := range snapshot.GetResources(request.GetTypeUrl()) { - if _, ok := knownResourceNames[r]; !ok { - shouldRespond = true - break - } - } - } - // The version has not changed, and the client already has all existing requested resources. - if !shouldRespond { - return createWatch(watch), nil - } - } - - // The version is different, or the client is subscribed to resources not yet returned to it. - if err := cache.respond(context.Background(), watch, resources, version, false); err != nil { - cache.log.Errorf("failed to send a response for %s%v to nodeID %q: %s", request.GetTypeUrl(), - sub.SubscribedResources(), nodeID, err) - return nil, fmt.Errorf("failed to send the response: %w", err) - } - - return func() {}, nil -} - -func (cache *snapshotCache) nextWatchID() int64 { - return atomic.AddInt64(&cache.watchCount, 1) -} - -// cancellation function for cleaning stale watches -func (cache *snapshotCache) cancelWatch(nodeID string, watchID int64) func() { - return func() { - // uses the cache mutex - cache.mu.RLock() - defer cache.mu.RUnlock() - if info, ok := cache.status[nodeID]; ok { - info.mu.Lock() - delete(info.watches, watchID) - info.mu.Unlock() - } - } -} - -// Respond to a watch with the snapshot value. The value channel should have capacity not to block. -// TODO(kuat) do not respond always, see issue https://github.com/envoyproxy/go-control-plane/issues/46 -func (cache *snapshotCache) respond(ctx context.Context, watch ResponseWatch, resources map[string]types.ResourceWithTTL, version string, heartbeat bool) error { - request := watch.Request - // for ADS, the request names must match the snapshot names - // if they do not, then the watch is never responded, and it is expected that envoy makes another request - if len(request.GetResourceNames()) != 0 && cache.ads { - if err := superset(nameSet(request.GetResourceNames()), resources); err != nil { - cache.log.Warnf("ADS mode: not responding to request %s %v: %v", request.GetTypeUrl(), request.GetResourceNames(), err) - return nil - } - } - - resp := createResponse(ctx, request, resources, version, heartbeat) - cache.log.Debugf("respond %s (requested %v) version %q with version %q and resources %v", request.GetTypeUrl(), request.GetResourceNames(), request.GetVersionInfo(), version, slices.Collect(maps.Keys(resp.GetReturnedResources()))) - - select { - case watch.Response <- resp: - return nil - case <-ctx.Done(): - return context.Canceled - } -} - -func createResponse(ctx context.Context, request *Request, resources map[string]types.ResourceWithTTL, version string, heartbeat bool) Response { - filtered := make([]*cachedResource, 0, len(resources)) - returnedResources := make(map[string]string, len(resources)) - - // Reply only with the requested resources. Envoy may ask each resource - // individually in a separate stream. It is ok to reply with the same version - // on separate streams since requests do not share their response versions. - if len(request.GetResourceNames()) != 0 { - set := nameSet(request.GetResourceNames()) - for name, resource := range resources { - if set[name] { - filtered = append(filtered, newCachedResourceWithTTL(name, resource, version)) - returnedResources[name] = version - } - } - } else { - for name, resource := range resources { - filtered = append(filtered, newCachedResourceWithTTL(name, resource, version)) - returnedResources[name] = version - } - } - - return &RawResponse{ - Request: request, - Version: version, - resources: filtered, - returnedResources: returnedResources, - Heartbeat: heartbeat, - Ctx: ctx, - } -} - -// CreateDeltaWatch returns a watch for a delta xDS request which implements the Simple SnapshotCache. -func (cache *snapshotCache) CreateDeltaWatch(request *DeltaRequest, sub Subscription, value chan DeltaResponse) (func(), error) { - nodeID := cache.hash.ID(request.GetNode()) - t := request.GetTypeUrl() - - cache.mu.Lock() - defer cache.mu.Unlock() - - info, ok := cache.status[nodeID] - if !ok { - info = newStatusInfo(request.GetNode()) - cache.status[nodeID] = info - } - - // update last watch request time - info.setLastDeltaWatchRequestTime(time.Now()) - - // find the current cache snapshot for the provided node - snapshot, exists := cache.snapshots[nodeID] - - // There are three different cases that leads to a delayed watch trigger: - // - no snapshot exists for the requested nodeID - // - a snapshot exists, but we failed to initialize its version map - // - we attempted to issue a response, but the caller is already up to date - delayedResponse := !exists - if exists { - err := snapshot.ConstructVersionMap() - if err != nil { - cache.log.Errorf("failed to compute version for snapshot resources inline: %s", err) - } - response, err := cache.respondDelta(context.Background(), snapshot, request, value, sub) - if err != nil { - cache.log.Errorf("failed to respond with delta response: %s", err) - } - - delayedResponse = response == nil - } - - if delayedResponse { - watchID := cache.nextDeltaWatchID() - - if exists { - cache.log.Infof("open delta watch ID:%d for %s Resources:%v from nodeID: %q, version %q", watchID, t, sub.SubscribedResources(), nodeID, snapshot.GetVersion(t)) - } else { - cache.log.Infof("open delta watch ID:%d for %s Resources:%v from nodeID: %q", watchID, t, sub.SubscribedResources(), nodeID) - } - - info.setDeltaResponseWatch(watchID, DeltaResponseWatch{Request: request, Response: value, subscription: sub}) - return cache.cancelDeltaWatch(nodeID, watchID), nil - } - - return nil, nil -} - -// Respond to a delta watch with the provided snapshot value. If the response is nil, there has been no state change. -func (cache *snapshotCache) respondDelta(ctx context.Context, snapshot ResourceSnapshot, request *DeltaRequest, value chan DeltaResponse, sub Subscription) (*RawDeltaResponse, error) { - resp := createDeltaResponse(ctx, request, sub, resourceContainer{ - resourceMap: snapshot.GetResources(request.GetTypeUrl()), - versionMap: snapshot.GetVersionMap(request.GetTypeUrl()), - }, snapshot.GetVersion(request.GetTypeUrl())) - - // Only send a response if there were changes - // We want to respond immediately for the first wildcard request in a stream, even if the response is empty - // otherwise, envoy won't complete initialization - if len(resp.resources) > 0 || len(resp.removedResources) > 0 || (sub.IsWildcard() && request.ResponseNonce == "") { - if cache.log != nil { - cache.log.Debugf("node: %s, sending delta response for typeURL %s with resources: %v removed resources: %v with wildcard: %t", - request.GetNode().GetId(), request.GetTypeUrl(), getCachedResourceNames(resp.resources), resp.removedResources, sub.IsWildcard()) - } - select { - case value <- resp: - return resp, nil - case <-ctx.Done(): - return resp, context.Canceled - } - } - return nil, nil -} - -func (cache *snapshotCache) nextDeltaWatchID() int64 { - return atomic.AddInt64(&cache.deltaWatchCount, 1) -} - -// cancellation function for cleaning stale delta watches -func (cache *snapshotCache) cancelDeltaWatch(nodeID string, watchID int64) func() { - return func() { - cache.mu.RLock() - defer cache.mu.RUnlock() - if info, ok := cache.status[nodeID]; ok { - info.mu.Lock() - delete(info.deltaWatches, watchID) - info.mu.Unlock() - } - } -} - -// Fetch implements the cache fetch function. -// Fetch is called on multiple streams, so responding to individual names with the same version works. -func (cache *snapshotCache) Fetch(ctx context.Context, request *Request) (Response, error) { - nodeID := cache.hash.ID(request.GetNode()) - - cache.mu.RLock() - defer cache.mu.RUnlock() - - if snapshot, exists := cache.snapshots[nodeID]; exists { - // Respond only if the request version is distinct from the current snapshot state. - // It might be beneficial to hold the request since Envoy will re-attempt the refresh. - version := snapshot.GetVersion(request.GetTypeUrl()) - if request.GetVersionInfo() == version { - cache.log.Warnf("skip fetch: version up to date") - return nil, &types.SkipFetchError{} - } - - resources := snapshot.GetResourcesAndTTL(request.GetTypeUrl()) - out := createResponse(ctx, request, resources, version, false) - return out, nil - } - - return nil, fmt.Errorf("missing snapshot for %q", nodeID) -} - -// GetStatusInfo retrieves the status info for the node. -func (cache *snapshotCache) GetStatusInfo(node string) StatusInfo { - cache.mu.RLock() - defer cache.mu.RUnlock() - - info, exists := cache.status[node] - if !exists { - cache.log.Warnf("node does not exist") - return nil - } - - return info -} - -// GetStatusKeys retrieves all node IDs in the status map. -func (cache *snapshotCache) GetStatusKeys() []string { - cache.mu.RLock() - defer cache.mu.RUnlock() - - out := make([]string, 0, len(cache.status)) - for id := range cache.status { - out = append(out, id) - } - - return out -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/snapshot.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/snapshot.go deleted file mode 100644 index a80f61d40..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/snapshot.go +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright 2018 Envoyproxy 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. - -package cache - -import ( - "errors" - "fmt" - - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" -) - -// Snapshot is an internally consistent snapshot of xDS resources. -// Consistency is important for the convergence as different resource types -// from the snapshot may be delivered to the proxy in arbitrary order. -type Snapshot struct { - Resources [types.UnknownType]Resources - - // VersionMap holds the current hash map of all resources in the snapshot. - // This field should remain nil until it is used, at which point should be - // instantiated by calling ConstructVersionMap(). - // VersionMap is only to be used with delta xDS. - VersionMap map[string]map[string]string -} - -var _ ResourceSnapshot = &Snapshot{} - -// NewSnapshot creates a snapshot from response types and a version. -// The resources map is keyed off the type URL of a resource, followed by the slice of resource objects. -func NewSnapshot(version string, resources map[resource.Type][]types.Resource) (*Snapshot, error) { - out := Snapshot{} - - for typ, resource := range resources { - index := GetResponseType(typ) - if index == types.UnknownType { - return nil, errors.New("unknown resource type: " + typ) - } - - out.Resources[index] = NewResources(version, resource) - } - - return &out, nil -} - -// NewSnapshotWithTTLs creates a snapshot of ResourceWithTTLs. -// The resources map is keyed off the type URL of a resource, followed by the slice of resource objects. -func NewSnapshotWithTTLs(version string, resources map[resource.Type][]types.ResourceWithTTL) (*Snapshot, error) { - out := Snapshot{} - - for typ, resource := range resources { - index := GetResponseType(typ) - if index == types.UnknownType { - return nil, errors.New("unknown resource type: " + typ) - } - - out.Resources[index] = NewResourcesWithTTL(version, resource) - } - - return &out, nil -} - -// Consistent check verifies that the dependent resources are exactly listed in the -// snapshot: -// - all EDS resources are listed by name in CDS resources -// - all SRDS/RDS resources are listed by name in LDS resources -// - all RDS resources are listed by name in SRDS resources -// -// Note that clusters and listeners are requested without name references, so -// Envoy will accept the snapshot list of clusters as-is even if it does not match -// all references found in xDS. -func (s *Snapshot) Consistent() error { - if s == nil { - return errors.New("nil snapshot") - } - - referencedResources := GetAllResourceReferences(s.Resources) - - // Loop through each referenced resource. - referencedResponseTypes := map[types.ResponseType]struct{}{ - types.Endpoint: {}, - types.Route: {}, - } - - for idx, items := range s.Resources { - // We only want to check resource types that are expected to be referenced by another resource type. - // Basically, if the consistency relationship is modeled as a DAG, we only want - // to check nodes that are expected to have edges pointing to it. - responseType := types.ResponseType(idx) - if _, ok := referencedResponseTypes[responseType]; ok { - typeURL, err := GetResponseTypeURL(responseType) - if err != nil { - return err - } - referenceSet := referencedResources[typeURL] - - if len(referenceSet) != len(items.Items) { - return fmt.Errorf("mismatched %q reference and resource lengths: len(%v) != %d", - typeURL, referenceSet, len(items.Items)) - } - - // Check superset. - if err := superset(referenceSet, items.Items); err != nil { - return fmt.Errorf("inconsistent %q reference: %w", typeURL, err) - } - } - } - - return nil -} - -// GetResources selects snapshot resources by type, returning the map of resources. -func (s *Snapshot) GetResources(typeURL resource.Type) map[string]types.Resource { - resources := s.GetResourcesAndTTL(typeURL) - if resources == nil { - return nil - } - - withoutTTL := make(map[string]types.Resource, len(resources)) - - for k, v := range resources { - withoutTTL[k] = v.Resource - } - - return withoutTTL -} - -// GetResourcesAndTTL selects snapshot resources by type, returning the map of resources and the associated TTL. -func (s *Snapshot) GetResourcesAndTTL(typeURL resource.Type) map[string]types.ResourceWithTTL { - if s == nil { - return nil - } - typ := GetResponseType(typeURL) - if typ == types.UnknownType { - return nil - } - return s.Resources[typ].Items -} - -// GetVersion returns the version for a resource type. -func (s *Snapshot) GetVersion(typeURL resource.Type) string { - if s == nil { - return "" - } - typ := GetResponseType(typeURL) - if typ == types.UnknownType { - return "" - } - return s.Resources[typ].Version -} - -// GetVersionMap will return the internal version map of the currently applied snapshot. -func (s *Snapshot) GetVersionMap(typeURL string) map[string]string { - return s.VersionMap[typeURL] -} - -// ConstructVersionMap will construct a version map based on the current state of a snapshot -func (s *Snapshot) ConstructVersionMap() error { - if s == nil { - return errors.New("missing snapshot") - } - - // The snapshot resources never change, so no need to ever rebuild. - if s.VersionMap != nil { - return nil - } - - s.VersionMap = make(map[string]map[string]string) - - for i, resources := range s.Resources { - typeURL, err := GetResponseTypeURL(types.ResponseType(i)) - if err != nil { - return err - } - if _, ok := s.VersionMap[typeURL]; !ok { - s.VersionMap[typeURL] = make(map[string]string, len(resources.Items)) - } - - for _, r := range resources.Items { - // Hash our version in here and build the version map. - marshaledResource, err := MarshalResource(r.Resource) - if err != nil { - return err - } - v := HashResource(marshaledResource) - if v == "" { - return fmt.Errorf("failed to build resource version: %w", err) - } - - s.VersionMap[typeURL][GetResourceName(r.Resource)] = v - } - } - - return nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/status.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/status.go deleted file mode 100644 index aed5bcdd7..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/cache/v3/status.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright 2018 Envoyproxy 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. - -package cache - -import ( - "context" - "sort" - "sync" - "time" - - core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" -) - -// NodeHash computes string identifiers for Envoy nodes. -type NodeHash interface { - // ID function defines a unique string identifier for the remote Envoy node. - ID(node *core.Node) string -} - -// IDHash uses ID field as the node hash. -type IDHash struct{} - -// ID uses the node ID field -func (IDHash) ID(node *core.Node) string { - if node == nil { - return "" - } - return node.GetId() -} - -var _ NodeHash = IDHash{} - -// StatusInfo publishes information about nodes that are watching the xDS cache. -type StatusInfo interface { - // GetNode returns the node metadata. - GetNode() *core.Node - - // GetNumWatches returns the number of open watches. - GetNumWatches() int - - // GetNumDeltaWatches returns the number of open delta watches. - GetNumDeltaWatches() int - - // GetLastWatchRequestTime returns the timestamp of the last discovery watch request. - GetLastWatchRequestTime() time.Time - - // GetLastDeltaWatchRequestTime returns the timestamp of the last delta discovery watch request. - GetLastDeltaWatchRequestTime() time.Time -} - -// statusInfo tracks the server state for the remote Envoy node. -type statusInfo struct { - // node is the constant Envoy node metadata. - node *core.Node - - // watches are indexed channels for the response watches and the original requests. - watches map[int64]ResponseWatch - orderedWatches keys - - // deltaWatches are indexed channels for the delta response watches and the original requests - deltaWatches map[int64]DeltaResponseWatch - orderedDeltaWatches keys - - // the timestamp of the last watch request - lastWatchRequestTime time.Time - - // the timestamp of the last delta watch request - lastDeltaWatchRequestTime time.Time - - // mutex to protect the status fields. - // should not acquire mutex of the parent cache after acquiring this mutex. - mu sync.RWMutex -} - -type WatchResponse interface { - GetReturnedResources() map[string]string - GetResponseVersion() string -} - -// ResponseWatch is a watch record keeping both the request and an open channel for the response. -type ResponseWatch struct { - // Request is the original request for the watch. - Request *Request - - // Response is the channel to push responses to. - Response chan Response - - // Subscription stores the current client subscription state. - subscription Subscription - - // fullStateResponses requires that all resources matching the request, with no regards to which ones actually updated, must be provided in the response. - fullStateResponses bool -} - -func (w ResponseWatch) isDelta() bool { - return false -} - -func (w ResponseWatch) useResourceVersion() bool { - return false -} - -func (w ResponseWatch) buildResponse(updatedResources []*cachedResource, _ []string, returnedVersions map[string]string, version string) WatchResponse { - return &RawResponse{ - Request: w.Request, - resources: updatedResources, - returnedResources: returnedVersions, - Version: version, - Ctx: context.Background(), - } -} - -func (w ResponseWatch) sendFullStateResponses() bool { - return w.fullStateResponses -} - -func (w ResponseWatch) getSubscription() Subscription { - return w.subscription -} - -func (w ResponseWatch) sendResponse(resp WatchResponse) { - w.Response <- resp.(*RawResponse) -} - -// DeltaResponseWatch is a watch record keeping both the delta request and an open channel for the delta response. -type DeltaResponseWatch struct { - // Request is the most recent delta request for the watch - Request *DeltaRequest - - // Response is the channel to push the delta responses to - Response chan DeltaResponse - - // Subscription stores the current client subscription state. - subscription Subscription -} - -func (w DeltaResponseWatch) isDelta() bool { - return true -} - -func (w DeltaResponseWatch) useResourceVersion() bool { - return true -} - -func (w DeltaResponseWatch) sendFullStateResponses() bool { - return false -} - -func (w DeltaResponseWatch) getSubscription() Subscription { - return w.subscription -} - -func (w DeltaResponseWatch) buildResponse(updatedResources []*cachedResource, removedResources []string, returnedVersions map[string]string, version string) WatchResponse { - return &RawDeltaResponse{ - DeltaRequest: w.Request, - resources: updatedResources, - removedResources: removedResources, - returnedResources: returnedVersions, - SystemVersionInfo: version, - Ctx: context.Background(), - } -} - -func (w DeltaResponseWatch) sendResponse(resp WatchResponse) { - w.Response <- resp.(*RawDeltaResponse) -} - -// newStatusInfo initializes a status info data structure. -func newStatusInfo(node *core.Node) *statusInfo { - out := statusInfo{ - node: node, - watches: make(map[int64]ResponseWatch), - orderedWatches: make(keys, 0), - deltaWatches: make(map[int64]DeltaResponseWatch), - } - return &out -} - -func (info *statusInfo) GetNode() *core.Node { - info.mu.RLock() - defer info.mu.RUnlock() - return info.node -} - -func (info *statusInfo) GetNumWatches() int { - info.mu.RLock() - defer info.mu.RUnlock() - return len(info.watches) -} - -func (info *statusInfo) GetNumDeltaWatches() int { - info.mu.RLock() - defer info.mu.RUnlock() - return len(info.deltaWatches) -} - -func (info *statusInfo) GetLastWatchRequestTime() time.Time { - info.mu.RLock() - defer info.mu.RUnlock() - return info.lastWatchRequestTime -} - -func (info *statusInfo) GetLastDeltaWatchRequestTime() time.Time { - info.mu.RLock() - defer info.mu.RUnlock() - return info.lastDeltaWatchRequestTime -} - -// setLastDeltaWatchRequestTime will set the current time of the last delta discovery watch request. -func (info *statusInfo) setLastDeltaWatchRequestTime(t time.Time) { - info.mu.Lock() - defer info.mu.Unlock() - info.lastDeltaWatchRequestTime = t -} - -// setDeltaResponseWatch will set the provided delta response watch for the associated watch ID. -func (info *statusInfo) setDeltaResponseWatch(id int64, drw DeltaResponseWatch) { - info.mu.Lock() - defer info.mu.Unlock() - info.deltaWatches[id] = drw -} - -// orderResponseWatches will track a list of watch keys and order them if -// true is passed. -func (info *statusInfo) orderResponseWatches() { - info.orderedWatches = make(keys, len(info.watches)) - - var index int - for id, watch := range info.watches { - info.orderedWatches[index] = key{ - ID: id, - TypeURL: watch.Request.GetTypeUrl(), - } - index++ - } - - // Sort our list which we can use in the SetSnapshot functions. - // This is only run when we enable ADS on the cache. - sort.Sort(info.orderedWatches) -} - -// orderResponseDeltaWatches will track a list of delta watch keys and order them if -// true is passed. -func (info *statusInfo) orderResponseDeltaWatches() { - info.orderedDeltaWatches = make(keys, len(info.deltaWatches)) - - var index int - for id, deltaWatch := range info.deltaWatches { - info.orderedDeltaWatches[index] = key{ - ID: id, - TypeURL: deltaWatch.Request.GetTypeUrl(), - } - index++ - } - - // Sort our list which we can use in the SetSnapshot functions. - // This is only run when we enable ADS on the cache. - sort.Sort(info.orderedDeltaWatches) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/log/default.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/log/default.go deleted file mode 100644 index 2f52fed46..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/log/default.go +++ /dev/null @@ -1,28 +0,0 @@ -//nolint:all -package log - -// DefaultLogger is enabled when no consuming clients provide -// a logger to the server/cache subsystem -type DefaultLogger struct { -} - -// NewDefaultLogger creates a DefaultLogger which is a no-op to maintain current functionality -func NewDefaultLogger() *DefaultLogger { - return &DefaultLogger{} -} - -// Debugf logs a message at level debug on the standard logger. -func (l *DefaultLogger) Debugf(string, ...interface{}) { -} - -// Infof logs a message at level info on the standard logger. -func (l *DefaultLogger) Infof(string, ...interface{}) { -} - -// Warnf logs a message at level warn on the standard logger. -func (l *DefaultLogger) Warnf(string, ...interface{}) { -} - -// Errorf logs a message at level error on the standard logger. -func (l *DefaultLogger) Errorf(string, ...interface{}) { -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/log/log.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/log/log.go deleted file mode 100644 index d823e9500..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/log/log.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2020 Envoyproxy 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. - -// Package log provides a logging interface for use in this library. -package log - -// Logger interface for reporting informational and warning messages. -type Logger interface { - // Debugf logs a formatted debugging message. - Debugf(format string, args ...interface{}) - - // Infof logs a formatted informational message. - Infof(format string, args ...interface{}) - - // Warnf logs a formatted warning message. - Warnf(format string, args ...interface{}) - - // Errorf logs a formatted error message. - Errorf(format string, args ...interface{}) -} - -// LoggerFuncs implements the Logger interface, allowing the -// caller to specify only the logging functions that are desired. -type LoggerFuncs struct { - DebugFunc func(string, ...interface{}) - InfoFunc func(string, ...interface{}) - WarnFunc func(string, ...interface{}) - ErrorFunc func(string, ...interface{}) -} - -// Debugf logs a formatted debugging message. -func (f LoggerFuncs) Debugf(format string, args ...interface{}) { - if f.DebugFunc != nil { - f.DebugFunc(format, args...) - } -} - -// Infof logs a formatted informational message. -func (f LoggerFuncs) Infof(format string, args ...interface{}) { - if f.InfoFunc != nil { - f.InfoFunc(format, args...) - } -} - -// Warnf logs a formatted warning message. -func (f LoggerFuncs) Warnf(format string, args ...interface{}) { - if f.WarnFunc != nil { - f.WarnFunc(format, args...) - } -} - -// Errorf logs a formatted error message. -func (f LoggerFuncs) Errorf(format string, args ...interface{}) { - if f.ErrorFunc != nil { - f.ErrorFunc(format, args...) - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/log/test.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/log/test.go deleted file mode 100644 index cbae60272..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/log/test.go +++ /dev/null @@ -1,37 +0,0 @@ -package log - -import "testing" - -type testLogger struct { - t testing.TB -} - -var _ Logger = testLogger{} - -func NewTestLogger(t testing.TB) Logger { - return testLogger{t} -} - -// Debugf logs a message at level debug on the test logger. -func (l testLogger) Debugf(msg string, args ...interface{}) { - l.t.Helper() - l.t.Logf("[debug] "+msg, args...) -} - -// Infof logs a message at level info on the test logger. -func (l testLogger) Infof(msg string, args ...interface{}) { - l.t.Helper() - l.t.Logf("[info] "+msg, args...) -} - -// Warnf logs a message at level warn on the test logger. -func (l testLogger) Warnf(msg string, args ...interface{}) { - l.t.Helper() - l.t.Logf("[warn] "+msg, args...) -} - -// Errorf logs a message at level error on the test logger. -func (l testLogger) Errorf(msg string, args ...interface{}) { - l.t.Helper() - l.t.Logf("[error] "+msg, args...) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/resource/v3/resource.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/resource/v3/resource.go deleted file mode 100644 index 6bf09d8b6..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/resource/v3/resource.go +++ /dev/null @@ -1,63 +0,0 @@ -package resource - -import ( - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" - - core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" - hcm "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" -) - -// Type is an alias to string which we expose to users of the snapshot API which accepts `resource.Type` resource URLs. -type Type = string - -// Resource types in xDS v3. -const ( - APITypePrefix = "type.googleapis.com/" - EndpointType = APITypePrefix + "envoy.config.endpoint.v3.ClusterLoadAssignment" - ClusterType = APITypePrefix + "envoy.config.cluster.v3.Cluster" - RouteType = APITypePrefix + "envoy.config.route.v3.RouteConfiguration" - ScopedRouteType = APITypePrefix + "envoy.config.route.v3.ScopedRouteConfiguration" - VirtualHostType = APITypePrefix + "envoy.config.route.v3.VirtualHost" - ListenerType = APITypePrefix + "envoy.config.listener.v3.Listener" - SecretType = APITypePrefix + "envoy.extensions.transport_sockets.tls.v3.Secret" - ExtensionConfigType = APITypePrefix + "envoy.config.core.v3.TypedExtensionConfig" - RuntimeType = APITypePrefix + "envoy.service.runtime.v3.Runtime" - ThriftRouteType = APITypePrefix + "envoy.extensions.filters.network.thrift_proxy.v3.RouteConfiguration" - - // Rate Limit service - RateLimitConfigType = APITypePrefix + "ratelimit.config.ratelimit.v3.RateLimitConfig" - - // AnyType is used only by ADS - AnyType = "" -) - -// Fetch urls in xDS v3. -const ( - FetchEndpoints = "/v3/discovery:endpoints" - FetchClusters = "/v3/discovery:clusters" - FetchListeners = "/v3/discovery:listeners" - FetchRoutes = "/v3/discovery:routes" - FetchScopedRoutes = "/v3/discovery:scoped-routes" - FetchSecrets = "/v3/discovery:secrets" //nolint:gosec - FetchRuntimes = "/v3/discovery:runtime" - FetchExtensionConfigs = "/v3/discovery:extension_configs" -) - -// DefaultAPIVersion is the api version -const DefaultAPIVersion = core.ApiVersion_V3 - -// GetHTTPConnectionManager creates a HttpConnectionManager -// from filter. Returns nil if the filter doesn't have a valid -// HttpConnectionManager configuration. -func GetHTTPConnectionManager(filter *listener.Filter) *hcm.HttpConnectionManager { - if typedConfig := filter.GetTypedConfig(); typedConfig != nil { - config := &hcm.HttpConnectionManager{} - if err := anypb.UnmarshalTo(typedConfig, config, proto.UnmarshalOptions{}); err == nil { - return config - } - } - - return nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/config/config.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/config/config.go deleted file mode 100644 index 1ae129ed1..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/config/config.go +++ /dev/null @@ -1,66 +0,0 @@ -package config - -import "github.com/envoyproxy/go-control-plane/pkg/log" - -// Opts for individual xDS implementations that can be -// utilized through the functional opts pattern. -type Opts struct { - // If true respond to ADS requests with a guaranteed resource ordering - Ordered bool - - Logger log.Logger - - // If true, deactivate legacy wildcard mode for all resource types - legacyWildcardDeactivated bool - - // Deactivate legacy wildcard mode for specific resource types - legacyWildcardDeactivatedTypes map[string]struct{} -} - -func NewOpts() Opts { - return Opts{ - Ordered: false, - Logger: log.NewDefaultLogger(), - } -} - -// IsLegacyWildcardActive returns whether legacy wildcard mode is active for the given resource type. -// Returns true if legacy wildcard mode is active, false if it has been deactivated. -func (o Opts) IsLegacyWildcardActive(typeURL string) bool { - if o.legacyWildcardDeactivated { - return false - } - if len(o.legacyWildcardDeactivatedTypes) > 0 { - if _, found := o.legacyWildcardDeactivatedTypes[typeURL]; found { - return false - } - } - return true -} - -// Each xDS implementation should implement their own functional opts. -// It is recommended that config values be added in this package specifically, -// but the individual opts functions should be in their respective -// implementation package so the import looks like the following: -// -// `sotw.WithOrderedADS()` -// `delta.WithOrderedADS()` -// -// this allows for easy inference as to which opt applies to what implementation. -type XDSOption func(*Opts) - -func DeactivateLegacyWildcard() XDSOption { - return func(o *Opts) { - o.legacyWildcardDeactivated = true - } -} - -func DeactivateLegacyWildcardForTypes(types []string) XDSOption { - return func(o *Opts) { - typeMap := make(map[string]struct{}, len(types)) - for _, t := range types { - typeMap[t] = struct{}{} - } - o.legacyWildcardDeactivatedTypes = typeMap - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/config/doc.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/config/doc.go deleted file mode 100644 index 2c85adfd5..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/config/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -/* -Config abstracts xDS server options into a unified configuration package -that allows for easy manipulation as well as unified passage of options -to individual xDS server implementations. - -This enables code reduction as well as a unified source of config. Delta -and SOTW might have similar ordered responses through ADS and rather than -duplicating the logic across server implementations, we add the options -in this package which are passed down to each individual spec. - -Each xDS implementation should implement their own functional opts. -It is recommended that config values be added in this package specifically, -but the individual opts functions should be in their respective -implementation package so the import looks like the following: - -`sotw.WithOrderedADS()` -`delta.WithOrderedADS()` - -this allows for easy inference as to which opt applies to what implementation. -*/ - -package config diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/delta/v3/server.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/delta/v3/server.go deleted file mode 100644 index 3b7c6b977..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/delta/v3/server.go +++ /dev/null @@ -1,282 +0,0 @@ -package delta - -import ( - "context" - "errors" - "strconv" - "sync/atomic" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - "github.com/envoyproxy/go-control-plane/pkg/log" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/config" - "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" -) - -// Server is a wrapper interface which is meant to hold the proper stream handler for each xDS protocol. -type Server interface { - DeltaStreamHandler(stream stream.DeltaStream, typeURL string) error -} - -type Callbacks interface { - // OnDeltaStreamOpen is called once an incremental xDS stream is open with a stream ID and the type URL (or "" for ADS). - // Returning an error will end processing and close the stream. OnStreamClosed will still be called. - OnDeltaStreamOpen(context.Context, int64, string) error - // OnDeltaStreamClosed is called immediately prior to closing an xDS stream with a stream ID. - OnDeltaStreamClosed(int64, *core.Node) - // OnStreamDeltaRequest is called once a request is received on a stream. - // Returning an error will end processing and close the stream. OnStreamClosed will still be called. - OnStreamDeltaRequest(int64, *discovery.DeltaDiscoveryRequest) error - // OnStreamDeltaResponse is called immediately prior to sending a response on a stream. - OnStreamDeltaResponse(int64, *discovery.DeltaDiscoveryRequest, *discovery.DeltaDiscoveryResponse) -} - -var deltaErrorResponse = &cache.RawDeltaResponse{} - -type server struct { - cache cache.ConfigWatcher - callbacks Callbacks - - // total stream count for counting bi-di streams - streamCount int64 - ctx context.Context - - // Local configuration flags for individual xDS implementations. - opts config.Opts -} - -// WithLogger configures the server logger. Defaults to no logging -func WithLogger(logger log.Logger) config.XDSOption { - return func(o *config.Opts) { - o.Logger = logger - } -} - -// DeactivateLegacyWildcard deactivates legacy wildcard mode for all resource types. -// In legacy wildcard mode, empty requests to a stream, are treated as wildcard requests as long -// as there is no request made with resources or explicit wildcard requests on the same stream. -// When deactivated, empty requests are treated as a request with no subscriptions to any resource. -// This is recommended for when you are using the go-control-plane to serve grpc-xds clients. -// These clients never want to treat an empty request as a wildcard subscription. -func DeactivateLegacyWildcard() config.XDSOption { - return config.DeactivateLegacyWildcard() -} - -// DeactivateLegacyWildcardForTypes deactivates legacy wildcard mode for specific resource types. -// In legacy wildcard mode, empty requests to a stream, are treated as wildcard requests as long -// as there is no request made with resources or explicit wildcard requests on the same stream. -// When deactivated, empty requests are treated as a request with no subscriptions to any resource. -func DeactivateLegacyWildcardForTypes(types []string) config.XDSOption { - return config.DeactivateLegacyWildcardForTypes(types) -} - -// NewServer creates a delta xDS specific server which utilizes a ConfigWatcher and delta Callbacks. -func NewServer(ctx context.Context, config cache.ConfigWatcher, callbacks Callbacks, opts ...config.XDSOption) Server { - s := &server{ - cache: config, - callbacks: callbacks, - ctx: ctx, - } - - // Parse through our options - for _, opt := range opts { - opt(&s.opts) - } - - return s -} - -func (s *server) processDelta(str stream.DeltaStream, reqCh <-chan *discovery.DeltaDiscoveryRequest, defaultTypeURL string) error { - streamID := atomic.AddInt64(&s.streamCount, 1) - - // streamNonce holds a unique nonce for req-resp pairs per xDS stream. - var streamNonce int64 - - // a collection of stack allocated watches per request type - watches := newWatches() - - node := &core.Node{} - - defer func() { - watches.Cancel() - if s.callbacks != nil { - s.callbacks.OnDeltaStreamClosed(streamID, node) - } - }() - - // sends a response, returns the new stream nonce - send := func(resp cache.DeltaResponse) (string, error) { - if resp == nil { - return "", errors.New("missing response") - } - - response, err := resp.GetDeltaDiscoveryResponse() - if err != nil { - return "", err - } - - streamNonce++ - response.Nonce = strconv.FormatInt(streamNonce, 10) - if s.callbacks != nil { - s.callbacks.OnStreamDeltaResponse(streamID, resp.GetDeltaRequest(), response) - } - - return response.GetNonce(), str.Send(response) - } - - // process a single delta response - process := func(resp cache.DeltaResponse) error { - typ := resp.GetDeltaRequest().GetTypeUrl() - if resp == deltaErrorResponse { - return status.Errorf(codes.Unavailable, "%s watch failed", typ) - } - - nonce, err := send(resp) - if err != nil { - return err - } - - watch := watches.deltaWatches[typ] - watch.nonce = nonce - - watch.subscription.SetReturnedResources(resp.GetNextVersionMap()) - watches.deltaWatches[typ] = watch - return nil - } - - // processAll purges the deltaMuxedResponses channel - processAll := func() error { - for { - select { - // We watch the multiplexed channel for incoming responses. - case resp, more := <-watches.deltaMuxedResponses: - if !more { - break - } - if err := process(resp); err != nil { - return err - } - default: - return nil - } - } - } - - if s.callbacks != nil { - if err := s.callbacks.OnDeltaStreamOpen(str.Context(), streamID, defaultTypeURL); err != nil { - return err - } - } - - for { - select { - case <-s.ctx.Done(): - return nil - // We watch the multiplexed channel for incoming responses. - case resp, more := <-watches.deltaMuxedResponses: - // input stream ended or errored out - if !more { - break - } - - if err := process(resp); err != nil { - return err - } - case req, more := <-reqCh: - // input stream ended or errored out - if !more { - return nil - } - - if req == nil { - return status.Errorf(codes.Unavailable, "empty request") - } - - // make sure all existing responses are processed prior to new requests to avoid deadlock - if err := processAll(); err != nil { - return err - } - - if s.callbacks != nil { - if err := s.callbacks.OnStreamDeltaRequest(streamID, req); err != nil { - return err - } - } - - // The node information might only be set on the first incoming delta discovery request, so store it here so we can - // reset it on subsequent requests that omit it. - if req.GetNode() != nil { - node = req.GetNode() - } else { - req.Node = node - } - - // type URL is required for ADS but is implicit for any other xDS stream - if defaultTypeURL == resource.AnyType { - if req.GetTypeUrl() == "" { - return status.Errorf(codes.InvalidArgument, "type URL is required for ADS") - } - } else if req.GetTypeUrl() == "" { - req.TypeUrl = defaultTypeURL - } - - typeURL := req.GetTypeUrl() - - // cancel existing watch to (re-)request a newer version - watch, ok := watches.deltaWatches[typeURL] - if !ok { - // Initialize the state of the type subscription. - // Since there was no previous subscription, we know we're handling the first request of this type - // so we set the initial resource versions if we have any. - // We also set the subscription as wildcard based on its legacy meaning (no resource name sent in resource_names_subscribe). - // If the subscription starts with this legacy mode, adding new resources will not unsubscribe from wildcard. - // It can still be done by explicitly unsubscribing from "*" - watch.subscription = stream.NewDeltaSubscription(req.GetResourceNamesSubscribe(), req.GetResourceNamesUnsubscribe(), req.GetInitialResourceVersions(), s.opts.IsLegacyWildcardActive(typeURL)) - } else { - watch.Cancel() - - // Update subscription with the new requests - watch.subscription.UpdateResourceSubscriptions( - req.GetResourceNamesSubscribe(), - req.GetResourceNamesUnsubscribe(), - ) - } - - var err error - watch.cancel, err = s.cache.CreateDeltaWatch(req, watch.subscription, watches.deltaMuxedResponses) - if err != nil { - return err - } - watches.deltaWatches[typeURL] = watch - } - } -} - -func (s *server) DeltaStreamHandler(str stream.DeltaStream, typeURL string) error { - // a channel for receiving incoming delta requests - reqCh := make(chan *discovery.DeltaDiscoveryRequest) - - // we need to concurrently handle incoming requests since we kick off processDelta as a return - go func() { - defer close(reqCh) - for { - req, err := str.Recv() - if err != nil { - return - } - select { - case reqCh <- req: - case <-str.Context().Done(): - return - case <-s.ctx.Done(): - return - } - } - }() - return s.processDelta(str, reqCh, typeURL) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/delta/v3/watches.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/delta/v3/watches.go deleted file mode 100644 index 98e4991b4..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/delta/v3/watches.go +++ /dev/null @@ -1,52 +0,0 @@ -package delta - -import ( - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" -) - -// watches for all delta xDS resource types -type watches struct { - deltaWatches map[string]watch - - // Opaque resources share a muxed channel - deltaMuxedResponses chan cache.DeltaResponse -} - -// newWatches creates and initializes watches. -func newWatches() watches { - // deltaMuxedResponses needs a buffer to release go-routines populating it - // - // because deltaMuxedResponses can be populated by an update from the cache - // and a request from the client, we need to create the channel with a buffer - // size of 2x the number of types to avoid deadlocks. - return watches{ - deltaWatches: make(map[string]watch, int(types.UnknownType)), - deltaMuxedResponses: make(chan cache.DeltaResponse, int(types.UnknownType)*2), - } -} - -// Cancel all watches -func (w *watches) Cancel() { - for _, watch := range w.deltaWatches { - watch.Cancel() - } - - close(w.deltaMuxedResponses) -} - -// watch contains the necessary modifiables for receiving resource responses -type watch struct { - cancel func() - nonce string - - subscription stream.Subscription -} - -// Cancel calls terminate and cancel -func (w *watch) Cancel() { - if w.cancel != nil { - w.cancel() - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/rest/v3/server.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/rest/v3/server.go deleted file mode 100644 index 06e1c13fb..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/rest/v3/server.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2020 Envoyproxy 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. - -// Package rest provides an implementation of REST-JSON part of XDS server -package rest - -import ( - "context" - "errors" - - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" -) - -type Server interface { - Fetch(context.Context, *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) -} - -type Callbacks interface { - // OnFetchRequest is called for each Fetch request. Returning an error will end processing of the - // request and respond with an error. - OnFetchRequest(context.Context, *discovery.DiscoveryRequest) error - // OnFetchResponse is called immediately prior to sending a response. - OnFetchResponse(*discovery.DiscoveryRequest, *discovery.DiscoveryResponse) -} - -func NewServer(config cache.ConfigFetcher, callbacks Callbacks) Server { - return &server{cache: config, callbacks: callbacks} -} - -type server struct { - cache cache.ConfigFetcher - callbacks Callbacks -} - -func (s *server) Fetch(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if s.callbacks != nil { - if err := s.callbacks.OnFetchRequest(ctx, req); err != nil { - return nil, err - } - } - resp, err := s.cache.Fetch(ctx, req) - if err != nil { - return nil, err - } - if resp == nil { - return nil, errors.New("missing response") - } - out, err := resp.GetDiscoveryResponse() - if s.callbacks != nil { - s.callbacks.OnFetchResponse(req, out) - } - return out, err -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/ads.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/ads.go deleted file mode 100644 index 705a5a0ec..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/ads.go +++ /dev/null @@ -1,124 +0,0 @@ -package sotw - -import ( - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" -) - -// process handles a bi-di stream request -func (s *server) processADS(sw *streamWrapper, reqCh chan *discovery.DiscoveryRequest) error { - // Create a buffered multiplexed channel the size of the known resource types. - respChan := make(chan cache.Response, types.UnknownType) - - // Instead of creating a separate channel for each incoming request and abandoning the old one - // This algorithm uses (and reuses) a single channel for all request types and guarantees - // the server will send updates over the wire in an ordered fashion. - // Downside is there is no longer back pressure per resource. - // There is potential for a dropped response from the cache but this is not impactful - // to the client since SOTW version handling is global and a new sequence will be - // initiated on a new request. - processAllExcept := func(typeURL string) error { - for { - select { - // We watch the multiplexed ADS channel for incoming responses. - case res := <-respChan: - if res.GetRequest().GetTypeUrl() != typeURL { - if err := sw.send(res); err != nil { - return err - } - } - default: - return nil - } - } - } - - // This control loop strictly orders resources when running in ADS mode. - // It should be treated as a child process of the original process() loop - // and should return on close of stream or error. This will cause the - // cleanup routines in the parent process() loop to execute. - for { - select { - case <-s.ctx.Done(): - return nil - // We only watch the multiplexed channel since we don't use per watch channels. - case res := <-respChan: - if err := sw.send(res); err != nil { - return status.Errorf(codes.Unavailable, err.Error()) - } - case req, ok := <-reqCh: - // Input stream ended or failed. - if !ok { - return nil - } - - // Received an empty request over the request channel. Can't respond. - if req == nil { - return status.Errorf(codes.Unavailable, "empty request") - } - - // Only first request is guaranteed to hold node info so if it's missing, reassign. - if req.GetNode() != nil { - sw.node = req.GetNode() - } else { - req.Node = sw.node - } - - // type URL is required for ADS but is implicit for xDS - typeURL := req.GetTypeUrl() - if typeURL == "" { - return status.Errorf(codes.InvalidArgument, "type URL is required for ADS") - } - - if s.callbacks != nil { - if err := s.callbacks.OnStreamRequest(sw.ID, req); err != nil { - return err - } - } - - var subscription stream.Subscription - w, ok := sw.watches.responders[typeURL] - if ok { - if w.nonce != "" && req.GetResponseNonce() != w.nonce { - // The request does not match the stream nonce, ignore it as per - // https://www.envoyproxy.io/docs/envoy/v1.28.0/api-docs/xds_protocol#resource-updates - // Ignore this request and wait for the next one - // This behavior is being discussed in https://github.com/envoyproxy/envoy/issues/10363 - // as it might create a race in edge cases, but it matches the current protocol definition - s.opts.Logger.Infof("[sotw ads] Skipping request as nonce is stale for %s", typeURL) - break - } - - // We found an existing watch - // Close it to ensure the Cache will not reply to it while we modify the subscription state - w.close() - - // Only process if we have an existing watch otherwise go ahead and create. - if err := processAllExcept(typeURL); err != nil { - return err - } - - subscription = w.sub - subscription.SetResourceSubscription(req.GetResourceNames()) - } else { - s.opts.Logger.Debugf("[sotw ads] New subscription for type %s and stream %d", typeURL, sw.ID) - subscription = stream.NewSotwSubscription(req.GetResourceNames(), s.opts.IsLegacyWildcardActive(typeURL)) - } - - cancel, err := s.cache.CreateWatch(req, subscription, respChan) - if err != nil { - return err - } - sw.watches.addWatch(typeURL, &watch{ - cancel: cancel, - response: respChan, - sub: subscription, - }) - } - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/server.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/server.go deleted file mode 100644 index 3fa992c65..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/server.go +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2020 Envoyproxy 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. - -// Package sotw provides an implementation of GRPC SoTW (State of The World) part of XDS server -package sotw - -import ( - "context" - "errors" - "fmt" - "strconv" - "sync/atomic" - - core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - "github.com/envoyproxy/go-control-plane/pkg/log" - "github.com/envoyproxy/go-control-plane/pkg/server/config" - "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" -) - -type Server interface { - StreamHandler(stream stream.Stream, typeURL string) error -} - -type Callbacks interface { - // OnStreamOpen is called once an xDS stream is open with a stream ID and the type URL (or "" for ADS). - // Returning an error will end processing and close the stream. OnStreamClosed will still be called. - OnStreamOpen(context.Context, int64, string) error - // OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID. - OnStreamClosed(int64, *core.Node) - // OnStreamRequest is called once a request is received on a stream. - // Returning an error will end processing and close the stream. OnStreamClosed will still be called. - OnStreamRequest(int64, *discovery.DiscoveryRequest) error - // OnStreamResponse is called immediately prior to sending a response on a stream. - OnStreamResponse(context.Context, int64, *discovery.DiscoveryRequest, *discovery.DiscoveryResponse) -} - -// NewServer creates handlers from a config watcher and callbacks. -func NewServer(ctx context.Context, cw cache.ConfigWatcher, callbacks Callbacks, opts ...config.XDSOption) Server { - s := &server{cache: cw, callbacks: callbacks, ctx: ctx, opts: config.NewOpts()} - - // Parse through our options - for _, opt := range opts { - opt(&s.opts) - } - - return s -} - -// WithOrderedADS enables the internal flag to order responses -// strictly. -func WithOrderedADS() config.XDSOption { - return func(o *config.Opts) { - o.Ordered = true - } -} - -// WithLogger configures the server logger. Defaults to no logging -func WithLogger(logger log.Logger) config.XDSOption { - return func(o *config.Opts) { - o.Logger = logger - } -} - -// DeactivateLegacyWildcard deactivates legacy wildcard mode for all resource types. -// In legacy wildcard mode, empty requests to a stream, are treated as wildcard requests as long -// as there is no request made with resources or explicit wildcard requests on the same stream. -// When deactivated, empty requests are treated as a request with no subscriptions to any resource. -// This is recommended for when you are using the go-control-plane to serve grpc-xds clients. -// These clients never want to treat an empty request as a wildcard subscription. -func DeactivateLegacyWildcard() config.XDSOption { - return config.DeactivateLegacyWildcard() -} - -// DeactivateLegacyWildcardForTypes deactivates legacy wildcard mode for specific resource types. -// In legacy wildcard mode, empty requests to a stream, are treated as wildcard requests as long -// as there is no request made with resources or explicit wildcard requests on the same stream. -// When deactivated, empty requests are treated as a request with no subscriptions to any resource. -func DeactivateLegacyWildcardForTypes(types []string) config.XDSOption { - return config.DeactivateLegacyWildcardForTypes(types) -} - -type server struct { - cache cache.ConfigWatcher - callbacks Callbacks - ctx context.Context - - // streamCount for counting bi-di streams - streamCount int64 - - // Local configuration flags for individual xDS implementations. - opts config.Opts -} - -// streamWrapper abstracts critical data passed around a stream for to be accessed -// through various code paths in the xDS lifecycle. This comes in handy when dealing -// with varying implementation types such as ordered vs unordered resource handling. -type streamWrapper struct { - stream stream.Stream // parent stream object - ID int64 // stream ID in relation to total stream count - nonce int64 // nonce per stream - watches watches // collection of stack allocated watchers per request type - callbacks Callbacks // callbacks for performing actions through stream lifecycle - - node *core.Node // registered xDS client -} - -// Send packages the necessary resources before sending on the gRPC stream, -// and sets the current state of the world. -func (s *streamWrapper) send(resp cache.Response) error { - if resp == nil { - return errors.New("missing response") - } - - out, err := resp.GetDiscoveryResponse() - if err != nil { - return err - } - - // increment nonce and convert it to base10 - out.Nonce = strconv.FormatInt(atomic.AddInt64(&s.nonce, 1), 10) - - typeURL := resp.GetRequest().GetTypeUrl() - w, ok := s.watches.responders[typeURL] - if !ok { - return fmt.Errorf("no current watch for %s", typeURL) - } - - // Track in the type subcription the nonce and objects returned to the client. - w.sub.SetReturnedResources(resp.GetReturnedResources()) - w.nonce = out.Nonce - - // Register with the callbacks provided that we are sending the response. - if s.callbacks != nil { - s.callbacks.OnStreamResponse(resp.GetContext(), s.ID, resp.GetRequest(), out) - } - - return s.stream.Send(out) -} - -// Shutdown closes all open watches, and notifies API consumers the stream has closed. -func (s *streamWrapper) shutdown() { - s.watches.close() - if s.callbacks != nil { - s.callbacks.OnStreamClosed(s.ID, s.node) - } -} - -// StreamHandler converts a blocking read call to channels and initiates stream processing -func (s *server) StreamHandler(stream stream.Stream, typeURL string) error { - // a channel for receiving incoming requests - reqCh := make(chan *discovery.DiscoveryRequest) - go func() { - defer close(reqCh) - for { - req, err := stream.Recv() - if err != nil { - return - } - select { - case reqCh <- req: - case <-stream.Context().Done(): - return - case <-s.ctx.Done(): - return - } - } - }() - - return s.process(stream, reqCh, typeURL) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/watches.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/watches.go deleted file mode 100644 index 43b3bedab..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/watches.go +++ /dev/null @@ -1,79 +0,0 @@ -package sotw - -import ( - "context" - "reflect" - - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" -) - -// watches for all xDS resource types -type watches struct { - responders map[string]*watch - - // cases is a dynamic select case for the watched channels. - cases []reflect.SelectCase -} - -// newWatches creates and initializes watches. -func newWatches() watches { - return watches{ - responders: make(map[string]*watch, int(types.UnknownType)), - cases: make([]reflect.SelectCase, 0), - } -} - -// addWatch creates a new watch entry in the watches map. -// Watches are sorted by typeURL. -func (w *watches) addWatch(typeURL string, watch *watch) { - w.responders[typeURL] = watch -} - -// close all open watches -func (w *watches) close() { - for _, watch := range w.responders { - watch.close() - } -} - -// recomputeWatches rebuilds the known list of dynamic channels if needed -func (w *watches) recompute(ctx context.Context, req <-chan *discovery.DiscoveryRequest) { - w.cases = w.cases[:0] // Clear the existing cases while retaining capacity. - - w.cases = append(w.cases, - reflect.SelectCase{ - Dir: reflect.SelectRecv, - Chan: reflect.ValueOf(ctx.Done()), - }, reflect.SelectCase{ - Dir: reflect.SelectRecv, - Chan: reflect.ValueOf(req), - }, - ) - - for _, watch := range w.responders { - w.cases = append(w.cases, reflect.SelectCase{ - Dir: reflect.SelectRecv, - Chan: reflect.ValueOf(watch.response), - }) - } -} - -// watch contains the necessary modifiable data for receiving resource responses -type watch struct { - cancel func() - response chan cache.Response - - sub stream.Subscription - // Nonce of the latest response sent for this type - nonce string -} - -// close cancels an open watch -func (w *watch) close() { - if w.cancel != nil { - w.cancel() - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/xds.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/xds.go deleted file mode 100644 index c5704a7ca..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3/xds.go +++ /dev/null @@ -1,164 +0,0 @@ -package sotw - -import ( - "reflect" - "sync/atomic" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" -) - -// process handles a bi-di stream request -func (s *server) process(str stream.Stream, reqCh chan *discovery.DiscoveryRequest, defaultTypeURL string) error { - // create our streamWrapper which can be passed down to sub control loops. - // this is useful for abstracting critical information for various types of - // xDS resource processing. - sw := streamWrapper{ - stream: str, - ID: atomic.AddInt64(&s.streamCount, 1), // increment stream count - callbacks: s.callbacks, - node: &core.Node{}, // node may only be set on the first discovery request - - // a collection of stack allocated watches per request type. - watches: newWatches(), - } - - // cleanup once our stream has ended. - defer sw.shutdown() - - if s.callbacks != nil { - if err := s.callbacks.OnStreamOpen(str.Context(), sw.ID, defaultTypeURL); err != nil { - return err - } - } - - // type URL is required for ADS but is implicit for xDS - if defaultTypeURL == resource.AnyType && s.opts.Ordered { - // When using ADS we need to order responses. - // This is guaranteed in the xDS protocol specification - // as ADS is required to be eventually consistent. - // More details can be found here if interested: - // https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#eventual-consistency-considerations - - // Trigger a different code path specifically for ADS. - // We want resource ordering so things don't get sent before they should. - // This is a blocking call and will exit the process function - // on successful completion. - s.opts.Logger.Debugf("[sotw] Switching to ordered ADS implementation for stream %d", sw.ID) - return s.processADS(&sw, reqCh) - } - - // do an initial recompute so we can load the first 2 channels: - // <-reqCh - // s.ctx.Done() - sw.watches.recompute(s.ctx, reqCh) - - for { - // The list of select cases looks like this: - // 0: <- ctx.Done - // 1: <- reqCh - // 2...: per type watches - index, value, ok := reflect.Select(sw.watches.cases) - switch index { - // ctx.Done() -> if we receive a value here we return - // as no further computation is needed - case 0: - return nil - // Case 1 handles any request inbound on the stream - // and handles all initialization as needed - case 1: - // input stream ended or failed - if !ok { - return nil - } - - req := value.Interface().(*discovery.DiscoveryRequest) - if req == nil { - s.opts.Logger.Debugf("[sotw] Rejecting empty request for stream %d", sw.ID) - return status.Errorf(codes.Unavailable, "empty request") - } - - // Only first request is guaranteed to hold node info so if it's missing, reassign. - if req.GetNode() != nil { - sw.node = req.GetNode() - } else { - req.Node = sw.node - } - - // type URL is required for ADS but is implicit for xDS - switch { - case defaultTypeURL == resource.AnyType && req.GetTypeUrl() == "": - s.opts.Logger.Debugf("[sotw] Rejecting request as missing URL for stream %d", sw.ID) - return status.Errorf(codes.InvalidArgument, "type URL is required for ADS") - case req.GetTypeUrl() == "": - req.TypeUrl = defaultTypeURL - } - - if s.callbacks != nil { - if err := s.callbacks.OnStreamRequest(sw.ID, req); err != nil { - return err - } - } - - typeURL := req.GetTypeUrl() - var subscription stream.Subscription - w, ok := sw.watches.responders[typeURL] - if ok { - if w.nonce != "" && req.GetResponseNonce() != w.nonce { - // The request does not match the stream nonce, ignore it as per - // https://www.envoyproxy.io/docs/envoy/v1.28.0/api-docs/xds_protocol#resource-updates - // Ignore this request and wait for the next one - // This behavior is being discussed in https://github.com/envoyproxy/envoy/issues/10363 - // as it might create a race in edge cases, but it matches the current protocol definition - s.opts.Logger.Infof("[sotw] Skipping request as nonce is stale for type %s and stream %d", typeURL, sw.ID) - break - } - - // We found an existing watch - // Close it to ensure the Cache will not reply to it while we modify the subscription state - w.close() - - subscription = w.sub - subscription.SetResourceSubscription(req.GetResourceNames()) - } else { - s.opts.Logger.Debugf("[sotw] New subscription for type %s and stream %d", typeURL, sw.ID) - subscription = stream.NewSotwSubscription(req.GetResourceNames(), s.opts.IsLegacyWildcardActive(typeURL)) - } - - responder := make(chan cache.Response, 1) - cancel, err := s.cache.CreateWatch(req, subscription, responder) - if err != nil { - s.opts.Logger.Warnf("[sotw] Watch rejected for type %s and stream %d", typeURL, sw.ID) - return err - } - sw.watches.addWatch(typeURL, &watch{ - cancel: cancel, - response: responder, - sub: subscription, - }) - - // Recompute the dynamic select cases for this stream. - sw.watches.recompute(s.ctx, reqCh) - default: - // Channel n -> these are the dynamic list of responders that correspond to the stream request typeURL - // nil is used to close the streams in the caches - if value.IsNil() || !ok { - // Receiver channel was closed. TODO(jpeach): probably cancel the watch or something? - return status.Errorf(codes.Unavailable, "resource watch %d -> failed", index) - } - - // If a non cache.Response arrived here, there are serious issues - res := value.Interface().(cache.Response) - err := sw.send(res) - if err != nil { - return err - } - } - } -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/stream/v3/stream.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/stream/v3/stream.go deleted file mode 100644 index b999d40c7..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/stream/v3/stream.go +++ /dev/null @@ -1,23 +0,0 @@ -package stream - -import ( - "google.golang.org/grpc" - - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" -) - -// Generic RPC stream for state of the world. -type Stream interface { - grpc.ServerStream - - Send(*discovery.DiscoveryResponse) error - Recv() (*discovery.DiscoveryRequest, error) -} - -// Generic RPC Stream for the delta based xDS protocol. -type DeltaStream interface { - grpc.ServerStream - - Send(*discovery.DeltaDiscoveryResponse) error - Recv() (*discovery.DeltaDiscoveryRequest, error) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/stream/v3/subscription.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/stream/v3/subscription.go deleted file mode 100644 index bbb5d6176..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/stream/v3/subscription.go +++ /dev/null @@ -1,183 +0,0 @@ -package stream - -const ( - explicitWildcard = "*" -) - -// Subscription stores the server view of a given type subscription in a stream. -type Subscription struct { - // wildcard indicates if the subscription currently has a wildcard watch. - wildcard bool - - // allowLegacyWildcard indicates that the stream never provided any resource - // and is de facto wildcard. - // As soon as a resource or an explicit subscription to wildcard is provided, - // this flag will be set to false - allowLegacyWildcard bool - - // subscribedResourceNames provides the resources explicitly requested by the client - // This list might be non-empty even when set as wildcard. - subscribedResourceNames map[string]struct{} - - // returnedResources contains the resources acknowledged by the client and the acknowledged versions. - returnedResources map[string]string -} - -// newSubscription initializes a subscription state. -func newSubscription(emptyRequest, allowLegacyWildcard bool, initialResourceVersions map[string]string) Subscription { - // By default we set the subscription as a wildcard only if the request was empty - // and in legacy mode. Later on, outside of this constructor, when we actually - // process the request, if the request was non-empty, it may have an - // explicit wildcard subscription, in which case - // we will set the wildcard field on the subscription accordingly. - wildcard := emptyRequest && allowLegacyWildcard - - state := Subscription{ - wildcard: wildcard, - allowLegacyWildcard: allowLegacyWildcard, - subscribedResourceNames: map[string]struct{}{}, - returnedResources: initialResourceVersions, - } - - if initialResourceVersions == nil { - state.returnedResources = make(map[string]string) - } - - return state -} - -func NewSotwSubscription(subscribed []string, allowLegacyWildcard bool) Subscription { - sub := newSubscription(len(subscribed) == 0, allowLegacyWildcard, nil) - sub.SetResourceSubscription(subscribed) - return sub -} - -// SetResourceSubscription updates the subscribed resources (including the wildcard state) -// based on the full state of subscribed resources provided in the request -// Used in sotw subscriptions -// Behavior is based on -// https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#how-the-client-specifies-what-resources-to-return -func (s *Subscription) SetResourceSubscription(subscribed []string) { - if s.allowLegacyWildcard { - if len(subscribed) == 0 { - // We were wildcard based on legacy behavior and still don't request any resource - // The watch remains wildcard - return - } - - // A resource was provided (might be an explicit wildcard) - // Documentation states that we should no longer allow to fallback to the previous case - // and no longer setting wildcard would no longer subscribe to anything - s.allowLegacyWildcard = false - } - - subscribedResources := make(map[string]struct{}, len(subscribed)) - explicitWildcardSet := false - for _, resource := range subscribed { - if resource == explicitWildcard { - explicitWildcardSet = true - } else { - subscribedResources[resource] = struct{}{} - } - } - - if !explicitWildcardSet { - // Cleanup resources no longer subscribed to. - // This ensures later subscriptions will trigger responses, - // even if the version has not changed - for resource := range s.returnedResources { - if _, ok := subscribedResources[resource]; !ok { - delete(s.returnedResources, resource) - } - } - } - - // Explicit subscription to wildcard as we are not in legacy wildcard behavior - s.wildcard = explicitWildcardSet - s.subscribedResourceNames = subscribedResources -} - -func NewDeltaSubscription(subscribed, unsubscribed []string, initialResourceVersions map[string]string, allowLegacyWildcard bool) Subscription { - sub := newSubscription(len(subscribed) == 0, allowLegacyWildcard, initialResourceVersions) - sub.UpdateResourceSubscriptions(subscribed, unsubscribed) - return sub -} - -// UpdateResourceSubscriptions updates the subscribed resources (including the wildcard state) -// based on newly subscribed or unsubscribed resources -// Used in delta subscriptions -func (s *Subscription) UpdateResourceSubscriptions(subscribed, unsubscribed []string) { - // Handles legacy wildcard behavior first to exit if we are still in this behavior - if s.allowLegacyWildcard { - // The protocol (as of v1.36.0) only references subscribed as triggering - // exiting legacy wildcard behavior, so we currently not check unsubscribed - if len(subscribed) == 0 { - // We were wildcard based on legacy behavior and still don't request any resource - // The watch remains wildcard - return - } - - // A resource was provided (might be an explicit wildcard) - // Documentation states that we should no longer allow to fallback to the previous case - // and no longer setting wildcard would no longer subscribe to anything - // The watch does remain wildcard if not explicitly unsubscribed (from the example in - // https://www.envoyproxy.io/docs/envoy/v1.29.0/api-docs/xds_protocol#how-the-client-specifies-what-resources-to-return) - s.allowLegacyWildcard = false - } - - // Handle subscriptions first - for _, resource := range subscribed { - if resource == explicitWildcard { - s.wildcard = true - continue - } - s.subscribedResourceNames[resource] = struct{}{} - } - - // Then unsubscriptions - for _, resource := range unsubscribed { - if resource == explicitWildcard { - s.wildcard = false - continue - } - if _, ok := s.subscribedResourceNames[resource]; ok && s.wildcard { - // The XDS protocol states that: - // * if a watch is currently wildcard - // * a resource is explicitly unsubscribed by name - // Then the control-plane must return in the response whether the resource is removed (if no longer present for this node) - // or still existing. In the latter case the entire resource must be returned, same as if it had been created or updated - // To achieve that, we mark the resource as having been returned with an empty version. While creating the response, the cache will either: - // * detect the version change, and return the resource (as an update) - // * detect the resource deletion, and set it as removed in the response - s.returnedResources[resource] = "" - } else { - // Cleanup unsubscribed resources. This avoids returning a response - // if the versions have not changed - delete(s.returnedResources, resource) - } - delete(s.subscribedResourceNames, resource) - } -} - -// SubscribedResources returns the list of resources currently explicitly subscribed to -// If the request is set to wildcard it may be empty -func (s Subscription) SubscribedResources() map[string]struct{} { - return s.subscribedResourceNames -} - -// IsWildcard returns whether or not the subscription currently has a wildcard watch -func (s Subscription) IsWildcard() bool { - return s.wildcard -} - -// ReturnedResources returns the list of resources returned to the client -// and their version -func (s Subscription) ReturnedResources() map[string]string { - return s.returnedResources -} - -// SetReturnedResources sets a list of resource versions currently known by the client -// The cache can use this state to compute resources added/updated/deleted -func (s *Subscription) SetReturnedResources(resourceVersions map[string]string) { - s.returnedResources = resourceVersions -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/v3/gateway.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/v3/gateway.go deleted file mode 100644 index 0d318c589..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/v3/gateway.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2018 Envoyproxy 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. - -package server - -import ( - "errors" - "fmt" - "io" - "net/http" - "path" - - "google.golang.org/protobuf/encoding/protojson" - - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" -) - -// HTTPGateway is a custom implementation of [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway) -// specialized to Envoy xDS API. -type HTTPGateway struct { - // Server is the underlying gRPC server - Server Server -} - -func (h *HTTPGateway) ServeHTTP(req *http.Request) ([]byte, int, error) { - p := path.Clean(req.URL.Path) - - typeURL := "" - switch p { - case resource.FetchEndpoints: - typeURL = resource.EndpointType - case resource.FetchClusters: - typeURL = resource.ClusterType - case resource.FetchListeners: - typeURL = resource.ListenerType - case resource.FetchRoutes: - typeURL = resource.RouteType - case resource.FetchScopedRoutes: - typeURL = resource.ScopedRouteType - case resource.FetchSecrets: - typeURL = resource.SecretType - case resource.FetchRuntimes: - typeURL = resource.RuntimeType - case resource.FetchExtensionConfigs: - typeURL = resource.ExtensionConfigType - default: - return nil, http.StatusNotFound, errors.New("no endpoint") - } - - if req.Body == nil { - return nil, http.StatusBadRequest, errors.New("empty body") - } - - body, err := io.ReadAll(req.Body) - if err != nil { - return nil, http.StatusBadRequest, errors.New("cannot read body") - } - - // parse as JSON - out := &discovery.DiscoveryRequest{} - err = protojson.Unmarshal(body, out) - if err != nil { - return nil, http.StatusBadRequest, fmt.Errorf("cannot parse JSON body: %w", err) - } - out.TypeUrl = typeURL - - // fetch results - res, err := h.Server.Fetch(req.Context(), out) - if err != nil { - // SkipFetchErrors will return a 304 which will signify to the envoy client that - // it is already at the latest version; all other errors will 500 with a message. - var skip *types.SkipFetchError - if ok := errors.As(err, &skip); ok { - return nil, http.StatusNotModified, nil - } - return nil, http.StatusInternalServerError, fmt.Errorf("fetch error: %w", err) - } - - b, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(res) - if err != nil { - return nil, http.StatusInternalServerError, fmt.Errorf("marshal error: %w", err) - } - - return b, http.StatusOK, nil -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/v3/server.go b/vendor/github.com/envoyproxy/go-control-plane/pkg/server/v3/server.go deleted file mode 100644 index c3e91ee03..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/pkg/server/v3/server.go +++ /dev/null @@ -1,352 +0,0 @@ -// Copyright 2018 Envoyproxy 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. - -// Package server provides an implementation of a streaming xDS server. -package server - -import ( - "context" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/envoyproxy/go-control-plane/pkg/server/config" - "github.com/envoyproxy/go-control-plane/pkg/server/delta/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/rest/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3" - "github.com/envoyproxy/go-control-plane/pkg/server/stream/v3" - - core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" - clusterservice "github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3" - discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - endpointservice "github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3" - extensionconfigservice "github.com/envoyproxy/go-control-plane/envoy/service/extension/v3" - listenerservice "github.com/envoyproxy/go-control-plane/envoy/service/listener/v3" - routeservice "github.com/envoyproxy/go-control-plane/envoy/service/route/v3" - runtimeservice "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" - secretservice "github.com/envoyproxy/go-control-plane/envoy/service/secret/v3" - "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" - rlsconfigservice "github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3" -) - -// Server is a collection of handlers for streaming discovery requests. -type Server interface { - endpointservice.EndpointDiscoveryServiceServer - clusterservice.ClusterDiscoveryServiceServer - routeservice.RouteDiscoveryServiceServer - routeservice.ScopedRoutesDiscoveryServiceServer - routeservice.VirtualHostDiscoveryServiceServer - listenerservice.ListenerDiscoveryServiceServer - discovery.AggregatedDiscoveryServiceServer - secretservice.SecretDiscoveryServiceServer - runtimeservice.RuntimeDiscoveryServiceServer - extensionconfigservice.ExtensionConfigDiscoveryServiceServer - rlsconfigservice.RateLimitConfigDiscoveryServiceServer - - rest.Server - sotw.Server - delta.Server -} - -// Callbacks is a collection of callbacks inserted into the server operation. -// The callbacks are invoked synchronously. -type Callbacks interface { - rest.Callbacks - sotw.Callbacks - delta.Callbacks -} - -// CallbackFuncs is a convenience type for implementing the Callbacks interface. -type CallbackFuncs struct { - StreamOpenFunc func(context.Context, int64, string) error - StreamClosedFunc func(int64, *core.Node) - DeltaStreamOpenFunc func(context.Context, int64, string) error - DeltaStreamClosedFunc func(int64, *core.Node) - StreamRequestFunc func(int64, *discovery.DiscoveryRequest) error - StreamResponseFunc func(context.Context, int64, *discovery.DiscoveryRequest, *discovery.DiscoveryResponse) - StreamDeltaRequestFunc func(int64, *discovery.DeltaDiscoveryRequest) error - StreamDeltaResponseFunc func(int64, *discovery.DeltaDiscoveryRequest, *discovery.DeltaDiscoveryResponse) - FetchRequestFunc func(context.Context, *discovery.DiscoveryRequest) error - FetchResponseFunc func(*discovery.DiscoveryRequest, *discovery.DiscoveryResponse) -} - -var _ Callbacks = CallbackFuncs{} - -// OnStreamOpen invokes StreamOpenFunc. -func (c CallbackFuncs) OnStreamOpen(ctx context.Context, streamID int64, typeURL string) error { - if c.StreamOpenFunc != nil { - return c.StreamOpenFunc(ctx, streamID, typeURL) - } - - return nil -} - -// OnStreamClosed invokes StreamClosedFunc. -func (c CallbackFuncs) OnStreamClosed(streamID int64, node *core.Node) { - if c.StreamClosedFunc != nil { - c.StreamClosedFunc(streamID, node) - } -} - -// OnDeltaStreamOpen invokes DeltaStreamOpenFunc. -func (c CallbackFuncs) OnDeltaStreamOpen(ctx context.Context, streamID int64, typeURL string) error { - if c.DeltaStreamOpenFunc != nil { - return c.DeltaStreamOpenFunc(ctx, streamID, typeURL) - } - - return nil -} - -// OnDeltaStreamClosed invokes DeltaStreamClosedFunc. -func (c CallbackFuncs) OnDeltaStreamClosed(streamID int64, node *core.Node) { - if c.DeltaStreamClosedFunc != nil { - c.DeltaStreamClosedFunc(streamID, node) - } -} - -// OnStreamRequest invokes StreamRequestFunc. -func (c CallbackFuncs) OnStreamRequest(streamID int64, req *discovery.DiscoveryRequest) error { - if c.StreamRequestFunc != nil { - return c.StreamRequestFunc(streamID, req) - } - - return nil -} - -// OnStreamResponse invokes StreamResponseFunc. -func (c CallbackFuncs) OnStreamResponse(ctx context.Context, streamID int64, req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse) { - if c.StreamResponseFunc != nil { - c.StreamResponseFunc(ctx, streamID, req, resp) - } -} - -// OnStreamDeltaRequest invokes StreamDeltaResponseFunc -func (c CallbackFuncs) OnStreamDeltaRequest(streamID int64, req *discovery.DeltaDiscoveryRequest) error { - if c.StreamDeltaRequestFunc != nil { - return c.StreamDeltaRequestFunc(streamID, req) - } - - return nil -} - -// OnStreamDeltaResponse invokes StreamDeltaResponseFunc. -func (c CallbackFuncs) OnStreamDeltaResponse(streamID int64, req *discovery.DeltaDiscoveryRequest, resp *discovery.DeltaDiscoveryResponse) { - if c.StreamDeltaResponseFunc != nil { - c.StreamDeltaResponseFunc(streamID, req, resp) - } -} - -// OnFetchRequest invokes FetchRequestFunc. -func (c CallbackFuncs) OnFetchRequest(ctx context.Context, req *discovery.DiscoveryRequest) error { - if c.FetchRequestFunc != nil { - return c.FetchRequestFunc(ctx, req) - } - - return nil -} - -// OnFetchResponse invoked FetchResponseFunc. -func (c CallbackFuncs) OnFetchResponse(req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse) { - if c.FetchResponseFunc != nil { - c.FetchResponseFunc(req, resp) - } -} - -// NewServer creates handlers from a config watcher and callbacks. -func NewServer(ctx context.Context, config cache.Cache, callbacks Callbacks, opts ...config.XDSOption) Server { - return NewServerAdvanced(rest.NewServer(config, callbacks), - sotw.NewServer(ctx, config, callbacks, opts...), - delta.NewServer(ctx, config, callbacks, opts...), - ) -} - -func NewServerAdvanced(restServer rest.Server, sotwServer sotw.Server, deltaServer delta.Server) Server { - return &server{rest: restServer, sotw: sotwServer, delta: deltaServer} -} - -type server struct { - rest rest.Server - sotw sotw.Server - delta delta.Server -} - -func (s *server) StreamHandler(stream stream.Stream, typeURL string) error { - return s.sotw.StreamHandler(stream, typeURL) -} - -func (s *server) StreamAggregatedResources(stream discovery.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error { - return s.StreamHandler(stream, resource.AnyType) -} - -func (s *server) StreamEndpoints(stream endpointservice.EndpointDiscoveryService_StreamEndpointsServer) error { - return s.StreamHandler(stream, resource.EndpointType) -} - -func (s *server) StreamClusters(stream clusterservice.ClusterDiscoveryService_StreamClustersServer) error { - return s.StreamHandler(stream, resource.ClusterType) -} - -func (s *server) StreamRoutes(stream routeservice.RouteDiscoveryService_StreamRoutesServer) error { - return s.StreamHandler(stream, resource.RouteType) -} - -func (s *server) StreamScopedRoutes(stream routeservice.ScopedRoutesDiscoveryService_StreamScopedRoutesServer) error { - return s.StreamHandler(stream, resource.ScopedRouteType) -} - -func (s *server) StreamListeners(stream listenerservice.ListenerDiscoveryService_StreamListenersServer) error { - return s.StreamHandler(stream, resource.ListenerType) -} - -func (s *server) StreamSecrets(stream secretservice.SecretDiscoveryService_StreamSecretsServer) error { - return s.StreamHandler(stream, resource.SecretType) -} - -func (s *server) StreamRuntime(stream runtimeservice.RuntimeDiscoveryService_StreamRuntimeServer) error { - return s.StreamHandler(stream, resource.RuntimeType) -} - -func (s *server) StreamExtensionConfigs(stream extensionconfigservice.ExtensionConfigDiscoveryService_StreamExtensionConfigsServer) error { - return s.StreamHandler(stream, resource.ExtensionConfigType) -} - -func (s *server) StreamRlsConfigs(stream rlsconfigservice.RateLimitConfigDiscoveryService_StreamRlsConfigsServer) error { - return s.StreamHandler(stream, resource.RateLimitConfigType) -} - -// VHDS doesn't support SOTW requests, so no handler for it exists. - -// Fetch is the universal fetch method. -func (s *server) Fetch(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - return s.rest.Fetch(ctx, req) -} - -func (s *server) FetchEndpoints(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.EndpointType - return s.Fetch(ctx, req) -} - -func (s *server) FetchClusters(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.ClusterType - return s.Fetch(ctx, req) -} - -func (s *server) FetchRoutes(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.RouteType - return s.Fetch(ctx, req) -} - -func (s *server) FetchScopedRoutes(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.ScopedRouteType - return s.Fetch(ctx, req) -} - -func (s *server) FetchListeners(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.ListenerType - return s.Fetch(ctx, req) -} - -func (s *server) FetchSecrets(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.SecretType - return s.Fetch(ctx, req) -} - -func (s *server) FetchRuntime(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.RuntimeType - return s.Fetch(ctx, req) -} - -func (s *server) FetchExtensionConfigs(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.ExtensionConfigType - return s.Fetch(ctx, req) -} - -func (s *server) FetchRlsConfigs(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) { - if req == nil { - return nil, status.Errorf(codes.Unavailable, "empty request") - } - req.TypeUrl = resource.RateLimitConfigType - return s.Fetch(ctx, req) -} - -// VHDS doesn't support REST requests, so no handler exists for this. - -func (s *server) DeltaStreamHandler(stream stream.DeltaStream, typeURL string) error { - return s.delta.DeltaStreamHandler(stream, typeURL) -} - -func (s *server) DeltaAggregatedResources(stream discovery.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error { - return s.DeltaStreamHandler(stream, resource.AnyType) -} - -func (s *server) DeltaEndpoints(stream endpointservice.EndpointDiscoveryService_DeltaEndpointsServer) error { - return s.DeltaStreamHandler(stream, resource.EndpointType) -} - -func (s *server) DeltaClusters(stream clusterservice.ClusterDiscoveryService_DeltaClustersServer) error { - return s.DeltaStreamHandler(stream, resource.ClusterType) -} - -func (s *server) DeltaRoutes(stream routeservice.RouteDiscoveryService_DeltaRoutesServer) error { - return s.DeltaStreamHandler(stream, resource.RouteType) -} - -func (s *server) DeltaScopedRoutes(stream routeservice.ScopedRoutesDiscoveryService_DeltaScopedRoutesServer) error { - return s.DeltaStreamHandler(stream, resource.ScopedRouteType) -} - -func (s *server) DeltaListeners(stream listenerservice.ListenerDiscoveryService_DeltaListenersServer) error { - return s.DeltaStreamHandler(stream, resource.ListenerType) -} - -func (s *server) DeltaSecrets(stream secretservice.SecretDiscoveryService_DeltaSecretsServer) error { - return s.DeltaStreamHandler(stream, resource.SecretType) -} - -func (s *server) DeltaRuntime(stream runtimeservice.RuntimeDiscoveryService_DeltaRuntimeServer) error { - return s.DeltaStreamHandler(stream, resource.RuntimeType) -} - -func (s *server) DeltaExtensionConfigs(stream extensionconfigservice.ExtensionConfigDiscoveryService_DeltaExtensionConfigsServer) error { - return s.DeltaStreamHandler(stream, resource.ExtensionConfigType) -} - -func (s *server) DeltaVirtualHosts(stream routeservice.VirtualHostDiscoveryService_DeltaVirtualHostsServer) error { - return s.DeltaStreamHandler(stream, resource.VirtualHostType) -} diff --git a/vendor/github.com/envoyproxy/go-control-plane/ratelimit/LICENSE b/vendor/github.com/envoyproxy/go-control-plane/ratelimit/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/ratelimit/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - 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. diff --git a/vendor/github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3/rls_conf_ds.pb.go b/vendor/github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3/rls_conf_ds.pb.go deleted file mode 100644 index bc8f489e6..000000000 --- a/vendor/github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3/rls_conf_ds.pb.go +++ /dev/null @@ -1,254 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.13.0 -// source: ratelimit/service/ratelimit/v3/rls_conf_ds.proto - -package configv3 - -import ( - context "context" - v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -var File_ratelimit_service_ratelimit_v3_rls_conf_ds_proto protoreflect.FileDescriptor - -var file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_rawDesc = []byte{ - 0x0a, 0x30, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x76, 0x33, - 0x2f, 0x72, 0x6c, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x64, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x1e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, - 0x76, 0x33, 0x1a, 0x2a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x33, 0x2f, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x8a, - 0x02, 0x0a, 0x1f, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x75, 0x0a, 0x10, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x6c, 0x73, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x70, 0x0a, 0x0f, 0x46, 0x65, 0x74, - 0x63, 0x68, 0x52, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x2c, 0x2e, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x6e, 0x76, - 0x6f, 0x79, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x33, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x8d, 0x01, 0x0a, 0x29, - 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x72, 0x61, - 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x33, 0x42, 0x0e, 0x52, 0x6c, 0x73, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4b, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, - 0x61, 0x6e, 0x65, 0x2f, 0x72, 0x61, 0x74, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x76, 0x33, 0x3b, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x76, 0x33, 0x88, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_goTypes = []interface{}{ - (*v3.DiscoveryRequest)(nil), // 0: envoy.service.discovery.v3.DiscoveryRequest - (*v3.DiscoveryResponse)(nil), // 1: envoy.service.discovery.v3.DiscoveryResponse -} -var file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_depIdxs = []int32{ - 0, // 0: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.StreamRlsConfigs:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 0, // 1: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.FetchRlsConfigs:input_type -> envoy.service.discovery.v3.DiscoveryRequest - 1, // 2: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.StreamRlsConfigs:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 1, // 3: ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService.FetchRlsConfigs:output_type -> envoy.service.discovery.v3.DiscoveryResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_init() } -func file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_init() { - if File_ratelimit_service_ratelimit_v3_rls_conf_ds_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_goTypes, - DependencyIndexes: file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_depIdxs, - }.Build() - File_ratelimit_service_ratelimit_v3_rls_conf_ds_proto = out.File - file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_rawDesc = nil - file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_goTypes = nil - file_ratelimit_service_ratelimit_v3_rls_conf_ds_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// RateLimitConfigDiscoveryServiceClient is the client API for RateLimitConfigDiscoveryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type RateLimitConfigDiscoveryServiceClient interface { - StreamRlsConfigs(ctx context.Context, opts ...grpc.CallOption) (RateLimitConfigDiscoveryService_StreamRlsConfigsClient, error) - FetchRlsConfigs(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) -} - -type rateLimitConfigDiscoveryServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewRateLimitConfigDiscoveryServiceClient(cc grpc.ClientConnInterface) RateLimitConfigDiscoveryServiceClient { - return &rateLimitConfigDiscoveryServiceClient{cc} -} - -func (c *rateLimitConfigDiscoveryServiceClient) StreamRlsConfigs(ctx context.Context, opts ...grpc.CallOption) (RateLimitConfigDiscoveryService_StreamRlsConfigsClient, error) { - stream, err := c.cc.NewStream(ctx, &_RateLimitConfigDiscoveryService_serviceDesc.Streams[0], "/ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService/StreamRlsConfigs", opts...) - if err != nil { - return nil, err - } - x := &rateLimitConfigDiscoveryServiceStreamRlsConfigsClient{stream} - return x, nil -} - -type RateLimitConfigDiscoveryService_StreamRlsConfigsClient interface { - Send(*v3.DiscoveryRequest) error - Recv() (*v3.DiscoveryResponse, error) - grpc.ClientStream -} - -type rateLimitConfigDiscoveryServiceStreamRlsConfigsClient struct { - grpc.ClientStream -} - -func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsClient) Send(m *v3.DiscoveryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsClient) Recv() (*v3.DiscoveryResponse, error) { - m := new(v3.DiscoveryResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *rateLimitConfigDiscoveryServiceClient) FetchRlsConfigs(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) { - out := new(v3.DiscoveryResponse) - err := c.cc.Invoke(ctx, "/ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService/FetchRlsConfigs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RateLimitConfigDiscoveryServiceServer is the server API for RateLimitConfigDiscoveryService service. -type RateLimitConfigDiscoveryServiceServer interface { - StreamRlsConfigs(RateLimitConfigDiscoveryService_StreamRlsConfigsServer) error - FetchRlsConfigs(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) -} - -// UnimplementedRateLimitConfigDiscoveryServiceServer can be embedded to have forward compatible implementations. -type UnimplementedRateLimitConfigDiscoveryServiceServer struct { -} - -func (*UnimplementedRateLimitConfigDiscoveryServiceServer) StreamRlsConfigs(RateLimitConfigDiscoveryService_StreamRlsConfigsServer) error { - return status.Errorf(codes.Unimplemented, "method StreamRlsConfigs not implemented") -} -func (*UnimplementedRateLimitConfigDiscoveryServiceServer) FetchRlsConfigs(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchRlsConfigs not implemented") -} - -func RegisterRateLimitConfigDiscoveryServiceServer(s *grpc.Server, srv RateLimitConfigDiscoveryServiceServer) { - s.RegisterService(&_RateLimitConfigDiscoveryService_serviceDesc, srv) -} - -func _RateLimitConfigDiscoveryService_StreamRlsConfigs_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(RateLimitConfigDiscoveryServiceServer).StreamRlsConfigs(&rateLimitConfigDiscoveryServiceStreamRlsConfigsServer{stream}) -} - -type RateLimitConfigDiscoveryService_StreamRlsConfigsServer interface { - Send(*v3.DiscoveryResponse) error - Recv() (*v3.DiscoveryRequest, error) - grpc.ServerStream -} - -type rateLimitConfigDiscoveryServiceStreamRlsConfigsServer struct { - grpc.ServerStream -} - -func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsServer) Send(m *v3.DiscoveryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *rateLimitConfigDiscoveryServiceStreamRlsConfigsServer) Recv() (*v3.DiscoveryRequest, error) { - m := new(v3.DiscoveryRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _RateLimitConfigDiscoveryService_FetchRlsConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(v3.DiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RateLimitConfigDiscoveryServiceServer).FetchRlsConfigs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService/FetchRlsConfigs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RateLimitConfigDiscoveryServiceServer).FetchRlsConfigs(ctx, req.(*v3.DiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _RateLimitConfigDiscoveryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "ratelimit.service.ratelimit.v3.RateLimitConfigDiscoveryService", - HandlerType: (*RateLimitConfigDiscoveryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "FetchRlsConfigs", - Handler: _RateLimitConfigDiscoveryService_FetchRlsConfigs_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamRlsConfigs", - Handler: _RateLimitConfigDiscoveryService_StreamRlsConfigs_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "ratelimit/service/ratelimit/v3/rls_conf_ds.proto", -} diff --git a/vendor/golang.org/x/sync/singleflight/singleflight.go b/vendor/golang.org/x/sync/singleflight/singleflight.go deleted file mode 100644 index 90ca138af..000000000 --- a/vendor/golang.org/x/sync/singleflight/singleflight.go +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package singleflight provides a duplicate function call suppression -// mechanism. -package singleflight // import "golang.org/x/sync/singleflight" - -import ( - "bytes" - "errors" - "fmt" - "runtime" - "runtime/debug" - "sync" -) - -// errGoexit indicates the runtime.Goexit was called in -// the user given function. -var errGoexit = errors.New("runtime.Goexit was called") - -// A panicError is an arbitrary value recovered from a panic -// with the stack trace during the execution of given function. -type panicError struct { - value any - stack []byte -} - -// Error implements error interface. -func (p *panicError) Error() string { - return fmt.Sprintf("%v\n\n%s", p.value, p.stack) -} - -func (p *panicError) Unwrap() error { - err, ok := p.value.(error) - if !ok { - return nil - } - - return err -} - -func newPanicError(v any) error { - stack := debug.Stack() - - // The first line of the stack trace is of the form "goroutine N [status]:" - // but by the time the panic reaches Do the goroutine may no longer exist - // and its status will have changed. Trim out the misleading line. - if line := bytes.IndexByte(stack[:], '\n'); line >= 0 { - stack = stack[line+1:] - } - return &panicError{value: v, stack: stack} -} - -// call is an in-flight or completed singleflight.Do call -type call struct { - wg sync.WaitGroup - - // These fields are written once before the WaitGroup is done - // and are only read after the WaitGroup is done. - val any - err error - - // These fields are read and written with the singleflight - // mutex held before the WaitGroup is done, and are read but - // not written after the WaitGroup is done. - dups int - chans []chan<- Result -} - -// Group represents a class of work and forms a namespace in -// which units of work can be executed with duplicate suppression. -type Group struct { - mu sync.Mutex // protects m - m map[string]*call // lazily initialized -} - -// Result holds the results of Do, so they can be passed -// on a channel. -type Result struct { - Val any - Err error - Shared bool -} - -// Do executes and returns the results of the given function, making -// sure that only one execution is in-flight for a given key at a -// time. If a duplicate comes in, the duplicate caller waits for the -// original to complete and receives the same results. -// The return value shared indicates whether v was given to multiple callers. -func (g *Group) Do(key string, fn func() (any, error)) (v any, err error, shared bool) { - g.mu.Lock() - if g.m == nil { - g.m = make(map[string]*call) - } - if c, ok := g.m[key]; ok { - c.dups++ - g.mu.Unlock() - c.wg.Wait() - - if e, ok := c.err.(*panicError); ok { - panic(e) - } else if c.err == errGoexit { - runtime.Goexit() - } - return c.val, c.err, true - } - c := new(call) - c.wg.Add(1) - g.m[key] = c - g.mu.Unlock() - - g.doCall(c, key, fn) - return c.val, c.err, c.dups > 0 -} - -// DoChan is like Do but returns a channel that will receive the -// results when they are ready. -// -// The returned channel will not be closed. -func (g *Group) DoChan(key string, fn func() (any, error)) <-chan Result { - ch := make(chan Result, 1) - g.mu.Lock() - if g.m == nil { - g.m = make(map[string]*call) - } - if c, ok := g.m[key]; ok { - c.dups++ - c.chans = append(c.chans, ch) - g.mu.Unlock() - return ch - } - c := &call{chans: []chan<- Result{ch}} - c.wg.Add(1) - g.m[key] = c - g.mu.Unlock() - - go g.doCall(c, key, fn) - - return ch -} - -// doCall handles the single call for a key. -func (g *Group) doCall(c *call, key string, fn func() (any, error)) { - normalReturn := false - recovered := false - - // use double-defer to distinguish panic from runtime.Goexit, - // more details see https://golang.org/cl/134395 - defer func() { - // the given function invoked runtime.Goexit - if !normalReturn && !recovered { - c.err = errGoexit - } - - g.mu.Lock() - defer g.mu.Unlock() - c.wg.Done() - if g.m[key] == c { - delete(g.m, key) - } - - if e, ok := c.err.(*panicError); ok { - // In order to prevent the waiting channels from being blocked forever, - // needs to ensure that this panic cannot be recovered. - if len(c.chans) > 0 { - go panic(e) - select {} // Keep this goroutine around so that it will appear in the crash dump. - } else { - panic(e) - } - } else if c.err == errGoexit { - // Already in the process of goexit, no need to call again - } else { - // Normal return - for _, ch := range c.chans { - ch <- Result{c.val, c.err, c.dups > 0} - } - } - }() - - func() { - defer func() { - if !normalReturn { - // Ideally, we would wait to take a stack trace until we've determined - // whether this is a panic or a runtime.Goexit. - // - // Unfortunately, the only way we can distinguish the two is to see - // whether the recover stopped the goroutine from terminating, and by - // the time we know that, the part of the stack trace relevant to the - // panic has been discarded. - if r := recover(); r != nil { - c.err = newPanicError(r) - } - } - }() - - c.val, c.err = fn() - normalReturn = true - }() - - if !normalReturn { - recovered = true - } -} - -// Forget tells the singleflight to forget about a key. Future calls -// to Do for this key will call the function rather than waiting for -// an earlier call to complete. -func (g *Group) Forget(key string) { - g.mu.Lock() - delete(g.m, key) - g.mu.Unlock() -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 13877b16e..c32d9b624 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -278,18 +278,6 @@ github.com/docker/docker-credential-helpers/credentials ## explicit; go 1.13 github.com/emicklei/go-restful/v3 github.com/emicklei/go-restful/v3/log -# github.com/envoyproxy/go-control-plane v0.14.0 -## explicit; go 1.23.0 -github.com/envoyproxy/go-control-plane/pkg/cache/types -github.com/envoyproxy/go-control-plane/pkg/cache/v3 -github.com/envoyproxy/go-control-plane/pkg/log -github.com/envoyproxy/go-control-plane/pkg/resource/v3 -github.com/envoyproxy/go-control-plane/pkg/server/config -github.com/envoyproxy/go-control-plane/pkg/server/delta/v3 -github.com/envoyproxy/go-control-plane/pkg/server/rest/v3 -github.com/envoyproxy/go-control-plane/pkg/server/sotw/v3 -github.com/envoyproxy/go-control-plane/pkg/server/stream/v3 -github.com/envoyproxy/go-control-plane/pkg/server/v3 # github.com/envoyproxy/go-control-plane/envoy v1.37.0 ## explicit; go 1.24.0 github.com/envoyproxy/go-control-plane/envoy/admin/v3 @@ -297,7 +285,6 @@ github.com/envoyproxy/go-control-plane/envoy/annotations github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3 github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3 github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3 -github.com/envoyproxy/go-control-plane/envoy/config/common/key_value/v3 github.com/envoyproxy/go-control-plane/envoy/config/common/matcher/v3 github.com/envoyproxy/go-control-plane/envoy/config/common/mutation_rules/v3 github.com/envoyproxy/go-control-plane/envoy/config/core/v3 @@ -310,13 +297,8 @@ github.com/envoyproxy/go-control-plane/envoy/config/route/v3 github.com/envoyproxy/go-control-plane/envoy/config/tap/v3 github.com/envoyproxy/go-control-plane/envoy/config/trace/v3 github.com/envoyproxy/go-control-plane/envoy/data/accesslog/v3 -github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/stream/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/aggregate/v3 -github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3 -github.com/envoyproxy/go-control-plane/envoy/extensions/common/dynamic_forward_proxy/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/filters/common/fault/v3 -github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3 -github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/ext_proc/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/fault/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/rbac/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/router/v3 @@ -327,29 +309,16 @@ github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/ github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/pick_first/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/ring_hash/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/wrr_locality/v3 -github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/rbac/audit_loggers/stream/v3 github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3 -github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/v3 -github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3 github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3 -github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3 -github.com/envoyproxy/go-control-plane/envoy/service/ext_proc/v3 -github.com/envoyproxy/go-control-plane/envoy/service/extension/v3 -github.com/envoyproxy/go-control-plane/envoy/service/listener/v3 github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v3 -github.com/envoyproxy/go-control-plane/envoy/service/route/v3 -github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3 -github.com/envoyproxy/go-control-plane/envoy/service/secret/v3 github.com/envoyproxy/go-control-plane/envoy/service/status/v3 github.com/envoyproxy/go-control-plane/envoy/type/http/v3 github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3 github.com/envoyproxy/go-control-plane/envoy/type/metadata/v3 github.com/envoyproxy/go-control-plane/envoy/type/tracing/v3 github.com/envoyproxy/go-control-plane/envoy/type/v3 -# github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 -## explicit; go 1.21 -github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3 # github.com/envoyproxy/protoc-gen-validate v1.3.3 ## explicit; go 1.24.1 github.com/envoyproxy/protoc-gen-validate/validate @@ -915,7 +884,6 @@ golang.org/x/oauth2/jwt ## explicit; go 1.25.0 golang.org/x/sync/errgroup golang.org/x/sync/semaphore -golang.org/x/sync/singleflight # golang.org/x/sys v0.45.0 ## explicit; go 1.25.0 golang.org/x/sys/cpu