pub struct TlsSender { /* private fields */ }Expand description
Sends events over one TLS connection to a TAK Server streaming input,
for example takserver:8089. The handshake (including the client
certificate) completes in connect, so a wrong CA or a rejected
certificate fails there, not on the first event.
use uas_cot::net::{TlsConfig, TlsSender};
let tls = TlsConfig::from_pem_files("ca.pem", "user.pem", "user.key")?;
let mut tak = TlsSender::connect("takserver.example:8089", &tls)?;
tak.send(&uas_cot::Event::new("test-1", "a-f-G", uas_cot::now_us(), 60))?;Implementations§
Source§impl TlsSender
impl TlsSender
Sourcepub fn connect(addr: &str, config: &TlsConfig) -> Result<Self>
pub fn connect(addr: &str, config: &TlsConfig) -> Result<Self>
Connects to addr (host:port) and checks the server certificate
against host.
Sourcepub fn connect_named(
addr: impl ToSocketAddrs,
server_name: &str,
config: &TlsConfig,
) -> Result<Self>
pub fn connect_named( addr: impl ToSocketAddrs, server_name: &str, config: &TlsConfig, ) -> Result<Self>
Connects to addr and checks the server certificate against
server_name (a DNS name or an IP address), for a server you reach
by one address and whose certificate names another.
Sourcepub fn send(&mut self, event: &Event) -> Result<()>
pub fn send(&mut self, event: &Event) -> Result<()>
Sends one event and flushes it to the socket.
Sourcepub fn stream_mut(&mut self) -> &mut StreamOwned<ClientConnection, TcpStream> ⓘ
pub fn stream_mut(&mut self) -> &mut StreamOwned<ClientConnection, TcpStream> ⓘ
The TLS stream, for reading what the server sends back (TAK Server streams other clients’ events to a connected client).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TlsSender
impl !UnwindSafe for TlsSender
impl Forget for TlsSender
impl Freeze for TlsSender
impl Move for TlsSender
impl Send for TlsSender
impl Sync for TlsSender
impl Unpin for TlsSender
impl UnsafeUnpin for TlsSender
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