1#[derive(Clone, PartialEq, ::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, ::prost::Message)]
76 pub struct Opaque {}
77 #[derive(Clone, Copy, PartialEq, ::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, ::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, ::prost::Message)]
181pub struct Identity {
182 #[prost(string, tag = "1")]
183 pub name: ::prost::alloc::string::String,
184}
185#[derive(Clone, PartialEq, ::prost::Message)]
190pub struct IdentitySuffix {
191 #[prost(string, repeated, tag = "1")]
192 pub parts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
193}
194#[derive(Clone, PartialEq, ::prost::Message)]
197pub struct HttpRoute {
198 #[prost(message, optional, tag = "1")]
199 pub metadata: ::core::option::Option<super::meta::Metadata>,
200 #[prost(message, repeated, tag = "2")]
202 pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
203 #[prost(message, repeated, tag = "3")]
206 pub authorizations: ::prost::alloc::vec::Vec<Authz>,
207 #[prost(message, repeated, tag = "4")]
209 pub rules: ::prost::alloc::vec::Vec<http_route::Rule>,
210}
211pub mod http_route {
213 #[derive(Clone, PartialEq, ::prost::Message)]
214 pub struct Rule {
215 #[prost(message, repeated, tag = "1")]
216 pub matches: ::prost::alloc::vec::Vec<super::super::http_route::HttpRouteMatch>,
217 #[prost(message, repeated, tag = "2")]
218 pub filters: ::prost::alloc::vec::Vec<Filter>,
219 }
220 #[derive(Clone, PartialEq, ::prost::Message)]
221 pub struct Filter {
222 #[prost(oneof = "filter::Kind", tags = "1, 2, 3")]
223 pub kind: ::core::option::Option<filter::Kind>,
224 }
225 pub mod filter {
227 #[derive(Clone, PartialEq, ::prost::Oneof)]
228 pub enum Kind {
229 #[prost(message, tag = "1")]
230 FailureInjector(super::super::super::http_route::HttpFailureInjector),
231 #[prost(message, tag = "2")]
232 RequestHeaderModifier(
233 super::super::super::http_route::RequestHeaderModifier,
234 ),
235 #[prost(message, tag = "3")]
236 Redirect(super::super::super::http_route::RequestRedirect),
237 }
238 }
239}
240#[derive(Clone, PartialEq, ::prost::Message)]
242pub struct GrpcRoute {
243 #[prost(message, optional, tag = "1")]
244 pub metadata: ::core::option::Option<super::meta::Metadata>,
245 #[prost(message, repeated, tag = "2")]
247 pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
248 #[prost(message, repeated, tag = "3")]
251 pub authorizations: ::prost::alloc::vec::Vec<Authz>,
252 #[prost(message, repeated, tag = "4")]
254 pub rules: ::prost::alloc::vec::Vec<grpc_route::Rule>,
255}
256pub mod grpc_route {
258 #[derive(Clone, PartialEq, ::prost::Message)]
259 pub struct Rule {
260 #[prost(message, repeated, tag = "1")]
261 pub matches: ::prost::alloc::vec::Vec<super::super::grpc_route::GrpcRouteMatch>,
262 #[prost(message, repeated, tag = "2")]
263 pub filters: ::prost::alloc::vec::Vec<Filter>,
264 }
265 #[derive(Clone, PartialEq, ::prost::Message)]
266 pub struct Filter {
267 #[prost(oneof = "filter::Kind", tags = "1, 2")]
268 pub kind: ::core::option::Option<filter::Kind>,
269 }
270 pub mod filter {
272 #[derive(Clone, PartialEq, ::prost::Oneof)]
273 pub enum Kind {
274 #[prost(message, tag = "1")]
275 FailureInjector(super::super::super::grpc_route::GrpcFailureInjector),
276 #[prost(message, tag = "2")]
277 RequestHeaderModifier(
278 super::super::super::http_route::RequestHeaderModifier,
279 ),
280 }
281 }
282}
283#[derive(Clone, PartialEq, ::prost::Message)]
284pub struct HttpLocalRateLimit {
285 #[prost(message, optional, tag = "1")]
287 pub metadata: ::core::option::Option<super::meta::Metadata>,
288 #[prost(message, optional, tag = "2")]
291 pub total: ::core::option::Option<http_local_rate_limit::Limit>,
292 #[prost(message, optional, tag = "3")]
295 pub identity: ::core::option::Option<http_local_rate_limit::Limit>,
296 #[prost(message, repeated, tag = "4")]
298 pub overrides: ::prost::alloc::vec::Vec<http_local_rate_limit::Override>,
299}
300pub mod http_local_rate_limit {
302 #[derive(Clone, PartialEq, ::prost::Message)]
303 pub struct Override {
304 #[prost(message, optional, tag = "1")]
305 pub limit: ::core::option::Option<Limit>,
306 #[prost(message, optional, tag = "2")]
307 pub clients: ::core::option::Option<r#override::ClientIdentities>,
308 }
309 pub mod r#override {
311 #[derive(Clone, PartialEq, ::prost::Message)]
312 pub struct ClientIdentities {
313 #[prost(message, repeated, tag = "1")]
315 pub identities: ::prost::alloc::vec::Vec<super::super::Identity>,
316 }
317 }
318 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
319 pub struct Limit {
320 #[prost(uint32, tag = "1")]
321 pub requests_per_second: u32,
322 }
323}
324pub mod inbound_server_policies_client {
326 #![allow(
327 unused_variables,
328 dead_code,
329 missing_docs,
330 clippy::wildcard_imports,
331 clippy::let_unit_value,
332 )]
333 use tonic::codegen::*;
334 use tonic::codegen::http::Uri;
335 #[derive(Debug, Clone)]
343 pub struct InboundServerPoliciesClient<T> {
344 inner: tonic::client::Grpc<T>,
345 }
346 impl<T> InboundServerPoliciesClient<T>
347 where
348 T: tonic::client::GrpcService<tonic::body::Body>,
349 T::Error: Into<StdError>,
350 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
351 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
352 {
353 pub fn new(inner: T) -> Self {
354 let inner = tonic::client::Grpc::new(inner);
355 Self { inner }
356 }
357 pub fn with_origin(inner: T, origin: Uri) -> Self {
358 let inner = tonic::client::Grpc::with_origin(inner, origin);
359 Self { inner }
360 }
361 pub fn with_interceptor<F>(
362 inner: T,
363 interceptor: F,
364 ) -> InboundServerPoliciesClient<InterceptedService<T, F>>
365 where
366 F: tonic::service::Interceptor,
367 T::ResponseBody: Default,
368 T: tonic::codegen::Service<
369 http::Request<tonic::body::Body>,
370 Response = http::Response<
371 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
372 >,
373 >,
374 <T as tonic::codegen::Service<
375 http::Request<tonic::body::Body>,
376 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
377 {
378 InboundServerPoliciesClient::new(InterceptedService::new(inner, interceptor))
379 }
380 #[must_use]
385 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
386 self.inner = self.inner.send_compressed(encoding);
387 self
388 }
389 #[must_use]
391 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
392 self.inner = self.inner.accept_compressed(encoding);
393 self
394 }
395 #[must_use]
399 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
400 self.inner = self.inner.max_decoding_message_size(limit);
401 self
402 }
403 #[must_use]
407 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
408 self.inner = self.inner.max_encoding_message_size(limit);
409 self
410 }
411 pub async fn get_port(
413 &mut self,
414 request: impl tonic::IntoRequest<super::PortSpec>,
415 ) -> std::result::Result<tonic::Response<super::Server>, tonic::Status> {
416 self.inner
417 .ready()
418 .await
419 .map_err(|e| {
420 tonic::Status::unknown(
421 format!("Service was not ready: {}", e.into()),
422 )
423 })?;
424 let codec = tonic::codec::ProstCodec::default();
425 let path = http::uri::PathAndQuery::from_static(
426 "/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort",
427 );
428 let mut req = request.into_request();
429 req.extensions_mut()
430 .insert(
431 GrpcMethod::new(
432 "io.linkerd.proxy.inbound.InboundServerPolicies",
433 "GetPort",
434 ),
435 );
436 self.inner.unary(req, path, codec).await
437 }
438 pub async fn watch_port(
440 &mut self,
441 request: impl tonic::IntoRequest<super::PortSpec>,
442 ) -> std::result::Result<
443 tonic::Response<tonic::codec::Streaming<super::Server>>,
444 tonic::Status,
445 > {
446 self.inner
447 .ready()
448 .await
449 .map_err(|e| {
450 tonic::Status::unknown(
451 format!("Service was not ready: {}", e.into()),
452 )
453 })?;
454 let codec = tonic::codec::ProstCodec::default();
455 let path = http::uri::PathAndQuery::from_static(
456 "/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort",
457 );
458 let mut req = request.into_request();
459 req.extensions_mut()
460 .insert(
461 GrpcMethod::new(
462 "io.linkerd.proxy.inbound.InboundServerPolicies",
463 "WatchPort",
464 ),
465 );
466 self.inner.server_streaming(req, path, codec).await
467 }
468 }
469}
470pub mod inbound_server_policies_server {
472 #![allow(
473 unused_variables,
474 dead_code,
475 missing_docs,
476 clippy::wildcard_imports,
477 clippy::let_unit_value,
478 )]
479 use tonic::codegen::*;
480 #[async_trait]
482 pub trait InboundServerPolicies: std::marker::Send + std::marker::Sync + 'static {
483 async fn get_port(
485 &self,
486 request: tonic::Request<super::PortSpec>,
487 ) -> std::result::Result<tonic::Response<super::Server>, tonic::Status>;
488 type WatchPortStream: tonic::codegen::tokio_stream::Stream<
490 Item = std::result::Result<super::Server, tonic::Status>,
491 >
492 + std::marker::Send
493 + 'static;
494 async fn watch_port(
496 &self,
497 request: tonic::Request<super::PortSpec>,
498 ) -> std::result::Result<tonic::Response<Self::WatchPortStream>, tonic::Status>;
499 }
500 #[derive(Debug)]
508 pub struct InboundServerPoliciesServer<T> {
509 inner: Arc<T>,
510 accept_compression_encodings: EnabledCompressionEncodings,
511 send_compression_encodings: EnabledCompressionEncodings,
512 max_decoding_message_size: Option<usize>,
513 max_encoding_message_size: Option<usize>,
514 }
515 impl<T> InboundServerPoliciesServer<T> {
516 pub fn new(inner: T) -> Self {
517 Self::from_arc(Arc::new(inner))
518 }
519 pub fn from_arc(inner: Arc<T>) -> Self {
520 Self {
521 inner,
522 accept_compression_encodings: Default::default(),
523 send_compression_encodings: Default::default(),
524 max_decoding_message_size: None,
525 max_encoding_message_size: None,
526 }
527 }
528 pub fn with_interceptor<F>(
529 inner: T,
530 interceptor: F,
531 ) -> InterceptedService<Self, F>
532 where
533 F: tonic::service::Interceptor,
534 {
535 InterceptedService::new(Self::new(inner), interceptor)
536 }
537 #[must_use]
539 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
540 self.accept_compression_encodings.enable(encoding);
541 self
542 }
543 #[must_use]
545 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
546 self.send_compression_encodings.enable(encoding);
547 self
548 }
549 #[must_use]
553 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
554 self.max_decoding_message_size = Some(limit);
555 self
556 }
557 #[must_use]
561 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
562 self.max_encoding_message_size = Some(limit);
563 self
564 }
565 }
566 impl<T, B> tonic::codegen::Service<http::Request<B>>
567 for InboundServerPoliciesServer<T>
568 where
569 T: InboundServerPolicies,
570 B: Body + std::marker::Send + 'static,
571 B::Error: Into<StdError> + std::marker::Send + 'static,
572 {
573 type Response = http::Response<tonic::body::Body>;
574 type Error = std::convert::Infallible;
575 type Future = BoxFuture<Self::Response, Self::Error>;
576 fn poll_ready(
577 &mut self,
578 _cx: &mut Context<'_>,
579 ) -> Poll<std::result::Result<(), Self::Error>> {
580 Poll::Ready(Ok(()))
581 }
582 fn call(&mut self, req: http::Request<B>) -> Self::Future {
583 match req.uri().path() {
584 "/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort" => {
585 #[allow(non_camel_case_types)]
586 struct GetPortSvc<T: InboundServerPolicies>(pub Arc<T>);
587 impl<
588 T: InboundServerPolicies,
589 > tonic::server::UnaryService<super::PortSpec> for GetPortSvc<T> {
590 type Response = super::Server;
591 type Future = BoxFuture<
592 tonic::Response<Self::Response>,
593 tonic::Status,
594 >;
595 fn call(
596 &mut self,
597 request: tonic::Request<super::PortSpec>,
598 ) -> Self::Future {
599 let inner = Arc::clone(&self.0);
600 let fut = async move {
601 <T as InboundServerPolicies>::get_port(&inner, request)
602 .await
603 };
604 Box::pin(fut)
605 }
606 }
607 let accept_compression_encodings = self.accept_compression_encodings;
608 let send_compression_encodings = self.send_compression_encodings;
609 let max_decoding_message_size = self.max_decoding_message_size;
610 let max_encoding_message_size = self.max_encoding_message_size;
611 let inner = self.inner.clone();
612 let fut = async move {
613 let method = GetPortSvc(inner);
614 let codec = tonic::codec::ProstCodec::default();
615 let mut grpc = tonic::server::Grpc::new(codec)
616 .apply_compression_config(
617 accept_compression_encodings,
618 send_compression_encodings,
619 )
620 .apply_max_message_size_config(
621 max_decoding_message_size,
622 max_encoding_message_size,
623 );
624 let res = grpc.unary(method, req).await;
625 Ok(res)
626 };
627 Box::pin(fut)
628 }
629 "/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort" => {
630 #[allow(non_camel_case_types)]
631 struct WatchPortSvc<T: InboundServerPolicies>(pub Arc<T>);
632 impl<
633 T: InboundServerPolicies,
634 > tonic::server::ServerStreamingService<super::PortSpec>
635 for WatchPortSvc<T> {
636 type Response = super::Server;
637 type ResponseStream = T::WatchPortStream;
638 type Future = BoxFuture<
639 tonic::Response<Self::ResponseStream>,
640 tonic::Status,
641 >;
642 fn call(
643 &mut self,
644 request: tonic::Request<super::PortSpec>,
645 ) -> Self::Future {
646 let inner = Arc::clone(&self.0);
647 let fut = async move {
648 <T as InboundServerPolicies>::watch_port(&inner, request)
649 .await
650 };
651 Box::pin(fut)
652 }
653 }
654 let accept_compression_encodings = self.accept_compression_encodings;
655 let send_compression_encodings = self.send_compression_encodings;
656 let max_decoding_message_size = self.max_decoding_message_size;
657 let max_encoding_message_size = self.max_encoding_message_size;
658 let inner = self.inner.clone();
659 let fut = async move {
660 let method = WatchPortSvc(inner);
661 let codec = tonic::codec::ProstCodec::default();
662 let mut grpc = tonic::server::Grpc::new(codec)
663 .apply_compression_config(
664 accept_compression_encodings,
665 send_compression_encodings,
666 )
667 .apply_max_message_size_config(
668 max_decoding_message_size,
669 max_encoding_message_size,
670 );
671 let res = grpc.server_streaming(method, req).await;
672 Ok(res)
673 };
674 Box::pin(fut)
675 }
676 _ => {
677 Box::pin(async move {
678 let mut response = http::Response::new(
679 tonic::body::Body::default(),
680 );
681 let headers = response.headers_mut();
682 headers
683 .insert(
684 tonic::Status::GRPC_STATUS,
685 (tonic::Code::Unimplemented as i32).into(),
686 );
687 headers
688 .insert(
689 http::header::CONTENT_TYPE,
690 tonic::metadata::GRPC_CONTENT_TYPE,
691 );
692 Ok(response)
693 })
694 }
695 }
696 }
697 }
698 impl<T> Clone for InboundServerPoliciesServer<T> {
699 fn clone(&self) -> Self {
700 let inner = self.inner.clone();
701 Self {
702 inner,
703 accept_compression_encodings: self.accept_compression_encodings,
704 send_compression_encodings: self.send_compression_encodings,
705 max_decoding_message_size: self.max_decoding_message_size,
706 max_encoding_message_size: self.max_encoding_message_size,
707 }
708 }
709 }
710 pub const SERVICE_NAME: &str = "io.linkerd.proxy.inbound.InboundServerPolicies";
712 impl<T> tonic::server::NamedService for InboundServerPoliciesServer<T> {
713 const NAME: &'static str = SERVICE_NAME;
714 }
715}