Struct TunnelBudget
pub struct TunnelBudget { /* private fields */ }masque only.Expand description
What each CONNECT-UDP tunnel of a proxy may move.
Every datagram is charged once, where it enters the proxy: one from the client when the
tunnel receives it, whatever happens to it next (empty, for an unknown context, oversized
or dropped later all count), one for the client when the tunnel takes it from its send queue.
So a relay’s output is what is charged toward the client: target packets a relay consumes
without sending anything back are not. A datagram costs one packet and its length in bytes, at least
TunnelBudget::with_min_charge. Over budget, it is dropped and counted in
ConnectUdpStats; nothing waits.
Until the target sends anything back, at most TunnelBudget::with_unanswered packets
and bytes are forwarded to it, so one tunnel cannot spray a target that does not answer.
Every tunnel has its own allowance; a client that opens more tunnels gets more of it,
which the per-principal limits of a proxy bound.
Implementations§
§impl TunnelBudget
impl TunnelBudget
pub const fn new() -> TunnelBudget
pub const fn new() -> TunnelBudget
No rates or quota; 64 packets and 64 KiB to a target that has not answered; a charge of 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
The rate of datagrams from the client to the target.
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
The rate of datagrams from the client to the target.
pub fn with_to_target(self, rate: DatagramRate) -> TunnelBudget
pub fn with_to_target(self, rate: DatagramRate) -> TunnelBudget
The rate of datagrams from the client to the target.
pub fn set_to_target(&mut self, rate: DatagramRate) -> &mut TunnelBudget
pub fn set_to_target(&mut self, rate: DatagramRate) -> &mut TunnelBudget
The rate of datagrams from the client to the target.
pub fn without_to_target(self) -> TunnelBudget
pub fn without_to_target(self) -> TunnelBudget
The rate of datagrams from the client to the target.
pub fn unset_to_target(&mut self) -> &mut TunnelBudget
pub fn unset_to_target(&mut self) -> &mut TunnelBudget
The rate of datagrams from the client to the target.
pub fn maybe_with_to_client(self, rate: Option<DatagramRate>) -> TunnelBudget
pub fn maybe_with_to_client(self, rate: Option<DatagramRate>) -> TunnelBudget
The rate of datagrams from the target to the 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
The rate of datagrams from the target to the client.
pub fn with_to_client(self, rate: DatagramRate) -> TunnelBudget
pub fn with_to_client(self, rate: DatagramRate) -> TunnelBudget
The rate of datagrams from the target to the client.
pub fn set_to_client(&mut self, rate: DatagramRate) -> &mut TunnelBudget
pub fn set_to_client(&mut self, rate: DatagramRate) -> &mut TunnelBudget
The rate of datagrams from the target to the client.
pub fn without_to_client(self) -> TunnelBudget
pub fn without_to_client(self) -> TunnelBudget
The rate of datagrams from the target to the client.
pub fn unset_to_client(&mut self) -> &mut TunnelBudget
pub fn unset_to_client(&mut self) -> &mut TunnelBudget
The rate of datagrams from the target to the client.
pub fn maybe_with_quota(self, bytes: Option<u64>) -> TunnelBudget
pub fn maybe_with_quota(self, bytes: Option<u64>) -> TunnelBudget
The most bytes, both ways together, a tunnel is charged in its lifetime. Only what the rates admitted counts: a datagram a rate refused is not charged to the quota.
pub fn maybe_set_quota(&mut self, bytes: Option<u64>) -> &mut TunnelBudget
pub fn maybe_set_quota(&mut self, bytes: Option<u64>) -> &mut TunnelBudget
The most bytes, both ways together, a tunnel is charged in its lifetime. Only what the rates admitted counts: a datagram a rate refused is not charged to the quota.
pub fn with_quota(self, bytes: u64) -> TunnelBudget
pub fn with_quota(self, bytes: u64) -> TunnelBudget
The most bytes, both ways together, a tunnel is charged in its lifetime. Only what the rates admitted counts: a datagram a rate refused is not charged to the quota.
pub fn set_quota(&mut self, bytes: u64) -> &mut TunnelBudget
pub fn set_quota(&mut self, bytes: u64) -> &mut TunnelBudget
The most bytes, both ways together, a tunnel is charged in its lifetime. Only what the rates admitted counts: a datagram a rate refused is not charged to the quota.
pub fn without_quota(self) -> TunnelBudget
pub fn without_quota(self) -> TunnelBudget
The most bytes, both ways together, a tunnel is charged in its lifetime. Only what the rates admitted counts: a datagram a rate refused is not charged to the quota.
pub fn unset_quota(&mut self) -> &mut TunnelBudget
pub fn unset_quota(&mut self) -> &mut TunnelBudget
The most bytes, both ways together, a tunnel is charged in its lifetime. Only what the rates admitted counts: a datagram a rate refused is not charged to the quota.
pub fn with_unanswered(self, packets: u64, bytes: u64) -> TunnelBudget
pub fn with_unanswered(self, packets: u64, bytes: u64) -> TunnelBudget
What a tunnel forwards to a target that has not sent anything back yet.
pub fn set_unanswered(&mut self, packets: u64, bytes: u64) -> &mut TunnelBudget
pub fn set_unanswered(&mut self, packets: u64, bytes: u64) -> &mut TunnelBudget
What a tunnel forwards to a target that has not sent anything back yet.
pub fn with_min_charge(self, bytes: u64) -> TunnelBudget
pub fn with_min_charge(self, bytes: u64) -> TunnelBudget
The least a datagram is charged in bytes, so small and empty ones still cost; no datagram is charged more than one UDP payload, whatever this says.
pub fn set_min_charge(&mut self, bytes: u64) -> &mut TunnelBudget
pub fn set_min_charge(&mut self, bytes: u64) -> &mut TunnelBudget
The least a datagram is charged in bytes, so small and empty ones still cost; no datagram is charged more than one UDP payload, whatever this says.
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