Skip to content

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.

fix: Add possibility to use proxy in Yahoo API request (#472)

Amaury Martinyaafcedf9b913
diff --git a/Cargo.lock b/Cargo.lock
index 105dbeae..1f190e74 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -15,61 +15,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
-[[package]]
-name = "aead"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4"
-dependencies = [
- "generic-array",
-]
-
-[[package]]
-name = "aes"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9"
-dependencies = [
- "aes-soft",
- "aesni",
- "block-cipher-trait",
-]
-
-[[package]]
-name = "aes-gcm"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638"
-dependencies = [
- "aead",
- "aes",
- "block-cipher-trait",
- "ghash",
- "subtle 2.2.3",
- "zeroize",
-]
-
-[[package]]
-name = "aes-soft"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d"
-dependencies = [
- "block-cipher-trait",
- "byteorder",
- "opaque-debug",
-]
-
-[[package]]
-name = "aesni"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100"
-dependencies = [
- "block-cipher-trait",
- "opaque-debug",
-]
-
[[package]]
name = "aho-corasick"
version = "0.7.13"
@@ -106,22 +51,6 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a"
-[[package]]
-name = "async-h1"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ad1494db96c4a94ca8a31a9aa56f15f3419c98bd4d3575f1ba682a06f5c1ac7"
-dependencies = [
- "async-std",
- "byte-pool",
- "futures-core",
- "http-types",
- "httparse",
- "lazy_static",
- "log",
- "pin-project-lite",
-]
-
[[package]]
name = "async-native-tls"
version = "0.3.3"
@@ -190,7 +119,7 @@ checksum = "d113439234775ae3e43d4e7589c5cc64fa3565996ae82dfe26b4ed78c02165be"
dependencies = [
"async-std",
"async-trait",
- "futures 0.3.5",
+ "futures",
"trust-dns-resolver",
]
@@ -242,12 +171,6 @@ dependencies = [
"rustc-demangle",
]
-[[package]]
-name = "base-x"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1"
-
[[package]]
name = "base64"
version = "0.12.3"
@@ -260,36 +183,6 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
-[[package]]
-name = "block-buffer"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
-dependencies = [
- "block-padding",
- "byte-tools",
- "byteorder",
- "generic-array",
-]
-
-[[package]]
-name = "block-cipher-trait"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774"
-dependencies = [
- "generic-array",
-]
-
-[[package]]
-name = "block-padding"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
-dependencies = [
- "byte-tools",
-]
-
[[package]]
name = "blocking"
version = "0.4.6"
@@ -315,22 +208,6 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
-[[package]]
-name = "byte-pool"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9342e102eac8b1879fbedf9a7e0572c40b0cc5805b663c4d4ca791cae0bae221"
-dependencies = [
- "crossbeam-queue",
- "stable_deref_trait",
-]
-
-[[package]]
-name = "byte-tools"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
-
[[package]]
name = "byteorder"
version = "1.3.4"
@@ -378,15 +255,14 @@ dependencies = [
"async-smtp",
"async-std-resolver",
"fast-socks5",
- "futures 0.3.5",
- "http-types",
+ "futures",
"log",
"mailchecker",
"rand",
"regex",
+ "reqwest",
"serde",
"serde_json",
- "surf",
"trust-dns-proto",
]
@@ -438,22 +314,6 @@ dependencies = [
"cache-padded",
]
-[[package]]
-name = "cookie"
-version = "0.14.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca761767cf3fa9068cc893ec8c247a22d0fd0535848e65640c0548bd1f8bbb36"
-dependencies = [
- "aes-gcm",
- "base64",
- "hkdf",
- "hmac",
- "percent-encoding",
- "rand",
- "sha2",
- "time 0.2.16",
-]
-
[[package]]
name = "core-foundation"
version = "0.7.1"
@@ -470,27 +330,6 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90accdee0acac454f78a41d2eefc1212ec6eaa2ae6a216619389e996c0155c3c"
-[[package]]
-name = "crossbeam-channel"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
-dependencies = [
- "crossbeam-utils",
- "maybe-uninit",
-]
-
-[[package]]
-name = "crossbeam-queue"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
-dependencies = [
- "cfg-if",
- "crossbeam-utils",
- "maybe-uninit",
-]
-
[[package]]
name = "crossbeam-utils"
version = "0.7.2"
@@ -502,74 +341,18 @@ dependencies = [
"lazy_static",
]
-[[package]]
-name = "crypto-mac"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5"
-dependencies = [
- "generic-array",
- "subtle 1.0.0",
-]
-
-[[package]]
-name = "curl"
-version = "0.4.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0447a642435be046540f042950d874a4907f9fee28c0513a0beb3ba89f91eb7"
-dependencies = [
- "curl-sys",
- "libc",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "socket2",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "curl-sys"
-version = "0.4.32+curl-7.70.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "834425a2f22fdd621434196965bf99fbfd9eaed96348488e27b7ac40736c560b"
-dependencies = [
- "cc",
- "libc",
- "libnghttp2-sys",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "data-encoding"
-version = "2.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72aa14c04dfae8dd7d8a2b1cb7ca2152618cd01336dbfe704b8dcbf8d41dbd69"
-
-[[package]]
-name = "digest"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
-dependencies = [
- "generic-array",
-]
-
-[[package]]
-name = "discard"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
-
[[package]]
name = "dtoa"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b"
+[[package]]
+name = "either"
+version = "1.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
+
[[package]]
name = "encoding_rs"
version = "0.8.23"
@@ -604,22 +387,6 @@ dependencies = [
"termcolor",
]
-[[package]]
-name = "error-chain"
-version = "0.12.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd"
-dependencies = [
- "backtrace",
- "version_check",
-]
-
-[[package]]
-name = "fake-simd"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
-
[[package]]
name = "fast-socks5"
version = "0.3.1"
@@ -628,7 +395,7 @@ checksum = "83424040c717f5937e28cbc5821b503b51afc7eb16e9436b1c5a079d95ab58ed"
dependencies = [
"anyhow",
"async-std",
- "futures 0.3.5",
+ "futures",
"log",
"thiserror",
]
@@ -685,12 +452,6 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
-[[package]]
-name = "futures"
-version = "0.1.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
-
[[package]]
name = "futures"
version = "0.3.5"
@@ -782,7 +543,6 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
dependencies = [
- "futures 0.1.29",
"futures-channel",
"futures-core",
"futures-io",
@@ -795,16 +555,6 @@ dependencies = [
"proc-macro-hack",
"proc-macro-nested",
"slab",
- "tokio-io",
-]
-
-[[package]]
-name = "generic-array"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
-dependencies = [
- "typenum",
]
[[package]]
@@ -818,15 +568,6 @@ dependencies = [
"wasi",
]
-[[package]]
-name = "ghash"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252"
-dependencies = [
- "polyval",
-]
-
[[package]]
name = "gimli"
version = "0.21.0"
@@ -883,26 +624,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "hkdf"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3"
-dependencies = [
- "digest",
- "hmac",
-]
-
-[[package]]
-name = "hmac"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695"
-dependencies = [
- "crypto-mac",
- "digest",
-]
-
[[package]]
name = "hostname"
version = "0.1.5"
@@ -945,44 +666,6 @@ dependencies = [
"http",
]
-[[package]]
-name = "http-client"
-version = "3.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fdae064c76b75ced4793544e843478c8c9c2bebf16fe6913212df83e30dfdb46"
-dependencies = [
- "async-h1",
- "async-native-tls",
- "async-std",
- "futures 0.3.5",
- "http-types",
- "isahc",
- "js-sys",
- "log",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
-]
-
-[[package]]
-name = "http-types"
-version = "2.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca4221cd1c7cedf275cd0ad3c9dfe58b5acc93cdd5511c7e020a102e1995fe99"
-dependencies = [
- "anyhow",
- "async-std",
- "cookie",
- "infer",
- "pin-project-lite",
- "rand",
- "serde",
- "serde_json",
- "serde_qs",
- "serde_urlencoded",
- "url",
-]
-
[[package]]
name = "httparse"
version = "1.3.4"
@@ -1016,12 +699,25 @@ dependencies = [
"log",
"pin-project",
"socket2",
- "time 0.1.43",
+ "time",
"tokio",
"tower-service",
"want",
]
+[[package]]
+name = "hyper-tls"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed"
+dependencies = [
+ "bytes 0.5.4",
+ "hyper",
+ "native-tls",
+ "tokio",
+ "tokio-tls",
+]
+
[[package]]
name = "idna"
version = "0.2.0"
@@ -1042,12 +738,6 @@ dependencies = [
"autocfg",
]
-[[package]]
-name = "infer"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6854dd77ddc4f9ba1a448f487e27843583d407648150426a30c2ea3a2c39490a"
-
[[package]]
name = "iovec"
version = "0.1.4"
@@ -1066,30 +756,7 @@ dependencies = [
"socket2",
"widestring",
"winapi 0.3.8",
- "winreg",
-]
-
-[[package]]
-name = "isahc"
-version = "0.9.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f54e7cf252df9a36605ccfabea2a754ad30c24b51b77f830486e555ac8e76bce"
-dependencies = [
- "bytes 0.5.4",
- "crossbeam-channel",
- "crossbeam-utils",
- "curl",
- "curl-sys",
- "futures-channel",
- "futures-io",
- "futures-util",
- "http",
- "lazy_static",
- "log",
- "slab",
- "sluice",
- "tracing",
- "tracing-futures",
+ "winreg 0.6.2",
]
[[package]]
@@ -1151,28 +818,6 @@ version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
-[[package]]
-name = "libnghttp2-sys"
-version = "0.1.4+1.41.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03624ec6df166e79e139a2310ca213283d6b3c30810c54844f307086d4488df1"
-dependencies = [
- "cc",
- "libc",
-]
-
-[[package]]
-name = "libz-sys"
-version = "1.0.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
[[package]]
name = "linked-hash-map"
version = "0.5.3"
@@ -1218,12 +863,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
-[[package]]
-name = "maybe-uninit"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
-
[[package]]
name = "memchr"
version = "2.3.3"
@@ -1348,12 +987,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
-[[package]]
-name = "opaque-debug"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
-
[[package]]
name = "openssl"
version = "0.10.30"
@@ -1437,16 +1070,6 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
-[[package]]
-name = "polyval"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212"
-dependencies = [
- "cfg-if",
- "universal-hash",
-]
-
[[package]]
name = "ppv-lite86"
version = "0.2.8"
@@ -1563,6 +1186,42 @@ dependencies = [
"winapi 0.3.8",
]
+[[package]]
+name = "reqwest"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680"
+dependencies = [
+ "base64",
+ "bytes 0.5.4",
+ "encoding_rs",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "hyper-tls",
+ "js-sys",
+ "lazy_static",
+ "log",
+ "mime",
+ "mime_guess",
+ "native-tls",
+ "percent-encoding",
+ "pin-project-lite",
+ "serde",
+ "serde_json",
+ "serde_urlencoded",
+ "tokio",
+ "tokio-socks",
+ "tokio-tls",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+ "winreg 0.7.0",
+]
+
[[package]]
name = "resolv-conf"
version = "0.6.3"
@@ -1579,15 +1238,6 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
-[[package]]
-name = "rustc_version"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
-dependencies = [
- "semver",
-]
-
[[package]]
name = "ryu"
version = "1.0.5"
@@ -1633,21 +1283,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "semver"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
-dependencies = [
- "semver-parser",
-]
-
-[[package]]
-name = "semver-parser"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-
[[package]]
name = "send_wrapper"
version = "0.4.0"
@@ -1685,18 +1320,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "serde_qs"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6f3acf84e23ab27c01cb5917551765c01c50b2000089db8fa47fe018a3260cf"
-dependencies = [
- "data-encoding",
- "error-chain",
- "percent-encoding",
- "serde",
-]
-
[[package]]
name = "serde_urlencoded"
version = "0.6.1"
@@ -1709,42 +1332,12 @@ dependencies = [
"url",
]
-[[package]]
-name = "sha1"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
-
-[[package]]
-name = "sha2"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69"
-dependencies = [
- "block-buffer",
- "digest",
- "fake-simd",
- "opaque-debug",
-]
-
[[package]]
name = "slab"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
-[[package]]
-name = "sluice"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fed13b7cb46f13a15db2c4740f087a848acc8b31af89f95844d40137451f89b1"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-util",
-]
-
[[package]]
name = "smallvec"
version = "1.4.0"
@@ -1784,116 +1377,18 @@ dependencies = [
"winapi 0.3.8",
]
-[[package]]
-name = "stable_deref_trait"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
-
-[[package]]
-name = "standback"
-version = "0.2.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0437cfb83762844799a60e1e3b489d5ceb6a650fbacb86437badc1b6d87b246"
-dependencies = [
- "version_check",
-]
-
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
-[[package]]
-name = "stdweb"
-version = "0.4.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
-dependencies = [
- "discard",
- "rustc_version",
- "stdweb-derive",
- "stdweb-internal-macros",
- "stdweb-internal-runtime",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "stdweb-derive"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
-dependencies = [
- "proc-macro2",
- "quote",
- "serde",
- "serde_derive",
- "syn",
-]
-
-[[package]]
-name = "stdweb-internal-macros"
-version = "0.2.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
-dependencies = [
- "base-x",
- "proc-macro2",
- "quote",
- "serde",
- "serde_derive",
- "serde_json",
- "sha1",
- "syn",
-]
-
-[[package]]
-name = "stdweb-internal-runtime"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
-
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-[[package]]
-name = "subtle"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
-
-[[package]]
-name = "subtle"
-version = "2.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1"
-
-[[package]]
-name = "surf"
-version = "2.0.0-alpha.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68bf1412b095b3a54da6ec3a969e2663cb3cf535652cd97c02e99443a400fd7d"
-dependencies = [
- "async-std",
- "encoding_rs",
- "futures 0.3.5",
- "http-client",
- "http-types",
- "log",
- "mime",
- "mime_guess",
- "pin-project-lite",
- "serde",
- "serde_json",
- "serde_urlencoded",
- "url",
- "web-sys",
-]
-
[[package]]
name = "syn"
version = "1.0.33"
@@ -1976,44 +1471,6 @@ dependencies = [
"winapi 0.3.8",
]
-[[package]]
-name = "time"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15"
-dependencies = [
- "cfg-if",
- "libc",
- "standback",
- "stdweb",
- "time-macros",
- "version_check",
- "winapi 0.3.8",
-]
-
-[[package]]
-name = "time-macros"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d"
-dependencies = [
- "proc-macro-hack",
- "time-macros-impl",
-]
-
-[[package]]
-name = "time-macros-impl"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa"
-dependencies = [
- "proc-macro-hack",
- "proc-macro2",
- "quote",
- "standback",
- "syn",
-]
-
[[package]]
name = "tinyvec"
version = "0.3.3"
@@ -2038,17 +1495,6 @@ dependencies = [
"tokio-macros",
]
-[[package]]
-name = "tokio-io"
-version = "0.1.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
-dependencies = [
- "bytes 0.4.12",
- "futures 0.1.29",
- "log",
-]
-
[[package]]
name = "tokio-macros"
version = "0.2.5"
@@ -2060,6 +1506,29 @@ dependencies = [
"syn",
]
+[[package]]
+name = "tokio-socks"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1997788a0e25e09300e44680ba1ef9d44d6f634a883641f80109e8b59c928daf"
+dependencies = [
+ "bytes 0.4.12",
+ "either",
+ "futures",
+ "thiserror",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-tls"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343"
+dependencies = [
+ "native-tls",
+ "tokio",
+]
+
[[package]]
name = "tokio-util"
version = "0.3.1"
@@ -2080,48 +1549,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
-[[package]]
-name = "tracing"
-version = "0.1.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f"
-dependencies = [
- "cfg-if",
- "log",
- "tracing-attributes",
- "tracing-core",
-]
-
-[[package]]
-name = "tracing-attributes"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "tracing-core"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715"
-dependencies = [
- "lazy_static",
-]
-
-[[package]]
-name = "tracing-futures"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c"
-dependencies = [
- "pin-project",
- "tracing",
-]
-
[[package]]
name = "trust-dns-proto"
version = "0.19.5"
@@ -2131,7 +1558,7 @@ dependencies = [
"async-trait",
"backtrace",
"enum-as-inner",
- "futures 0.3.5",
+ "futures",
"idna",
"lazy_static",
"log",
@@ -2150,7 +1577,7 @@ checksum = "0f23cdfdc3d8300b3c50c9e84302d3bd6d860fb9529af84ace6cf9665f181b77"
dependencies = [
"backtrace",
"cfg-if",
- "futures 0.3.5",
+ "futures",
"ipconfig",
"lazy_static",
"log",
@@ -2167,12 +1594,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
-[[package]]
-name = "typenum"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
-
[[package]]
name = "unicase"
version = "2.6.0"
@@ -2218,16 +1639,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
-[[package]]
-name = "universal-hash"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01"
-dependencies = [
- "generic-array",
- "subtle 2.2.3",
-]
-
[[package]]
name = "url"
version = "2.1.1"
@@ -2286,6 +1697,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a634620115e4a229108b71bde263bb4220c483b3f07f5ba514ee8d15064c4c2"
dependencies = [
"cfg-if",
+ "serde",
+ "serde_json",
"wasm-bindgen-macro",
]
@@ -2422,6 +1835,15 @@ dependencies = [
"winapi 0.3.8",
]
+[[package]]
+name = "winreg"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
+dependencies = [
+ "winapi 0.3.8",
+]
+
[[package]]
name = "winutil"
version = "0.1.1"
@@ -2446,9 +1868,3 @@ name = "yaml-rust"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992"
-
-[[package]]
-name = "zeroize"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 21ade782..6b0a4819 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -21,12 +21,11 @@ async-smtp = { version = "0.3", features = ["socks5"] }
async-std-resolver = "0.19"
fast-socks5 = "0.3"
futures = "0.3"
-http-types = "2.2"
log = "0.4"
mailchecker = "3.3"
rand = "0.7"
regex = "1.3"
+reqwest = { version = "0.10", features = ["json", "socks"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
-surf = "2.0.0-alpha.4"
trust-dns-proto = "0.19"
diff --git a/core/src/smtp/mod.rs b/core/src/smtp/mod.rs
index 962c38c4..5bd2950f 100644
--- a/core/src/smtp/mod.rs
+++ b/core/src/smtp/mod.rs
@@ -336,7 +336,9 @@ pub async fn check_smtp(
) -> Result<SmtpDetails, SmtpError> {
// FIXME Is this `contains` too lenient?
if input.yahoo_use_api && domain.to_lowercase().contains("yahoo") {
- return yahoo::check_yahoo(to_email).await.map_err(|err| err.into());
+ return yahoo::check_yahoo(to_email, input)
+ .await
+ .map_err(|err| err.into());
}
// FIXME If the SMTP is not connectable, we should actually return an
diff --git a/core/src/smtp/yahoo.rs b/core/src/smtp/yahoo.rs
index 39d095b5..a364a0ab 100644
--- a/core/src/smtp/yahoo.rs
+++ b/core/src/smtp/yahoo.rs
@@ -15,17 +15,19 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use super::SmtpDetails;
-use crate::util::constants::LOG_TARGET;
-use crate::util::ser_with_display::ser_with_display;
+use crate::util::{
+ constants::LOG_TARGET, input_output::CheckEmailInput, ser_with_display::ser_with_display,
+};
use async_smtp::EmailAddress;
-use http_types::Error as HttpError;
use regex::Regex;
+use reqwest::Error as ReqwestError;
use serde::{Deserialize, Serialize};
use serde_json::error::Error as SerdeError;
use std::fmt;
const SIGNUP_PAGE: &str = "https://login.yahoo.com/account/create?specId=yidReg&lang=en-US&src=&done=https%3A%2F%2Fwww.yahoo.com&display=login";
const SIGNUP_API: &str = "https://login.yahoo.com/account/module/create?validateField=yid";
+const USER_AGENT: &str = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"; // Fake one to use in API requests
/// The form inputs to pass into the HTTP request.
#[derive(Serialize)]
@@ -72,15 +74,15 @@ struct FormResponse {
/// Possible errors when checking Yahoo email addresses.
#[derive(Debug, Serialize)]
pub enum YahooError {
- /// Error when sending an HTTP request. Used to verify Yahoo emails.
- #[serde(serialize_with = "ser_with_display")]
- HttpError(HttpError),
/// Cannot find "acrumb" field in cookie.
NoAcrumb,
/// Cannot find cookie in Yahoo response.
NoCookie,
/// Error when serializing or deserializing HTTP requests and responses.
#[serde(serialize_with = "ser_with_display")]
+ ReqwestError(ReqwestError),
+ /// Error when serializing or deserializing HTTP requests and responses.
+ #[serde(serialize_with = "ser_with_display")]
SerdeError(SerdeError),
}
@@ -91,9 +93,9 @@ impl fmt::Display for YahooError {
}
}
-impl From<HttpError> for YahooError {
- fn from(error: HttpError) -> Self {
- YahooError::HttpError(error)
+impl From<ReqwestError> for YahooError {
+ fn from(error: ReqwestError) -> Self {
+ YahooError::ReqwestError(error)
}
}
@@ -103,13 +105,37 @@ impl From<SerdeError> for YahooError {
}
}
+/// Helper function to create a reqwest client, with optional proxy.
+fn create_client(input: &CheckEmailInput) -> Result<reqwest::Client, ReqwestError> {
+ if let Some(proxy) = &input.proxy {
+ log::debug!(
+ target: LOG_TARGET,
+ "Using proxy socks://{}:{} for Yahoo API",
+ proxy.host,
+ proxy.port
+ );
+
+ let proxy = reqwest::Proxy::all(&format!("socks5://{}:{}", proxy.host, proxy.port))?;
+ reqwest::Client::builder().proxy(proxy).build()
+ } else {
+ Ok(reqwest::Client::new())
+ }
+}
+
/// Use well-crafted HTTP requests to verify if a Yahoo email address exists.
/// Inspired by https://github.com/hbattat/verifyEmail.
-pub async fn check_yahoo(to_email: &EmailAddress) -> Result<SmtpDetails, YahooError> {
- let response = surf::get(SIGNUP_PAGE).await?;
+pub async fn check_yahoo(
+ to_email: &EmailAddress,
+ input: &CheckEmailInput,
+) -> Result<SmtpDetails, YahooError> {
+ let response = create_client(input)?
+ .get(SIGNUP_PAGE)
+ .header("User-Agent", USER_AGENT)
+ .send()
+ .await?;
// Get the cookies from the response.
- let cookies = match response.header("Set-Cookie") {
+ let cookies = match response.headers().get("Set-Cookie") {
Some(x) => x,
_ => {
return Err(YahooError::NoCookie);
@@ -125,14 +151,14 @@ pub async fn check_yahoo(to_email: &EmailAddress) -> Result<SmtpDetails, YahooEr
.expect("The email is well-formed. qed.");
// From the cookies, fetch the "acrumb" field.
- let acrumb = match cookies.into_iter().next() {
- Some(x) => x.to_string(),
+ let acrumb = match cookies.to_str() {
+ Ok(x) => x,
_ => {
return Err(YahooError::NoAcrumb);
}
};
let re = Regex::new(r"s=(?P<acrumb>[^;]*)").expect("Correct regex. qed.");
- let acrumb = match re.captures(acrumb.as_ref()) {
+ let acrumb = match re.captures(acrumb) {
Some(x) => x,
_ => {
return Err(YahooError::NoAcrumb);
@@ -140,18 +166,28 @@ pub async fn check_yahoo(to_email: &EmailAddress) -> Result<SmtpDetails, YahooEr
};
// Mimic a real HTTP request.
- let response = surf::post(SIGNUP_API).set_header("Origin","https://login.yahoo.com")
- .set_header("X-Requested-With","XMLHttpRequest")
- .set_header("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36")
- .set_header("Content-type", "application/x-www-form-urlencoded; charset=UTF-8")
- .set_header("Accept", "*/*")
- .set_header("Referer", SIGNUP_PAGE)
- .set_header("Accept-Encoding", "gzip, deflate, br")
- .set_header("Accept-Language", "en-US,en;q=0.8,ar;q=0.6")
- .set_header("Cookie", cookies)
- .body_json(&FormRequest::new(acrumb["acrumb"].to_string(), username.into()))?
- .recv_json::<FormResponse>()
- .await?;
+ let response = create_client(input)?
+ .post(SIGNUP_API)
+ .header("Origin", "https://login.yahoo.com")
+ .header("X-Requested-With", "XMLHttpRequest")
+ .header("User-Agent", USER_AGENT)
+ .header(
+ "Content-type",
+ "application/x-www-form-urlencoded; charset=UTF-8",
+ )
+ .header("Accept", "*/*")
+ .header("Referer", SIGNUP_PAGE)
+ .header("Accept-Encoding", "gzip, deflate, br")
+ .header("Accept-Language", "en-US,en;q=0.8,ar;q=0.6")
+ .header("Cookie", cookies)
+ .json(&FormRequest::new(
+ acrumb["acrumb"].to_string(),
+ username.into(),
+ ))
+ .send()
+ .await?
+ .json::<FormResponse>()
+ .await?;
log::debug!(target: LOG_TARGET, "Yahoo 2nd response: {:?}", response);
diff --git a/test_suite/src/fixtures/[email protected] b/test_suite/src/fixtures/[email protected]
new file mode 100644
index 00000000..1206c499
--- /dev/null
+++ b/test_suite/src/fixtures/[email protected]
@@ -0,0 +1,26 @@
+{
+ "input": "[email protected]",
+ "is_reachable": "invalid",
+ "misc": { "is_disposable": false, "is_role_account": false },
+ "mx": {
+ "accepts_mail": true,
+ "records": [
+ "mta7.am0.yahoodns.net.",
+ "mta6.am0.yahoodns.net.",
+ "mta5.am0.yahoodns.net."
+ ]
+ },
+ "smtp": {
+ "can_connect_smtp": true,
+ "has_full_inbox": false,
+ "is_catch_all": false,
+ "is_deliverable": false,
+ "is_disabled": false
+ },
+ "syntax": {
+ "address": "[email protected]",
+ "domain": "yahoo.com",
+ "is_valid_syntax": true,
+ "username": "yahoo"
+ }
+}