linkerd2_proxy_api/gen/
io.linkerd.proxy.inbound.rs

1#[allow(clippy::derive_partial_eq_without_eq)]
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct PortSpec {
4    /// Identifies a proxy workload (e.g., pod name).
5    #[prost(string, tag = "1")]
6    pub workload: ::prost::alloc::string::String,
7    /// An inbound port on _workload_.
8    #[prost(uint32, tag = "2")]
9    pub port: u32,
10}
11#[allow(clippy::derive_partial_eq_without_eq)]
12#[derive(Clone, PartialEq, ::prost::Message)]
13pub struct Server {
14    /// If set, indicates how the proxy should proxy connections on the specified
15    /// port.
16    #[prost(message, optional, tag = "1")]
17    pub protocol: ::core::option::Option<ProxyProtocol>,
18    /// Indicates the IP addresses on which the proxy may receive connections.
19    /// Connections targetting other IP addresses will be dropped.
20    #[prost(message, repeated, tag = "2")]
21    pub server_ips: ::prost::alloc::vec::Vec<super::net::IpAddress>,
22    /// Configures a proxy to allow connections from the specified clients.
23    ///
24    /// If unset, no connections are permitted.
25    #[prost(message, repeated, tag = "3")]
26    pub authorizations: ::prost::alloc::vec::Vec<Authz>,
27    /// Descriptive labels to be added to metrics, etc.
28    ///
29    /// A control plane SHOULD return the same keys in all policies. That is, we do
30    /// NOT want to return arbitrary pod labels in this field.
31    #[prost(map = "string, string", tag = "4")]
32    pub labels: ::std::collections::HashMap<
33        ::prost::alloc::string::String,
34        ::prost::alloc::string::String,
35    >,
36}
37#[allow(clippy::derive_partial_eq_without_eq)]
38#[derive(Clone, PartialEq, ::prost::Message)]
39pub struct ProxyProtocol {
40    #[prost(oneof = "proxy_protocol::Kind", tags = "1, 2, 3, 4, 5, 6")]
41    pub kind: ::core::option::Option<proxy_protocol::Kind>,
42}
43/// Nested message and enum types in `ProxyProtocol`.
44pub mod proxy_protocol {
45    #[allow(clippy::derive_partial_eq_without_eq)]
46    #[derive(Clone, PartialEq, ::prost::Message)]
47    pub struct Detect {
48        #[prost(message, optional, tag = "1")]
49        pub timeout: ::core::option::Option<::prost_types::Duration>,
50        /// If the protocol detected as HTTP, a list of HTTP routes that should be
51        /// matched.
52        #[prost(message, repeated, tag = "3")]
53        pub http_routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
54        /// If the protocol detected as HTTP, applicable rate limit.
55        #[prost(message, optional, tag = "4")]
56        pub http_local_rate_limit: ::core::option::Option<super::HttpLocalRateLimit>,
57    }
58    #[allow(clippy::derive_partial_eq_without_eq)]
59    #[derive(Clone, PartialEq, ::prost::Message)]
60    pub struct Http1 {
61        #[prost(message, repeated, tag = "2")]
62        pub routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
63        #[prost(message, optional, tag = "3")]
64        pub local_rate_limit: ::core::option::Option<super::HttpLocalRateLimit>,
65    }
66    #[allow(clippy::derive_partial_eq_without_eq)]
67    #[derive(Clone, PartialEq, ::prost::Message)]
68    pub struct Http2 {
69        #[prost(message, repeated, tag = "2")]
70        pub routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
71        #[prost(message, optional, tag = "3")]
72        pub local_rate_limit: ::core::option::Option<super::HttpLocalRateLimit>,
73    }
74    #[allow(clippy::derive_partial_eq_without_eq)]
75    #[derive(Clone, PartialEq, ::prost::Message)]
76    pub struct Grpc {
77        #[prost(message, repeated, tag = "2")]
78        pub routes: ::prost::alloc::vec::Vec<super::GrpcRoute>,
79    }
80    /// TODO: opaque TLS settings (versions, algorithms, SNI)
81    #[allow(clippy::derive_partial_eq_without_eq)]
82    #[derive(Clone, PartialEq, ::prost::Message)]
83    pub struct Opaque {}
84    #[allow(clippy::derive_partial_eq_without_eq)]
85    #[derive(Clone, PartialEq, ::prost::Message)]
86    pub struct Tls {}
87    #[allow(clippy::derive_partial_eq_without_eq)]
88    #[derive(Clone, PartialEq, ::prost::Oneof)]
89    pub enum Kind {
90        #[prost(message, tag = "1")]
91        Detect(Detect),
92        #[prost(message, tag = "2")]
93        Opaque(Opaque),
94        #[prost(message, tag = "3")]
95        Tls(Tls),
96        #[prost(message, tag = "4")]
97        Http1(Http1),
98        #[prost(message, tag = "5")]
99        Http2(Http2),
100        #[prost(message, tag = "6")]
101        Grpc(Grpc),
102    }
103}
104#[allow(clippy::derive_partial_eq_without_eq)]
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct Authz {
107    /// Limits this authorization to client addresses in the provided networks.
108    ///
109    /// Must have at least one network, otherwise the authorization must be
110    /// ignored. An authorization matches all clients by including an explicit
111    /// match on, i.e., `\[0.0.0.0/0, 0::/0\]``.
112    #[prost(message, repeated, tag = "1")]
113    pub networks: ::prost::alloc::vec::Vec<Network>,
114    /// Must be set.
115    #[prost(message, optional, tag = "2")]
116    pub authentication: ::core::option::Option<Authn>,
117    /// Descriptive labels to be added to metrics, etc.
118    ///
119    /// A control plane SHOULD return the same keys in all authorizations. That is,
120    /// we do NOT want to return arbitrary pod labels in this field.
121    ///
122    /// `labels` should be considered deprecated. `metadata` is preferred. However,
123    /// controllers should continue to set `labels` for compatibility with older
124    /// proxies.
125    #[prost(map = "string, string", tag = "3")]
126    pub labels: ::std::collections::HashMap<
127        ::prost::alloc::string::String,
128        ::prost::alloc::string::String,
129    >,
130    /// If set, describes an Authorization configuration. Replaces the free-from
131    /// `labels` field.
132    #[prost(message, optional, tag = "4")]
133    pub metadata: ::core::option::Option<super::meta::Metadata>,
134}
135/// Describes a network of authorized clients.
136#[allow(clippy::derive_partial_eq_without_eq)]
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct Network {
139    #[prost(message, optional, tag = "1")]
140    pub net: ::core::option::Option<super::net::IpNetwork>,
141    #[prost(message, repeated, tag = "2")]
142    pub except: ::prost::alloc::vec::Vec<super::net::IpNetwork>,
143}
144#[allow(clippy::derive_partial_eq_without_eq)]
145#[derive(Clone, PartialEq, ::prost::Message)]
146pub struct Authn {
147    #[prost(oneof = "authn::Permit", tags = "1, 2")]
148    pub permit: ::core::option::Option<authn::Permit>,
149}
150/// Nested message and enum types in `Authn`.
151pub mod authn {
152    #[allow(clippy::derive_partial_eq_without_eq)]
153    #[derive(Clone, PartialEq, ::prost::Message)]
154    pub struct PermitUnauthenticated {}
155    #[allow(clippy::derive_partial_eq_without_eq)]
156    #[derive(Clone, PartialEq, ::prost::Message)]
157    pub struct PermitMeshTls {
158        #[prost(oneof = "permit_mesh_tls::Clients", tags = "1, 2")]
159        pub clients: ::core::option::Option<permit_mesh_tls::Clients>,
160    }
161    /// Nested message and enum types in `PermitMeshTLS`.
162    pub mod permit_mesh_tls {
163        #[allow(clippy::derive_partial_eq_without_eq)]
164        #[derive(Clone, PartialEq, ::prost::Message)]
165        pub struct PermitClientIdentities {
166            /// A list of literal identities.
167            #[prost(message, repeated, tag = "1")]
168            pub identities: ::prost::alloc::vec::Vec<super::super::Identity>,
169            /// A list of identity suffixes.
170            ///
171            /// If this contains an empty suffix, all identities are matched.
172            #[prost(message, repeated, tag = "2")]
173            pub suffixes: ::prost::alloc::vec::Vec<super::super::IdentitySuffix>,
174        }
175        #[allow(clippy::derive_partial_eq_without_eq)]
176        #[derive(Clone, PartialEq, ::prost::Oneof)]
177        pub enum Clients {
178            /// Indicates that client identities are not required.
179            #[prost(message, tag = "1")]
180            Unauthenticated(super::PermitUnauthenticated),
181            /// Indicates that mutually-authenticated connections are permitted from
182            /// clients with matching identities.
183            #[prost(message, tag = "2")]
184            Identities(PermitClientIdentities),
185        }
186    }
187    #[allow(clippy::derive_partial_eq_without_eq)]
188    #[derive(Clone, PartialEq, ::prost::Oneof)]
189    pub enum Permit {
190        #[prost(message, tag = "1")]
191        Unauthenticated(PermitUnauthenticated),
192        /// If set, requires that the connection is transported over mesh TLS.
193        #[prost(message, tag = "2")]
194        MeshTls(PermitMeshTls),
195    }
196}
197#[allow(clippy::derive_partial_eq_without_eq)]
198#[derive(Clone, PartialEq, ::prost::Message)]
199pub struct Identity {
200    #[prost(string, tag = "1")]
201    pub name: ::prost::alloc::string::String,
202}
203/// Encodes a DNS-like name suffix as sequence of parts.
204///
205/// An empty list is equivalent to `.` (matching all names); the list `["foo",
206/// "bar"]` is equivalent to "foo.bar." (matching `*.foo.bar`), etc.
207#[allow(clippy::derive_partial_eq_without_eq)]
208#[derive(Clone, PartialEq, ::prost::Message)]
209pub struct IdentitySuffix {
210    #[prost(string, repeated, tag = "1")]
211    pub parts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
212}
213/// Inbound-specific HTTP route configuration (based on the
214/// [Gateway API](<https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.HTTPRoute>)).
215#[allow(clippy::derive_partial_eq_without_eq)]
216#[derive(Clone, PartialEq, ::prost::Message)]
217pub struct HttpRoute {
218    #[prost(message, optional, tag = "1")]
219    pub metadata: ::core::option::Option<super::meta::Metadata>,
220    /// If empty, the host value is ignored.
221    #[prost(message, repeated, tag = "2")]
222    pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
223    /// Extends the list of authorizations on the `Server` with authorizations
224    /// specific to this route.
225    #[prost(message, repeated, tag = "3")]
226    pub authorizations: ::prost::alloc::vec::Vec<Authz>,
227    /// Must have at least one rule.
228    #[prost(message, repeated, tag = "4")]
229    pub rules: ::prost::alloc::vec::Vec<http_route::Rule>,
230}
231/// Nested message and enum types in `HttpRoute`.
232pub mod http_route {
233    #[allow(clippy::derive_partial_eq_without_eq)]
234    #[derive(Clone, PartialEq, ::prost::Message)]
235    pub struct Rule {
236        #[prost(message, repeated, tag = "1")]
237        pub matches: ::prost::alloc::vec::Vec<super::super::http_route::HttpRouteMatch>,
238        #[prost(message, repeated, tag = "2")]
239        pub filters: ::prost::alloc::vec::Vec<Filter>,
240    }
241    #[allow(clippy::derive_partial_eq_without_eq)]
242    #[derive(Clone, PartialEq, ::prost::Message)]
243    pub struct Filter {
244        #[prost(oneof = "filter::Kind", tags = "1, 2, 3")]
245        pub kind: ::core::option::Option<filter::Kind>,
246    }
247    /// Nested message and enum types in `Filter`.
248    pub mod filter {
249        #[allow(clippy::derive_partial_eq_without_eq)]
250        #[derive(Clone, PartialEq, ::prost::Oneof)]
251        pub enum Kind {
252            #[prost(message, tag = "1")]
253            FailureInjector(super::super::super::http_route::HttpFailureInjector),
254            #[prost(message, tag = "2")]
255            RequestHeaderModifier(
256                super::super::super::http_route::RequestHeaderModifier,
257            ),
258            #[prost(message, tag = "3")]
259            Redirect(super::super::super::http_route::RequestRedirect),
260        }
261    }
262}
263/// Inbound-specific gRPC route configuration.
264#[allow(clippy::derive_partial_eq_without_eq)]
265#[derive(Clone, PartialEq, ::prost::Message)]
266pub struct GrpcRoute {
267    #[prost(message, optional, tag = "1")]
268    pub metadata: ::core::option::Option<super::meta::Metadata>,
269    /// If empty, the host value is ignored.
270    #[prost(message, repeated, tag = "2")]
271    pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
272    /// The server MUST return at least one authorization, otherwise all requests
273    /// to this route will fail with an unauthorized response.
274    #[prost(message, repeated, tag = "3")]
275    pub authorizations: ::prost::alloc::vec::Vec<Authz>,
276    /// Must have at least one rule.
277    #[prost(message, repeated, tag = "4")]
278    pub rules: ::prost::alloc::vec::Vec<grpc_route::Rule>,
279}
280/// Nested message and enum types in `GrpcRoute`.
281pub mod grpc_route {
282    #[allow(clippy::derive_partial_eq_without_eq)]
283    #[derive(Clone, PartialEq, ::prost::Message)]
284    pub struct Rule {
285        #[prost(message, repeated, tag = "1")]
286        pub matches: ::prost::alloc::vec::Vec<super::super::grpc_route::GrpcRouteMatch>,
287        #[prost(message, repeated, tag = "2")]
288        pub filters: ::prost::alloc::vec::Vec<Filter>,
289    }
290    #[allow(clippy::derive_partial_eq_without_eq)]
291    #[derive(Clone, PartialEq, ::prost::Message)]
292    pub struct Filter {
293        #[prost(oneof = "filter::Kind", tags = "1, 2")]
294        pub kind: ::core::option::Option<filter::Kind>,
295    }
296    /// Nested message and enum types in `Filter`.
297    pub mod filter {
298        #[allow(clippy::derive_partial_eq_without_eq)]
299        #[derive(Clone, PartialEq, ::prost::Oneof)]
300        pub enum Kind {
301            #[prost(message, tag = "1")]
302            FailureInjector(super::super::super::grpc_route::GrpcFailureInjector),
303            #[prost(message, tag = "2")]
304            RequestHeaderModifier(
305                super::super::super::http_route::RequestHeaderModifier,
306            ),
307        }
308    }
309}
310#[allow(clippy::derive_partial_eq_without_eq)]
311#[derive(Clone, PartialEq, ::prost::Message)]
312pub struct HttpLocalRateLimit {
313    /// Describes the associated HTTPLocalRateLimitPolicy resource
314    #[prost(message, optional, tag = "1")]
315    pub metadata: ::core::option::Option<super::meta::Metadata>,
316    /// Overall rate-limit, which all traffic coming to this server should abide
317    /// to. If unset no overall limit is applied.
318    #[prost(message, optional, tag = "2")]
319    pub total: ::core::option::Option<http_local_rate_limit::Limit>,
320    /// Fairness for individual identities; each separate client, grouped by
321    /// identity, will have this rate-limit.
322    #[prost(message, optional, tag = "3")]
323    pub identity: ::core::option::Option<http_local_rate_limit::Limit>,
324    /// Limit overrides for traffic from a specific client.
325    #[prost(message, repeated, tag = "4")]
326    pub overrides: ::prost::alloc::vec::Vec<http_local_rate_limit::Override>,
327}
328/// Nested message and enum types in `HttpLocalRateLimit`.
329pub mod http_local_rate_limit {
330    #[allow(clippy::derive_partial_eq_without_eq)]
331    #[derive(Clone, PartialEq, ::prost::Message)]
332    pub struct Override {
333        #[prost(message, optional, tag = "1")]
334        pub limit: ::core::option::Option<Limit>,
335        #[prost(message, optional, tag = "2")]
336        pub clients: ::core::option::Option<r#override::ClientIdentities>,
337    }
338    /// Nested message and enum types in `Override`.
339    pub mod r#override {
340        #[allow(clippy::derive_partial_eq_without_eq)]
341        #[derive(Clone, PartialEq, ::prost::Message)]
342        pub struct ClientIdentities {
343            /// A list of literal identities.
344            #[prost(message, repeated, tag = "1")]
345            pub identities: ::prost::alloc::vec::Vec<super::super::Identity>,
346        }
347    }
348    #[allow(clippy::derive_partial_eq_without_eq)]
349    #[derive(Clone, PartialEq, ::prost::Message)]
350    pub struct Limit {
351        #[prost(uint32, tag = "1")]
352        pub requests_per_second: u32,
353    }
354}
355/// Generated client implementations.
356pub mod inbound_server_policies_client {
357    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
358    use tonic::codegen::*;
359    use tonic::codegen::http::Uri;
360    /// / An API exposed to the linkerd2-proxy to configure the inbound proxy with per-port configuration
361    /// /
362    /// / Proxies are expected to watch policies for each known port. As policies change, proxies update
363    /// / their behavior for newly accepted connections.
364    /// /
365    /// / The unary `GetPort` endpoint is exposed as a convenience for clients to query policies for
366    /// / diagnostic purposes.
367    #[derive(Debug, Clone)]
368    pub struct InboundServerPoliciesClient<T> {
369        inner: tonic::client::Grpc<T>,
370    }
371    impl<T> InboundServerPoliciesClient<T>
372    where
373        T: tonic::client::GrpcService<tonic::body::BoxBody>,
374        T::Error: Into<StdError>,
375        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
376        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
377    {
378        pub fn new(inner: T) -> Self {
379            let inner = tonic::client::Grpc::new(inner);
380            Self { inner }
381        }
382        pub fn with_origin(inner: T, origin: Uri) -> Self {
383            let inner = tonic::client::Grpc::with_origin(inner, origin);
384            Self { inner }
385        }
386        pub fn with_interceptor<F>(
387            inner: T,
388            interceptor: F,
389        ) -> InboundServerPoliciesClient<InterceptedService<T, F>>
390        where
391            F: tonic::service::Interceptor,
392            T::ResponseBody: Default,
393            T: tonic::codegen::Service<
394                http::Request<tonic::body::BoxBody>,
395                Response = http::Response<
396                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
397                >,
398            >,
399            <T as tonic::codegen::Service<
400                http::Request<tonic::body::BoxBody>,
401            >>::Error: Into<StdError> + Send + Sync,
402        {
403            InboundServerPoliciesClient::new(InterceptedService::new(inner, interceptor))
404        }
405        /// Compress requests with the given encoding.
406        ///
407        /// This requires the server to support it otherwise it might respond with an
408        /// error.
409        #[must_use]
410        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
411            self.inner = self.inner.send_compressed(encoding);
412            self
413        }
414        /// Enable decompressing responses.
415        #[must_use]
416        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
417            self.inner = self.inner.accept_compressed(encoding);
418            self
419        }
420        /// Limits the maximum size of a decoded message.
421        ///
422        /// Default: `4MB`
423        #[must_use]
424        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
425            self.inner = self.inner.max_decoding_message_size(limit);
426            self
427        }
428        /// Limits the maximum size of an encoded message.
429        ///
430        /// Default: `usize::MAX`
431        #[must_use]
432        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
433            self.inner = self.inner.max_encoding_message_size(limit);
434            self
435        }
436        /// / Gets the inbound server policy for a given workload port.
437        pub async fn get_port(
438            &mut self,
439            request: impl tonic::IntoRequest<super::PortSpec>,
440        ) -> std::result::Result<tonic::Response<super::Server>, tonic::Status> {
441            self.inner
442                .ready()
443                .await
444                .map_err(|e| {
445                    tonic::Status::new(
446                        tonic::Code::Unknown,
447                        format!("Service was not ready: {}", e.into()),
448                    )
449                })?;
450            let codec = tonic::codec::ProstCodec::default();
451            let path = http::uri::PathAndQuery::from_static(
452                "/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort",
453            );
454            let mut req = request.into_request();
455            req.extensions_mut()
456                .insert(
457                    GrpcMethod::new(
458                        "io.linkerd.proxy.inbound.InboundServerPolicies",
459                        "GetPort",
460                    ),
461                );
462            self.inner.unary(req, path, codec).await
463        }
464        /// / Watches the inbound server policy for a given workload port.
465        pub async fn watch_port(
466            &mut self,
467            request: impl tonic::IntoRequest<super::PortSpec>,
468        ) -> std::result::Result<
469            tonic::Response<tonic::codec::Streaming<super::Server>>,
470            tonic::Status,
471        > {
472            self.inner
473                .ready()
474                .await
475                .map_err(|e| {
476                    tonic::Status::new(
477                        tonic::Code::Unknown,
478                        format!("Service was not ready: {}", e.into()),
479                    )
480                })?;
481            let codec = tonic::codec::ProstCodec::default();
482            let path = http::uri::PathAndQuery::from_static(
483                "/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort",
484            );
485            let mut req = request.into_request();
486            req.extensions_mut()
487                .insert(
488                    GrpcMethod::new(
489                        "io.linkerd.proxy.inbound.InboundServerPolicies",
490                        "WatchPort",
491                    ),
492                );
493            self.inner.server_streaming(req, path, codec).await
494        }
495    }
496}
497/// Generated server implementations.
498pub mod inbound_server_policies_server {
499    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
500    use tonic::codegen::*;
501    /// Generated trait containing gRPC methods that should be implemented for use with InboundServerPoliciesServer.
502    #[async_trait]
503    pub trait InboundServerPolicies: Send + Sync + 'static {
504        /// / Gets the inbound server policy for a given workload port.
505        async fn get_port(
506            &self,
507            request: tonic::Request<super::PortSpec>,
508        ) -> std::result::Result<tonic::Response<super::Server>, tonic::Status>;
509        /// Server streaming response type for the WatchPort method.
510        type WatchPortStream: tonic::codegen::tokio_stream::Stream<
511                Item = std::result::Result<super::Server, tonic::Status>,
512            >
513            + Send
514            + 'static;
515        /// / Watches the inbound server policy for a given workload port.
516        async fn watch_port(
517            &self,
518            request: tonic::Request<super::PortSpec>,
519        ) -> std::result::Result<tonic::Response<Self::WatchPortStream>, tonic::Status>;
520    }
521    /// / An API exposed to the linkerd2-proxy to configure the inbound proxy with per-port configuration
522    /// /
523    /// / Proxies are expected to watch policies for each known port. As policies change, proxies update
524    /// / their behavior for newly accepted connections.
525    /// /
526    /// / The unary `GetPort` endpoint is exposed as a convenience for clients to query policies for
527    /// / diagnostic purposes.
528    #[derive(Debug)]
529    pub struct InboundServerPoliciesServer<T: InboundServerPolicies> {
530        inner: _Inner<T>,
531        accept_compression_encodings: EnabledCompressionEncodings,
532        send_compression_encodings: EnabledCompressionEncodings,
533        max_decoding_message_size: Option<usize>,
534        max_encoding_message_size: Option<usize>,
535    }
536    struct _Inner<T>(Arc<T>);
537    impl<T: InboundServerPolicies> InboundServerPoliciesServer<T> {
538        pub fn new(inner: T) -> Self {
539            Self::from_arc(Arc::new(inner))
540        }
541        pub fn from_arc(inner: Arc<T>) -> Self {
542            let inner = _Inner(inner);
543            Self {
544                inner,
545                accept_compression_encodings: Default::default(),
546                send_compression_encodings: Default::default(),
547                max_decoding_message_size: None,
548                max_encoding_message_size: None,
549            }
550        }
551        pub fn with_interceptor<F>(
552            inner: T,
553            interceptor: F,
554        ) -> InterceptedService<Self, F>
555        where
556            F: tonic::service::Interceptor,
557        {
558            InterceptedService::new(Self::new(inner), interceptor)
559        }
560        /// Enable decompressing requests with the given encoding.
561        #[must_use]
562        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
563            self.accept_compression_encodings.enable(encoding);
564            self
565        }
566        /// Compress responses with the given encoding, if the client supports it.
567        #[must_use]
568        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
569            self.send_compression_encodings.enable(encoding);
570            self
571        }
572        /// Limits the maximum size of a decoded message.
573        ///
574        /// Default: `4MB`
575        #[must_use]
576        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
577            self.max_decoding_message_size = Some(limit);
578            self
579        }
580        /// Limits the maximum size of an encoded message.
581        ///
582        /// Default: `usize::MAX`
583        #[must_use]
584        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
585            self.max_encoding_message_size = Some(limit);
586            self
587        }
588    }
589    impl<T, B> tonic::codegen::Service<http::Request<B>>
590    for InboundServerPoliciesServer<T>
591    where
592        T: InboundServerPolicies,
593        B: Body + Send + 'static,
594        B::Error: Into<StdError> + Send + 'static,
595    {
596        type Response = http::Response<tonic::body::BoxBody>;
597        type Error = std::convert::Infallible;
598        type Future = BoxFuture<Self::Response, Self::Error>;
599        fn poll_ready(
600            &mut self,
601            _cx: &mut Context<'_>,
602        ) -> Poll<std::result::Result<(), Self::Error>> {
603            Poll::Ready(Ok(()))
604        }
605        fn call(&mut self, req: http::Request<B>) -> Self::Future {
606            let inner = self.inner.clone();
607            match req.uri().path() {
608                "/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort" => {
609                    #[allow(non_camel_case_types)]
610                    struct GetPortSvc<T: InboundServerPolicies>(pub Arc<T>);
611                    impl<
612                        T: InboundServerPolicies,
613                    > tonic::server::UnaryService<super::PortSpec> for GetPortSvc<T> {
614                        type Response = super::Server;
615                        type Future = BoxFuture<
616                            tonic::Response<Self::Response>,
617                            tonic::Status,
618                        >;
619                        fn call(
620                            &mut self,
621                            request: tonic::Request<super::PortSpec>,
622                        ) -> Self::Future {
623                            let inner = Arc::clone(&self.0);
624                            let fut = async move {
625                                <T as InboundServerPolicies>::get_port(&inner, request)
626                                    .await
627                            };
628                            Box::pin(fut)
629                        }
630                    }
631                    let accept_compression_encodings = self.accept_compression_encodings;
632                    let send_compression_encodings = self.send_compression_encodings;
633                    let max_decoding_message_size = self.max_decoding_message_size;
634                    let max_encoding_message_size = self.max_encoding_message_size;
635                    let inner = self.inner.clone();
636                    let fut = async move {
637                        let inner = inner.0;
638                        let method = GetPortSvc(inner);
639                        let codec = tonic::codec::ProstCodec::default();
640                        let mut grpc = tonic::server::Grpc::new(codec)
641                            .apply_compression_config(
642                                accept_compression_encodings,
643                                send_compression_encodings,
644                            )
645                            .apply_max_message_size_config(
646                                max_decoding_message_size,
647                                max_encoding_message_size,
648                            );
649                        let res = grpc.unary(method, req).await;
650                        Ok(res)
651                    };
652                    Box::pin(fut)
653                }
654                "/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort" => {
655                    #[allow(non_camel_case_types)]
656                    struct WatchPortSvc<T: InboundServerPolicies>(pub Arc<T>);
657                    impl<
658                        T: InboundServerPolicies,
659                    > tonic::server::ServerStreamingService<super::PortSpec>
660                    for WatchPortSvc<T> {
661                        type Response = super::Server;
662                        type ResponseStream = T::WatchPortStream;
663                        type Future = BoxFuture<
664                            tonic::Response<Self::ResponseStream>,
665                            tonic::Status,
666                        >;
667                        fn call(
668                            &mut self,
669                            request: tonic::Request<super::PortSpec>,
670                        ) -> Self::Future {
671                            let inner = Arc::clone(&self.0);
672                            let fut = async move {
673                                <T as InboundServerPolicies>::watch_port(&inner, request)
674                                    .await
675                            };
676                            Box::pin(fut)
677                        }
678                    }
679                    let accept_compression_encodings = self.accept_compression_encodings;
680                    let send_compression_encodings = self.send_compression_encodings;
681                    let max_decoding_message_size = self.max_decoding_message_size;
682                    let max_encoding_message_size = self.max_encoding_message_size;
683                    let inner = self.inner.clone();
684                    let fut = async move {
685                        let inner = inner.0;
686                        let method = WatchPortSvc(inner);
687                        let codec = tonic::codec::ProstCodec::default();
688                        let mut grpc = tonic::server::Grpc::new(codec)
689                            .apply_compression_config(
690                                accept_compression_encodings,
691                                send_compression_encodings,
692                            )
693                            .apply_max_message_size_config(
694                                max_decoding_message_size,
695                                max_encoding_message_size,
696                            );
697                        let res = grpc.server_streaming(method, req).await;
698                        Ok(res)
699                    };
700                    Box::pin(fut)
701                }
702                _ => {
703                    Box::pin(async move {
704                        Ok(
705                            http::Response::builder()
706                                .status(200)
707                                .header("grpc-status", "12")
708                                .header("content-type", "application/grpc")
709                                .body(empty_body())
710                                .unwrap(),
711                        )
712                    })
713                }
714            }
715        }
716    }
717    impl<T: InboundServerPolicies> Clone for InboundServerPoliciesServer<T> {
718        fn clone(&self) -> Self {
719            let inner = self.inner.clone();
720            Self {
721                inner,
722                accept_compression_encodings: self.accept_compression_encodings,
723                send_compression_encodings: self.send_compression_encodings,
724                max_decoding_message_size: self.max_decoding_message_size,
725                max_encoding_message_size: self.max_encoding_message_size,
726            }
727        }
728    }
729    impl<T: InboundServerPolicies> Clone for _Inner<T> {
730        fn clone(&self) -> Self {
731            Self(Arc::clone(&self.0))
732        }
733    }
734    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
735        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
736            write!(f, "{:?}", self.0)
737        }
738    }
739    impl<T: InboundServerPolicies> tonic::server::NamedService
740    for InboundServerPoliciesServer<T> {
741        const NAME: &'static str = "io.linkerd.proxy.inbound.InboundServerPolicies";
742    }
743}