[package] name = "tokio-listener" version = "0.4.3" edition = "2021" repository = "https://github.com/vi/tokio-listener" license = "MIT OR Apache-2.0" description = "Add flexibility in a way of accepting connections: unix sockets, socket activation, inetd mode to Tokio-based projects." categories = ["network-programming", "command-line-interface"] keywords = ["tokio","unix", "systemd", "socket-activation", "clap"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] ## Enable `derive(Parser)` for [`UserOptions`] and other Clap helpers clap = { version = "4.3.11", default-features = false, features = ["derive", "std"], optional=true } document-features = "0.2.7" futures-core = "0.3.28" hyper014 = { version = "0.14.27", optional = true, features = ["server"], package="hyper" } hyper1 = { version = "1", optional = true, features = ["server"], package="hyper" } hyper-util = { version = "0.1", optional=true, features=["server", "server-auto"]} tower-service = {version = "0.3", optional=true} tower = {version = "0.4", optional=true, features=["util"]} pin-project = "1.1.2" serde = { version = "1.0.171", features = ["derive"] , optional = true} serde_with = { version = "3.0.0", optional = true} socket2 = {version="0.5.3", optional=true, features=["all"]} tokio = { version = "1.29.1", features = ["net", "io-std", "time", "sync"] } tonic_012 = { package = "tonic", version = "0.12.0", optional = true } tonic_011 = { package = "tonic", version = "0.11.0", optional = true } tonic_010 = { package = "tonic", version = "0.10.2", optional = true } tracing = "0.1.37" axum07 = { version="0.7", package="axum", optional=true } futures-util = {version="0.3", optional=true} tokio-util = {version = "0.7", optional=true, features=["net","codec"]} [target.'cfg(unix)'.dependencies] nix = { version = "0.26.2", default-features = false, features = ["user", "fs"], optional=true } [features] default = ["user_facing_default", "tokio-util"] ## Subset of default features that add features supposed to be accessed by end user user_facing_default = ["inetd", "unix", "unix_path_tools", "sd_listen", "socket_options"] ## Enable `serde::Serialize` and `serde::Deserialize` implementations for [`UserOptions`] and [`ListenerAddress`] and some other types. serde = ["dep:serde", "serde_with"] ## Enable `hyper(v0.14)::server::accept::Accept` implementation for [`Listener`] hyper014 = ["dep:hyper014"] ## Enable tokio-listener-adapted `serve` function from Axum 0.7 (and related types) axum07 = ["dep:hyper1", "dep:hyper-util", "dep:futures-util", "dep:tower-service", "dep:tower", "dep:axum07"] ## Enable inetd (stdin/stdout) mode inetd = ["dep:futures-util"] ## Enable UNIX socket mode unix = [] ## Enable tools such as unlink/chmod/chown for UNIX path sockets in [`UserOptions`] unix_path_tools = ["nix"] ## Enable receiving pre-bound sockets from inherited file descriptor (e.g. from systemd). Disabling this should make the crate `unsafe`-free. sd_listen = ["socket2"] ## Enable socket options such as receive or send buffer sizes or keepalives in [`UserOptions`] socket_options = ["socket2"] ## Enable `tonic(v0.10)::transport::server::Connected` implementation for [`Connection`] tonic010 = ["dep:tonic_010"] ## Enable `tonic(v0.11)::transport::server::Connected` implementation for [`Connection`] tonic011 = ["dep:tonic_011"] ## Enable `tonic(v0.12)::transport::server::Connected` implementation for [`Connection`] tonic012 = ["dep:tonic_012"] ## Enable [`tokio_util::net::Listener`] implementation for [`Listener`]. tokio-util = ["dep:tokio-util"] ## Enable [`Listener::bind_multiple`] and `sd-listen:*` (if combined with `sd_listen` feature) multi-listener = ["dep:futures-util"] [dev-dependencies] anyhow = "1.0.71" argh = "0.1.10" axum06 = { version="0.6.18", package="axum" } clap = { version = "4.3.11", features = ["help"] } hyper014 = { version = "0.14.27", features = ["server", "http1"], package="hyper" } tokio = { version = "1.29.1", features = ["macros", "rt", "io-util"] } tokio-test = "0.4.2" toml = "0.7.6" tonic-health = "0.12.0" tracing-subscriber = "0.3.17" [[example]] name = "serde_echo" required-features = ["serde", "sd_listen"] [[example]] name = "clap_axum06" required-features = ["clap","hyper014"] [[example]] name = "clap_axum07" required-features = ["clap","axum07"] [[example]] name = "clap_axum07_advanced" required-features = ["clap","axum07"] [[example]] name = "argh_hyper014" required-features = ["hyper014", "user_facing_default"] [[example]] name = "tonic" required-features = ["tonic012"] [package.metadata."docs.rs"] all-features = true rustdoc-args = ["--cfg", "docsrs_alt"]