Tx3RelayConfig

Struct Tx3RelayConfig 

Source
#[non_exhaustive]
pub struct Tx3RelayConfig { pub tx3_config: Tx3Config, pub max_inbound_connections: u32, pub max_control_streams: u32, pub max_control_streams_per_ip: u32, pub max_relays_per_control: u32, pub connection_timeout_ms: u32, }
Expand description

A wrapper around Tx3Config with some additional parameters specific to configuring a relay server.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§tx3_config: Tx3Config

The standard tx3 configuration parameters.

§max_inbound_connections: u32

The maximum incoming connections that will be allowed. Any incoming connections beyond this limit will be dropped without response. The default value is 20480, which, while approaching as large as it can be, isn’t that large… if every user has the default max of 64 relays open, we can only support 320 users. It would be ideal to only use the following more specific limits, but we cannot know the stream type until reading from it, so we need this way to drop streams quicker immediately on accept().

§max_control_streams: u32

The maximum control streams we are willing to handle as a relay node. The default value is 320. 320 * 64 relays per control stream = 20480 which is approaching the max ephemeral port range on many systems (32768–60999 = 28231).

§max_control_streams_per_ip: u32

The maximum control streams we allow per remote ip address… Sorry folks behind campus or corporate NATs, this is the best we can do to at least require the effort of distributing a DDoS attack. But even with the small number of 4 here, it only takes 80 distributed nodes to lock down a relay server. The default value is 4.

§max_relays_per_control: u32

The maximum relay streams allowed for each relay client (identified by the control stream). Clients should close least recently used connections before the open count reaches this number, or any new incoming connections will be dropped before being reported to the control stream. The default value is 64.

§connection_timeout_ms: u32

This timeout is applied to two different types of incoming streams. First, it requires control stream TLS negotiation to complete in this time period. Second, it requires initiated streams to be matched and spliced to a target within this time frame. The default value is 20 seconds (1000 * 20).

Implementations§

Source§

impl Tx3RelayConfig

Source

pub fn new() -> Self

Construct a new default Tx3RelayConfig

Source

pub fn with_bind<B>(self, bind: B) -> Self
where B: Into<Tx3Url>,

Append a bind to the list of bindings (shadow the deref builder function so we return ourselves)

Trait Implementations§

Source§

impl Default for Tx3RelayConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for Tx3RelayConfig

Source§

type Target = Tx3Config

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Tx3RelayConfig

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'de> Deserialize<'de> for Tx3RelayConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Tx3RelayConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,