Skip to main content

TtkClient

Struct TtkClient 

Source
pub struct TtkClient { /* private fields */ }
Expand description

HTTP/3 client for communicating with TTKServer over QUIC.

Implementations§

Source§

impl TtkClient

Connecting to the server and issuing requests.

Source

pub async fn connect( server_addr: SocketAddr, server_name: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>

Connect to the TTKServer at the specified server_addr with the given SNI server_name, accepting only genuine AWS Nitro attestation (see EnclaveCertVerifier::new).

Source

pub async fn connect_with_verifier( server_addr: SocketAddr, server_name: &str, verifier: EnclaveCertVerifier, ) -> Result<Self, Box<dyn Error + Send + Sync>>

Connect to the TTKServer using a custom attestation verifier policy.

Source

pub fn server_addr(&self) -> SocketAddr

Return the server address this client is connected to.

Source

pub fn server_name(&self) -> &str

Return the SNI server name configured for this client.

Source

pub fn peer_cert(&self) -> Option<&CertificateDer<'static>>

Retrieve the peer’s certificate DER bytes if captured.

Source

pub fn peer_cert_sha256(&self) -> Option<[u8; 32]>

Retrieve the SHA-256 digest of the peer certificate.

Source

pub fn peer_cert_sha256_hex(&self) -> Option<String>

Retrieve the SHA-256 digest of the peer certificate as a hex string.

Source

pub async fn get( &mut self, path: &str, ) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>

Send an HTTP/3 GET request to the specified path.

Source

pub async fn post( &mut self, path: &str, body: &[u8], ) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>

Send an HTTP/3 POST request with the given body to the specified path.

Source

pub async fn send( &mut self, req: Request<()>, payload: Option<&[u8]>, ) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>

Send an HTTP/3 request with an optional payload and receive the response.

Source

pub async fn close(self) -> Result<(), Box<dyn Error + Send + Sync>>

Close the client and wait for underlying QUIC streams and driver to settle.

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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