From dd98a593e2fc0ba3ba9d1d1c9fde5c516d0f0173 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Mon, 5 Jul 2021 14:32:17 +0300 Subject: [PATCH] feat: allow using native-tls or rustls (#330) --- Cargo.lock | 18 ++++++++++++++---- ethers-providers/Cargo.toml | 9 ++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b788d2c..5bdba1be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "Inflector" version = "0.11.4" @@ -2446,17 +2448,21 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" +checksum = "1e96bb520beab540ab664bd5a9cfeaa1fcd846fa68c830b42e2c8963071251d2" dependencies = [ "futures-util", "log", "native-tls", "pin-project", + "rustls", "tokio", "tokio-native-tls", + "tokio-rustls", "tungstenite", + "webpki", + "webpki-roots", ] [[package]] @@ -2517,9 +2523,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "tungstenite" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" +checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093" dependencies = [ "base64 0.13.0", "byteorder", @@ -2530,9 +2536,13 @@ dependencies = [ "log", "native-tls", "rand 0.8.3", + "rustls", "sha-1", + "thiserror", "url", "utf-8", + "webpki", + "webpki-roots", ] [[package]] diff --git a/ethers-providers/Cargo.toml b/ethers-providers/Cargo.toml index 35050742..dc9c1ec2 100644 --- a/ethers-providers/Cargo.toml +++ b/ethers-providers/Cargo.toml @@ -18,7 +18,7 @@ ethers-core = { version = "0.2.2", path = "../ethers-core", default-features = f async-trait = { version = "0.1.50", default-features = false } hex = { version = "0.4.3", default-features = false, features = ["std"] } -reqwest = { version = "0.11.4", default-features = false, features = ["json", "rustls-tls"] } +reqwest = { version = "0.11.4", default-features = false, features = ["json"] } serde = { version = "1.0.124", default-features = false, features = ["derive"] } serde_json = { version = "1.0.64", default-features = false } thiserror = { version = "1.0.26", default-features = false } @@ -38,7 +38,7 @@ tracing-futures = { version = "0.2.5", default-features = false, features = ["st # tokio tokio = { version = "1.5", default-features = false, optional = true } -tokio-tungstenite = { version = "0.13.0", default-features = false, features = ["connect", "tls"], optional = true } +tokio-tungstenite = { version = "0.14.0", default-features = false, features = ["connect"], optional = true } tokio-util = { version = "0.6.7", default-features = false, features = ["io"], optional = true } bytes = { version = "1.0.1", default-features = false, optional = true } @@ -48,7 +48,10 @@ tokio = { version = "1.5", default-features = false, features = ["rt", "macros"] tempfile = "3.2.0" [features] -default = ["ws", "ipc"] +default = ["ws", "ipc", "rustls"] celo = ["ethers-core/celo"] ws = ["tokio", "tokio-tungstenite"] ipc = ["tokio", "tokio/io-util", "tokio-util", "bytes"] + +openssl = ["tokio-tungstenite/native-tls", "reqwest/native-tls"] +rustls = ["tokio-tungstenite/rustls-tls", "reqwest/rustls-tls"]