pingora_core::upstreams::peer

Struct BasicPeer

Source
pub struct BasicPeer {
    pub _address: SocketAddr,
    pub sni: String,
    pub options: PeerOptions,
}
Expand description

A simple TCP or TLS peer without many complicated settings.

Fields§

§_address: SocketAddr§sni: String§options: PeerOptions

Implementations§

Source§

impl BasicPeer

Source

pub fn new(address: &str) -> Self

Create a new BasicPeer.

Source

pub fn new_uds<P: AsRef<Path>>(path: P) -> Result<Self>

Create a new BasicPeer with the given path to a Unix domain socket.

Trait Implementations§

Source§

impl Clone for BasicPeer

Source§

fn clone(&self) -> BasicPeer

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BasicPeer

Source§

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

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

impl Display for BasicPeer

Source§

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

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

impl Peer for BasicPeer

Source§

fn address(&self) -> &SocketAddr

The remote address to connect to
Source§

fn tls(&self) -> bool

If TLS should be used;
Source§

fn bind_to(&self) -> Option<&BindTo>

Information about the local source address this connection should be bound to.
Source§

fn sni(&self) -> &str

The SNI to send, if TLS is used
Source§

fn reuse_hash(&self) -> u64

To decide whether a Peer can use the connection established by another Peer. Read more
Source§

fn get_peer_options(&self) -> Option<&PeerOptions>

Get the additional options to connect to the peer. Read more
Source§

fn get_proxy(&self) -> Option<&Proxy>

Get the proxy setting to connect to the remote server
Source§

fn get_mut_peer_options(&mut self) -> Option<&mut PeerOptions>

Get the additional options for modification.
Source§

fn verify_cert(&self) -> bool

Whether the TLS handshake should validate the cert of the server.
Source§

fn verify_hostname(&self) -> bool

Whether the TLS handshake should verify that the server cert matches the SNI.
Source§

fn alternative_cn(&self) -> Option<&String>

The alternative common name to use to verify the server cert. Read more
Source§

fn connection_timeout(&self) -> Option<Duration>

How long connect() call should be wait before it returns a timeout error.
Source§

fn total_connection_timeout(&self) -> Option<Duration>

How long the overall connection establishment should take before a timeout error is returned.
Source§

fn idle_timeout(&self) -> Option<Duration>

If the connection can be reused, how long the connection should wait to be reused before it shuts down.
Source§

fn get_alpn(&self) -> Option<&ALPN>

Get the ALPN preference.
Source§

fn get_ca(&self) -> Option<&Arc<CaType>>

Get the CA cert to use to validate the server cert. Read more
Source§

fn get_client_cert_key(&self) -> Option<&Arc<CertKey>>

Get the client cert and key for mutual TLS if any
Source§

fn tcp_keepalive(&self) -> Option<&TcpKeepalive>

The TCP keepalive setting that should be applied to this connection
Source§

fn h2_ping_interval(&self) -> Option<Duration>

The interval H2 pings to send to the server if any
Source§

fn tcp_recv_buf(&self) -> Option<usize>

The size of the TCP receive buffer should be limited to. See SO_RCVBUF for more details.
Source§

fn dscp(&self) -> Option<u8>

The DSCP value that should be applied to the send side of this connection. See the RFC for more details.
Source§

fn tcp_fast_open(&self) -> bool

Whether to enable TCP fast open.
Source§

fn matches_fd<V: AsRawFd>(&self, fd: V) -> bool

Source§

fn get_tracer(&self) -> Option<Tracer>

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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