#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PortSpec {
#[prost(string, tag="1")]
pub workload: ::prost::alloc::string::String,
#[prost(uint32, tag="2")]
pub port: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Server {
#[prost(message, optional, tag="1")]
pub protocol: ::core::option::Option<ProxyProtocol>,
#[prost(message, repeated, tag="2")]
pub server_ips: ::prost::alloc::vec::Vec<super::net::IpAddress>,
#[prost(message, repeated, tag="3")]
pub authorizations: ::prost::alloc::vec::Vec<Authz>,
#[prost(map="string, string", tag="4")]
pub labels: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProxyProtocol {
#[prost(oneof="proxy_protocol::Kind", tags="1, 2, 3, 4, 5, 6")]
pub kind: ::core::option::Option<proxy_protocol::Kind>,
}
pub mod proxy_protocol {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Detect {
#[prost(message, optional, tag="1")]
pub timeout: ::core::option::Option<::prost_types::Duration>,
#[prost(message, repeated, tag="3")]
pub http_routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Http1 {
#[prost(message, repeated, tag="2")]
pub routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Http2 {
#[prost(message, repeated, tag="2")]
pub routes: ::prost::alloc::vec::Vec<super::HttpRoute>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Grpc {
#[prost(message, repeated, tag="2")]
pub routes: ::prost::alloc::vec::Vec<super::GrpcRoute>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Opaque {
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Tls {
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
#[prost(message, tag="1")]
Detect(Detect),
#[prost(message, tag="2")]
Opaque(Opaque),
#[prost(message, tag="3")]
Tls(Tls),
#[prost(message, tag="4")]
Http1(Http1),
#[prost(message, tag="5")]
Http2(Http2),
#[prost(message, tag="6")]
Grpc(Grpc),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Authz {
#[prost(message, repeated, tag="1")]
pub networks: ::prost::alloc::vec::Vec<Network>,
#[prost(message, optional, tag="2")]
pub authentication: ::core::option::Option<Authn>,
#[prost(map="string, string", tag="3")]
pub labels: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(message, optional, tag="4")]
pub metadata: ::core::option::Option<super::meta::Metadata>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Network {
#[prost(message, optional, tag="1")]
pub net: ::core::option::Option<super::net::IpNetwork>,
#[prost(message, repeated, tag="2")]
pub except: ::prost::alloc::vec::Vec<super::net::IpNetwork>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Authn {
#[prost(oneof="authn::Permit", tags="1, 2")]
pub permit: ::core::option::Option<authn::Permit>,
}
pub mod authn {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PermitUnauthenticated {
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PermitMeshTls {
#[prost(oneof="permit_mesh_tls::Clients", tags="1, 2")]
pub clients: ::core::option::Option<permit_mesh_tls::Clients>,
}
pub mod permit_mesh_tls {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PermitClientIdentities {
#[prost(message, repeated, tag="1")]
pub identities: ::prost::alloc::vec::Vec<super::super::Identity>,
#[prost(message, repeated, tag="2")]
pub suffixes: ::prost::alloc::vec::Vec<super::super::IdentitySuffix>,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Clients {
#[prost(message, tag="1")]
Unauthenticated(super::PermitUnauthenticated),
#[prost(message, tag="2")]
Identities(PermitClientIdentities),
}
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Permit {
#[prost(message, tag="1")]
Unauthenticated(PermitUnauthenticated),
#[prost(message, tag="2")]
MeshTls(PermitMeshTls),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Identity {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IdentitySuffix {
#[prost(string, repeated, tag="1")]
pub parts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HttpRoute {
#[prost(message, optional, tag="1")]
pub metadata: ::core::option::Option<super::meta::Metadata>,
#[prost(message, repeated, tag="2")]
pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
#[prost(message, repeated, tag="3")]
pub authorizations: ::prost::alloc::vec::Vec<Authz>,
#[prost(message, repeated, tag="4")]
pub rules: ::prost::alloc::vec::Vec<http_route::Rule>,
}
pub mod http_route {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Rule {
#[prost(message, repeated, tag="1")]
pub matches: ::prost::alloc::vec::Vec<super::super::http_route::HttpRouteMatch>,
#[prost(message, repeated, tag="2")]
pub filters: ::prost::alloc::vec::Vec<Filter>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Filter {
#[prost(oneof="filter::Kind", tags="1, 2, 3")]
pub kind: ::core::option::Option<filter::Kind>,
}
pub mod filter {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
#[prost(message, tag="1")]
FailureInjector(super::super::super::http_route::HttpFailureInjector),
#[prost(message, tag="2")]
RequestHeaderModifier(super::super::super::http_route::RequestHeaderModifier),
#[prost(message, tag="3")]
Redirect(super::super::super::http_route::RequestRedirect),
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GrpcRoute {
#[prost(message, optional, tag="1")]
pub metadata: ::core::option::Option<super::meta::Metadata>,
#[prost(message, repeated, tag="2")]
pub hosts: ::prost::alloc::vec::Vec<super::http_route::HostMatch>,
#[prost(message, repeated, tag="3")]
pub authorizations: ::prost::alloc::vec::Vec<Authz>,
#[prost(message, repeated, tag="4")]
pub rules: ::prost::alloc::vec::Vec<grpc_route::Rule>,
}
pub mod grpc_route {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Rule {
#[prost(message, repeated, tag="1")]
pub matches: ::prost::alloc::vec::Vec<super::super::grpc_route::GrpcRouteMatch>,
#[prost(message, repeated, tag="2")]
pub filters: ::prost::alloc::vec::Vec<Filter>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Filter {
#[prost(oneof="filter::Kind", tags="1, 2")]
pub kind: ::core::option::Option<filter::Kind>,
}
pub mod filter {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
#[prost(message, tag="1")]
FailureInjector(super::super::super::grpc_route::GrpcFailureInjector),
#[prost(message, tag="2")]
RequestHeaderModifier(super::super::super::http_route::RequestHeaderModifier),
}
}
}
pub mod inbound_server_policies_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct InboundServerPoliciesClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> InboundServerPoliciesClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InboundServerPoliciesClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
InboundServerPoliciesClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
pub async fn get_port(
&mut self,
request: impl tonic::IntoRequest<super::PortSpec>,
) -> Result<tonic::Response<super::Server>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn watch_port(
&mut self,
request: impl tonic::IntoRequest<super::PortSpec>,
) -> Result<
tonic::Response<tonic::codec::Streaming<super::Server>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort",
);
self.inner.server_streaming(request.into_request(), path, codec).await
}
}
}
pub mod inbound_server_policies_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait InboundServerPolicies: Send + Sync + 'static {
async fn get_port(
&self,
request: tonic::Request<super::PortSpec>,
) -> Result<tonic::Response<super::Server>, tonic::Status>;
type WatchPortStream: futures_core::Stream<
Item = Result<super::Server, tonic::Status>,
>
+ Send
+ 'static;
async fn watch_port(
&self,
request: tonic::Request<super::PortSpec>,
) -> Result<tonic::Response<Self::WatchPortStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct InboundServerPoliciesServer<T: InboundServerPolicies> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: InboundServerPolicies> InboundServerPoliciesServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>>
for InboundServerPoliciesServer<T>
where
T: InboundServerPolicies,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/io.linkerd.proxy.inbound.InboundServerPolicies/GetPort" => {
#[allow(non_camel_case_types)]
struct GetPortSvc<T: InboundServerPolicies>(pub Arc<T>);
impl<
T: InboundServerPolicies,
> tonic::server::UnaryService<super::PortSpec> for GetPortSvc<T> {
type Response = super::Server;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PortSpec>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get_port(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetPortSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/io.linkerd.proxy.inbound.InboundServerPolicies/WatchPort" => {
#[allow(non_camel_case_types)]
struct WatchPortSvc<T: InboundServerPolicies>(pub Arc<T>);
impl<
T: InboundServerPolicies,
> tonic::server::ServerStreamingService<super::PortSpec>
for WatchPortSvc<T> {
type Response = super::Server;
type ResponseStream = T::WatchPortStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PortSpec>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).watch_port(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = WatchPortSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: InboundServerPolicies> Clone for InboundServerPoliciesServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
}
}
}
impl<T: InboundServerPolicies> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: InboundServerPolicies> tonic::server::NamedService
for InboundServerPoliciesServer<T> {
const NAME: &'static str = "io.linkerd.proxy.inbound.InboundServerPolicies";
}
}