1#[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 #[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}
22pub mod update {
24 #[derive(Clone, PartialEq, ::prost::Oneof)]
25 pub enum Update {
26 #[prost(message, tag = "1")]
29 Add(super::WeightedAddrSet),
30 #[prost(message, tag = "2")]
32 Remove(super::AddrSet),
33 #[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 #[prost(message, optional, tag = "8")]
79 pub http2: ::core::option::Option<Http2ClientParams>,
80 #[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 #[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}
95pub mod tls_identity {
97 #[derive(Clone, PartialEq, ::prost::Message)]
99 pub struct DnsLikeIdentity {
100 #[prost(string, tag = "1")]
105 pub name: ::prost::alloc::string::String,
106 }
107 #[derive(Clone, PartialEq, ::prost::Message)]
109 pub struct UriLikeIdentity {
110 #[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#[derive(Clone, Copy, PartialEq, ::prost::Message)]
138pub struct ProtocolHint {
139 #[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}
146pub 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 #[prost(uint32, tag = "1")]
156 pub inbound_port: u32,
157 }
158 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
159 pub enum Protocol {
160 #[prost(message, tag = "1")]
163 H2(H2),
164 #[prost(message, tag = "3")]
168 Opaque(Opaque),
169 }
170}
171#[derive(Clone, Copy, PartialEq, ::prost::Message)]
173pub struct Http2ClientParams {
174 #[prost(message, optional, tag = "1")]
176 pub flow_control: ::core::option::Option<http2_client_params::FlowControl>,
177 #[prost(message, optional, tag = "2")]
179 pub keep_alive: ::core::option::Option<http2_client_params::KeepAlive>,
180 #[prost(message, optional, tag = "3")]
182 pub internals: ::core::option::Option<http2_client_params::Internals>,
183}
184pub mod http2_client_params {
186 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
187 pub struct FlowControl {
188 #[prost(uint32, tag = "1")]
190 pub initial_connection_window_size: u32,
191 #[prost(uint32, tag = "2")]
193 pub initial_stream_window_size: u32,
194 #[prost(bool, tag = "3")]
196 pub adaptive_flow_control: bool,
197 }
198 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
199 pub struct KeepAlive {
200 #[prost(message, optional, tag = "1")]
202 pub interval: ::core::option::Option<::prost_types::Duration>,
203 #[prost(message, optional, tag = "2")]
206 pub timeout: ::core::option::Option<::prost_types::Duration>,
207 #[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 #[prost(string, tag = "5")]
236 pub fully_qualified_name: ::prost::alloc::string::String,
237 #[prost(bool, tag = "4")]
241 pub opaque_protocol: bool,
242 #[prost(message, repeated, tag = "1")]
245 pub routes: ::prost::alloc::vec::Vec<Route>,
246 #[prost(message, optional, tag = "2")]
250 pub retry_budget: ::core::option::Option<RetryBudget>,
251 #[prost(message, repeated, tag = "3")]
256 pub dst_overrides: ::prost::alloc::vec::Vec<WeightedDst>,
257 #[prost(message, optional, tag = "6")]
265 pub endpoint: ::core::option::Option<WeightedAddr>,
266 #[prost(message, optional, tag = "7")]
269 pub parent_ref: ::core::option::Option<super::meta::Metadata>,
270 #[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 #[prost(message, optional, tag = "1")]
279 pub condition: ::core::option::Option<RequestMatch>,
280 #[prost(message, repeated, tag = "2")]
284 pub response_classes: ::prost::alloc::vec::Vec<ResponseClass>,
285 #[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 #[prost(bool, tag = "4")]
294 pub is_retryable: bool,
295 #[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 #[prost(float, tag = "1")]
309 pub retry_ratio: f32,
310 #[prost(uint32, tag = "2")]
314 pub min_retries_per_second: u32,
315 #[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 #[prost(message, optional, tag = "1")]
325 pub condition: ::core::option::Option<ResponseMatch>,
326 #[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}
336pub 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 #[prost(message, tag = "5")]
355 Method(super::super::http_types::HttpMethod),
356 }
357}
358#[derive(Clone, PartialEq, ::prost::Message)]
359pub struct PathMatch {
360 #[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}
369pub 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 #[prost(message, tag = "4")]
386 Status(super::HttpStatusRange),
387 }
388}
389#[derive(Clone, Copy, PartialEq, ::prost::Message)]
392pub struct HttpStatusRange {
393 #[prost(uint32, tag = "1")]
395 pub min: u32,
396 #[prost(uint32, tag = "2")]
398 pub max: u32,
399}
400#[derive(Clone, PartialEq, ::prost::Message)]
401pub struct WeightedDst {
402 #[prost(string, tag = "1")]
405 pub authority: ::prost::alloc::string::String,
406 #[prost(uint32, tag = "2")]
409 pub weight: u32,
410 #[prost(message, optional, tag = "3")]
412 pub backend_ref: ::core::option::Option<super::meta::Metadata>,
413}
414pub 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 #[must_use]
468 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
469 self.inner = self.inner.send_compressed(encoding);
470 self
471 }
472 #[must_use]
474 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
475 self.inner = self.inner.accept_compressed(encoding);
476 self
477 }
478 #[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 #[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 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 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}
555pub 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 #[async_trait]
567 pub trait Destination: std::marker::Send + std::marker::Sync + 'static {
568 type GetStream: tonic::codegen::tokio_stream::Stream<
570 Item = std::result::Result<super::Update, tonic::Status>,
571 >
572 + std::marker::Send
573 + 'static;
574 async fn get(
577 &self,
578 request: tonic::Request<super::GetDestination>,
579 ) -> std::result::Result<tonic::Response<Self::GetStream>, tonic::Status>;
580 type GetProfileStream: tonic::codegen::tokio_stream::Stream<
582 Item = std::result::Result<super::DestinationProfile, tonic::Status>,
583 >
584 + std::marker::Send
585 + 'static;
586 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 #[must_use]
625 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
626 self.accept_compression_encodings.enable(encoding);
627 self
628 }
629 #[must_use]
631 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
632 self.send_compression_encodings.enable(encoding);
633 self
634 }
635 #[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 #[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 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}