mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-04 21:37:58 +03:00
Prepare connect release
This commit is contained in:
parent
16d5d1d3f4
commit
db671bdb7f
7 changed files with 43 additions and 19 deletions
|
@ -1,5 +1,9 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## [1.0.0] - 2024-01-09
|
||||||
|
|
||||||
|
* Release
|
||||||
|
|
||||||
## [1.0.0-b.1] - 2024-01-08
|
## [1.0.0-b.1] - 2024-01-08
|
||||||
|
|
||||||
* Refactor io tls filters
|
* Refactor io tls filters
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ntex-connect"
|
name = "ntex-connect"
|
||||||
version = "1.0.0-b.1"
|
version = "1.0.0"
|
||||||
authors = ["ntex contributors <team@ntex.rs>"]
|
authors = ["ntex contributors <team@ntex.rs>"]
|
||||||
description = "ntexwork connect utils for ntex framework"
|
description = "ntexwork connect utils for ntex framework"
|
||||||
keywords = ["network", "framework", "async", "futures"]
|
keywords = ["network", "framework", "async", "futures"]
|
||||||
|
@ -35,8 +35,8 @@ async-std = ["ntex-rt/async-std", "ntex-async-std"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ntex-service = "2.0.0"
|
ntex-service = "2.0.0"
|
||||||
ntex-io = "1.0.0-b.1"
|
ntex-io = "1.0.0"
|
||||||
ntex-tls = "1.0.0-b.1"
|
ntex-tls = "1.0.0"
|
||||||
ntex-util = "1.0.0"
|
ntex-util = "1.0.0"
|
||||||
ntex-bytes = "0.1.21"
|
ntex-bytes = "0.1.21"
|
||||||
ntex-http = "0.1"
|
ntex-http = "0.1"
|
||||||
|
@ -45,9 +45,9 @@ ntex-rt = "0.4.7"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
|
||||||
ntex-tokio = { version = "0.4.0-b.0", optional = true }
|
ntex-tokio = { version = "0.4.0", optional = true }
|
||||||
ntex-glommio = { version = "0.4.0-b.0", optional = true }
|
ntex-glommio = { version = "0.4.0", optional = true }
|
||||||
ntex-async-std = { version = "0.4.0-b.0", optional = true }
|
ntex-async-std = { version = "0.4.0", optional = true }
|
||||||
|
|
||||||
# openssl
|
# openssl
|
||||||
tls-openssl = { version="0.10", package = "openssl", optional = true }
|
tls-openssl = { version="0.10", package = "openssl", optional = true }
|
||||||
|
@ -59,4 +59,4 @@ webpki-roots = { version = "0.25", optional = true }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
ntex = { version = "1.0.0-b.0", features = ["tokio"] }
|
ntex = { version = "1.0.0-b.1", features = ["tokio"] }
|
||||||
|
|
|
@ -19,14 +19,24 @@ impl<T> Resolver<T> {
|
||||||
|
|
||||||
impl<T: Address> Resolver<T> {
|
impl<T: Address> Resolver<T> {
|
||||||
/// Lookup ip addresses for provided host
|
/// Lookup ip addresses for provided host
|
||||||
pub async fn lookup(&self, mut req: Connect<T>) -> Result<Connect<T>, ConnectError> {
|
pub async fn lookup(&self, req: Connect<T>) -> Result<Connect<T>, ConnectError> {
|
||||||
|
self.lookup_with_tag(req, "TCP-CLIENT").await
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
/// Lookup ip addresses for provided host
|
||||||
|
pub async fn lookup_with_tag(
|
||||||
|
&self,
|
||||||
|
mut req: Connect<T>,
|
||||||
|
tag: &'static str,
|
||||||
|
) -> Result<Connect<T>, ConnectError> {
|
||||||
if req.addr.is_some() || req.req.addr().is_some() {
|
if req.addr.is_some() || req.req.addr().is_some() {
|
||||||
Ok(req)
|
Ok(req)
|
||||||
} else if let Ok(ip) = req.host().parse() {
|
} else if let Ok(ip) = req.host().parse() {
|
||||||
req.addr = Some(Either::Left(net::SocketAddr::new(ip, req.port())));
|
req.addr = Some(Either::Left(net::SocketAddr::new(ip, req.port())));
|
||||||
Ok(req)
|
Ok(req)
|
||||||
} else {
|
} else {
|
||||||
log::trace!("DNS resolver: resolving host {:?}", req.host());
|
log::trace!("{}: DNS Resolver - resolving host {:?}", tag, req.host());
|
||||||
|
|
||||||
let host = if req.host().contains(':') {
|
let host = if req.host().contains(':') {
|
||||||
req.host().to_string()
|
req.host().to_string()
|
||||||
|
@ -44,7 +54,8 @@ impl<T: Address> Resolver<T> {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
log::trace!(
|
log::trace!(
|
||||||
"DNS resolver: host {:?} resolved to {:?}",
|
"{}: DNS Resolver - host {:?} resolved to {:?}",
|
||||||
|
tag,
|
||||||
req.host(),
|
req.host(),
|
||||||
req.addrs()
|
req.addrs()
|
||||||
);
|
);
|
||||||
|
@ -57,7 +68,8 @@ impl<T: Address> Resolver<T> {
|
||||||
}
|
}
|
||||||
Ok(Err(e)) => {
|
Ok(Err(e)) => {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
"DNS resolver: failed to resolve host {:?} err: {}",
|
"{}: DNS Resolver - failed to resolve host {:?} err: {}",
|
||||||
|
tag,
|
||||||
req.host(),
|
req.host(),
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
|
@ -65,7 +77,8 @@ impl<T: Address> Resolver<T> {
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
"DNS resolver: failed to resolve host {:?} err: {}",
|
"{}: DNS Resolver - failed to resolve host {:?} err: {}",
|
||||||
|
tag,
|
||||||
req.host(),
|
req.host(),
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
|
|
|
@ -50,7 +50,10 @@ impl<T: Address> Connector<T> {
|
||||||
Connect<T>: From<U>,
|
Connect<T>: From<U>,
|
||||||
{
|
{
|
||||||
// resolve first
|
// resolve first
|
||||||
let address = self.resolver.lookup(message.into()).await?;
|
let address = self
|
||||||
|
.resolver
|
||||||
|
.lookup_with_tag(message.into(), self.tag)
|
||||||
|
.await?;
|
||||||
|
|
||||||
let port = address.port();
|
let port = address.port();
|
||||||
let Connect { req, addr, .. } = address;
|
let Connect { req, addr, .. } = address;
|
||||||
|
@ -92,7 +95,7 @@ impl<T> Clone for Connector<T> {
|
||||||
impl<T> fmt::Debug for Connector<T> {
|
impl<T> fmt::Debug for Connector<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("Connector")
|
f.debug_struct("Connector")
|
||||||
.field("tagr", &self.tag)
|
.field("tag", &self.tag)
|
||||||
.field("resolver", &self.resolver)
|
.field("resolver", &self.resolver)
|
||||||
.field("memory_pool", &self.pool)
|
.field("memory_pool", &self.pool)
|
||||||
.finish()
|
.finish()
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## [1.0.0] - 2024-01-09
|
||||||
|
|
||||||
|
* Release
|
||||||
|
|
||||||
## [1.0.0-b.1] - 2024-01-08
|
## [1.0.0-b.1] - 2024-01-08
|
||||||
|
|
||||||
* Refactor io tls filters
|
* Refactor io tls filters
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ntex-tls"
|
name = "ntex-tls"
|
||||||
version = "1.0.0-b.1"
|
version = "1.0.0"
|
||||||
authors = ["ntex contributors <team@ntex.rs>"]
|
authors = ["ntex contributors <team@ntex.rs>"]
|
||||||
description = "An implementation of SSL streams for ntex backed by OpenSSL"
|
description = "An implementation of SSL streams for ntex backed by OpenSSL"
|
||||||
keywords = ["network", "framework", "async", "futures"]
|
keywords = ["network", "framework", "async", "futures"]
|
||||||
|
@ -26,7 +26,7 @@ rustls = ["tls_rust"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ntex-bytes = "0.1.21"
|
ntex-bytes = "0.1.21"
|
||||||
ntex-io = "1.0.0-b.1"
|
ntex-io = "1.0.0"
|
||||||
ntex-util = "1.0.0"
|
ntex-util = "1.0.0"
|
||||||
ntex-service = "2.0.0"
|
ntex-service = "2.0.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
@ -39,7 +39,7 @@ tls_openssl = { version = "0.10", package = "openssl", optional = true }
|
||||||
tls_rust = { version = "0.21", package = "rustls", optional = true }
|
tls_rust = { version = "0.21", package = "rustls", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
ntex = { version = "1.0.0-b.0", features = ["openssl", "rustls", "tokio"] }
|
ntex = { version = "1.0.0-b.1", features = ["openssl", "rustls", "tokio"] }
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
rustls-pemfile = "1.0"
|
rustls-pemfile = "1.0"
|
||||||
webpki-roots = "0.25"
|
webpki-roots = "0.25"
|
||||||
|
|
|
@ -49,7 +49,7 @@ async-std = ["ntex-rt/async-std", "ntex-async-std", "ntex-connect/async-std"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ntex-codec = "0.6.2"
|
ntex-codec = "0.6.2"
|
||||||
ntex-connect = "1.0.0-b.1"
|
ntex-connect = "1.0.0"
|
||||||
ntex-http = "0.1.11"
|
ntex-http = "0.1.11"
|
||||||
ntex-router = "0.5.2"
|
ntex-router = "0.5.2"
|
||||||
ntex-service = "2.0.0"
|
ntex-service = "2.0.0"
|
||||||
|
@ -59,7 +59,7 @@ ntex-bytes = "0.1.21"
|
||||||
ntex-h2 = "0.5.0-b.0"
|
ntex-h2 = "0.5.0-b.0"
|
||||||
ntex-rt = "0.4.11"
|
ntex-rt = "0.4.11"
|
||||||
ntex-io = "1.0.0"
|
ntex-io = "1.0.0"
|
||||||
ntex-tls = "1.0.0-b.1"
|
ntex-tls = "1.0.0"
|
||||||
ntex-tokio = { version = "0.4.0", optional = true }
|
ntex-tokio = { version = "0.4.0", optional = true }
|
||||||
ntex-glommio = { version = "0.4.0", optional = true }
|
ntex-glommio = { version = "0.4.0", optional = true }
|
||||||
ntex-async-std = { version = "0.4.0", optional = true }
|
ntex-async-std = { version = "0.4.0", optional = true }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue