generated from PlexSheep/rs-base
Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Christoph J. Scherr | 557e0b61b0 | |
Christoph J. Scherr | bc2b7284df |
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "netpong"
|
name = "netpong"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = true
|
publish = true
|
||||||
authors = ["Christoph J. Scherr <software@cscherr.de>"]
|
authors = ["Christoph J. Scherr <software@cscherr.de>"]
|
||||||
|
|
|
@ -11,7 +11,7 @@ use tokio::{
|
||||||
net::TcpStream,
|
net::TcpStream,
|
||||||
};
|
};
|
||||||
use tokio_rustls::{
|
use tokio_rustls::{
|
||||||
rustls::{self, pki_types}, TlsConnector, TlsStream
|
rustls::{self, pki_types}, TlsConnector, client::TlsStream
|
||||||
};
|
};
|
||||||
use webpki_roots;
|
use webpki_roots;
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@ const BUF_SIZE: usize = 512;
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
cfg: Config,
|
cfg: Config,
|
||||||
stream: TlsStream<TcpStream>,
|
stream: TlsStream<TcpStream>,
|
||||||
connector: TlsConnector,
|
|
||||||
domain: pki_types::ServerName<'static>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
|
@ -47,13 +45,11 @@ impl Client {
|
||||||
return Err(err.into());
|
return Err(err.into());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut stream = connector.connect(domain, TcpStream::connect(&cfg.addr).await?).await?;
|
let stream = connector.connect(domain.clone(), TcpStream::connect(&cfg.addr).await?).await?;
|
||||||
|
|
||||||
Ok(Client {
|
Ok(Client {
|
||||||
cfg: cfg.clone(),
|
cfg: cfg.clone(),
|
||||||
stream,
|
stream,
|
||||||
connector,
|
|
||||||
domain,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue