diff --git a/Cargo.lock b/Cargo.lock index 8f5480f80..00ea66023 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -423,7 +423,6 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_with", "tokio", "trust-dns-proto", ] @@ -619,41 +618,6 @@ dependencies = [ "syn", ] -[[package]] -name = "darling" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "data-encoding" version = "2.3.2" @@ -1238,12 +1202,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.2.3" @@ -1263,7 +1221,6 @@ checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", "hashbrown", - "serde", ] [[package]] @@ -2206,34 +2163,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_with" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bf4a5a814902cd1014dbccfa4d4560fb8432c779471e96e035602519f82eef" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap", - "serde", - "serde_json", - "serde_with_macros", - "time 0.3.14", -] - -[[package]] -name = "serde_with_macros" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3452b4c0f6c1e357f73fdb87cd1efabaa12acf328c7a528e252893baeb3f4aa" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sha-1" version = "0.10.0" @@ -2549,7 +2478,6 @@ dependencies = [ "itoa 1.0.3", "libc", "num_threads", - "serde", "time-macros", ] diff --git a/backend/openapi.json b/backend/openapi.json index 9fc6b2a63..6f1fc55e9 100644 --- a/backend/openapi.json +++ b/backend/openapi.json @@ -330,10 +330,6 @@ "type": "number", "description": "SMTP port to use for email validation. Generally, ports 25, 465, 587 and 2525 are used." }, - "smtp_timeout": { - "type": "number", - "description": "Add optional timeout for the SMTP verification step, in seconds." - }, "yahoo_use_api": { "type": "boolean", "description": "For Yahoo email addresses, use Yahoo's API instead of connecting directly to their SMTP servers." @@ -369,6 +365,9 @@ "Wrapper" ], "description": "How to apply TLS to a SMTP client connection." + }, + "smtp_timeout": { + "$ref": "#/components/schemas/Duration" } }, "required": ["to_email"] @@ -403,6 +402,25 @@ } }, "required": ["host", "port"] + }, + "Duration": { + "title": "Duration", + "x-stoplight": { + "id": "0s9q75wxim1iw" + }, + "type": "object", + "description": "An object representing a duration (seconds + nanoseconds).", + "properties": { + "secs": { + "type": "number", + "description": "Seconds" + }, + "nanos": { + "type": "string", + "description": "Nanoseconds" + } + }, + "required": ["secs", "nanos"] } }, "securitySchemes": { diff --git a/core/Cargo.toml b/core/Cargo.toml index 3ed49288f..aab311ee7 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -31,7 +31,6 @@ serde_json = "1.0.91" trust-dns-proto = "0.21.2" md5 = "0.7.0" levenshtein = "1.0.5" -serde_with = "2.1.0" [dev-dependencies] tokio = { version = "1.23.0" } diff --git a/core/src/util/input_output.rs b/core/src/util/input_output.rs index 4b18161aa..1686d21ad 100644 --- a/core/src/util/input_output.rs +++ b/core/src/util/input_output.rs @@ -18,7 +18,6 @@ use std::time::Duration; use async_smtp::{ClientSecurity, ClientTlsParameters}; use serde::{ser::SerializeMap, Deserialize, Serialize, Serializer}; -use serde_with::{serde_as, DurationSeconds}; use crate::misc::{MiscDetails, MiscError}; use crate::mx::{MxDetails, MxError}; @@ -72,20 +71,18 @@ impl SmtpSecurity { /// Builder pattern for the input argument into the main `email_exists` /// function. -#[serde_as] #[derive(Debug, Clone, Deserialize, Serialize)] +#[serde(default)] pub struct CheckEmailInput { /// The email to validate. pub to_email: String, /// Email to use in the `MAIL FROM:` SMTP command. /// /// Defaults to "user@example.org". - #[serde(default)] pub from_email: String, /// Name to use in the `EHLO:` SMTP command. /// /// Defaults to "localhost" (note: "localhost" is not a FQDN). - #[serde(default)] pub hello_name: String, /// Perform the email verification via the specified SOCK5 proxy. The usage of a /// proxy is optional. @@ -94,37 +91,30 @@ pub struct CheckEmailInput { /// and 2525 are used. /// /// Defaults to 25. - #[serde(default)] pub smtp_port: u16, /// Add timeout for the SMTP verification step. Set to None if you don't /// want to use a timeout. /// /// Defaults to 10s. - #[serde_as(as = "Option")] - #[serde(default)] pub smtp_timeout: Option, /// For Yahoo email addresses, use Yahoo's API instead of connecting /// directly to their SMTP servers. /// /// Defaults to true. - #[serde(default)] pub yahoo_use_api: bool, /// For Gmail email addresses, use Gmail's API instead of connecting /// directly to their SMTP servers. /// /// Defaults to false. - #[serde(default)] pub gmail_use_api: bool, /// For Microsoft 365 email addresses, use OneDrive's API instead of /// connecting directly to their SMTP servers. /// /// Defaults to false. - #[serde(default)] pub microsoft365_use_api: bool, // Whether to check if a gravatar image is existing for the given email. // // Defaults to false. - #[serde(default)] pub check_gravatar: bool, /// For Hotmail/Outlook email addresses, use a headless navigator /// connecting to the password recovery page instead of the SMTP server. @@ -134,17 +124,14 @@ pub struct CheckEmailInput { /// /// Defaults to None. #[cfg(feature = "headless")] - #[serde(default)] pub hotmail_use_headless: Option, /// Number of retries of SMTP connections to do. /// /// Defaults to 2 to avoid greylisting. - #[serde(default)] pub retries: usize, /// How to apply TLS to a SMTP client connection. /// /// Defaults to Opportunistic. - #[serde(default)] pub smtp_security: SmtpSecurity, }