From fe3e12e1a50078f418ba4717f070331811d2d384 Mon Sep 17 00:00:00 2001 From: H1rono Date: Tue, 30 Jul 2024 05:39:21 +0900 Subject: [PATCH 1/2] :sparkles: Add optional feature `rustls-tls` --- Cargo.toml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1dfb246..61add92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,11 @@ documentation = "https://github.com/traPtitech/rust-traq/tree/main/docs" keywords = ["traq", "openapi"] edition = "2021" +[features] +default = ["native-tls"] +native-tls = ["reqwest/native-tls"] +rustls-tls = ["reqwest/rustls-tls"] + [dependencies] serde = "^1.0" serde_derive = "^1.0" @@ -17,6 +22,8 @@ serde_json = "^1.0" serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.0", features = ["serde"] } + [dependencies.reqwest] version = "^0.12" -features = ["json", "multipart"] +default-features = false +features = ["json", "multipart", "charset", "http2", "macos-system-configuration"] From a083fb9fef9cd0a093198bcee6b6118d0a706ee7 Mon Sep 17 00:00:00 2001 From: H1rono Date: Tue, 30 Jul 2024 06:37:32 +0900 Subject: [PATCH 2/2] :pencil: Write about TLS backend in README --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 993320d..f01cf2f 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,21 @@ async fn main() { println!("{:?}", res); } ``` + +## TLS Backend + +This crate depends on [reqwest](https://crates.io/crates/reqwest) as an HTTPS client. As with reqwest, you can select TLS backend through this crate's feature flags. + +- `native-tls`: the system-installed TLS backend +- `rustls-tls`: the TLS library written in Rust + +`native-tls` is used by default. To use only `rustls-tls`, write dependencies as: + +```toml +[dependencies] +traq.version = "..." +traq.default-features = false +traq.features = ["rustls-tls"] +``` + +For more information, see [docs in reqwest::tls](https://docs.rs/reqwest/0.12/reqwest/tls/index.html).