1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct PortSpec {
4 #[prost(string, tag = "1")]
6 pub workload: ::prost::alloc::string::String,
7 #[prost(uint32, tag = "2")]
9 pub port: u32,
10}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct Server {
13 #[prost(message, optional, tag = "1")]
16 pub protocol: ::core::option::Option<ProxyProtocol>,
17 #[prost(message, repeated, tag = "2")]
20 pub server_ips: ::prost::alloc::vec::Vec<super::net::IpAddress>,
21 #[prost(message, repeated, tag = "3")]
25 pub authorizations: ::prost::alloc::vec::Vec<Authz>,
26 #[prost(map = "string, string", tag = "4")]
31 pub labels: ::std::collections::HashMap<
32 ::prost::alloc::string::String,
33 ::prost::alloc::string::String,
34 >,
35}
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct ProxyProtocol {
38 #[prost(oneof = "proxy_protocol::Kind", tags = "1, 2, 3, 4, 5, 6")]
39 pub kind: ::core::option::Option<proxy_protocol::Kind>,
40}
41pub mod proxy_protocol {
43 #[derive(Clone, PartialEq, ::prost::Message)]
44 pub struct Detect {
45 #[prost(message, optional, tag = "1")]
46 pub timeout: ::core::option::Option<::prost_types::Duration>,
47 #[prost(message, repeated, tag = "3")]
50 pub http_routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
51 #[prost(message, optional, tag = "4")]
53 pub http_local_rate_limit: ::core::option::Option<super::HttpLocalRateLimit>,
54 }
55 #[derive(Clone, PartialEq, ::prost::Message)]
56 pub struct Http1 {
57 #[prost(message, repeated, tag = "2")]
58 pub routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
59 #[prost(message, optional, tag = "3")]
60 pub local_rate_limit: ::core::option::Option<super::HttpLocalRateLimit>,
61 }
62 #[derive(Clone, PartialEq, ::prost::Message)]
63 pub struct Http2 {
64 #[prost(message, repeated, tag = "2")]
65 pub routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
66 #[prost(message, optional, tag = "3")]
67 pub local_rate_limit: ::core::option::Option<super::HttpLocalRateLimit>,
68 }
69 #[derive(Clone, PartialEq, ::prost::Message)]
70 pub struct Grpc {
71 #[prost(message, repeated, tag = "2")]
72 pub routes: ::prost::alloc::vec::Vec<super::GrpcRoute>,
73 }
74 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
76 pub struct Opaque {}
77 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
78 pub struct Tls {}
79 #[derive(Clone, PartialEq, ::prost::Oneof)]
80 pub enum Kind {
81 #[prost(message, tag = "1")]
82 Detect(Detect),
83 #[prost(message, tag = "2")]
84 Opaque(Opaque),
85 #[prost(message, tag = "3")]
86 Tls(Tls),
87 #[prost(message, tag = "4")]
88 Http1(Http1),
89 #[prost(message, tag = "5")]
90 Http2(Http2),
91 #[prost(message, tag = "6")]
92 Grpc(Grpc),
93 }
94}
95#[derive(Clone, PartialEq, ::prost::Message)]
96pub struct Authz {
97 #[prost(message, repeated, tag = "1")]
103 pub networks: ::prost::alloc::vec::Vec<Network>,
104 #[prost(message, optional, tag = "2")]
106 pub authentication: ::core::option::Option<Authn>,
107 #[prost(map = "string, string", tag = "3")]
116 pub labels: ::std::collections::HashMap<
117 ::prost::alloc::string::String,
118 ::prost::alloc::string::String,
119 >,
120 #[prost(message, optional, tag = "4")]
123 pub metadata: ::core::option::Option<super::meta::Metadata>,
124}
125#[derive(Clone, PartialEq, ::prost::Message)]
127pub struct Network {
128 #[prost(message, optional, tag = "1")]
129 pub net: ::core::option::Option<super::net::IpNetwork>,
130 #[prost(message, repeated, tag = "2")]
131 pub except: ::prost::alloc::vec::Vec<super::net::IpNetwork>,
132}
133#[derive(Clone, PartialEq, ::prost::Message)]
134pub struct Authn {
135 #[prost(oneof = "authn::Permit", tags = "1, 2")]
136 pub permit: ::core::option::Option<authn::Permit>,
137}
138pub mod authn {
140 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
141 pub struct PermitUnauthenticated {}
142 #[derive(Clone, PartialEq, ::prost::Message)]
143 pub struct PermitMeshTls {
144 #[prost(oneof = "permit_mesh_tls::Clients", tags = "1, 2")]
145 pub clients: ::core::option::Option<permit_mesh_tls::Clients>,
146 }
147 pub mod permit_mesh_tls {
149 #[derive(Clone, PartialEq, ::prost::Message)]
150 pub struct PermitClientIdentities {
151 #[prost(message, repeated, tag = "1")]
153 pub identities: ::prost::alloc::vec::Vec<super::super::Identity>,
154 #[prost(message, repeated, tag = "2")]
158 pub suffixes: ::prost::alloc::vec::Vec<super::super::IdentitySuffix>,
159 }
160 #[derive(Clone, PartialEq, ::prost::Oneof)]
161 pub enum Clients {
162 #[prost(message, tag = "1")]
164 Unauthenticated(super::PermitUnauthenticated),
165 #[prost(message, tag = "2")]
168 Identities(PermitClientIdentities),
169 }
170 }
171 #[derive(Clone, PartialEq, ::prost::Oneof)]
172 pub enum Permit {
173 #[prost(message, tag = "1")]
174 Unauthenticated(PermitUnauthenticated),
175 #[prost(message, tag = "2")]
177 MeshTls(PermitMeshTls),
178 }
179}
180#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
181pub struct Identity {
182 #[prost(string, tag = "1")]
183 pub name: ::prost::alloc::string::String,
184}
185#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
189pub struct IdentitySuffix {
190 #[prost(string, repeated, tag = "1")]
191 pub parts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
192}
193#[derive(Clone, PartialEq, ::prost::Message)]
196pub struct HttpRoute {
197 #[prost(message, optional, tag = "1")]
198 pub metadata: ::core::option::Option<super::meta::Metadata>,
199 #[prost(message, repeated, tag = "2")]
201 pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
202 #[prost(message, repeated, tag = "3")]
205 pub authorizations: ::prost::alloc::vec::Vec<Authz>,
206 #[prost(message, repeated, tag = "4")]
208 pub rules: ::prost::alloc::vec::Vec<http_route::Rule>,
209}
210pub mod http_route {
212 #[derive(Clone, PartialEq, ::prost::Message)]
213 pub struct Rule {
214 #[prost(message, repeated, tag = "1")]
215 pub matches: ::prost::alloc::vec::Vec<super::super::http_route::HttpRouteMatch>,
216 #[prost(message, repeated, tag = "2")]
217 pub filters: ::prost::alloc::vec::Vec<Filter>,
218 }
219 #[derive(Clone, PartialEq, ::prost::Message)]
220 pub struct Filter {
221 #[prost(oneof = "filter::Kind", tags = "1, 2, 3")]
222 pub kind: ::core::option::Option<filter::Kind>,
223 }
224 pub mod filter {
226 #[derive(Clone, PartialEq, ::prost::Oneof)]
227 pub enum Kind {
228 #[prost(message, tag = "1")]
229 FailureInjector(super::super::super::http_route::HttpFailureInjector),
230 #[prost(message, tag = "2")]
231 RequestHeaderModifier(
232 super::super::super::http_route::RequestHeaderModifier,
233 ),
234 #[prost(message, tag = "3")]
235 Redirect(super::super::super::http_route::RequestRedirect),
236 }
237 }
238}
239#[derive(Clone, PartialEq, ::prost::Message)]
241pub struct GrpcRoute {
242 #[prost(message, optional, tag = "1")]
243 pub metadata: ::core::option::Option<super::meta::Metadata>,
244 #[prost(message, repeated, tag = "2")]
246 pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
247 #[prost(message, repeated, tag = "3")]
250 pub authorizations: ::prost::alloc::vec::Vec<Authz>,
251 #[prost(message, repeated, tag = "4")]
253 pub rules: ::prost::alloc::vec::Vec<grpc_route::Rule>,
254}
255pub mod grpc_route {
257 #[derive(Clone, PartialEq, ::prost::Message)]
258 pub struct Rule {
259 #[prost(message, repeated, tag = "1")]
260 pub matches: ::prost::alloc::vec::Vec<super::super::grpc_route::GrpcRouteMatch>,
261 #[prost(message, repeated, tag = "2")]
262 pub filters: ::prost::alloc::vec::Vec<Filter>,
263 }
264 #[derive(Clone, PartialEq, ::prost::Message)]
265 pub struct Filter {
266 #[prost(oneof = "filter::Kind", tags = "1, 2")]
267 pub kind: ::core::option::Option<filter::Kind>,
268 }
269 pub mod filter {
271 #[derive(Clone, PartialEq, ::prost::Oneof)]
272 pub enum Kind {
273 #[prost(message, tag = "1")]
274 FailureInjector(super::super::super::grpc_route::GrpcFailureInjector),
275 #[prost(message, tag = "2")]
276 RequestHeaderModifier(
277 super::super::super::http_route::RequestHeaderModifier,
278 ),
279 }
280 }
281}
282#[derive(Clone, PartialEq, ::prost::Message)]
283pub struct HttpLocalRateLimit {
284 #[prost(message, optional, tag = "1")]
286 pub metadata: ::core::option::Option<super::meta::Metadata>,
287 #[prost(message, optional, tag = "2")]
290 pub total: ::core::option::Option<http_local_rate_limit::Limit>,
291 #[prost(message, optional, tag = "3")]
294 pub identity: ::core::option::Option<http_local_rate_limit::Limit>,
295 #[prost(message, repeated, tag = "4")]
297 pub overrides: ::prost::alloc::vec::Vec<http_local_rate_limit::Override>,
298}
299pub mod http_local_rate_limit {
301 #[derive(Clone, PartialEq, ::prost::Message)]
302 pub struct Override {
303 #[prost(message, optional, tag = "1")]
304 pub limit: ::core::option::Option<Limit>,
305 #[prost(message, optional, tag = "2")]
306 pub clients: ::core::option::Option<r#override::ClientIdentities>,
307 }
308 pub mod r#override {
310 #[derive(Clone, PartialEq, ::prost::Message)]
311 pub struct ClientIdentities {
312 #[prost(message, repeated, tag = "1")]
314 pub identities: ::prost::alloc::vec::Vec<super::super::Identity>,
315 }
316 }
317 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
318 pub struct Limit {
319 #[prost(uint32, tag = "1")]
320 pub requests_per_second: u32,
321 }
322}
323pub mod inbound_server_policies_client {
325 #![allow(
326 unused_variables,
327 dead_code,
328 missing_docs,
329 clippy::wildcard_imports,
330 clippy::let_unit_value,
331 )]
332 use tonic::codegen::*;
333 use tonic::codegen::http::Uri;
334 #[derive(Debug, Clone)]
342 pub struct InboundServerPoliciesClient<T> {
343 inner: tonic::client::Grpc<T>,
344 }
345 impl InboundServerPoliciesClient<tonic::transport::Channel> {
346 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
348 where
349 D: TryInto<tonic::transport::Endpoint>,
350 D::Error: Into<StdError>,
351 {
352 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
353 Ok(Self::new(conn))
354 }
355 }
356 impl<T> InboundServerPoliciesClient<T>
357 where
358 T: tonic::client::GrpcService<tonic::body::Body>,
359 T::Error: Into<StdError>,
360 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
361 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
362 {
363 pub fn new(inner: T) -> Self {
364 let inner = tonic::client::Grpc::new(inner);
365 Self { inner }
366 }
367 pub fn with_origin(inner: T, origin: Uri) -> Self {
368 let inner = tonic::client::Grpc::with_origin(inner, origin);
369 Self { inner }
370 }
371 pub fn with_interceptor<F>(
372 inner: T,
373 interceptor: F,
374 ) -> InboundServerPoliciesClient<InterceptedService<T, F>>
375 where
376 F: tonic::service::Interceptor,
377 T::ResponseBody: Default,
378 T: tonic::codegen::Service<
379 http::Request<tonic::body::Body>,
380 Response = http::Response<
381 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
382 >,
383 >,
384 <T as tonic::codegen::Service<
385 http::Request<tonic::body::Body>,
386 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
387 {
388 InboundServerPoliciesClient::new(InterceptedService::new(inner, interceptor))
389 }
390 #[must_use]
395 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
396 self.inner = self.inner.send_compressed(encoding);
397 self
398 }
399 #[must_use]
401 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
402 self.inner = self.inner.accept_compressed(encoding);
403 self
404 }
405 #[must_use]
409 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
410 self.inner = self.inner.max_decoding_message_size(limit);
411 self
412 }
413 #[must_use]
417 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
418 self.inner = self.inner.max_encoding_message_size(limit);
419 self
420 }
421 pub async fn get_port(
423 &mut self,
424 request: impl tonic::IntoRequest<super::PortSpec>,
425 ) -> std::result::Result<tonic::Response<super::Server>, tonic::Status> {
426 self.inner
427 .ready()
428 .await
429 .map_err(|e| {
430 tonic::Status::unknown(
431 format!("Service was not ready: {}", e.into()),
432 )
433 })?;
434 let codec = tonic_prost::ProstCodec::default();
435 let path = http::uri::PathAndQuery::from_static(
436 "/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort",
437 );
438 let mut req = request.into_request();
439 req.extensions_mut()
440 .insert(
441 GrpcMethod::new(
442 "io.linkerd.proxy.inbound.InboundServerPolicies",
443 "GetPort",
444 ),
445 );
446 self.inner.unary(req, path, codec).await
447 }
448 pub async fn watch_port(
450 &mut self,
451 request: impl tonic::IntoRequest<super::PortSpec>,
452 ) -> std::result::Result<
453 tonic::Response<tonic::codec::Streaming<super::Server>>,
454 tonic::Status,
455 > {
456 self.inner
457 .ready()
458 .await
459 .map_err(|e| {
460 tonic::Status::unknown(
461 format!("Service was not ready: {}", e.into()),
462 )
463 })?;
464 let codec = tonic_prost::ProstCodec::default();
465 let path = http::uri::PathAndQuery::from_static(
466 "/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort",
467 );
468 let mut req = request.into_request();
469 req.extensions_mut()
470 .insert(
471 GrpcMethod::new(
472 "io.linkerd.proxy.inbound.InboundServerPolicies",
473 "WatchPort",
474 ),
475 );
476 self.inner.server_streaming(req, path, codec).await
477 }
478 }
479}
480pub mod inbound_server_policies_server {
482 #![allow(
483 unused_variables,
484 dead_code,
485 missing_docs,
486 clippy::wildcard_imports,
487 clippy::let_unit_value,
488 )]
489 use tonic::codegen::*;
490 #[async_trait]
492 pub trait InboundServerPolicies: std::marker::Send + std::marker::Sync + 'static {
493 async fn get_port(
495 &self,
496 request: tonic::Request<super::PortSpec>,
497 ) -> std::result::Result<tonic::Response<super::Server>, tonic::Status>;
498 type WatchPortStream: tonic::codegen::tokio_stream::Stream<
500 Item = std::result::Result<super::Server, tonic::Status>,
501 >
502 + std::marker::Send
503 + 'static;
504 async fn watch_port(
506 &self,
507 request: tonic::Request<super::PortSpec>,
508 ) -> std::result::Result<tonic::Response<Self::WatchPortStream>, tonic::Status>;
509 }
510 #[derive(Debug)]
518 pub struct InboundServerPoliciesServer<T> {
519 inner: Arc<T>,
520 accept_compression_encodings: EnabledCompressionEncodings,
521 send_compression_encodings: EnabledCompressionEncodings,
522 max_decoding_message_size: Option<usize>,
523 max_encoding_message_size: Option<usize>,
524 }
525 impl<T> InboundServerPoliciesServer<T> {
526 pub fn new(inner: T) -> Self {
527 Self::from_arc(Arc::new(inner))
528 }
529 pub fn from_arc(inner: Arc<T>) -> Self {
530 Self {
531 inner,
532 accept_compression_encodings: Default::default(),
533 send_compression_encodings: Default::default(),
534 max_decoding_message_size: None,
535 max_encoding_message_size: None,
536 }
537 }
538 pub fn with_interceptor<F>(
539 inner: T,
540 interceptor: F,
541 ) -> InterceptedService<Self, F>
542 where
543 F: tonic::service::Interceptor,
544 {
545 InterceptedService::new(Self::new(inner), interceptor)
546 }
547 #[must_use]
549 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
550 self.accept_compression_encodings.enable(encoding);
551 self
552 }
553 #[must_use]
555 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
556 self.send_compression_encodings.enable(encoding);
557 self
558 }
559 #[must_use]
563 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
564 self.max_decoding_message_size = Some(limit);
565 self
566 }
567 #[must_use]
571 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
572 self.max_encoding_message_size = Some(limit);
573 self
574 }
575 }
576 impl<T, B> tonic::codegen::Service<http::Request<B>>
577 for InboundServerPoliciesServer<T>
578 where
579 T: InboundServerPolicies,
580 B: Body + std::marker::Send + 'static,
581 B::Error: Into<StdError> + std::marker::Send + 'static,
582 {
583 type Response = http::Response<tonic::body::Body>;
584 type Error = std::convert::Infallible;
585 type Future = BoxFuture<Self::Response, Self::Error>;
586 fn poll_ready(
587 &mut self,
588 _cx: &mut Context<'_>,
589 ) -> Poll<std::result::Result<(), Self::Error>> {
590 Poll::Ready(Ok(()))
591 }
592 fn call(&mut self, req: http::Request<B>) -> Self::Future {
593 match req.uri().path() {
594 "/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort" => {
595 #[allow(non_camel_case_types)]
596 struct GetPortSvc<T: InboundServerPolicies>(pub Arc<T>);
597 impl<
598 T: InboundServerPolicies,
599 > tonic::server::UnaryService<super::PortSpec> for GetPortSvc<T> {
600 type Response = super::Server;
601 type Future = BoxFuture<
602 tonic::Response<Self::Response>,
603 tonic::Status,
604 >;
605 fn call(
606 &mut self,
607 request: tonic::Request<super::PortSpec>,
608 ) -> Self::Future {
609 let inner = Arc::clone(&self.0);
610 let fut = async move {
611 <T as InboundServerPolicies>::get_port(&inner, request)
612 .await
613 };
614 Box::pin(fut)
615 }
616 }
617 let accept_compression_encodings = self.accept_compression_encodings;
618 let send_compression_encodings = self.send_compression_encodings;
619 let max_decoding_message_size = self.max_decoding_message_size;
620 let max_encoding_message_size = self.max_encoding_message_size;
621 let inner = self.inner.clone();
622 let fut = async move {
623 let method = GetPortSvc(inner);
624 let codec = tonic_prost::ProstCodec::default();
625 let mut grpc = tonic::server::Grpc::new(codec)
626 .apply_compression_config(
627 accept_compression_encodings,
628 send_compression_encodings,
629 )
630 .apply_max_message_size_config(
631 max_decoding_message_size,
632 max_encoding_message_size,
633 );
634 let res = grpc.unary(method, req).await;
635 Ok(res)
636 };
637 Box::pin(fut)
638 }
639 "/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort" => {
640 #[allow(non_camel_case_types)]
641 struct WatchPortSvc<T: InboundServerPolicies>(pub Arc<T>);
642 impl<
643 T: InboundServerPolicies,
644 > tonic::server::ServerStreamingService<super::PortSpec>
645 for WatchPortSvc<T> {
646 type Response = super::Server;
647 type ResponseStream = T::WatchPortStream;
648 type Future = BoxFuture<
649 tonic::Response<Self::ResponseStream>,
650 tonic::Status,
651 >;
652 fn call(
653 &mut self,
654 request: tonic::Request<super::PortSpec>,
655 ) -> Self::Future {
656 let inner = Arc::clone(&self.0);
657 let fut = async move {
658 <T as InboundServerPolicies>::watch_port(&inner, request)
659 .await
660 };
661 Box::pin(fut)
662 }
663 }
664 let accept_compression_encodings = self.accept_compression_encodings;
665 let send_compression_encodings = self.send_compression_encodings;
666 let max_decoding_message_size = self.max_decoding_message_size;
667 let max_encoding_message_size = self.max_encoding_message_size;
668 let inner = self.inner.clone();
669 let fut = async move {
670 let method = WatchPortSvc(inner);
671 let codec = tonic_prost::ProstCodec::default();
672 let mut grpc = tonic::server::Grpc::new(codec)
673 .apply_compression_config(
674 accept_compression_encodings,
675 send_compression_encodings,
676 )
677 .apply_max_message_size_config(
678 max_decoding_message_size,
679 max_encoding_message_size,
680 );
681 let res = grpc.server_streaming(method, req).await;
682 Ok(res)
683 };
684 Box::pin(fut)
685 }
686 _ => {
687 Box::pin(async move {
688 let mut response = http::Response::new(
689 tonic::body::Body::default(),
690 );
691 let headers = response.headers_mut();
692 headers
693 .insert(
694 tonic::Status::GRPC_STATUS,
695 (tonic::Code::Unimplemented as i32).into(),
696 );
697 headers
698 .insert(
699 http::header::CONTENT_TYPE,
700 tonic::metadata::GRPC_CONTENT_TYPE,
701 );
702 Ok(response)
703 })
704 }
705 }
706 }
707 }
708 impl<T> Clone for InboundServerPoliciesServer<T> {
709 fn clone(&self) -> Self {
710 let inner = self.inner.clone();
711 Self {
712 inner,
713 accept_compression_encodings: self.accept_compression_encodings,
714 send_compression_encodings: self.send_compression_encodings,
715 max_decoding_message_size: self.max_decoding_message_size,
716 max_encoding_message_size: self.max_encoding_message_size,
717 }
718 }
719 }
720 pub const SERVICE_NAME: &str = "io.linkerd.proxy.inbound.InboundServerPolicies";
722 impl<T> tonic::server::NamedService for InboundServerPoliciesServer<T> {
723 const NAME: &'static str = SERVICE_NAME;
724 }
725}