Skip to content

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

feat: Add deprecated warning when running HTTP server (#943)

Amaurye4b1570a8be5
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 01f29d3c..1363aa3f 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -74,4 +74,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
- args: -- -D warnings
+ args: -- -D warnings -A deprecated
diff --git a/Cargo.lock b/Cargo.lock
index 87b918c5..8d436183 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -307,7 +307,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "check-if-email-exists"
-version = "0.8.23"
+version = "0.8.24"
dependencies = [
"async-smtp",
"async-std",
@@ -327,7 +327,7 @@ dependencies = [
[[package]]
name = "check-if-email-exists-cli"
-version = "0.8.23"
+version = "0.8.24"
dependencies = [
"check-if-email-exists",
"clap",
@@ -341,7 +341,7 @@ dependencies = [
[[package]]
name = "check-if-email-exists-test-suite"
-version = "0.8.23"
+version = "0.8.24"
dependencies = [
"check-if-email-exists",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index 736af373..000fd6c7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "check-if-email-exists-cli"
-version = "0.8.23"
+version = "0.8.24"
default-run = "check_if_email_exists"
edition = "2018"
description = "Check if an email address exists without sending any email."
diff --git a/Dockerfile b/Dockerfile
index 4f1a04a0..53c6614f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,7 +8,7 @@ FROM alpine
# `ciee` stands for check-if-email-exists
WORKDIR /ciee
# Fetch latest version
-ENV CIEE_VERSION 0.8.23
+ENV CIEE_VERSION 0.8.24
# Install needed libraries
RUN apk update && \
diff --git a/README.md b/README.md
index 8ce44c27..6078331f 100644
--- a/README.md
+++ b/README.md
@@ -110,7 +110,7 @@ Head to the [releases page](https://github.com/reacherhq/check-if-email-exists/r
```
> $ check_if_email_exists --help
-check_if_email_exists 0.8.23
+check_if_email_exists 0.8.24
Check if an email address exists without sending any email.
USAGE:
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 3fa56153..9a95cf0c 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "check-if-email-exists"
-version = "0.8.23"
+version = "0.8.24"
authors = ["Amaury <[email protected]>"]
categories = ["email"]
description = "Check if an email address exists without sending any email"
diff --git a/src/http.rs b/src/http.rs
index 105d7cf0..246d0f12 100644
--- a/src/http.rs
+++ b/src/http.rs
@@ -25,6 +25,10 @@ use crate::CONF;
/// JSON Request from POST /
#[derive(Debug, Deserialize, Serialize)]
+#[deprecated(
+ since = "0.8.24",
+ note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
+)]
pub struct PostReqBody {
from_email: Option<String>,
hello_name: Option<String>,
@@ -35,9 +39,14 @@ pub struct PostReqBody {
/// Error Response from POST /
#[derive(Debug, Deserialize, Serialize)]
+#[deprecated(
+ since = "0.8.24",
+ note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
+)]
pub struct PostResError {
error: String,
}
+
async fn req_handler(req: Request<Body>) -> Result<Response<Body>, hyper::Error> {
match (req.method(), req.uri().path()) {
// Serve some instructions at /
@@ -99,9 +108,15 @@ async fn req_handler(req: Request<Body>) -> Result<Response<Body>, hyper::Error>
}
}
+#[deprecated(
+ since = "0.8.24",
+ note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
+)]
pub async fn run<A: Into<SocketAddr>>(
addr: A,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
+ println!("WARNING: The HTTP server is deprecated, and will be removed in v0.9.0. Please see https://github.com/reacherhq/backend for a replacement.");
+
let service = make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(req_handler)) });
let addr = addr.into();
diff --git a/src/main.rs b/src/main.rs
index 40101dd2..c07bae42 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -51,19 +51,34 @@ pub struct Cli {
/// The email to check.
pub to_email: Option<String>,
- /// Runs a HTTP server.
+ /// DEPRECATED. Runs a HTTP server.
+ /// This option will be removed in v0.9.0.
#[clap(long)]
+ #[deprecated(
+ since = "0.8.24",
+ note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
+ )]
pub http: bool,
- /// Sets the host IP address on which the HTTP server should bind.
+ /// DEPRECATED. Sets the host IP address on which the HTTP server should bind.
/// Only used when `--http` flag is on.
+ /// This option will be removed in v0.9.0.
#[clap(long, env = "HOST", default_value = "127.0.0.1")]
+ #[deprecated(
+ since = "0.8.24",
+ note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
+ )]
pub http_host: IpAddr,
- /// Sets the port on which the HTTP server should bind.
+ /// DEPRECATED. Sets the port on which the HTTP server should bind.
/// Only used when `--http` flag is on.
/// If not set, then it will use $PORT, or default to 3000.
+ /// This option will be removed in v0.9.0.
#[clap(long, env = "PORT", default_value = "3000")]
+ #[deprecated(
+ since = "0.8.24",
+ note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
+ )]
pub http_port: u16,
}
@@ -99,7 +114,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
};
}
- // Run the web server if flag is on
+ // Run the web server if --http flag is on.
if CONF.http {
http::run((CONF.http_host, CONF.http_port)).await?;
}
diff --git a/test_suite/Cargo.toml b/test_suite/Cargo.toml
index e5e0fce4..96a57ab2 100644
--- a/test_suite/Cargo.toml
+++ b/test_suite/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "check-if-email-exists-test-suite"
-version = "0.8.23"
+version = "0.8.24"
edition = "2018"
publish = false