mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-04 05:17:39 +03:00
Refactor service pipelines (#214)
This commit is contained in:
parent
a02009d7be
commit
6382ef6b40
61 changed files with 848 additions and 792 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "ntex-tls"
|
||||
version = "0.3.0-beta.1"
|
||||
version = "0.3.0"
|
||||
authors = ["ntex contributors <team@ntex.rs>"]
|
||||
description = "An implementation of SSL streams for ntex backed by OpenSSL"
|
||||
keywords = ["network", "framework", "async", "futures"]
|
||||
|
@ -26,9 +26,9 @@ rustls = ["tls_rust"]
|
|||
|
||||
[dependencies]
|
||||
ntex-bytes = "0.1.19"
|
||||
ntex-io = "0.3.0-beta.1"
|
||||
ntex-util = "0.3.0-beta.1"
|
||||
ntex-service = "1.2.0-beta.1"
|
||||
ntex-io = "0.3.0"
|
||||
ntex-util = "0.3.0"
|
||||
ntex-service = "1.2.0"
|
||||
log = "0.4"
|
||||
pin-project-lite = "0.2"
|
||||
|
||||
|
@ -39,7 +39,7 @@ tls_openssl = { version = "0.10", package = "openssl", optional = true }
|
|||
tls_rust = { version = "0.21", package = "rustls", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
ntex = { version = "0.7.0-beta.1", features = ["openssl", "rustls", "tokio"] }
|
||||
ntex = { version = "0.7.0", features = ["openssl", "rustls", "tokio"] }
|
||||
env_logger = "0.10"
|
||||
rustls-pemfile = { version = "1.0" }
|
||||
webpki-roots = { version = "0.23" }
|
||||
rustls-pemfile = "1.0"
|
||||
webpki-roots = "0.23"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{fs::File, io, io::BufReader, sync::Arc};
|
||||
|
||||
use ntex::service::{fn_service, pipeline_factory};
|
||||
use ntex::service::{chain_factory, fn_service};
|
||||
use ntex::{codec, io::filter, io::Io, server, util::Either};
|
||||
use ntex_tls::rustls::TlsAcceptor;
|
||||
use rustls_pemfile::{certs, rsa_private_keys};
|
||||
|
@ -34,7 +34,7 @@ async fn main() -> io::Result<()> {
|
|||
// start server
|
||||
server::ServerBuilder::new()
|
||||
.bind("basic", "127.0.0.1:8443", move |_| {
|
||||
pipeline_factory(filter(TlsAcceptor::new(tls_config.clone()))).and_then(
|
||||
chain_factory(filter(TlsAcceptor::new(tls_config.clone()))).and_then(
|
||||
fn_service(|io: Io<_>| async move {
|
||||
println!("New client is connected");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::io;
|
||||
|
||||
use ntex::service::{fn_service, pipeline_factory};
|
||||
use ntex::service::{chain_factory, fn_service};
|
||||
use ntex::{codec, io::filter, io::Io, server, util::Either};
|
||||
use ntex_tls::openssl::{PeerCert, PeerCertChain, SslAcceptor};
|
||||
use tls_openssl::ssl::{self, SslFiletype, SslMethod, SslVerifyMode};
|
||||
|
@ -27,8 +27,8 @@ async fn main() -> io::Result<()> {
|
|||
// start server
|
||||
server::ServerBuilder::new()
|
||||
.bind("basic", "127.0.0.1:8443", move |_| {
|
||||
pipeline_factory(filter(SslAcceptor::new(acceptor.clone()))).and_then(
|
||||
fn_service(|io: Io<_>| async move {
|
||||
chain_factory(filter(SslAcceptor::new(acceptor.clone()))).and_then(fn_service(
|
||||
|io: Io<_>| async move {
|
||||
println!("New client is connected");
|
||||
if let Some(cert) = io.query::<PeerCert>().as_ref() {
|
||||
println!("Peer cert: {:?}", cert.0);
|
||||
|
@ -53,8 +53,8 @@ async fn main() -> io::Result<()> {
|
|||
}
|
||||
println!("Client is disconnected");
|
||||
Ok(())
|
||||
}),
|
||||
)
|
||||
},
|
||||
))
|
||||
})?
|
||||
.workers(1)
|
||||
.run()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue