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

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct GetDestination {
4    #[prost(string, tag = "1")]
5    pub scheme: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub path: ::prost::alloc::string::String,
8    /// An opaque value that is set at injection-time and sent with destintion
9    /// lookups.
10    ///
11    /// If, for instance, the token encodes a namespace or some locality
12    /// information, the service may alter its results to take this locality into
13    /// account.
14    #[prost(string, tag = "3")]
15    pub context_token: ::prost::alloc::string::String,
16}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct Update {
19    #[prost(oneof = "update::Update", tags = "1, 2, 3")]
20    pub update: ::core::option::Option<update::Update>,
21}
22/// Nested message and enum types in `Update`.
23pub mod update {
24    #[derive(Clone, PartialEq, ::prost::Oneof)]
25    pub enum Update {
26        /// A new set of endpoints are available for the service. The set might be
27        /// empty.
28        #[prost(message, tag = "1")]
29        Add(super::WeightedAddrSet),
30        /// Some endpoints have been removed from the service.
31        #[prost(message, tag = "2")]
32        Remove(super::AddrSet),
33        /// `no_endpoints{exists: false}` indicates that the service does not exist
34        /// and the client MAY try an alternate service discovery method (e.g. DNS).
35        ///
36        /// `no_endpoints(exists: true)` indicates that the service does exist and
37        /// the client MUST NOT fall back to an alternate service discovery method.
38        #[prost(message, tag = "3")]
39        NoEndpoints(super::NoEndpoints),
40    }
41}
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct AddrSet {
44    #[prost(message, repeated, tag = "1")]
45    pub addrs: ::prost::alloc::vec::Vec<super::net::TcpAddress>,
46}
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct WeightedAddrSet {
49    #[prost(message, repeated, tag = "1")]
50    pub addrs: ::prost::alloc::vec::Vec<WeightedAddr>,
51    #[prost(map = "string, string", tag = "2")]
52    pub metric_labels: ::std::collections::HashMap<
53        ::prost::alloc::string::String,
54        ::prost::alloc::string::String,
55    >,
56}
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct WeightedAddr {
59    #[prost(message, optional, tag = "1")]
60    pub addr: ::core::option::Option<super::net::TcpAddress>,
61    #[prost(uint32, tag = "3")]
62    pub weight: u32,
63    #[prost(map = "string, string", tag = "4")]
64    pub metric_labels: ::std::collections::HashMap<
65        ::prost::alloc::string::String,
66        ::prost::alloc::string::String,
67    >,
68    #[prost(message, optional, tag = "5")]
69    pub tls_identity: ::core::option::Option<TlsIdentity>,
70    #[prost(message, optional, tag = "6")]
71    pub protocol_hint: ::core::option::Option<ProtocolHint>,
72    #[prost(message, optional, tag = "7")]
73    pub authority_override: ::core::option::Option<AuthorityOverride>,
74    /// The HTTP/2 parameters to use when connecting to the destination, if HTTP/2
75    /// is used. These parameters are used by proxies when the application traffic
76    /// is HTTP/2 or when the H2 ProtocolHint is used to transport HTTP/1
77    /// connections over HTTP/2.
78    #[prost(message, optional, tag = "8")]
79    pub http2: ::core::option::Option<Http2ClientParams>,
80    /// A reference to the metadata for this endpoint, usually a Pod. This may be
81    /// omitted when the resource type is unknown.
82    #[prost(message, optional, tag = "9")]
83    pub resource_ref: ::core::option::Option<super::meta::Metadata>,
84}
85#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
86pub struct TlsIdentity {
87    /// The server name of the endpoint. This is the value that needs to be included
88    /// by clients in the ClientHello SNI extension of the TLS handshake when they
89    /// initiate TLS connections to servers.
90    #[prost(message, optional, tag = "4")]
91    pub server_name: ::core::option::Option<tls_identity::DnsLikeIdentity>,
92    #[prost(oneof = "tls_identity::Strategy", tags = "1, 3")]
93    pub strategy: ::core::option::Option<tls_identity::Strategy>,
94}
95/// Nested message and enum types in `TlsIdentity`.
96pub mod tls_identity {
97    /// Verify the certificate based on the Kubernetes pod identity.
98    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
99    pub struct DnsLikeIdentity {
100        /// A DNS-like name that encodes workload coordinates.
101        ///
102        /// For example:
103        /// {name}.{namespace}.{type}.identity.{control-namespace}.{trust-domain...}
104        #[prost(string, tag = "1")]
105        pub name: ::prost::alloc::string::String,
106    }
107    /// Verify the certificate based on an URI identity.
108    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
109    pub struct UriLikeIdentity {
110        /// A URI name that encodes workload identity.
111        ///
112        /// For example:
113        /// spiffe://trust-domain/workload-dentifier
114        #[prost(string, tag = "1")]
115        pub uri: ::prost::alloc::string::String,
116    }
117    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
118    pub enum Strategy {
119        #[prost(message, tag = "1")]
120        DnsLikeIdentity(DnsLikeIdentity),
121        #[prost(message, tag = "3")]
122        UriLikeIdentity(UriLikeIdentity),
123    }
124}
125#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
126pub struct AuthorityOverride {
127    #[prost(string, tag = "1")]
128    pub authority_override: ::prost::alloc::string::String,
129}
130#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
131pub struct NoEndpoints {
132    #[prost(bool, tag = "1")]
133    pub exists: bool,
134}
135/// A hint of what protocol the service knows. The default value is
136/// for the `hint` field to be not be set, essentially meaning "unknown".
137#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
138pub struct ProtocolHint {
139    /// When set, indicates that the target supports receiving opaque traffic
140    /// wrapped with the Linkerd connection header on the specified port.
141    #[prost(message, optional, tag = "2")]
142    pub opaque_transport: ::core::option::Option<protocol_hint::OpaqueTransport>,
143    #[prost(oneof = "protocol_hint::Protocol", tags = "1, 3")]
144    pub protocol: ::core::option::Option<protocol_hint::Protocol>,
145}
146/// Nested message and enum types in `ProtocolHint`.
147pub mod protocol_hint {
148    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
149    pub struct H2 {}
150    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
151    pub struct Opaque {}
152    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
153    pub struct OpaqueTransport {
154        /// The target proxy's inbound port.
155        #[prost(uint32, tag = "1")]
156        pub inbound_port: u32,
157    }
158    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
159    pub enum Protocol {
160        /// Hints that the service understands HTTP2 and the proxy's internal
161        /// http2-upgrade mechanism.
162        #[prost(message, tag = "1")]
163        H2(H2),
164        /// Hints that the destination will handle this connection as an opaque TCP
165        /// stream, and (if `opaque_transport` is set) that the proxy should not send
166        /// a `SessionProtocol` as part of its transport header.
167        #[prost(message, tag = "3")]
168        Opaque(Opaque),
169    }
170}
171/// Configures the parameters used to initialize an HTTP/2 connection.
172#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
173pub struct Http2ClientParams {
174    /// Overrides the default client flow control settings.
175    #[prost(message, optional, tag = "1")]
176    pub flow_control: ::core::option::Option<http2_client_params::FlowControl>,
177    /// Enables keep-alive timeouts.
178    #[prost(message, optional, tag = "2")]
179    pub keep_alive: ::core::option::Option<http2_client_params::KeepAlive>,
180    /// Configures Hyper internals.
181    #[prost(message, optional, tag = "3")]
182    pub internals: ::core::option::Option<http2_client_params::Internals>,
183}
184/// Nested message and enum types in `Http2ClientParams`.
185pub mod http2_client_params {
186    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
187    pub struct FlowControl {
188        /// Configures the maximum connection-level flow control window size.
189        #[prost(uint32, tag = "1")]
190        pub initial_connection_window_size: u32,
191        /// Configures the maximum stream-level flow control window size.
192        #[prost(uint32, tag = "2")]
193        pub initial_stream_window_size: u32,
194        /// Enables Hyper's adaptive flow control, ignoring other window settings.
195        #[prost(bool, tag = "3")]
196        pub adaptive_flow_control: bool,
197    }
198    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
199    pub struct KeepAlive {
200        /// The time between pings.
201        #[prost(message, optional, tag = "1")]
202        pub interval: ::core::option::Option<::prost_types::Duration>,
203        /// The time to wait for a ping response before considering the connection
204        /// dead.
205        #[prost(message, optional, tag = "2")]
206        pub timeout: ::core::option::Option<::prost_types::Duration>,
207        /// Whether to send pings when there is no other traffic.
208        #[prost(bool, tag = "3")]
209        pub while_idle: bool,
210    }
211    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
212    pub struct Internals {
213        #[prost(uint32, tag = "1")]
214        pub max_concurrent_reset_streams: u32,
215        #[prost(uint32, tag = "2")]
216        pub max_frame_size: u32,
217        #[prost(uint32, tag = "3")]
218        pub max_send_buf_size: u32,
219    }
220}
221#[derive(Clone, PartialEq, ::prost::Message)]
222pub struct DestinationProfile {
223    /// The fully-qualified service name, if one exists.
224    ///
225    /// When resolving (especially by IP), this field provides the fully-qualified
226    /// name of the resolved service, if one exists. This field does NOT include
227    /// any port information. E.g. a lookup for 10.2.3.4:8080 might have a name
228    /// like `foo.bar.svc.cluster.local`.
229    ///
230    /// Implementations MAY provide names for non-service IP-lookups (e.g., pod or
231    /// node dns names), but this is not required.
232    ///
233    /// If the lookup does not refer to a known named entity, this field MUST be
234    /// left empty.
235    #[prost(string, tag = "5")]
236    pub fully_qualified_name: ::prost::alloc::string::String,
237    /// Indicates that connections on this service address should be handled as
238    /// opaque TCP streams. HTTP routes returned on for such services will be
239    /// ignored.
240    #[prost(bool, tag = "4")]
241    pub opaque_protocol: bool,
242    /// A list of routes, each with a RequestMatch.  If a request matches
243    /// more than one route, the first match wins.
244    #[prost(message, repeated, tag = "1")]
245    pub routes: ::prost::alloc::vec::Vec<Route>,
246    /// The retry budget controls how much additional load the proxy can generate
247    /// as retries. Failured requests on retryable routes will not be retried if
248    /// there is no available budget.
249    #[prost(message, optional, tag = "2")]
250    pub retry_budget: ::core::option::Option<RetryBudget>,
251    /// If this list is non-empty, requests to this destination should instead be
252    /// split between the destinations in this list.  Each destination should
253    /// receive a portion of the requests proportional to its weight.  If this
254    /// list is empty, requests should be sent to this destination as normal.
255    #[prost(message, repeated, tag = "3")]
256    pub dst_overrides: ::prost::alloc::vec::Vec<WeightedDst>,
257    /// If this field is set, it indicates that the target is a known endpoint (and
258    /// not a service address). The values of `fully_qualified_name` and
259    /// `dst_overrides` will be ignored for the purposes of service discovery--
260    /// traffic split and load balancing will be skipped and the single endpoint
261    /// are used.
262    ///
263    /// No endpoint should be set If the target is unknown.
264    #[prost(message, optional, tag = "6")]
265    pub endpoint: ::core::option::Option<WeightedAddr>,
266    /// A reference to the metadata for this destination, usually a service. May be
267    /// omitted if the destination is not a service.
268    #[prost(message, optional, tag = "7")]
269    pub parent_ref: ::core::option::Option<super::meta::Metadata>,
270    /// A reference to the metadata for a ServiceProfile resource. This is omitted
271    /// when no ServiceProfile resource exists.
272    #[prost(message, optional, tag = "8")]
273    pub profile_ref: ::core::option::Option<super::meta::Metadata>,
274}
275#[derive(Clone, PartialEq, ::prost::Message)]
276pub struct Route {
277    /// This route contains requests which match this condition.
278    #[prost(message, optional, tag = "1")]
279    pub condition: ::core::option::Option<RequestMatch>,
280    /// A list of response classes for this route.  If a response matches
281    /// more than one ResponseClass, the first match wins.  If a response does not
282    /// match any ResponseClasses, it is considered to be a successful response.
283    #[prost(message, repeated, tag = "2")]
284    pub response_classes: ::prost::alloc::vec::Vec<ResponseClass>,
285    /// Metric labels to attach to requests and responses that match this route.
286    #[prost(map = "string, string", tag = "3")]
287    pub metrics_labels: ::std::collections::HashMap<
288        ::prost::alloc::string::String,
289        ::prost::alloc::string::String,
290    >,
291    /// If a route is retryable, any failed requests on that route may be retried
292    /// by the proxy.
293    #[prost(bool, tag = "4")]
294    pub is_retryable: bool,
295    /// After this time has elapsed since receiving the initial request, any
296    /// outstanding request will be cancelled, a timeout error response will be
297    /// returned, and no more retries will be attempted.
298    #[prost(message, optional, tag = "5")]
299    pub timeout: ::core::option::Option<::prost_types::Duration>,
300}
301#[derive(Clone, Copy, PartialEq, ::prost::Message)]
302pub struct RetryBudget {
303    /// The ratio of additional traffic that may be added by retries.  A
304    /// retry_ratio of 0.1 means that 1 retry may be attempted for every 10 regular
305    /// requests.  A retry_ratio of 1.0 means that 1 retry may be attempted for
306    /// every 1 regular request (in other words, total request load may be doubled
307    /// as a result of retries).
308    #[prost(float, tag = "1")]
309    pub retry_ratio: f32,
310    /// The proxy may always attempt this number of retries per second, even if it
311    /// would violate the retry_ratio.  This is to allow retries to happen even
312    /// when the request rate is very low.
313    #[prost(uint32, tag = "2")]
314    pub min_retries_per_second: u32,
315    /// This duration indicates for how long requests should be considered for the
316    /// purposes of enforcing the retry_ratio.  A higher value considers a larger
317    /// window and therefore allows burstier retries.
318    #[prost(message, optional, tag = "3")]
319    pub ttl: ::core::option::Option<::prost_types::Duration>,
320}
321#[derive(Clone, PartialEq, ::prost::Message)]
322pub struct ResponseClass {
323    /// This class contains responses which match this condition.
324    #[prost(message, optional, tag = "1")]
325    pub condition: ::core::option::Option<ResponseMatch>,
326    /// If responses in this class should be considered failures.  This defaults
327    /// to false (success).
328    #[prost(bool, tag = "2")]
329    pub is_failure: bool,
330}
331#[derive(Clone, PartialEq, ::prost::Message)]
332pub struct RequestMatch {
333    #[prost(oneof = "request_match::Match", tags = "1, 2, 3, 4, 5")]
334    pub r#match: ::core::option::Option<request_match::Match>,
335}
336/// Nested message and enum types in `RequestMatch`.
337pub mod request_match {
338    #[derive(Clone, PartialEq, ::prost::Message)]
339    pub struct Seq {
340        #[prost(message, repeated, tag = "1")]
341        pub matches: ::prost::alloc::vec::Vec<super::RequestMatch>,
342    }
343    #[derive(Clone, PartialEq, ::prost::Oneof)]
344    pub enum Match {
345        #[prost(message, tag = "1")]
346        All(Seq),
347        #[prost(message, tag = "2")]
348        Any(Seq),
349        #[prost(message, tag = "3")]
350        Not(::prost::alloc::boxed::Box<super::RequestMatch>),
351        #[prost(message, tag = "4")]
352        Path(super::PathMatch),
353        /// TODO: match on arbitrary header
354        #[prost(message, tag = "5")]
355        Method(super::super::http_types::HttpMethod),
356    }
357}
358#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
359pub struct PathMatch {
360    /// Match if the request path matches this regex.
361    #[prost(string, tag = "1")]
362    pub regex: ::prost::alloc::string::String,
363}
364#[derive(Clone, PartialEq, ::prost::Message)]
365pub struct ResponseMatch {
366    #[prost(oneof = "response_match::Match", tags = "1, 2, 3, 4")]
367    pub r#match: ::core::option::Option<response_match::Match>,
368}
369/// Nested message and enum types in `ResponseMatch`.
370pub mod response_match {
371    #[derive(Clone, PartialEq, ::prost::Message)]
372    pub struct Seq {
373        #[prost(message, repeated, tag = "1")]
374        pub matches: ::prost::alloc::vec::Vec<super::ResponseMatch>,
375    }
376    #[derive(Clone, PartialEq, ::prost::Oneof)]
377    pub enum Match {
378        #[prost(message, tag = "1")]
379        All(Seq),
380        #[prost(message, tag = "2")]
381        Any(Seq),
382        #[prost(message, tag = "3")]
383        Not(::prost::alloc::boxed::Box<super::ResponseMatch>),
384        /// TODO: match on arbitrary header or trailer
385        #[prost(message, tag = "4")]
386        Status(super::HttpStatusRange),
387    }
388}
389/// If either a minimum or maximum is not specified, the range is considered to
390/// be over a discrete value.
391#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
392pub struct HttpStatusRange {
393    /// Minimum matching http status code (inclusive), if specified.
394    #[prost(uint32, tag = "1")]
395    pub min: u32,
396    /// Maximum matching http status code (inclusive), if specified.
397    #[prost(uint32, tag = "2")]
398    pub max: u32,
399}
400#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
401pub struct WeightedDst {
402    /// This authority will be used as the `path` in a call to the Destination.Get
403    /// rpc.
404    #[prost(string, tag = "1")]
405    pub authority: ::prost::alloc::string::String,
406    /// The proportion of requests to send to this destination.  This value is
407    /// relative to other weights in the same dst_overrides list.
408    #[prost(uint32, tag = "2")]
409    pub weight: u32,
410    /// A reference to the metadata for a Service resource.
411    #[prost(message, optional, tag = "3")]
412    pub backend_ref: ::core::option::Option<super::meta::Metadata>,
413}
414/// Generated client implementations.
415pub mod destination_client {
416    #![allow(
417        unused_variables,
418        dead_code,
419        missing_docs,
420        clippy::wildcard_imports,
421        clippy::let_unit_value,
422    )]
423    use tonic::codegen::*;
424    use tonic::codegen::http::Uri;
425    #[derive(Debug, Clone)]
426    pub struct DestinationClient<T> {
427        inner: tonic::client::Grpc<T>,
428    }
429    impl DestinationClient<tonic::transport::Channel> {
430        /// Attempt to create a new client by connecting to a given endpoint.
431        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
432        where
433            D: TryInto<tonic::transport::Endpoint>,
434            D::Error: Into<StdError>,
435        {
436            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
437            Ok(Self::new(conn))
438        }
439    }
440    impl<T> DestinationClient<T>
441    where
442        T: tonic::client::GrpcService<tonic::body::Body>,
443        T::Error: Into<StdError>,
444        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
445        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
446    {
447        pub fn new(inner: T) -> Self {
448            let inner = tonic::client::Grpc::new(inner);
449            Self { inner }
450        }
451        pub fn with_origin(inner: T, origin: Uri) -> Self {
452            let inner = tonic::client::Grpc::with_origin(inner, origin);
453            Self { inner }
454        }
455        pub fn with_interceptor<F>(
456            inner: T,
457            interceptor: F,
458        ) -> DestinationClient<InterceptedService<T, F>>
459        where
460            F: tonic::service::Interceptor,
461            T::ResponseBody: Default,
462            T: tonic::codegen::Service<
463                http::Request<tonic::body::Body>,
464                Response = http::Response<
465                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
466                >,
467            >,
468            <T as tonic::codegen::Service<
469                http::Request<tonic::body::Body>,
470            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
471        {
472            DestinationClient::new(InterceptedService::new(inner, interceptor))
473        }
474        /// Compress requests with the given encoding.
475        ///
476        /// This requires the server to support it otherwise it might respond with an
477        /// error.
478        #[must_use]
479        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
480            self.inner = self.inner.send_compressed(encoding);
481            self
482        }
483        /// Enable decompressing responses.
484        #[must_use]
485        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
486            self.inner = self.inner.accept_compressed(encoding);
487            self
488        }
489        /// Limits the maximum size of a decoded message.
490        ///
491        /// Default: `4MB`
492        #[must_use]
493        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
494            self.inner = self.inner.max_decoding_message_size(limit);
495            self
496        }
497        /// Limits the maximum size of an encoded message.
498        ///
499        /// Default: `usize::MAX`
500        #[must_use]
501        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
502            self.inner = self.inner.max_encoding_message_size(limit);
503            self
504        }
505        /// Given a destination, return all addresses in that destination as a long-
506        /// running stream of updates.
507        pub async fn get(
508            &mut self,
509            request: impl tonic::IntoRequest<super::GetDestination>,
510        ) -> std::result::Result<
511            tonic::Response<tonic::codec::Streaming<super::Update>>,
512            tonic::Status,
513        > {
514            self.inner
515                .ready()
516                .await
517                .map_err(|e| {
518                    tonic::Status::unknown(
519                        format!("Service was not ready: {}", e.into()),
520                    )
521                })?;
522            let codec = tonic_prost::ProstCodec::default();
523            let path = http::uri::PathAndQuery::from_static(
524                "/io.linkerd.proxy.destination.Destination/Get",
525            );
526            let mut req = request.into_request();
527            req.extensions_mut()
528                .insert(
529                    GrpcMethod::new("io.linkerd.proxy.destination.Destination", "Get"),
530                );
531            self.inner.server_streaming(req, path, codec).await
532        }
533        /// Given a destination, return that destination's profile and send an update
534        /// whenever it changes.
535        pub async fn get_profile(
536            &mut self,
537            request: impl tonic::IntoRequest<super::GetDestination>,
538        ) -> std::result::Result<
539            tonic::Response<tonic::codec::Streaming<super::DestinationProfile>>,
540            tonic::Status,
541        > {
542            self.inner
543                .ready()
544                .await
545                .map_err(|e| {
546                    tonic::Status::unknown(
547                        format!("Service was not ready: {}", e.into()),
548                    )
549                })?;
550            let codec = tonic_prost::ProstCodec::default();
551            let path = http::uri::PathAndQuery::from_static(
552                "/io.linkerd.proxy.destination.Destination/GetProfile",
553            );
554            let mut req = request.into_request();
555            req.extensions_mut()
556                .insert(
557                    GrpcMethod::new(
558                        "io.linkerd.proxy.destination.Destination",
559                        "GetProfile",
560                    ),
561                );
562            self.inner.server_streaming(req, path, codec).await
563        }
564    }
565}
566/// Generated server implementations.
567pub mod destination_server {
568    #![allow(
569        unused_variables,
570        dead_code,
571        missing_docs,
572        clippy::wildcard_imports,
573        clippy::let_unit_value,
574    )]
575    use tonic::codegen::*;
576    /// Generated trait containing gRPC methods that should be implemented for use with DestinationServer.
577    #[async_trait]
578    pub trait Destination: std::marker::Send + std::marker::Sync + 'static {
579        /// Server streaming response type for the Get method.
580        type GetStream: tonic::codegen::tokio_stream::Stream<
581                Item = std::result::Result<super::Update, tonic::Status>,
582            >
583            + std::marker::Send
584            + 'static;
585        /// Given a destination, return all addresses in that destination as a long-
586        /// running stream of updates.
587        async fn get(
588            &self,
589            request: tonic::Request<super::GetDestination>,
590        ) -> std::result::Result<tonic::Response<Self::GetStream>, tonic::Status>;
591        /// Server streaming response type for the GetProfile method.
592        type GetProfileStream: tonic::codegen::tokio_stream::Stream<
593                Item = std::result::Result<super::DestinationProfile, tonic::Status>,
594            >
595            + std::marker::Send
596            + 'static;
597        /// Given a destination, return that destination's profile and send an update
598        /// whenever it changes.
599        async fn get_profile(
600            &self,
601            request: tonic::Request<super::GetDestination>,
602        ) -> std::result::Result<tonic::Response<Self::GetProfileStream>, tonic::Status>;
603    }
604    #[derive(Debug)]
605    pub struct DestinationServer<T> {
606        inner: Arc<T>,
607        accept_compression_encodings: EnabledCompressionEncodings,
608        send_compression_encodings: EnabledCompressionEncodings,
609        max_decoding_message_size: Option<usize>,
610        max_encoding_message_size: Option<usize>,
611    }
612    impl<T> DestinationServer<T> {
613        pub fn new(inner: T) -> Self {
614            Self::from_arc(Arc::new(inner))
615        }
616        pub fn from_arc(inner: Arc<T>) -> Self {
617            Self {
618                inner,
619                accept_compression_encodings: Default::default(),
620                send_compression_encodings: Default::default(),
621                max_decoding_message_size: None,
622                max_encoding_message_size: None,
623            }
624        }
625        pub fn with_interceptor<F>(
626            inner: T,
627            interceptor: F,
628        ) -> InterceptedService<Self, F>
629        where
630            F: tonic::service::Interceptor,
631        {
632            InterceptedService::new(Self::new(inner), interceptor)
633        }
634        /// Enable decompressing requests with the given encoding.
635        #[must_use]
636        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
637            self.accept_compression_encodings.enable(encoding);
638            self
639        }
640        /// Compress responses with the given encoding, if the client supports it.
641        #[must_use]
642        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
643            self.send_compression_encodings.enable(encoding);
644            self
645        }
646        /// Limits the maximum size of a decoded message.
647        ///
648        /// Default: `4MB`
649        #[must_use]
650        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
651            self.max_decoding_message_size = Some(limit);
652            self
653        }
654        /// Limits the maximum size of an encoded message.
655        ///
656        /// Default: `usize::MAX`
657        #[must_use]
658        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
659            self.max_encoding_message_size = Some(limit);
660            self
661        }
662    }
663    impl<T, B> tonic::codegen::Service<http::Request<B>> for DestinationServer<T>
664    where
665        T: Destination,
666        B: Body + std::marker::Send + 'static,
667        B::Error: Into<StdError> + std::marker::Send + 'static,
668    {
669        type Response = http::Response<tonic::body::Body>;
670        type Error = std::convert::Infallible;
671        type Future = BoxFuture<Self::Response, Self::Error>;
672        fn poll_ready(
673            &mut self,
674            _cx: &mut Context<'_>,
675        ) -> Poll<std::result::Result<(), Self::Error>> {
676            Poll::Ready(Ok(()))
677        }
678        fn call(&mut self, req: http::Request<B>) -> Self::Future {
679            match req.uri().path() {
680                "/io.linkerd.proxy.destination.Destination/Get" => {
681                    #[allow(non_camel_case_types)]
682                    struct GetSvc<T: Destination>(pub Arc<T>);
683                    impl<
684                        T: Destination,
685                    > tonic::server::ServerStreamingService<super::GetDestination>
686                    for GetSvc<T> {
687                        type Response = super::Update;
688                        type ResponseStream = T::GetStream;
689                        type Future = BoxFuture<
690                            tonic::Response<Self::ResponseStream>,
691                            tonic::Status,
692                        >;
693                        fn call(
694                            &mut self,
695                            request: tonic::Request<super::GetDestination>,
696                        ) -> Self::Future {
697                            let inner = Arc::clone(&self.0);
698                            let fut = async move {
699                                <T as Destination>::get(&inner, request).await
700                            };
701                            Box::pin(fut)
702                        }
703                    }
704                    let accept_compression_encodings = self.accept_compression_encodings;
705                    let send_compression_encodings = self.send_compression_encodings;
706                    let max_decoding_message_size = self.max_decoding_message_size;
707                    let max_encoding_message_size = self.max_encoding_message_size;
708                    let inner = self.inner.clone();
709                    let fut = async move {
710                        let method = GetSvc(inner);
711                        let codec = tonic_prost::ProstCodec::default();
712                        let mut grpc = tonic::server::Grpc::new(codec)
713                            .apply_compression_config(
714                                accept_compression_encodings,
715                                send_compression_encodings,
716                            )
717                            .apply_max_message_size_config(
718                                max_decoding_message_size,
719                                max_encoding_message_size,
720                            );
721                        let res = grpc.server_streaming(method, req).await;
722                        Ok(res)
723                    };
724                    Box::pin(fut)
725                }
726                "/io.linkerd.proxy.destination.Destination/GetProfile" => {
727                    #[allow(non_camel_case_types)]
728                    struct GetProfileSvc<T: Destination>(pub Arc<T>);
729                    impl<
730                        T: Destination,
731                    > tonic::server::ServerStreamingService<super::GetDestination>
732                    for GetProfileSvc<T> {
733                        type Response = super::DestinationProfile;
734                        type ResponseStream = T::GetProfileStream;
735                        type Future = BoxFuture<
736                            tonic::Response<Self::ResponseStream>,
737                            tonic::Status,
738                        >;
739                        fn call(
740                            &mut self,
741                            request: tonic::Request<super::GetDestination>,
742                        ) -> Self::Future {
743                            let inner = Arc::clone(&self.0);
744                            let fut = async move {
745                                <T as Destination>::get_profile(&inner, request).await
746                            };
747                            Box::pin(fut)
748                        }
749                    }
750                    let accept_compression_encodings = self.accept_compression_encodings;
751                    let send_compression_encodings = self.send_compression_encodings;
752                    let max_decoding_message_size = self.max_decoding_message_size;
753                    let max_encoding_message_size = self.max_encoding_message_size;
754                    let inner = self.inner.clone();
755                    let fut = async move {
756                        let method = GetProfileSvc(inner);
757                        let codec = tonic_prost::ProstCodec::default();
758                        let mut grpc = tonic::server::Grpc::new(codec)
759                            .apply_compression_config(
760                                accept_compression_encodings,
761                                send_compression_encodings,
762                            )
763                            .apply_max_message_size_config(
764                                max_decoding_message_size,
765                                max_encoding_message_size,
766                            );
767                        let res = grpc.server_streaming(method, req).await;
768                        Ok(res)
769                    };
770                    Box::pin(fut)
771                }
772                _ => {
773                    Box::pin(async move {
774                        let mut response = http::Response::new(
775                            tonic::body::Body::default(),
776                        );
777                        let headers = response.headers_mut();
778                        headers
779                            .insert(
780                                tonic::Status::GRPC_STATUS,
781                                (tonic::Code::Unimplemented as i32).into(),
782                            );
783                        headers
784                            .insert(
785                                http::header::CONTENT_TYPE,
786                                tonic::metadata::GRPC_CONTENT_TYPE,
787                            );
788                        Ok(response)
789                    })
790                }
791            }
792        }
793    }
794    impl<T> Clone for DestinationServer<T> {
795        fn clone(&self) -> Self {
796            let inner = self.inner.clone();
797            Self {
798                inner,
799                accept_compression_encodings: self.accept_compression_encodings,
800                send_compression_encodings: self.send_compression_encodings,
801                max_decoding_message_size: self.max_decoding_message_size,
802                max_encoding_message_size: self.max_encoding_message_size,
803            }
804        }
805    }
806    /// Generated gRPC service name
807    pub const SERVICE_NAME: &str = "io.linkerd.proxy.destination.Destination";
808    impl<T> tonic::server::NamedService for DestinationServer<T> {
809        const NAME: &'static str = SERVICE_NAME;
810    }
811}