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

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::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, ::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, ::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, ::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, ::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, ::prost::Message)]
126pub struct AuthorityOverride {
127    #[prost(string, tag = "1")]
128    pub authority_override: ::prost::alloc::string::String,
129}
130#[derive(Clone, Copy, PartialEq, ::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, ::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, ::prost::Message)]
149    pub struct H2 {}
150    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
151    pub struct Opaque {}
152    #[derive(Clone, Copy, PartialEq, ::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, ::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, ::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, ::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, ::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, ::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, ::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, ::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, ::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<T> DestinationClient<T>
430    where
431        T: tonic::client::GrpcService<tonic::body::Body>,
432        T::Error: Into<StdError>,
433        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
434        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
435    {
436        pub fn new(inner: T) -> Self {
437            let inner = tonic::client::Grpc::new(inner);
438            Self { inner }
439        }
440        pub fn with_origin(inner: T, origin: Uri) -> Self {
441            let inner = tonic::client::Grpc::with_origin(inner, origin);
442            Self { inner }
443        }
444        pub fn with_interceptor<F>(
445            inner: T,
446            interceptor: F,
447        ) -> DestinationClient<InterceptedService<T, F>>
448        where
449            F: tonic::service::Interceptor,
450            T::ResponseBody: Default,
451            T: tonic::codegen::Service<
452                http::Request<tonic::body::Body>,
453                Response = http::Response<
454                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
455                >,
456            >,
457            <T as tonic::codegen::Service<
458                http::Request<tonic::body::Body>,
459            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
460        {
461            DestinationClient::new(InterceptedService::new(inner, interceptor))
462        }
463        /// Compress requests with the given encoding.
464        ///
465        /// This requires the server to support it otherwise it might respond with an
466        /// error.
467        #[must_use]
468        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
469            self.inner = self.inner.send_compressed(encoding);
470            self
471        }
472        /// Enable decompressing responses.
473        #[must_use]
474        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
475            self.inner = self.inner.accept_compressed(encoding);
476            self
477        }
478        /// Limits the maximum size of a decoded message.
479        ///
480        /// Default: `4MB`
481        #[must_use]
482        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
483            self.inner = self.inner.max_decoding_message_size(limit);
484            self
485        }
486        /// Limits the maximum size of an encoded message.
487        ///
488        /// Default: `usize::MAX`
489        #[must_use]
490        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
491            self.inner = self.inner.max_encoding_message_size(limit);
492            self
493        }
494        /// Given a destination, return all addresses in that destination as a long-
495        /// running stream of updates.
496        pub async fn get(
497            &mut self,
498            request: impl tonic::IntoRequest<super::GetDestination>,
499        ) -> std::result::Result<
500            tonic::Response<tonic::codec::Streaming<super::Update>>,
501            tonic::Status,
502        > {
503            self.inner
504                .ready()
505                .await
506                .map_err(|e| {
507                    tonic::Status::unknown(
508                        format!("Service was not ready: {}", e.into()),
509                    )
510                })?;
511            let codec = tonic::codec::ProstCodec::default();
512            let path = http::uri::PathAndQuery::from_static(
513                "/io.linkerd.proxy.destination.Destination/Get",
514            );
515            let mut req = request.into_request();
516            req.extensions_mut()
517                .insert(
518                    GrpcMethod::new("io.linkerd.proxy.destination.Destination", "Get"),
519                );
520            self.inner.server_streaming(req, path, codec).await
521        }
522        /// Given a destination, return that destination's profile and send an update
523        /// whenever it changes.
524        pub async fn get_profile(
525            &mut self,
526            request: impl tonic::IntoRequest<super::GetDestination>,
527        ) -> std::result::Result<
528            tonic::Response<tonic::codec::Streaming<super::DestinationProfile>>,
529            tonic::Status,
530        > {
531            self.inner
532                .ready()
533                .await
534                .map_err(|e| {
535                    tonic::Status::unknown(
536                        format!("Service was not ready: {}", e.into()),
537                    )
538                })?;
539            let codec = tonic::codec::ProstCodec::default();
540            let path = http::uri::PathAndQuery::from_static(
541                "/io.linkerd.proxy.destination.Destination/GetProfile",
542            );
543            let mut req = request.into_request();
544            req.extensions_mut()
545                .insert(
546                    GrpcMethod::new(
547                        "io.linkerd.proxy.destination.Destination",
548                        "GetProfile",
549                    ),
550                );
551            self.inner.server_streaming(req, path, codec).await
552        }
553    }
554}
555/// Generated server implementations.
556pub mod destination_server {
557    #![allow(
558        unused_variables,
559        dead_code,
560        missing_docs,
561        clippy::wildcard_imports,
562        clippy::let_unit_value,
563    )]
564    use tonic::codegen::*;
565    /// Generated trait containing gRPC methods that should be implemented for use with DestinationServer.
566    #[async_trait]
567    pub trait Destination: std::marker::Send + std::marker::Sync + 'static {
568        /// Server streaming response type for the Get method.
569        type GetStream: tonic::codegen::tokio_stream::Stream<
570                Item = std::result::Result<super::Update, tonic::Status>,
571            >
572            + std::marker::Send
573            + 'static;
574        /// Given a destination, return all addresses in that destination as a long-
575        /// running stream of updates.
576        async fn get(
577            &self,
578            request: tonic::Request<super::GetDestination>,
579        ) -> std::result::Result<tonic::Response<Self::GetStream>, tonic::Status>;
580        /// Server streaming response type for the GetProfile method.
581        type GetProfileStream: tonic::codegen::tokio_stream::Stream<
582                Item = std::result::Result<super::DestinationProfile, tonic::Status>,
583            >
584            + std::marker::Send
585            + 'static;
586        /// Given a destination, return that destination's profile and send an update
587        /// whenever it changes.
588        async fn get_profile(
589            &self,
590            request: tonic::Request<super::GetDestination>,
591        ) -> std::result::Result<tonic::Response<Self::GetProfileStream>, tonic::Status>;
592    }
593    #[derive(Debug)]
594    pub struct DestinationServer<T> {
595        inner: Arc<T>,
596        accept_compression_encodings: EnabledCompressionEncodings,
597        send_compression_encodings: EnabledCompressionEncodings,
598        max_decoding_message_size: Option<usize>,
599        max_encoding_message_size: Option<usize>,
600    }
601    impl<T> DestinationServer<T> {
602        pub fn new(inner: T) -> Self {
603            Self::from_arc(Arc::new(inner))
604        }
605        pub fn from_arc(inner: Arc<T>) -> Self {
606            Self {
607                inner,
608                accept_compression_encodings: Default::default(),
609                send_compression_encodings: Default::default(),
610                max_decoding_message_size: None,
611                max_encoding_message_size: None,
612            }
613        }
614        pub fn with_interceptor<F>(
615            inner: T,
616            interceptor: F,
617        ) -> InterceptedService<Self, F>
618        where
619            F: tonic::service::Interceptor,
620        {
621            InterceptedService::new(Self::new(inner), interceptor)
622        }
623        /// Enable decompressing requests with the given encoding.
624        #[must_use]
625        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
626            self.accept_compression_encodings.enable(encoding);
627            self
628        }
629        /// Compress responses with the given encoding, if the client supports it.
630        #[must_use]
631        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
632            self.send_compression_encodings.enable(encoding);
633            self
634        }
635        /// Limits the maximum size of a decoded message.
636        ///
637        /// Default: `4MB`
638        #[must_use]
639        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
640            self.max_decoding_message_size = Some(limit);
641            self
642        }
643        /// Limits the maximum size of an encoded message.
644        ///
645        /// Default: `usize::MAX`
646        #[must_use]
647        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
648            self.max_encoding_message_size = Some(limit);
649            self
650        }
651    }
652    impl<T, B> tonic::codegen::Service<http::Request<B>> for DestinationServer<T>
653    where
654        T: Destination,
655        B: Body + std::marker::Send + 'static,
656        B::Error: Into<StdError> + std::marker::Send + 'static,
657    {
658        type Response = http::Response<tonic::body::Body>;
659        type Error = std::convert::Infallible;
660        type Future = BoxFuture<Self::Response, Self::Error>;
661        fn poll_ready(
662            &mut self,
663            _cx: &mut Context<'_>,
664        ) -> Poll<std::result::Result<(), Self::Error>> {
665            Poll::Ready(Ok(()))
666        }
667        fn call(&mut self, req: http::Request<B>) -> Self::Future {
668            match req.uri().path() {
669                "/io.linkerd.proxy.destination.Destination/Get" => {
670                    #[allow(non_camel_case_types)]
671                    struct GetSvc<T: Destination>(pub Arc<T>);
672                    impl<
673                        T: Destination,
674                    > tonic::server::ServerStreamingService<super::GetDestination>
675                    for GetSvc<T> {
676                        type Response = super::Update;
677                        type ResponseStream = T::GetStream;
678                        type Future = BoxFuture<
679                            tonic::Response<Self::ResponseStream>,
680                            tonic::Status,
681                        >;
682                        fn call(
683                            &mut self,
684                            request: tonic::Request<super::GetDestination>,
685                        ) -> Self::Future {
686                            let inner = Arc::clone(&self.0);
687                            let fut = async move {
688                                <T as Destination>::get(&inner, request).await
689                            };
690                            Box::pin(fut)
691                        }
692                    }
693                    let accept_compression_encodings = self.accept_compression_encodings;
694                    let send_compression_encodings = self.send_compression_encodings;
695                    let max_decoding_message_size = self.max_decoding_message_size;
696                    let max_encoding_message_size = self.max_encoding_message_size;
697                    let inner = self.inner.clone();
698                    let fut = async move {
699                        let method = GetSvc(inner);
700                        let codec = tonic::codec::ProstCodec::default();
701                        let mut grpc = tonic::server::Grpc::new(codec)
702                            .apply_compression_config(
703                                accept_compression_encodings,
704                                send_compression_encodings,
705                            )
706                            .apply_max_message_size_config(
707                                max_decoding_message_size,
708                                max_encoding_message_size,
709                            );
710                        let res = grpc.server_streaming(method, req).await;
711                        Ok(res)
712                    };
713                    Box::pin(fut)
714                }
715                "/io.linkerd.proxy.destination.Destination/GetProfile" => {
716                    #[allow(non_camel_case_types)]
717                    struct GetProfileSvc<T: Destination>(pub Arc<T>);
718                    impl<
719                        T: Destination,
720                    > tonic::server::ServerStreamingService<super::GetDestination>
721                    for GetProfileSvc<T> {
722                        type Response = super::DestinationProfile;
723                        type ResponseStream = T::GetProfileStream;
724                        type Future = BoxFuture<
725                            tonic::Response<Self::ResponseStream>,
726                            tonic::Status,
727                        >;
728                        fn call(
729                            &mut self,
730                            request: tonic::Request<super::GetDestination>,
731                        ) -> Self::Future {
732                            let inner = Arc::clone(&self.0);
733                            let fut = async move {
734                                <T as Destination>::get_profile(&inner, request).await
735                            };
736                            Box::pin(fut)
737                        }
738                    }
739                    let accept_compression_encodings = self.accept_compression_encodings;
740                    let send_compression_encodings = self.send_compression_encodings;
741                    let max_decoding_message_size = self.max_decoding_message_size;
742                    let max_encoding_message_size = self.max_encoding_message_size;
743                    let inner = self.inner.clone();
744                    let fut = async move {
745                        let method = GetProfileSvc(inner);
746                        let codec = tonic::codec::ProstCodec::default();
747                        let mut grpc = tonic::server::Grpc::new(codec)
748                            .apply_compression_config(
749                                accept_compression_encodings,
750                                send_compression_encodings,
751                            )
752                            .apply_max_message_size_config(
753                                max_decoding_message_size,
754                                max_encoding_message_size,
755                            );
756                        let res = grpc.server_streaming(method, req).await;
757                        Ok(res)
758                    };
759                    Box::pin(fut)
760                }
761                _ => {
762                    Box::pin(async move {
763                        let mut response = http::Response::new(
764                            tonic::body::Body::default(),
765                        );
766                        let headers = response.headers_mut();
767                        headers
768                            .insert(
769                                tonic::Status::GRPC_STATUS,
770                                (tonic::Code::Unimplemented as i32).into(),
771                            );
772                        headers
773                            .insert(
774                                http::header::CONTENT_TYPE,
775                                tonic::metadata::GRPC_CONTENT_TYPE,
776                            );
777                        Ok(response)
778                    })
779                }
780            }
781        }
782    }
783    impl<T> Clone for DestinationServer<T> {
784        fn clone(&self) -> Self {
785            let inner = self.inner.clone();
786            Self {
787                inner,
788                accept_compression_encodings: self.accept_compression_encodings,
789                send_compression_encodings: self.send_compression_encodings,
790                max_decoding_message_size: self.max_decoding_message_size,
791                max_encoding_message_size: self.max_encoding_message_size,
792            }
793        }
794    }
795    /// Generated gRPC service name
796    pub const SERVICE_NAME: &str = "io.linkerd.proxy.destination.Destination";
797    impl<T> tonic::server::NamedService for DestinationServer<T> {
798        const NAME: &'static str = SERVICE_NAME;
799    }
800}