Skip to content

Commit dfc7989

Browse files
authored
Merge pull request #2 from dignifiedquire/master
fix test_0rtt, examples and cargo fmt
2 parents b9b4b0c + 3994a30 commit dfc7989

File tree

11 files changed

+28
-30
lines changed

11 files changed

+28
-30
lines changed

examples/client/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use async_std::io;
2-
use async_std::io::Write;
32
use async_std::net::TcpStream;
3+
use async_std::prelude::*;
44
use async_std::task;
55
use async_tls::TlsConnector;
66

examples/server/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use async_std::io;
2-
use async_std::io::Write;
32
use async_std::net::{TcpListener, TcpStream};
4-
use async_std::stream::Stream;
3+
use async_std::prelude::*;
54
use async_std::task;
65
use async_tls::TlsAcceptor;
76
use rustls::internal::pemfile::{certs, rsa_private_keys};
@@ -41,7 +40,7 @@ fn load_keys(path: &Path) -> io::Result<Vec<PrivateKey>> {
4140

4241
/// Configure the server using rusttls
4342
/// See https://docs.rs/rustls/0.16.0/rustls/struct.ServerConfig.html for details
44-
///
43+
///
4544
/// A TLS server needs a certificate and a fitting private key
4645
fn load_config(options: &Options) -> io::Result<ServerConfig> {
4746
let certs = load_certs(&options.cert)?;

src/acceptor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ use crate::server;
44
use futures::io::{AsyncRead, AsyncWrite};
55
use rustls::{ServerConfig, ServerSession};
66
use std::future::Future;
7+
use std::io;
78
use std::pin::Pin;
89
use std::sync::Arc;
910
use std::task::{Context, Poll};
10-
use std::io;
1111

1212
/// The TLS accepting part. The acceptor drives
1313
/// the server side of the TLS handshake process. It works
@@ -73,4 +73,4 @@ impl From<Arc<ServerConfig>> for TlsAcceptor {
7373
fn from(inner: Arc<ServerConfig>) -> TlsAcceptor {
7474
TlsAcceptor { inner }
7575
}
76-
}
76+
}

src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::rusttls::stream::Stream;
21
use crate::common::tls_state::TlsState;
2+
use crate::rusttls::stream::Stream;
33
use futures::io::{AsyncRead, AsyncWrite};
44
use rustls::ClientSession;
55
use std::future::Future;

src/common/tls_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ impl TlsState {
3636
_ => true,
3737
}
3838
}
39-
}
39+
}

src/connector.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ use crate::common::tls_state::TlsState;
33
use crate::client;
44

55
use futures::io::{AsyncRead, AsyncWrite};
6-
use rustls::{ClientConfig,ClientSession};
6+
use rustls::{ClientConfig, ClientSession};
77
use std::future::Future;
8+
use std::io;
89
use std::pin::Pin;
910
use std::sync::Arc;
1011
use std::task::{Context, Poll};
11-
use std::io;
1212
use webpki::DNSNameRef;
1313

1414
/// The TLS connecting part. The acceptor drives
1515
/// the client side of the TLS handshake process. It works
1616
/// on any asynchronous stream.
17-
///
17+
///
1818
/// It provides a simple interface (`connect`), returning a future
1919
/// that will resolve when the handshake process completed. On
2020
/// success, it will hand you an async `TlsStream`.
21-
///
21+
///
2222
/// To create a `TlsConnector` with a non-default configuation, create
2323
/// a `rusttls::ClientConfig` and call `.into()` on it.
2424
///
2525
/// ## Example
26-
///
26+
///
2727
/// ```rust
2828
/// #![feature(async_await)]
2929
///
@@ -67,7 +67,7 @@ impl Default for TlsConnector {
6767

6868
impl TlsConnector {
6969
/// Create a new TlsConnector with default configuration.
70-
///
70+
///
7171
/// This is the same as calling `TlsConnector::default()`.
7272
pub fn new() -> Self {
7373
Default::default()
@@ -157,7 +157,3 @@ impl<IO: AsyncRead + AsyncWrite + Unpin> Future for Connect<IO> {
157157
Pin::new(&mut self.0).poll(cx)
158158
}
159159
}
160-
161-
#[cfg(feature = "early-data")]
162-
#[cfg(test)]
163-
mod test_0rtt;

src/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
33
#![deny(unsafe_code)]
44

5+
mod acceptor;
56
pub mod client;
6-
pub mod server;
77
mod common;
8-
mod rusttls;
98
mod connector;
10-
mod acceptor;
9+
mod rusttls;
10+
pub mod server;
11+
12+
pub use acceptor::TlsAcceptor;
13+
pub use connector::TlsConnector;
1114

12-
pub use acceptor::TlsAcceptor as TlsAcceptor;
13-
pub use connector::TlsConnector as TlsConnector;
15+
#[cfg(feature = "early-data")]
16+
#[cfg(test)]
17+
mod test_0rtt;

src/rusttls/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub(crate) mod stream;
1+
pub(crate) mod stream;

src/rusttls/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,5 @@ impl<'a, IO: AsyncRead + AsyncWrite + Unpin, S: Session> AsyncWrite for Stream<'
258258
}
259259

260260
#[cfg(test)]
261-
#[path="test_stream.rs"]
261+
#[path = "test_stream.rs"]
262262
mod test_stream;

src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::rusttls::stream::Stream;
21
use crate::common::tls_state::TlsState;
2+
use crate::rusttls::stream::Stream;
33

44
use futures::io::{AsyncRead, AsyncWrite};
55
use rustls::ServerSession;

0 commit comments

Comments
 (0)