feat(mailer-smtp): implement in-process SMTP server and management IPC integration
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartmta',
|
||||
version: '2.0.1',
|
||||
version: '2.1.0',
|
||||
description: 'A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.'
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxzQkFBc0I7SUFDNUIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHlIQUF5SDtDQUN2SSxDQUFBIn0=
|
||||
@@ -164,6 +164,17 @@ export declare class UnifiedEmailServer extends EventEmitter {
|
||||
* Stop the unified email server
|
||||
*/
|
||||
stop(): Promise<void>;
|
||||
/**
|
||||
* Handle an emailReceived event from the Rust SMTP server.
|
||||
* Decodes the email data, processes it through the routing system,
|
||||
* and sends back the result via the correlation-ID callback.
|
||||
*/
|
||||
private handleRustEmailReceived;
|
||||
/**
|
||||
* Handle an authRequest event from the Rust SMTP server.
|
||||
* Validates credentials and sends back the result.
|
||||
*/
|
||||
private handleRustAuthRequest;
|
||||
/**
|
||||
* Verify inbound email security (DKIM/SPF/DMARC) using the Rust bridge.
|
||||
* Falls back gracefully if the bridge is not running.
|
||||
|
||||
File diff suppressed because one or more lines are too long
92
dist_ts/security/classes.rustsecuritybridge.d.ts
vendored
92
dist_ts/security/classes.rustsecuritybridge.d.ts
vendored
@@ -60,6 +60,53 @@ interface IVersionInfo {
|
||||
security: string;
|
||||
smtp: string;
|
||||
}
|
||||
interface ISmtpServerConfig {
|
||||
hostname: string;
|
||||
ports: number[];
|
||||
securePort?: number;
|
||||
tlsCertPem?: string;
|
||||
tlsKeyPem?: string;
|
||||
maxMessageSize?: number;
|
||||
maxConnections?: number;
|
||||
maxRecipients?: number;
|
||||
connectionTimeoutSecs?: number;
|
||||
dataTimeoutSecs?: number;
|
||||
authEnabled?: boolean;
|
||||
maxAuthFailures?: number;
|
||||
socketTimeoutSecs?: number;
|
||||
processingTimeoutSecs?: number;
|
||||
rateLimits?: IRateLimitConfig;
|
||||
}
|
||||
interface IRateLimitConfig {
|
||||
maxConnectionsPerIp?: number;
|
||||
maxMessagesPerSender?: number;
|
||||
maxAuthFailuresPerIp?: number;
|
||||
windowSecs?: number;
|
||||
}
|
||||
interface IEmailData {
|
||||
type: 'inline' | 'file';
|
||||
base64?: string;
|
||||
path?: string;
|
||||
}
|
||||
interface IEmailReceivedEvent {
|
||||
correlationId: string;
|
||||
sessionId: string;
|
||||
mailFrom: string;
|
||||
rcptTo: string[];
|
||||
data: IEmailData;
|
||||
remoteAddr: string;
|
||||
clientHostname: string | null;
|
||||
secure: boolean;
|
||||
authenticatedUser: string | null;
|
||||
securityResults: any | null;
|
||||
}
|
||||
interface IAuthRequestEvent {
|
||||
correlationId: string;
|
||||
sessionId: string;
|
||||
username: string;
|
||||
password: string;
|
||||
remoteAddr: string;
|
||||
}
|
||||
/**
|
||||
* Bridge between TypeScript and the Rust `mailer-bin` binary.
|
||||
*
|
||||
@@ -135,5 +182,48 @@ export declare class RustSecurityBridge {
|
||||
hostname?: string;
|
||||
mailFrom: string;
|
||||
}): Promise<IEmailSecurityResult>;
|
||||
/**
|
||||
* Start the Rust SMTP server.
|
||||
* The server will listen on the configured ports and emit events for
|
||||
* emailReceived and authRequest that must be handled by the caller.
|
||||
*/
|
||||
startSmtpServer(config: ISmtpServerConfig): Promise<boolean>;
|
||||
/** Stop the Rust SMTP server. */
|
||||
stopSmtpServer(): Promise<void>;
|
||||
/**
|
||||
* Send the result of email processing back to the Rust SMTP server.
|
||||
* This resolves a pending correlation-ID callback, allowing the Rust
|
||||
* server to send the SMTP response to the client.
|
||||
*/
|
||||
sendEmailProcessingResult(opts: {
|
||||
correlationId: string;
|
||||
accepted: boolean;
|
||||
smtpCode?: number;
|
||||
smtpMessage?: string;
|
||||
}): Promise<void>;
|
||||
/**
|
||||
* Send the result of authentication validation back to the Rust SMTP server.
|
||||
*/
|
||||
sendAuthResult(opts: {
|
||||
correlationId: string;
|
||||
success: boolean;
|
||||
message?: string;
|
||||
}): Promise<void>;
|
||||
/** Update rate limit configuration at runtime. */
|
||||
configureRateLimits(config: IRateLimitConfig): Promise<void>;
|
||||
/**
|
||||
* Register a handler for emailReceived events from the Rust SMTP server.
|
||||
* These events fire when a complete email has been received and needs processing.
|
||||
*/
|
||||
onEmailReceived(handler: (data: IEmailReceivedEvent) => void): void;
|
||||
/**
|
||||
* Register a handler for authRequest events from the Rust SMTP server.
|
||||
* The handler must call sendAuthResult() with the correlationId.
|
||||
*/
|
||||
onAuthRequest(handler: (data: IAuthRequestEvent) => void): void;
|
||||
/** Remove an emailReceived event handler. */
|
||||
offEmailReceived(handler: (data: IEmailReceivedEvent) => void): void;
|
||||
/** Remove an authRequest event handler. */
|
||||
offAuthRequest(handler: (data: IAuthRequestEvent) => void): void;
|
||||
}
|
||||
export type { IDkimVerificationResult, ISpfResult, IDmarcResult, IEmailSecurityResult, IValidationResult, IBounceDetection, IContentScanResult, IReputationResult as IRustReputationResult, IVersionInfo, };
|
||||
export type { IDkimVerificationResult, ISpfResult, IDmarcResult, IEmailSecurityResult, IValidationResult, IBounceDetection, IContentScanResult, IReputationResult as IRustReputationResult, IVersionInfo, ISmtpServerConfig, IRateLimitConfig, IEmailData, IEmailReceivedEvent, IAuthRequestEvent, };
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user