Skip to main content

ReverseServerConfig

Struct ReverseServerConfig 

Source
pub struct ReverseServerConfig {
    pub control_bind: SocketAddr,
    pub external_bind: Option<SocketAddr>,
    pub auth_username: Option<String>,
    pub auth_password: Option<String>,
    pub max_control_connections: u32,
    pub read_timeout_ms: u64,
    pub allow_bind: Option<Vec<SocketAddr>>,
    pub max_listeners_per_client: u32,
    pub max_streams_per_listener: u32,
    pub max_pending_external: u32,
    pub tls: Option<ReverseServerTlsConfig>,
}
Expand description

Configuration for a reverse proxy server (acceptor side).

The server accepts control connections from remote clients and dispatches externally-accepted connections back through the control channel.

Fields§

§control_bind: SocketAddr

Address to bind the control listener on.

§external_bind: Option<SocketAddr>

Address to bind the external listener on (for clients to connect to).

§auth_username: Option<String>

Optional username for authentication.

§auth_password: Option<String>

Optional password for authentication.

§max_control_connections: u32

Maximum concurrent control connections.

§read_timeout_ms: u64

Read timeout in milliseconds (for idle control connections).

§allow_bind: Option<Vec<SocketAddr>>

Optional list of allowed external bind addresses. When Some and non-empty, the server rejects bind addresses not in the list. When None or empty, no allowlist enforcement is applied.

§max_listeners_per_client: u32

Maximum number of external listeners per control client. Currently pproxy supports one external listener per control connection, so defaults to 1.

§max_streams_per_listener: u32

Maximum concurrent streams per external listener.

§max_pending_external: u32

Maximum number of concurrent external clients queued while waiting for a control connection. Excess clients are dropped.

§tls: Option<ReverseServerTlsConfig>

Optional TLS for the control channel. When present, the TCP control stream is wrapped with Rustls before reverse framing/authentication. External listener traffic remains plaintext TCP.

Implementations§

Source§

impl ReverseServerConfig

Source

pub fn is_bind_allowed(&self, addr: SocketAddr) -> bool

Returns true if the supplied external bind address is allowed by the configured allow_bind policy. When allow_bind is None or empty, all addresses are allowed.

Source

pub fn is_loopback(addr: SocketAddr) -> bool

Returns true if the address is loopback (127.0.0.0/8 or ::1).

Source

pub fn validate(&self) -> Result<(), ProtocolError>

Validate this configuration. Returns an error if the configuration is unsafe (e.g. external bind on a non-loopback address without authentication and without an explicit allow_bind allowlist).

This is a defense-in-depth check: it catches misconfigurations that would otherwise expose the reverse proxy to unauthenticated network clients. TLS material is validated here as well so impossible combinations fail before any socket is bound.

Trait Implementations§

Source§

impl Clone for ReverseServerConfig

Source§

fn clone(&self) -> ReverseServerConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReverseServerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ReverseServerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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