Skip to main content

Connection

Struct Connection 

Source
pub struct Connection { /* private fields */ }

Implementations§

Source§

impl Connection

Source

pub fn with_client_random(self, client_random: Vec<u8>) -> Connection

Source

pub fn with_verify(self, verify: bool) -> Connection

Source

pub fn disable_verify(self) -> Connection

Source

pub fn set_by_server_hello( &mut self, server_hello: &ServerHello<'_>, ) -> Result<(), RlsError>

Source

pub fn set_by_certificate( &mut self, certificate: Certificates<'_>, sni: &str, ) -> Result<(), RlsError>

Source

pub fn set_by_cert_req( &mut self, req: CertificateRequest<'_>, cert: Option<&mut Certificate>, ) -> Result<(), RlsError>

Source

pub fn set_by_server_exchange_key( &mut self, server_key: ServerKeyExchange, ) -> Result<(), RlsError>

Source

pub fn set_by_client_exchange_key(&mut self, client_key: ClientKeyExchange<'_>)

Source

pub fn pub_share_key(&mut self) -> Result<Buf<'_>, RlsError>

Source

pub fn make_cipher(&mut self, server: bool) -> Result<(), RlsError>

Source

pub fn gen_server_hello<'a>( &mut self, client_hello: ClientHello<'_>, certificate: &'a mut [Certificate], pri_key: &RsaKey, random: &'a [u8], ) -> Result<RecordLayer<'a>, RlsError>

Source

pub fn make_finish_message( &mut self, buffer: &mut [u8], server: bool, ) -> Result<usize, RlsError>

§tls Record结构-5bytes(头部)
  • aes-gcm: payload(8byte的explicit+16payload+16byte的tag)
  • chacha20_poly1305: payload(16payload+16byte tag)
Source

pub fn verify_finish( &mut self, data: &[u8], server: bool, ) -> Result<(), RlsError>

Source

pub fn make_message( &mut self, cty: RecordType, buffer: &mut [u8], payload: &[u8], ) -> Result<usize, RlsError>

Source

pub fn read_message( &mut self, origin: &[u8], buffer: &mut [u8], ) -> Result<usize, RlsError>

Source

pub fn alpn(&self) -> Option<&ALPN>

Source

pub fn update_session(&mut self, data: impl AsRef<[u8]>) -> Result<(), RlsError>

Source

pub fn cipher_suite(&self) -> &CipherSuite

Source

pub fn mtls(&self) -> bool

Source

pub fn handle_mtls_client<W>( &mut self, writer: &mut W, key: &RsaKey, ) -> Result<usize, RlsError>
where W: WriteExt,

Trait Implementations§

Source§

impl Default for Connection

Source§

fn default() -> Connection

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.