pub struct ConnectionInfo { /* private fields */ }Expand description
The connection requests arrive on, in the form a tonic server records it: the TCP ends, and behind TLS the client’s certificate chain.
Built from what Connected::connect_info returns for a
tokio::net::TcpStream (ConnectionInfo::from) or a
tokio_rustls::server::TlsStream<TcpStream> (ConnectionInfo::tls), so a
tonic handler behind the proxy reads it as it would behind tonic’s own
server: Request::remote_addr, and Request::peer_certs for mTLS.
Implementations§
Source§impl ConnectionInfo
impl ConnectionInfo
Sourcepub fn remote_addr(&self) -> Option<SocketAddr>
pub fn remote_addr(&self) -> Option<SocketAddr>
The client’s address.
Sourcepub fn peer_certs(&self) -> Option<Arc<Vec<CertificateDer<'static>>>>
pub fn peer_certs(&self) -> Option<Arc<Vec<CertificateDer<'static>>>>
The certificate chain the client presented over TLS, if it did.
Source§impl ConnectionInfo
impl ConnectionInfo
Sourcepub fn tls(tls: TlsConnectInfo) -> Self
pub fn tls(tls: TlsConnectInfo) -> Self
A TLS connection, from what connect_info reports for a
tokio_rustls::server::TlsStream<TcpStream>: the TCP ends and the
client’s certificate chain.
Trait Implementations§
Source§impl Clone for ConnectionInfo
impl Clone for ConnectionInfo
Source§impl Debug for ConnectionInfo
impl Debug for ConnectionInfo
Source§impl From<TcpConnectInfo> for ConnectionInfo
impl From<TcpConnectInfo> for ConnectionInfo
Source§fn from(tcp: TcpConnectInfo) -> Self
fn from(tcp: TcpConnectInfo) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ConnectionInfo
impl RefUnwindSafe for ConnectionInfo
impl Send for ConnectionInfo
impl Sync for ConnectionInfo
impl Unpin for ConnectionInfo
impl UnsafeUnpin for ConnectionInfo
impl UnwindSafe for ConnectionInfo
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request