[−][src]Struct psk_client::builder::PskClientBuilder
The builder for a PSK client, somewhat simplifies creating a new PSK client and makes it more ergonomic.
Implementations
impl<'a, H: ToSocketAddrs> PskClientBuilder<'a, H>
[src]
pub fn new(host: H) -> Self
[src]
Create a new PskClientBuilder
with the default cipher list, a None
identity and an empty key.
pub fn build(self) -> Result<PskClient, PskClientError>
[src]
Returns a new PskClient
which can be used to
use psk_client::PskClient; use std::io::Write; if let Ok(client) = PskClient::builder("127.0.0.1:4433") .identity("some-client") .key("1A2B3C4D") .build() { if let Ok(mut connection) = client.connect() { connection.write_all(b"oing").unwrap(); } }
pub fn use_fips(mut self: Self) -> Self
[src]
Tries to enable FIPS for this client session, requires that OpenSSL has been compiled with FIPS enabled. Will silently fail if FIPS cannot be enabled.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .use_fips();
pub fn require_fips(mut self: Self) -> Self
[src]
Tries to enable FIPS for this client session, requires that OpenSSL has been compiled with FIPS enabled. Will return an error on client build if FIPS cannot be enabled.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .require_fips();
#[must_use]pub fn identity<S: Into<String>>(mut self: Self, identity: S) -> Self
[src]
Sets the identity to use for this session. This is required.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .identity("some-client");
pub fn identity_from<R: Read>(
self,
mut reader: R
) -> Result<Self, PskClientError>
[src]
self,
mut reader: R
) -> Result<Self, PskClientError>
Sets the identity to use for this session, taking the identity from an object implementing
Read
use psk_client::PskClient; use psk_client::error::PskClientError; use std::io::Cursor; // Create a dummy file let file = Cursor::new(b"some-identity"); let builder = PskClient::builder("127.0.0.1:4433") .identity_from(file) .unwrap();
#[must_use]pub fn key<S: Into<Vec<u8>>>(mut self: Self, key: S) -> Self
[src]
Sets the key to use for this session. Must be valid hex. This is required.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .key("1A2B3C4D");
pub fn key_from<R: Read>(self, mut reader: R) -> Result<Self, PskClientError>
[src]
Sets the key to sue for this session, taking the value from an object which implements Read
.
Must be valid hex. It will also cleanup non alphanumeric
characters to special sequences (like new lines, trailing whitespace) are not included.
use psk_client::PskClient; use psk_client::error::PskClientError; use std::io::Cursor; // Create a dummy file let file = Cursor::new(b"a1b2c3d4\n"); let builder = PskClient::builder("127.0.0.1:4433") .key_from(file) .unwrap();
pub fn cipher(mut self: Self, cipher: &'a str) -> Self
[src]
Adds a given cipher to the list of ciphers to send to the server
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .cipher("PSK-AES256-CBC-SHA");
pub fn reset_ciphers(mut self: Self) -> Self
[src]
Clears the current list of ciphers, which are initialised with a default PSK set.
use psk_client::PskClient; let builder = PskClient::builder("127.0.0.1:4433") .reset_ciphers();
Trait Implementations
impl<'a, H: Clone + ToSocketAddrs> Clone for PskClientBuilder<'a, H>
[src]
pub fn clone(&self) -> PskClientBuilder<'a, H>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, H: Debug + ToSocketAddrs> Debug for PskClientBuilder<'a, H>
[src]
impl<'a, H: Default + ToSocketAddrs> Default for PskClientBuilder<'a, H>
[src]
pub fn default() -> PskClientBuilder<'a, H>
[src]
impl<'a, H: PartialEq + ToSocketAddrs> PartialEq<PskClientBuilder<'a, H>> for PskClientBuilder<'a, H>
[src]
pub fn eq(&self, other: &PskClientBuilder<'a, H>) -> bool
[src]
pub fn ne(&self, other: &PskClientBuilder<'a, H>) -> bool
[src]
impl<'a, H: ToSocketAddrs> StructuralPartialEq for PskClientBuilder<'a, H>
[src]
Auto Trait Implementations
impl<'a, H> RefUnwindSafe for PskClientBuilder<'a, H> where
H: RefUnwindSafe,
[src]
H: RefUnwindSafe,
impl<'a, H> Send for PskClientBuilder<'a, H> where
H: Send,
[src]
H: Send,
impl<'a, H> Sync for PskClientBuilder<'a, H> where
H: Sync,
[src]
H: Sync,
impl<'a, H> Unpin for PskClientBuilder<'a, H> where
H: Unpin,
[src]
H: Unpin,
impl<'a, H> UnwindSafe for PskClientBuilder<'a, H> where
H: UnwindSafe,
[src]
H: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,