feat(rust): scaffold Rust workspace and fix TypeScript build errors
- Add @git.zone/tsrust with linux_amd64/linux_arm64 cross-compilation - Scaffold Rust workspace with 5 crates: mailer-core, mailer-smtp, mailer-security, mailer-napi, mailer-bin - Fix all TypeScript compilation errors for upgraded dependencies (smartfile v13, mailauth v4.13, smartproxy v23) - Replace smartfile.fs/memory with @push.rocks/smartfs throughout codebase - Fix .ts import extensions to .js for NodeNext module resolution - Update DKIMSignOptions usage to match mailauth v4.13 API - Add MTA error classes with permissive signatures for legacy SMTP client - Replace removed DcRouter/StorageManager/deliverability imports with local interfaces
This commit is contained in:
2
rust/.cargo/config.toml
Normal file
2
rust/.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
2354
rust/Cargo.lock
generated
Normal file
2354
rust/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
rust/Cargo.toml
Normal file
30
rust/Cargo.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"crates/mailer-core",
|
||||
"crates/mailer-smtp",
|
||||
"crates/mailer-security",
|
||||
"crates/mailer-napi",
|
||||
"crates/mailer-bin",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
||||
[workspace.dependencies]
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-rustls = "0.26"
|
||||
hickory-dns = { version = "0.25", package = "hickory-resolver" }
|
||||
mail-auth = "0.4"
|
||||
mailparse = "0.15"
|
||||
napi = { version = "2", features = ["napi9", "async", "serde-json"] }
|
||||
napi-derive = "2"
|
||||
ring = "0.17"
|
||||
dashmap = "6"
|
||||
thiserror = "2"
|
||||
tracing = "0.1"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
bytes = "1"
|
||||
18
rust/crates/mailer-bin/Cargo.toml
Normal file
18
rust/crates/mailer-bin/Cargo.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "mailer-bin"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "mailer-bin"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
mailer-core = { path = "../mailer-core" }
|
||||
mailer-smtp = { path = "../mailer-smtp" }
|
||||
mailer-security = { path = "../mailer-security" }
|
||||
tokio.workspace = true
|
||||
tracing.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
11
rust/crates/mailer-bin/src/main.rs
Normal file
11
rust/crates/mailer-bin/src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
//! mailer-bin: Standalone Rust binary for the @serve.zone/mailer network stack.
|
||||
|
||||
fn main() {
|
||||
println!(
|
||||
"mailer-bin v{} (core: {}, smtp: {}, security: {})",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
mailer_core::version(),
|
||||
mailer_smtp::version(),
|
||||
mailer_security::version(),
|
||||
);
|
||||
}
|
||||
13
rust/crates/mailer-core/Cargo.toml
Normal file
13
rust/crates/mailer-core/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "mailer-core"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
bytes.workspace = true
|
||||
mailparse.workspace = true
|
||||
19
rust/crates/mailer-core/src/lib.rs
Normal file
19
rust/crates/mailer-core/src/lib.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
//! mailer-core: Email model, validation, and RFC 5322 primitives.
|
||||
|
||||
/// Re-export mailparse for MIME parsing.
|
||||
pub use mailparse;
|
||||
|
||||
/// Placeholder for email address validation and data types.
|
||||
pub fn version() -> &'static str {
|
||||
env!("CARGO_PKG_VERSION")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
assert!(!version().is_empty());
|
||||
}
|
||||
}
|
||||
21
rust/crates/mailer-napi/Cargo.toml
Normal file
21
rust/crates/mailer-napi/Cargo.toml
Normal file
@@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "mailer-napi"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
mailer-core = { path = "../mailer-core" }
|
||||
mailer-smtp = { path = "../mailer-smtp" }
|
||||
mailer-security = { path = "../mailer-security" }
|
||||
napi.workspace = true
|
||||
napi-derive.workspace = true
|
||||
tokio.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
napi-build = "2"
|
||||
5
rust/crates/mailer-napi/build.rs
Normal file
5
rust/crates/mailer-napi/build.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
extern crate napi_build;
|
||||
|
||||
fn main() {
|
||||
napi_build::setup();
|
||||
}
|
||||
15
rust/crates/mailer-napi/src/lib.rs
Normal file
15
rust/crates/mailer-napi/src/lib.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
//! mailer-napi: N-API bindings exposing Rust mailer to Node.js/TypeScript.
|
||||
|
||||
use napi_derive::napi;
|
||||
|
||||
/// Returns the version of the native mailer module.
|
||||
#[napi]
|
||||
pub fn get_version() -> String {
|
||||
format!(
|
||||
"mailer-napi v{} (core: {}, smtp: {}, security: {})",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
mailer_core::version(),
|
||||
mailer_smtp::version(),
|
||||
mailer_security::version(),
|
||||
)
|
||||
}
|
||||
13
rust/crates/mailer-security/Cargo.toml
Normal file
13
rust/crates/mailer-security/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "mailer-security"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
mailer-core = { path = "../mailer-core" }
|
||||
mail-auth.workspace = true
|
||||
ring.workspace = true
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
serde.workspace = true
|
||||
18
rust/crates/mailer-security/src/lib.rs
Normal file
18
rust/crates/mailer-security/src/lib.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
//! mailer-security: DKIM, SPF, and DMARC verification.
|
||||
|
||||
pub use mailer_core;
|
||||
|
||||
/// Placeholder for DKIM/SPF/DMARC implementation.
|
||||
pub fn version() -> &'static str {
|
||||
env!("CARGO_PKG_VERSION")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
assert!(!version().is_empty());
|
||||
}
|
||||
}
|
||||
16
rust/crates/mailer-smtp/Cargo.toml
Normal file
16
rust/crates/mailer-smtp/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "mailer-smtp"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
mailer-core = { path = "../mailer-core" }
|
||||
tokio.workspace = true
|
||||
tokio-rustls.workspace = true
|
||||
hickory-dns.workspace = true
|
||||
dashmap.workspace = true
|
||||
thiserror.workspace = true
|
||||
tracing.workspace = true
|
||||
bytes.workspace = true
|
||||
serde.workspace = true
|
||||
18
rust/crates/mailer-smtp/src/lib.rs
Normal file
18
rust/crates/mailer-smtp/src/lib.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
//! mailer-smtp: SMTP protocol engine (server + client).
|
||||
|
||||
pub use mailer_core;
|
||||
|
||||
/// Placeholder for the SMTP server and client implementation.
|
||||
pub fn version() -> &'static str {
|
||||
env!("CARGO_PKG_VERSION")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
assert!(!version().is_empty());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user