pub struct MeshExpose {
pub identity: MeshIdent,
pub ports: Vec<MeshPort>,
pub allow_from: Vec<MeshPeer>,
}Expand description
Mesh-internal port exposure and peer access control.
Fields§
§identity: MeshIdentDNS-segment mesh identity for this workload. Must be unique in the
cluster. Regex: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$, length ≤ 63.
ports: Vec<MeshPort>Ports this workload listens on, each optionally named (R844-F17). Other
workloads reach it at <identity>:<port> on the mesh.
See MeshPort for the three accepted spellings. Read the numbers with
MeshExpose::numbers and the names with
MeshExpose::named_numbers — there is deliberately no way to read
this as a plain Vec<u16>, because a name-only entry has no number yet
and a conversion that dropped it would be exactly the silent loss named
ports exist to prevent.
allow_from: Vec<MeshPeer>Peers permitted to initiate connections to this workload on the mesh
(W206 / R558-F3). Same-tenant tier rules and explicit cross-tenant
grants share this one list. With no MeshPeer::Tier entries every
same-tenant peer is admitted (the historical “empty = allow all”
default); cross-tenant peers are always denied unless named by a
MeshPeer::CrossTenant entry. See MeshExpose::admits_peer.
Implementations§
Source§impl MeshExpose
impl MeshExpose
Sourcepub fn numbers(&self) -> Vec<u16>
pub fn numbers(&self) -> Vec<u16>
Every port number this workload declares, in declaration order.
Name-only entries (ports = ["http"]) carry no number and are simply
absent here — they do not have one until a supervisor allocates it. That
is why this is a method rather than the field: a caller reading numbers
has to be able to see that the list it got is shorter than the list the
author wrote, and a Vec<u16> field could not say so.
Sourcepub fn declares_number(&self, port: u16) -> bool
pub fn declares_number(&self, port: u16) -> bool
Whether port appears as a declared number.
Sourcepub fn named_numbers(&self) -> BTreeMap<String, u16>
pub fn named_numbers(&self) -> BTreeMap<String, u16>
The name -> number map for every port the manifest declares both
for. Name-only ports are absent (no number yet) and unnamed ports are
absent (no name); kamaji::name_anonymous_ports is what fills the
second gap once numbers are known.
Sourcepub fn anonymous_ports(numbers: impl IntoIterator<Item = u16>) -> Vec<MeshPort>
pub fn anonymous_ports(numbers: impl IntoIterator<Item = u16>) -> Vec<MeshPort>
The pre-R844-F17 spelling as a value: a list of unnamed numbers. Kept because most call sites — and every test fixture — genuinely mean “these numbers, names irrelevant”.
Sourcepub fn admits_peer(
&self,
own_tenant: &TenantId,
peer_tenant: &TenantId,
peer_namespace: &NamespaceId,
peer_name: &MeshIdent,
peer_tier: &TierTag,
) -> bool
pub fn admits_peer( &self, own_tenant: &TenantId, peer_tenant: &TenantId, peer_namespace: &NamespaceId, peer_name: &MeshIdent, peer_tier: &TierTag, ) -> bool
Whether a peer may initiate a mesh connection to a workload whose mesh
exposure is self. own_tenant is the tenant of the workload being
protected; the remaining arguments identify the connecting peer.
Deny-by-default across tenants (W206 / R558-F3):
- Same tenant (
own_tenant == peer_tenant): admitted when the peer’s tier matches aMeshPeer::Tierrule, or when there are noTierrules at all (historical “emptyallow_from= allow all same-tenant”). - Cross tenant: admitted only when an explicit
MeshPeer::CrossTenantentry matches the peer’s(tenant, namespace, name).
Trait Implementations§
Source§impl Clone for MeshExpose
impl Clone for MeshExpose
Source§fn clone(&self) -> MeshExpose
fn clone(&self) -> MeshExpose
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MeshExpose
impl Debug for MeshExpose
Source§impl<'de> Deserialize<'de> for MeshExpose
impl<'de> Deserialize<'de> for MeshExpose
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for MeshExpose
Source§impl PartialEq for MeshExpose
impl PartialEq for MeshExpose
Source§impl Serialize for MeshExpose
impl Serialize for MeshExpose
impl StructuralPartialEq for MeshExpose
Source§impl TS for MeshExpose
impl TS for MeshExpose
Source§type WithoutGenerics = MeshExpose
type WithoutGenerics = MeshExpose
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = MeshExpose
type OptionInnerType = MeshExpose
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read moreSource§fn export_to_string(cfg: &Config) -> Result<String, ExportError>where
Self: 'static,
fn export_to_string(cfg: &Config) -> Result<String, ExportError>where
Self: 'static,
Auto Trait Implementations§
impl Freeze for MeshExpose
impl RefUnwindSafe for MeshExpose
impl Send for MeshExpose
impl Sync for MeshExpose
impl Unpin for MeshExpose
impl UnsafeUnpin for MeshExpose
impl UnwindSafe for MeshExpose
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.