[workspace]
members = [".", "examples/logger"]
resolver = "2"

[package]
name = "custom-utils"
version = "0.11.3"
edition = "2021"
description = "Provide customized tools based on features"
repository = "https://github.com/jm-observer/custom-utils.git"

license-file = "LICENSE"
readme = "README.md"

include = [
    "Makefile.toml", "LICENSE", "Cargo.toml", "README.md", "src/**/*.rs"
]

[dependencies]
anyhow = "1.0"
tokio = { version = "1.18", features = ["signal", "rt-multi-thread", "macros", "time"], optional = true }
log = "0.4.29"
flexi_logger = { version = "=0.29.8", optional = true, features = ["specfile_without_notification", "specfile", "colors", "async"], default-features = false }
lazy_static = { version = "1.4", optional = true }
ansi_term = { version = "0.12", optional = true }
# ------------- tls_util start----------------------
picky = { version = "6.3", features = ["chrono_conversion"], optional = true }
rsa = { version = "0.6", optional = true }
chrono = { version = "0.4", optional = true }
rand = { version = "0.8.5", optional = true }
der-parser = { version = "8", optional = true }
x509-parser = { version = "0.13", features = ["validate", "verify"], optional = true }
# ------------- tls start----------------------
rustls-pemfile = { version = "1", optional = true }
rustls-native-certs = { version = "0.6", optional = true }
rustls = { version = "0.20", optional = true }
# -----------------------------
timer-util = { version = "0.3.2", optional = true }

syn = { version = "2.0", features = ["extra-traits", "full"], optional = true }

reqwest = { version = "0.13", features = ["json", "stream"] }
serde_json = "1.0"
futures-util = "0.3"
home = "0.5.12"

# ------------- daemon start----------------------
[target.'cfg(target_os="linux")'.dependencies]
libsystemd = { version = "0.5.0", optional = true }


[dev-dependencies]
picky = { version = "6.3", features = ["chrono_conversion"] }
tokio = { version = "1.18", features = ["rt-multi-thread", "macros", "sync", "time"] }
tempfile = "3.27.0"

[features]
default = ["logger"]
dev = []
prod = []
derive = []
tls = ["rustls-pemfile", "rustls-native-certs", "rustls"]
tls-util = ["picky", "rsa", "chrono", "rand", "der-parser", "x509-parser"]
tls_util = ["tls-util"]
logger = ["flexi_logger", "lazy_static", "ansi_term"]
daemon-async = ["libsystemd", "tokio"]
daemon-sync = ["libsystemd"]
timer = ["timer-util"]
updater = ["tokio"]

[[example]]
name = "parse_derive"
required-features = ["derive"]
path = "examples/parse_derive.rs"

[[example]]
name = "self_sign_cert"
required-features = ["tls-util"]
path = "examples/self_sign_cert.rs"
[[example]]
name = "timer"
required-features = ["timer"]
path = "examples/timer.rs"
[[test]]
name = "util_tls_util"
required-features = ["tls_util"]
path = "tests/util_tls_util.rs"
[[test]]
name = "util_tls_util_print"
required-features = ["tls_util"]
path = "tests/util_tls_util_print.rs"
