Struct TunnelBudget
pub struct TunnelBudget { /* private fields */ }masque only.Expand description
Directional rates and a lifetime quota for one MASQUE tunnel.
Defaults to no rates or quota and a minimum charge of 64 bytes. Charging runs principal first, then tunnel rate, then tunnel quota. A rate-refused attempt does not spend the tunnel quota. Earlier stages are not refunded if a later stage refuses; malformed packets and unknown contexts still count as attempts.
Implementations§
§impl TunnelBudget
impl TunnelBudget
pub const fn new() -> TunnelBudget
pub const fn new() -> TunnelBudget
No rates or quota; each packet/control attempt costs at least 64 bytes.
pub fn maybe_with_to_target(self, rate: Option<DatagramRate>) -> TunnelBudget
pub fn maybe_with_to_target(self, rate: Option<DatagramRate>) -> TunnelBudget
Packet and byte rates toward the target network.
pub fn maybe_set_to_target(
&mut self,
rate: Option<DatagramRate>,
) -> &mut TunnelBudget
pub fn maybe_set_to_target( &mut self, rate: Option<DatagramRate>, ) -> &mut TunnelBudget
Packet and byte rates toward the target network.
pub fn with_to_target(self, rate: DatagramRate) -> TunnelBudget
pub fn with_to_target(self, rate: DatagramRate) -> TunnelBudget
Packet and byte rates toward the target network.
pub fn set_to_target(&mut self, rate: DatagramRate) -> &mut TunnelBudget
pub fn set_to_target(&mut self, rate: DatagramRate) -> &mut TunnelBudget
Packet and byte rates toward the target network.
pub fn without_to_target(self) -> TunnelBudget
pub fn without_to_target(self) -> TunnelBudget
Packet and byte rates toward the target network.
pub fn unset_to_target(&mut self) -> &mut TunnelBudget
pub fn unset_to_target(&mut self) -> &mut TunnelBudget
Packet and byte rates toward the target network.
pub fn maybe_with_to_client(self, rate: Option<DatagramRate>) -> TunnelBudget
pub fn maybe_with_to_client(self, rate: Option<DatagramRate>) -> TunnelBudget
Packet and byte rates toward the HTTP client.
pub fn maybe_set_to_client(
&mut self,
rate: Option<DatagramRate>,
) -> &mut TunnelBudget
pub fn maybe_set_to_client( &mut self, rate: Option<DatagramRate>, ) -> &mut TunnelBudget
Packet and byte rates toward the HTTP client.
pub fn with_to_client(self, rate: DatagramRate) -> TunnelBudget
pub fn with_to_client(self, rate: DatagramRate) -> TunnelBudget
Packet and byte rates toward the HTTP client.
pub fn set_to_client(&mut self, rate: DatagramRate) -> &mut TunnelBudget
pub fn set_to_client(&mut self, rate: DatagramRate) -> &mut TunnelBudget
Packet and byte rates toward the HTTP client.
pub fn without_to_client(self) -> TunnelBudget
pub fn without_to_client(self) -> TunnelBudget
Packet and byte rates toward the HTTP client.
pub fn unset_to_client(&mut self) -> &mut TunnelBudget
pub fn unset_to_client(&mut self) -> &mut TunnelBudget
Packet and byte rates toward the HTTP client.
pub fn maybe_with_quota(self, bytes: Option<u64>) -> TunnelBudget
pub fn maybe_with_quota(self, bytes: Option<u64>) -> TunnelBudget
Lifetime byte quota shared by both directions. Only attempts admitted by the tunnel rate spend this quota. Zero refuses every positive charge.
pub fn maybe_set_quota(&mut self, bytes: Option<u64>) -> &mut TunnelBudget
pub fn maybe_set_quota(&mut self, bytes: Option<u64>) -> &mut TunnelBudget
Lifetime byte quota shared by both directions. Only attempts admitted by the tunnel rate spend this quota. Zero refuses every positive charge.
pub fn with_quota(self, bytes: u64) -> TunnelBudget
pub fn with_quota(self, bytes: u64) -> TunnelBudget
Lifetime byte quota shared by both directions. Only attempts admitted by the tunnel rate spend this quota. Zero refuses every positive charge.
pub fn set_quota(&mut self, bytes: u64) -> &mut TunnelBudget
pub fn set_quota(&mut self, bytes: u64) -> &mut TunnelBudget
Lifetime byte quota shared by both directions. Only attempts admitted by the tunnel rate spend this quota. Zero refuses every positive charge.
pub fn without_quota(self) -> TunnelBudget
pub fn without_quota(self) -> TunnelBudget
Lifetime byte quota shared by both directions. Only attempts admitted by the tunnel rate spend this quota. Zero refuses every positive charge.
pub fn unset_quota(&mut self) -> &mut TunnelBudget
pub fn unset_quota(&mut self) -> &mut TunnelBudget
Lifetime byte quota shared by both directions. Only attempts admitted by the tunnel rate spend this quota. Zero refuses every positive charge.
pub fn with_min_charge(self, bytes: u64) -> TunnelBudget
pub fn with_min_charge(self, bytes: u64) -> TunnelBudget
Minimum byte charge per attempt, bounded by the carrier’s charge cap.
pub fn set_min_charge(&mut self, bytes: u64) -> &mut TunnelBudget
pub fn set_min_charge(&mut self, bytes: u64) -> &mut TunnelBudget
Minimum byte charge per attempt, bounded by the carrier’s charge cap.
Trait Implementations§
§impl Clone for TunnelBudget
impl Clone for TunnelBudget
§fn clone(&self) -> TunnelBudget
fn clone(&self) -> TunnelBudget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TunnelBudget
§impl Debug for TunnelBudget
impl Debug for TunnelBudget
§impl Default for TunnelBudget
impl Default for TunnelBudget
§fn default() -> TunnelBudget
fn default() -> TunnelBudget
impl Eq for TunnelBudget
§impl PartialEq for TunnelBudget
impl PartialEq for TunnelBudget
impl StructuralPartialEq for TunnelBudget
Auto Trait Implementations§
impl Freeze for TunnelBudget
impl RefUnwindSafe for TunnelBudget
impl Send for TunnelBudget
impl Sync for TunnelBudget
impl Unpin for TunnelBudget
impl UnsafeUnpin for TunnelBudget
impl UnwindSafe for TunnelBudget
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more