1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 18:02:58 +01:00

add unix domain sockets support

This commit is contained in:
Nikolay Kim 2019-07-18 16:43:42 +06:00
parent 9d1b428b34
commit 2955e49d78
3 changed files with 37 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-server-config" name = "actix-server-config"
version = "0.1.1" version = "0.1.2"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix server config utils" description = "Actix server config utils"
homepage = "https://actix.rs" homepage = "https://actix.rs"
@ -14,7 +14,7 @@ name = "actix_server_config"
path = "src/lib.rs" path = "src/lib.rs"
[package.metadata.docs.rs] [package.metadata.docs.rs]
features = ["ssl", "rust-tls"] features = ["ssl", "rust-tls", "uds"]
[features] [features]
default = [] default = []
@ -25,6 +25,9 @@ ssl = ["tokio-openssl"]
# rustls # rustls
rust-tls = ["rustls", "tokio-rustls"] rust-tls = ["rustls", "tokio-rustls"]
# unix domain sockets
uds = ["tokio-uds"]
[dependencies] [dependencies]
futures = "0.1.25" futures = "0.1.25"
tokio-io = "0.1.12" tokio-io = "0.1.12"
@ -32,3 +35,4 @@ tokio-tcp = "0.1"
tokio-openssl = { version="0.3.0", optional = true } tokio-openssl = { version="0.3.0", optional = true }
rustls = { version = "0.15.2", optional = true } rustls = { version = "0.15.2", optional = true }
tokio-rustls = { version = "0.9.1", optional = true } tokio-rustls = { version = "0.9.1", optional = true }
tokio-uds = { version="0.2.5", optional = true }

View File

@ -1,5 +1,12 @@
# Changes # Changes
## [0.1.2] - 2019-07-18
### Added
* Add unix domnain sockets support
## [0.1.1] - 2019-04-16 ## [0.1.1] - 2019-04-16
### Added ### Added

View File

@ -95,9 +95,9 @@ impl<T, P> Io<T, P> {
/// Return new Io object with new parameter. /// Return new Io object with new parameter.
pub fn set<U>(self, params: U) -> Io<T, U> { pub fn set<U>(self, params: U) -> Io<T, U> {
Io { Io {
params,
io: self.io, io: self.io,
proto: self.proto, proto: self.proto,
params: params,
} }
} }
@ -216,3 +216,26 @@ impl<T: IoStream> IoStream for tokio_rustls::TlsStream<T, rustls::ServerSession>
self.get_mut().0.set_keepalive(dur) self.get_mut().0.set_keepalive(dur)
} }
} }
#[cfg(all(unix, feature = "uds"))]
impl IoStream for tokio_uds::UnixStream {
#[inline]
fn peer_addr(&self) -> Option<net::SocketAddr> {
None
}
#[inline]
fn set_nodelay(&mut self, _: bool) -> io::Result<()> {
Ok(())
}
#[inline]
fn set_linger(&mut self, _: Option<time::Duration>) -> io::Result<()> {
Ok(())
}
#[inline]
fn set_keepalive(&mut self, _: Option<time::Duration>) -> io::Result<()> {
Ok(())
}
}