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:
@@ -1,10 +1,10 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { logger } from '../../logger.ts';
|
||||
import { type EmailProcessingMode } from '../routing/classes.email.config.ts';
|
||||
import type { IEmailRoute } from '../routing/interfaces.ts';
|
||||
import { logger } from '../../logger.js';
|
||||
import { type EmailProcessingMode } from '../routing/classes.email.config.js';
|
||||
import type { IEmailRoute } from '../routing/interfaces.js';
|
||||
|
||||
/**
|
||||
* Queue item status
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import * as net from 'node:net';
|
||||
import * as tls from 'node:tls';
|
||||
import { logger } from '../../logger.ts';
|
||||
import { logger } from '../../logger.js';
|
||||
import {
|
||||
SecurityLogger,
|
||||
SecurityLogLevel,
|
||||
SecurityEventType
|
||||
} from '../../security/index.ts';
|
||||
import { UnifiedDeliveryQueue, type IQueueItem } from './classes.delivery.queue.ts';
|
||||
import type { Email } from '../core/classes.email.ts';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.ts';
|
||||
import type { SmtpClient } from './smtpclient/smtp-client.ts';
|
||||
} from '../../security/index.js';
|
||||
import { UnifiedDeliveryQueue, type IQueueItem } from './classes.delivery.queue.js';
|
||||
import type { Email } from '../core/classes.email.js';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.js';
|
||||
import type { SmtpClient } from './smtpclient/smtp-client.js';
|
||||
|
||||
/**
|
||||
* Delivery status enumeration
|
||||
@@ -768,7 +768,11 @@ export class MultiModeDeliverySystem extends EventEmitter {
|
||||
const rawEmail = email.toRFC822String();
|
||||
|
||||
// Sign the email
|
||||
const dkimPrivateKey = (await this.emailServer.dkimCreator.readDKIMKeys(domainName)).privateKey;
|
||||
const signResult = await plugins.dkimSign(rawEmail, {
|
||||
signingDomain: domainName,
|
||||
selector: keySelector,
|
||||
privateKey: dkimPrivateKey,
|
||||
canonicalization: 'relaxed/relaxed',
|
||||
algorithm: 'rsa-sha256',
|
||||
signTime: new Date(),
|
||||
@@ -776,7 +780,7 @@ export class MultiModeDeliverySystem extends EventEmitter {
|
||||
{
|
||||
signingDomain: domainName,
|
||||
selector: keySelector,
|
||||
privateKey: (await this.emailServer.dkimCreator.readDKIMKeys(domainName)).privateKey,
|
||||
privateKey: dkimPrivateKey,
|
||||
algorithm: 'rsa-sha256',
|
||||
canonicalization: 'relaxed/relaxed'
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import * as paths from '../../paths.ts';
|
||||
import { Email } from '../core/classes.email.ts';
|
||||
import { EmailSignJob } from './classes.emailsignjob.ts';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.ts';
|
||||
import type { SmtpClient } from './smtpclient/smtp-client.ts';
|
||||
import type { ISmtpSendResult } from './smtpclient/interfaces.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import * as paths from '../../paths.js';
|
||||
import { Email } from '../core/classes.email.js';
|
||||
import { EmailSignJob } from './classes.emailsignjob.js';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.js';
|
||||
import type { SmtpClient } from './smtpclient/smtp-client.js';
|
||||
import type { ISmtpSendResult } from './smtpclient/interfaces.js';
|
||||
|
||||
// Configuration options for email sending
|
||||
export interface IEmailSendOptions {
|
||||
@@ -400,13 +400,13 @@ export class EmailSendJob {
|
||||
const fileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_success.eml`;
|
||||
const filePath = plugins.path.join(paths.sentEmailsDir, fileName);
|
||||
|
||||
await plugins.smartfile.fs.ensureDir(paths.sentEmailsDir);
|
||||
await plugins.smartfile.memory.toFs(emailContent, filePath);
|
||||
|
||||
await plugins.smartfs.directory(paths.sentEmailsDir).recursive().create();
|
||||
await plugins.smartfs.file(filePath).write(emailContent);
|
||||
|
||||
// Also save delivery info
|
||||
const infoFileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_info.json`;
|
||||
const infoPath = plugins.path.join(paths.sentEmailsDir, infoFileName);
|
||||
await plugins.smartfile.memory.toFs(JSON.stringify(this.deliveryInfo, null, 2), infoPath);
|
||||
await plugins.smartfs.file(infoPath).write(JSON.stringify(this.deliveryInfo, null, 2));
|
||||
|
||||
this.log(`Email saved to ${fileName}`);
|
||||
} catch (error) {
|
||||
@@ -424,13 +424,13 @@ export class EmailSendJob {
|
||||
const fileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_failed.eml`;
|
||||
const filePath = plugins.path.join(paths.failedEmailsDir, fileName);
|
||||
|
||||
await plugins.smartfile.fs.ensureDir(paths.failedEmailsDir);
|
||||
await plugins.smartfile.memory.toFs(emailContent, filePath);
|
||||
|
||||
await plugins.smartfs.directory(paths.failedEmailsDir).recursive().create();
|
||||
await plugins.smartfs.file(filePath).write(emailContent);
|
||||
|
||||
// Also save delivery info with error details
|
||||
const infoFileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_error.json`;
|
||||
const infoPath = plugins.path.join(paths.failedEmailsDir, infoFileName);
|
||||
await plugins.smartfile.memory.toFs(JSON.stringify(this.deliveryInfo, null, 2), infoPath);
|
||||
await plugins.smartfs.file(infoPath).write(JSON.stringify(this.deliveryInfo, null, 2));
|
||||
|
||||
this.log(`Failed email saved to ${fileName}`);
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.js';
|
||||
|
||||
interface Headers {
|
||||
[key: string]: string;
|
||||
@@ -27,37 +27,21 @@ export class EmailSignJob {
|
||||
}
|
||||
|
||||
public async getSignatureHeader(emailMessage: string): Promise<string> {
|
||||
const privateKey = await this.loadPrivateKey();
|
||||
const signResult = await plugins.dkimSign(emailMessage, {
|
||||
// Optional, default canonicalization, default is "relaxed/relaxed"
|
||||
canonicalization: 'relaxed/relaxed', // c=
|
||||
|
||||
// Optional, default signing and hashing algorithm
|
||||
// Mostly useful when you want to use rsa-sha1, otherwise no need to set
|
||||
signingDomain: this.jobOptions.domain,
|
||||
selector: this.jobOptions.selector,
|
||||
privateKey,
|
||||
canonicalization: 'relaxed/relaxed',
|
||||
algorithm: 'rsa-sha256',
|
||||
|
||||
// Optional, default is current time
|
||||
signTime: new Date(), // t=
|
||||
|
||||
// Keys for one or more signatures
|
||||
// Different signatures can use different algorithms (mostly useful when
|
||||
// you want to sign a message both with RSA and Ed25519)
|
||||
signTime: new Date(),
|
||||
signatureData: [
|
||||
{
|
||||
signingDomain: this.jobOptions.domain, // d=
|
||||
selector: this.jobOptions.selector, // s=
|
||||
// supported key types: RSA, Ed25519
|
||||
privateKey: await this.loadPrivateKey(), // k=
|
||||
|
||||
// Optional algorithm, default is derived from the key.
|
||||
// Overrides whatever was set in parent object
|
||||
signingDomain: this.jobOptions.domain,
|
||||
selector: this.jobOptions.selector,
|
||||
privateKey,
|
||||
algorithm: 'rsa-sha256',
|
||||
|
||||
// Optional signature specifc canonicalization, overrides whatever was set in parent object
|
||||
canonicalization: 'relaxed/relaxed', // c=
|
||||
|
||||
// Maximum number of canonicalized body bytes to sign (eg. the "l=" tag).
|
||||
// Do not use though. This is available only for compatibility testing.
|
||||
// maxBodyLength: 12345
|
||||
canonicalization: 'relaxed/relaxed',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import * as paths from '../../paths.ts';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import * as paths from '../../paths.js';
|
||||
import type { UnifiedEmailServer } from '../routing/classes.unified.email.server.js';
|
||||
|
||||
/**
|
||||
* Configures email server storage settings
|
||||
* @param emailServer Reference to the unified email server
|
||||
* @param options Configuration options containing storage paths
|
||||
*/
|
||||
export function configureEmailStorage(emailServer: UnifiedEmailServer, options: any): void {
|
||||
export async function configureEmailStorage(emailServer: UnifiedEmailServer, options: any): Promise<void> {
|
||||
// Extract the receivedEmailsPath if available
|
||||
if (options?.emailPortConfig?.receivedEmailsPath) {
|
||||
const receivedEmailsPath = options.emailPortConfig.receivedEmailsPath;
|
||||
|
||||
|
||||
// Ensure the directory exists
|
||||
plugins.smartfile.fs.ensureDirSync(receivedEmailsPath);
|
||||
|
||||
await plugins.smartfs.directory(receivedEmailsPath).recursive().create();
|
||||
|
||||
// Set path for received emails
|
||||
if (emailServer) {
|
||||
// Storage paths are now handled by the unified email server system
|
||||
plugins.smartfile.fs.ensureDirSync(paths.receivedEmailsDir);
|
||||
|
||||
await plugins.smartfs.directory(paths.receivedEmailsDir).recursive().create();
|
||||
|
||||
console.log(`Configured email server to store received emails to: ${receivedEmailsPath}`);
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,8 @@ export function configureEmailStorage(emailServer: UnifiedEmailServer, options:
|
||||
* @param emailServer Reference to the unified email server
|
||||
* @param config Configuration settings for email server
|
||||
*/
|
||||
export function configureEmailServer(
|
||||
emailServer: UnifiedEmailServer,
|
||||
export async function configureEmailServer(
|
||||
emailServer: UnifiedEmailServer,
|
||||
config: {
|
||||
ports?: number[];
|
||||
hostname?: string;
|
||||
@@ -42,32 +42,32 @@ export function configureEmailServer(
|
||||
};
|
||||
storagePath?: string;
|
||||
}
|
||||
): boolean {
|
||||
): Promise<boolean> {
|
||||
if (!emailServer) {
|
||||
console.error('Email server not available');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Configure the email server with updated options
|
||||
const serverOptions = {
|
||||
ports: config.ports || [25, 587, 465],
|
||||
hostname: config.hostname || 'localhost',
|
||||
tls: config.tls
|
||||
};
|
||||
|
||||
|
||||
// Update the email server options
|
||||
emailServer.updateOptions(serverOptions);
|
||||
|
||||
|
||||
console.log(`Configured email server on ports ${serverOptions.ports.join(', ')}`);
|
||||
|
||||
|
||||
// Set up storage path if provided
|
||||
if (config.storagePath) {
|
||||
configureEmailStorage(emailServer, {
|
||||
await configureEmailStorage(emailServer, {
|
||||
emailPortConfig: {
|
||||
receivedEmailsPath: config.storagePath
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { logger } from '../../logger.ts';
|
||||
import { logger } from '../../logger.js';
|
||||
|
||||
/**
|
||||
* Configuration options for rate limiter
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import { logger } from '../../logger.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { logger } from '../../logger.js';
|
||||
import {
|
||||
SecurityLogger,
|
||||
SecurityLogLevel,
|
||||
SecurityEventType
|
||||
} from '../../security/index.ts';
|
||||
} from '../../security/index.js';
|
||||
|
||||
import {
|
||||
MtaConnectionError,
|
||||
@@ -13,10 +13,10 @@ import {
|
||||
MtaConfigurationError,
|
||||
MtaTimeoutError,
|
||||
MtaProtocolError
|
||||
} from '../../errors/index.ts';
|
||||
} from '../../errors/index.js';
|
||||
|
||||
import { Email } from '../core/classes.email.ts';
|
||||
import type { EmailProcessingMode } from './interfaces.ts';
|
||||
import { Email } from '../core/classes.email.js';
|
||||
import type { EmailProcessingMode } from './interfaces.js';
|
||||
|
||||
// Custom error type extension
|
||||
interface NodeNetworkError extends Error {
|
||||
@@ -851,22 +851,33 @@ export class SmtpClient {
|
||||
|
||||
// Sign email
|
||||
const signOptions = {
|
||||
domainName: this.options.dkim.domain,
|
||||
keySelector: this.options.dkim.selector,
|
||||
signingDomain: this.options.dkim.domain,
|
||||
selector: this.options.dkim.selector,
|
||||
privateKey: this.options.dkim.privateKey,
|
||||
headerFieldNames: this.options.dkim.headers || [
|
||||
'from', 'to', 'subject', 'date', 'message-id'
|
||||
canonicalization: 'relaxed/relaxed' as const,
|
||||
algorithm: 'rsa-sha256' as const,
|
||||
signTime: new Date(),
|
||||
signatureData: [
|
||||
{
|
||||
signingDomain: this.options.dkim.domain,
|
||||
selector: this.options.dkim.selector,
|
||||
privateKey: this.options.dkim.privateKey,
|
||||
algorithm: 'rsa-sha256',
|
||||
canonicalization: 'relaxed/relaxed',
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const signedEmail = await dkimSign(emailContent, signOptions);
|
||||
|
||||
// Replace headers in original email
|
||||
const dkimHeader = signedEmail.substring(0, signedEmail.indexOf('\r\n\r\n')).split('\r\n')
|
||||
.find(line => line.startsWith('DKIM-Signature: '));
|
||||
|
||||
if (dkimHeader) {
|
||||
email.addHeader('DKIM-Signature', dkimHeader.substring('DKIM-Signature: '.length));
|
||||
|
||||
const signResult = await dkimSign(emailContent, signOptions);
|
||||
|
||||
// Add DKIM-Signature header from the signing result
|
||||
if (signResult.signatures) {
|
||||
const dkimHeader = signResult.signatures.split('\r\n')
|
||||
.find(line => line.startsWith('DKIM-Signature: '));
|
||||
|
||||
if (dkimHeader) {
|
||||
email.addHeader('DKIM-Signature', dkimHeader.substring('DKIM-Signature: '.length));
|
||||
}
|
||||
}
|
||||
|
||||
logger.log('debug', 'DKIM signature applied successfully');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { logger } from '../../logger.ts';
|
||||
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.ts';
|
||||
import { logger } from '../../logger.js';
|
||||
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.js';
|
||||
|
||||
/**
|
||||
* Interface for rate limit configuration
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
// Email delivery components
|
||||
export * from './classes.emailsignjob.ts';
|
||||
export * from './classes.delivery.queue.ts';
|
||||
export * from './classes.delivery.system.ts';
|
||||
export * from './classes.emailsignjob.js';
|
||||
export * from './classes.delivery.queue.js';
|
||||
export * from './classes.delivery.system.js';
|
||||
|
||||
// Handle exports with naming conflicts
|
||||
export { EmailSendJob } from './classes.emailsendjob.ts';
|
||||
export { DeliveryStatus } from './classes.delivery.system.ts';
|
||||
export { EmailSendJob } from './classes.emailsendjob.js';
|
||||
export { DeliveryStatus } from './classes.delivery.system.js';
|
||||
|
||||
// Rate limiter exports - fix naming conflict
|
||||
export { RateLimiter } from './classes.ratelimiter.ts';
|
||||
export type { IRateLimitConfig } from './classes.ratelimiter.ts';
|
||||
export { RateLimiter } from './classes.ratelimiter.js';
|
||||
export type { IRateLimitConfig } from './classes.ratelimiter.js';
|
||||
|
||||
// Unified rate limiter
|
||||
export * from './classes.unified.rate.limiter.ts';
|
||||
export * from './classes.unified.rate.limiter.js';
|
||||
|
||||
// SMTP client and configuration
|
||||
export * from './classes.mta.config.ts';
|
||||
export * from './classes.mta.config.js';
|
||||
|
||||
// Import and export SMTP modules as namespaces to avoid conflicts
|
||||
import * as smtpClientMod from './smtpclient/index.ts';
|
||||
import * as smtpServerMod from './smtpserver/index.ts';
|
||||
import * as smtpClientMod from './smtpclient/index.js';
|
||||
import * as smtpServerMod from './smtpserver/index.js';
|
||||
|
||||
export { smtpClientMod, smtpServerMod };
|
||||
@@ -2,7 +2,7 @@
|
||||
* SMTP and email delivery interface definitions
|
||||
*/
|
||||
|
||||
import type { Email } from '../core/classes.email.ts';
|
||||
import type { Email } from '../core/classes.email.js';
|
||||
|
||||
/**
|
||||
* SMTP session state enumeration
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
* Authentication mechanisms implementation
|
||||
*/
|
||||
|
||||
import { AUTH_METHODS } from './constants.ts';
|
||||
import { AUTH_METHODS } from './constants.js';
|
||||
import type {
|
||||
ISmtpConnection,
|
||||
ISmtpAuthOptions,
|
||||
ISmtpClientOptions,
|
||||
ISmtpResponse,
|
||||
IOAuth2Options
|
||||
} from './interfaces.ts';
|
||||
} from './interfaces.js';
|
||||
import {
|
||||
encodeAuthPlain,
|
||||
encodeAuthLogin,
|
||||
generateOAuth2String,
|
||||
isSuccessCode
|
||||
} from './utils/helpers.ts';
|
||||
import { logAuthentication, logDebug } from './utils/logging.ts';
|
||||
import type { CommandHandler } from './command-handler.ts';
|
||||
} from './utils/helpers.js';
|
||||
import { logAuthentication, logDebug } from './utils/logging.js';
|
||||
import type { CommandHandler } from './command-handler.js';
|
||||
|
||||
export class AuthHandler {
|
||||
private options: ISmtpClientOptions;
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { SMTP_COMMANDS, SMTP_CODES, LINE_ENDINGS } from './constants.ts';
|
||||
import { SMTP_COMMANDS, SMTP_CODES, LINE_ENDINGS } from './constants.js';
|
||||
import type {
|
||||
ISmtpConnection,
|
||||
ISmtpResponse,
|
||||
ISmtpClientOptions,
|
||||
ISmtpCapabilities
|
||||
} from './interfaces.ts';
|
||||
} from './interfaces.js';
|
||||
import {
|
||||
parseSmtpResponse,
|
||||
parseEhloResponse,
|
||||
formatCommand,
|
||||
isSuccessCode
|
||||
} from './utils/helpers.ts';
|
||||
import { logCommand, logDebug } from './utils/logging.ts';
|
||||
} from './utils/helpers.js';
|
||||
import { logCommand, logDebug } from './utils/logging.js';
|
||||
|
||||
export class CommandHandler extends EventEmitter {
|
||||
private options: ISmtpClientOptions;
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
import * as net from 'node:net';
|
||||
import * as tls from 'node:tls';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { DEFAULTS, CONNECTION_STATES } from './constants.ts';
|
||||
import { DEFAULTS, CONNECTION_STATES } from './constants.js';
|
||||
import type {
|
||||
ISmtpClientOptions,
|
||||
ISmtpConnection,
|
||||
IConnectionPoolStatus,
|
||||
ConnectionState
|
||||
} from './interfaces.ts';
|
||||
import { logConnection, logDebug } from './utils/logging.ts';
|
||||
import { generateConnectionId } from './utils/helpers.ts';
|
||||
} from './interfaces.js';
|
||||
import { logConnection, logDebug } from './utils/logging.js';
|
||||
import { generateConnectionId } from './utils/helpers.js';
|
||||
|
||||
export class ConnectionManager extends EventEmitter {
|
||||
private options: ISmtpClientOptions;
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
* Factory function for client creation and dependency injection
|
||||
*/
|
||||
|
||||
import { SmtpClient } from './smtp-client.ts';
|
||||
import { ConnectionManager } from './connection-manager.ts';
|
||||
import { CommandHandler } from './command-handler.ts';
|
||||
import { AuthHandler } from './auth-handler.ts';
|
||||
import { TlsHandler } from './tls-handler.ts';
|
||||
import { SmtpErrorHandler } from './error-handler.ts';
|
||||
import type { ISmtpClientOptions } from './interfaces.ts';
|
||||
import { validateClientOptions } from './utils/validation.ts';
|
||||
import { DEFAULTS } from './constants.ts';
|
||||
import { SmtpClient } from './smtp-client.js';
|
||||
import { ConnectionManager } from './connection-manager.js';
|
||||
import { CommandHandler } from './command-handler.js';
|
||||
import { AuthHandler } from './auth-handler.js';
|
||||
import { TlsHandler } from './tls-handler.js';
|
||||
import { SmtpErrorHandler } from './error-handler.js';
|
||||
import type { ISmtpClientOptions } from './interfaces.js';
|
||||
import { validateClientOptions } from './utils/validation.js';
|
||||
import { DEFAULTS } from './constants.js';
|
||||
|
||||
/**
|
||||
* Create a complete SMTP client with all components
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Error classification and recovery strategies
|
||||
*/
|
||||
|
||||
import { SmtpErrorType } from './constants.ts';
|
||||
import type { ISmtpResponse, ISmtpErrorContext, ISmtpClientOptions } from './interfaces.ts';
|
||||
import { logDebug } from './utils/logging.ts';
|
||||
import { SmtpErrorType } from './constants.js';
|
||||
import type { ISmtpResponse, ISmtpErrorContext, ISmtpClientOptions } from './interfaces.js';
|
||||
import { logDebug } from './utils/logging.js';
|
||||
|
||||
export class SmtpErrorHandler {
|
||||
private options: ISmtpClientOptions;
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
*/
|
||||
|
||||
// Main client class and factory
|
||||
export * from './smtp-client.ts';
|
||||
export * from './create-client.ts';
|
||||
export * from './smtp-client.js';
|
||||
export * from './create-client.js';
|
||||
|
||||
// Core handlers
|
||||
export * from './connection-manager.ts';
|
||||
export * from './command-handler.ts';
|
||||
export * from './auth-handler.ts';
|
||||
export * from './tls-handler.ts';
|
||||
export * from './error-handler.ts';
|
||||
export * from './connection-manager.js';
|
||||
export * from './command-handler.js';
|
||||
export * from './auth-handler.js';
|
||||
export * from './tls-handler.js';
|
||||
export * from './error-handler.js';
|
||||
|
||||
// Interfaces and types
|
||||
export * from './interfaces.ts';
|
||||
export * from './constants.ts';
|
||||
export * from './interfaces.js';
|
||||
export * from './constants.js';
|
||||
|
||||
// Utilities
|
||||
export * from './utils/validation.ts';
|
||||
export * from './utils/logging.ts';
|
||||
export * from './utils/helpers.ts';
|
||||
export * from './utils/validation.js';
|
||||
export * from './utils/logging.js';
|
||||
export * from './utils/helpers.js';
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import type * as tls from 'node:tls';
|
||||
import type * as net from 'node:net';
|
||||
import type { Email } from '../../core/classes.email.ts';
|
||||
import type { Email } from '../../core/classes.email.js';
|
||||
|
||||
/**
|
||||
* SMTP client connection options
|
||||
|
||||
@@ -4,22 +4,22 @@
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'node:events';
|
||||
import type { Email } from '../../core/classes.email.ts';
|
||||
import type { Email } from '../../core/classes.email.js';
|
||||
import type {
|
||||
ISmtpClientOptions,
|
||||
ISmtpSendResult,
|
||||
ISmtpConnection,
|
||||
IConnectionPoolStatus,
|
||||
ConnectionState
|
||||
} from './interfaces.ts';
|
||||
import { CONNECTION_STATES, SmtpErrorType } from './constants.ts';
|
||||
import type { ConnectionManager } from './connection-manager.ts';
|
||||
import type { CommandHandler } from './command-handler.ts';
|
||||
import type { AuthHandler } from './auth-handler.ts';
|
||||
import type { TlsHandler } from './tls-handler.ts';
|
||||
import type { SmtpErrorHandler } from './error-handler.ts';
|
||||
import { validateSender, validateRecipients } from './utils/validation.ts';
|
||||
import { logEmailSend, logPerformance, logDebug } from './utils/logging.ts';
|
||||
} from './interfaces.js';
|
||||
import { CONNECTION_STATES, SmtpErrorType } from './constants.js';
|
||||
import type { ConnectionManager } from './connection-manager.js';
|
||||
import type { CommandHandler } from './command-handler.js';
|
||||
import type { AuthHandler } from './auth-handler.js';
|
||||
import type { TlsHandler } from './tls-handler.js';
|
||||
import type { SmtpErrorHandler } from './error-handler.js';
|
||||
import { validateSender, validateRecipients } from './utils/validation.js';
|
||||
import { logEmailSend, logPerformance, logDebug } from './utils/logging.js';
|
||||
|
||||
interface ISmtpClientDependencies {
|
||||
options: ISmtpClientOptions;
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
|
||||
import * as tls from 'node:tls';
|
||||
import * as net from 'node:net';
|
||||
import { DEFAULTS } from './constants.ts';
|
||||
import { DEFAULTS } from './constants.js';
|
||||
import type {
|
||||
ISmtpConnection,
|
||||
ISmtpClientOptions,
|
||||
ConnectionState
|
||||
} from './interfaces.ts';
|
||||
import { CONNECTION_STATES } from './constants.ts';
|
||||
import { logTLS, logDebug } from './utils/logging.ts';
|
||||
import { isSuccessCode } from './utils/helpers.ts';
|
||||
import type { CommandHandler } from './command-handler.ts';
|
||||
} from './interfaces.js';
|
||||
import { CONNECTION_STATES } from './constants.js';
|
||||
import { logTLS, logDebug } from './utils/logging.js';
|
||||
import { isSuccessCode } from './utils/helpers.js';
|
||||
import type { CommandHandler } from './command-handler.js';
|
||||
|
||||
export class TlsHandler {
|
||||
private options: ISmtpClientOptions;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Protocol helper functions and utilities
|
||||
*/
|
||||
|
||||
import { SMTP_CODES, REGEX_PATTERNS, LINE_ENDINGS } from '../constants.ts';
|
||||
import type { ISmtpResponse, ISmtpCapabilities } from '../interfaces.ts';
|
||||
import { SMTP_CODES, REGEX_PATTERNS, LINE_ENDINGS } from '../constants.js';
|
||||
import type { ISmtpResponse, ISmtpCapabilities } from '../interfaces.js';
|
||||
|
||||
/**
|
||||
* Parse SMTP server response
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Client-side logging utilities for SMTP operations
|
||||
*/
|
||||
|
||||
import { logger } from '../../../../logger.ts';
|
||||
import type { ISmtpResponse, ISmtpClientOptions } from '../interfaces.ts';
|
||||
import { logger } from '../../../../logger.js';
|
||||
import type { ISmtpResponse, ISmtpClientOptions } from '../interfaces.js';
|
||||
|
||||
export interface ISmtpClientLogData {
|
||||
component: string;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Input validation functions for SMTP client operations
|
||||
*/
|
||||
|
||||
import { REGEX_PATTERNS } from '../constants.ts';
|
||||
import type { ISmtpClientOptions, ISmtpAuthOptions } from '../interfaces.ts';
|
||||
import { REGEX_PATTERNS } from '../constants.js';
|
||||
import type { ISmtpClientOptions, ISmtpAuthOptions } from '../interfaces.js';
|
||||
|
||||
/**
|
||||
* Validate email address format
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as tls from 'tls';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
|
||||
/**
|
||||
* Certificate data
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
* Responsible for parsing and handling SMTP commands
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import { SmtpState } from './interfaces.ts';
|
||||
import type { ISmtpSession, IEnvelopeRecipient } from './interfaces.ts';
|
||||
import type { ICommandHandler, ISmtpServer } from './interfaces.ts';
|
||||
import { SmtpCommand, SmtpResponseCode, SMTP_DEFAULTS, SMTP_EXTENSIONS } from './constants.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import { adaptiveLogger } from './utils/adaptive-logging.ts';
|
||||
import { extractCommandName, extractCommandArgs, formatMultilineResponse } from './utils/helpers.ts';
|
||||
import { validateEhlo, validateMailFrom, validateRcptTo, isValidCommandSequence } from './utils/validation.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import { SmtpState } from './interfaces.js';
|
||||
import type { ISmtpSession, IEnvelopeRecipient } from './interfaces.js';
|
||||
import type { ICommandHandler, ISmtpServer } from './interfaces.js';
|
||||
import { SmtpCommand, SmtpResponseCode, SMTP_DEFAULTS, SMTP_EXTENSIONS } from './constants.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
import { adaptiveLogger } from './utils/adaptive-logging.js';
|
||||
import { extractCommandName, extractCommandArgs, formatMultilineResponse } from './utils/helpers.js';
|
||||
import { validateEhlo, validateMailFrom, validateRcptTo, isValidCommandSequence } from './utils/validation.js';
|
||||
|
||||
/**
|
||||
* Handles SMTP commands and responses
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
* Responsible for managing socket connections to the SMTP server
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import type { IConnectionManager, ISmtpServer } from './interfaces.ts';
|
||||
import { SmtpResponseCode, SMTP_DEFAULTS, SmtpState } from './constants.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import { adaptiveLogger } from './utils/adaptive-logging.ts';
|
||||
import { getSocketDetails, formatMultilineResponse } from './utils/helpers.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import type { IConnectionManager, ISmtpServer } from './interfaces.js';
|
||||
import { SmtpResponseCode, SMTP_DEFAULTS, SmtpState } from './constants.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
import { adaptiveLogger } from './utils/adaptive-logging.js';
|
||||
import { getSocketDetails, formatMultilineResponse } from './utils/helpers.js';
|
||||
|
||||
/**
|
||||
* Manager for SMTP connections
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* This file contains all constants and enums used by the SMTP server
|
||||
*/
|
||||
|
||||
import { SmtpState } from '../interfaces.ts';
|
||||
import { SmtpState } from '../interfaces.js';
|
||||
|
||||
// Re-export SmtpState enum from the main interfaces file
|
||||
export { SmtpState };
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
* Provides a simple way to create a complete SMTP server
|
||||
*/
|
||||
|
||||
import { SmtpServer } from './smtp-server.ts';
|
||||
import { SessionManager } from './session-manager.ts';
|
||||
import { ConnectionManager } from './connection-manager.ts';
|
||||
import { CommandHandler } from './command-handler.ts';
|
||||
import { DataHandler } from './data-handler.ts';
|
||||
import { TlsHandler } from './tls-handler.ts';
|
||||
import { SecurityHandler } from './security-handler.ts';
|
||||
import type { ISmtpServerOptions } from './interfaces.ts';
|
||||
import { UnifiedEmailServer } from '../../routing/classes.unified.email.server.ts';
|
||||
import { SmtpServer } from './smtp-server.js';
|
||||
import { SessionManager } from './session-manager.js';
|
||||
import { ConnectionManager } from './connection-manager.js';
|
||||
import { CommandHandler } from './command-handler.js';
|
||||
import { DataHandler } from './data-handler.js';
|
||||
import { TlsHandler } from './tls-handler.js';
|
||||
import { SecurityHandler } from './security-handler.js';
|
||||
import type { ISmtpServerOptions } from './interfaces.js';
|
||||
import { UnifiedEmailServer } from '../../routing/classes.unified.email.server.js';
|
||||
|
||||
/**
|
||||
* Create a complete SMTP server with all components
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
* Responsible for processing email data during and after DATA command
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { SmtpState } from './interfaces.ts';
|
||||
import type { ISmtpSession, ISmtpTransactionResult } from './interfaces.ts';
|
||||
import type { IDataHandler, ISmtpServer } from './interfaces.ts';
|
||||
import { SmtpResponseCode, SMTP_PATTERNS, SMTP_DEFAULTS } from './constants.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import { detectHeaderInjection } from './utils/validation.ts';
|
||||
import { Email } from '../../core/classes.email.ts';
|
||||
import { SmtpState } from './interfaces.js';
|
||||
import type { ISmtpSession, ISmtpTransactionResult } from './interfaces.js';
|
||||
import type { IDataHandler, ISmtpServer } from './interfaces.js';
|
||||
import { SmtpResponseCode, SMTP_PATTERNS, SMTP_DEFAULTS } from './constants.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
import { detectHeaderInjection } from './utils/validation.js';
|
||||
import { Email } from '../../core/classes.email.js';
|
||||
|
||||
/**
|
||||
* Handles SMTP DATA command and email data processing
|
||||
|
||||
@@ -4,29 +4,29 @@
|
||||
*/
|
||||
|
||||
// Export interfaces
|
||||
export * from './interfaces.ts';
|
||||
export * from './interfaces.js';
|
||||
|
||||
// Export server classes
|
||||
export { SmtpServer } from './smtp-server.ts';
|
||||
export { SessionManager } from './session-manager.ts';
|
||||
export { ConnectionManager } from './connection-manager.ts';
|
||||
export { CommandHandler } from './command-handler.ts';
|
||||
export { DataHandler } from './data-handler.ts';
|
||||
export { TlsHandler } from './tls-handler.ts';
|
||||
export { SecurityHandler } from './security-handler.ts';
|
||||
export { SmtpServer } from './smtp-server.js';
|
||||
export { SessionManager } from './session-manager.js';
|
||||
export { ConnectionManager } from './connection-manager.js';
|
||||
export { CommandHandler } from './command-handler.js';
|
||||
export { DataHandler } from './data-handler.js';
|
||||
export { TlsHandler } from './tls-handler.js';
|
||||
export { SecurityHandler } from './security-handler.js';
|
||||
|
||||
// Export constants
|
||||
export * from './constants.ts';
|
||||
export * from './constants.js';
|
||||
|
||||
// Export utilities
|
||||
export { SmtpLogger } from './utils/logging.ts';
|
||||
export * from './utils/validation.ts';
|
||||
export * from './utils/helpers.ts';
|
||||
export { SmtpLogger } from './utils/logging.js';
|
||||
export * from './utils/validation.js';
|
||||
export * from './utils/helpers.js';
|
||||
|
||||
// Export TLS and certificate utilities
|
||||
export * from './certificate-utils.ts';
|
||||
export * from './secure-server.ts';
|
||||
export * from './starttls-handler.ts';
|
||||
export * from './certificate-utils.js';
|
||||
export * from './secure-server.js';
|
||||
export * from './starttls-handler.js';
|
||||
|
||||
// Factory function to create a complete SMTP server with default components
|
||||
export { createSmtpServer } from './create-server.ts';
|
||||
export { createSmtpServer } from './create-server.js';
|
||||
@@ -3,15 +3,15 @@
|
||||
* Defines all the interfaces used by the SMTP server implementation
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import type { Email } from '../../core/classes.email.ts';
|
||||
import type { UnifiedEmailServer } from '../../routing/classes.unified.email.server.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import type { Email } from '../../core/classes.email.js';
|
||||
import type { UnifiedEmailServer } from '../../routing/classes.unified.email.server.js';
|
||||
|
||||
// Re-export types from other modules
|
||||
import { SmtpState } from '../interfaces.ts';
|
||||
import { SmtpCommand } from './constants.ts';
|
||||
import { SmtpState } from '../interfaces.js';
|
||||
import { SmtpCommand } from './constants.js';
|
||||
export { SmtpState, SmtpCommand };
|
||||
export type { IEnvelopeRecipient } from '../interfaces.ts';
|
||||
export type { IEnvelopeRecipient } from '../interfaces.js';
|
||||
|
||||
/**
|
||||
* Interface for components that need cleanup
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
* Provides helper functions for creating and managing secure TLS server
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import {
|
||||
loadCertificatesFromString,
|
||||
generateSelfSignedCertificates,
|
||||
createTlsOptions,
|
||||
type ICertificateData
|
||||
} from './certificate-utils.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
} from './certificate-utils.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
|
||||
/**
|
||||
* Create a secure TLS server for direct TLS connections
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
* email validation, and authentication
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import type { ISmtpSession, ISmtpAuth } from './interfaces.ts';
|
||||
import type { ISecurityHandler, ISmtpServer } from './interfaces.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import { SecurityEventType, SecurityLogLevel } from './constants.ts';
|
||||
import { isValidEmail } from './utils/validation.ts';
|
||||
import { getSocketDetails, getTlsDetails } from './utils/helpers.ts';
|
||||
import { IPReputationChecker } from '../../../security/classes.ipreputationchecker.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import type { ISmtpSession, ISmtpAuth } from './interfaces.js';
|
||||
import type { ISecurityHandler, ISmtpServer } from './interfaces.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
import { SecurityEventType, SecurityLogLevel } from './constants.js';
|
||||
import { isValidEmail } from './utils/validation.js';
|
||||
import { getSocketDetails, getTlsDetails } from './utils/helpers.js';
|
||||
import { IPReputationChecker } from '../../../security/classes.ipreputationchecker.js';
|
||||
|
||||
/**
|
||||
* Interface for IP denylist entry
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
* Responsible for creating, managing, and cleaning up SMTP sessions
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import { SmtpState } from './interfaces.ts';
|
||||
import type { ISmtpSession, ISmtpEnvelope } from './interfaces.ts';
|
||||
import type { ISessionManager, ISessionEvents } from './interfaces.ts';
|
||||
import { SMTP_DEFAULTS } from './constants.ts';
|
||||
import { generateSessionId, getSocketDetails } from './utils/helpers.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import { SmtpState } from './interfaces.js';
|
||||
import type { ISmtpSession, ISmtpEnvelope } from './interfaces.js';
|
||||
import type { ISessionManager, ISessionEvents } from './interfaces.js';
|
||||
import { SMTP_DEFAULTS } from './constants.js';
|
||||
import { generateSessionId, getSocketDetails } from './utils/helpers.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
|
||||
/**
|
||||
* Manager for SMTP sessions
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
* Core implementation for the refactored SMTP server
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import { SmtpState } from './interfaces.ts';
|
||||
import type { ISmtpServerOptions } from './interfaces.ts';
|
||||
import type { ISmtpServer, ISmtpServerConfig, ISessionManager, IConnectionManager, ICommandHandler, IDataHandler, ITlsHandler, ISecurityHandler } from './interfaces.ts';
|
||||
import { SessionManager } from './session-manager.ts';
|
||||
import { ConnectionManager } from './connection-manager.ts';
|
||||
import { CommandHandler } from './command-handler.ts';
|
||||
import { DataHandler } from './data-handler.ts';
|
||||
import { TlsHandler } from './tls-handler.ts';
|
||||
import { SecurityHandler } from './security-handler.ts';
|
||||
import { SMTP_DEFAULTS } from './constants.ts';
|
||||
import { mergeWithDefaults } from './utils/helpers.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import { adaptiveLogger } from './utils/adaptive-logging.ts';
|
||||
import { UnifiedEmailServer } from '../../routing/classes.unified.email.server.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import { SmtpState } from './interfaces.js';
|
||||
import type { ISmtpServerOptions } from './interfaces.js';
|
||||
import type { ISmtpServer, ISmtpServerConfig, ISessionManager, IConnectionManager, ICommandHandler, IDataHandler, ITlsHandler, ISecurityHandler } from './interfaces.js';
|
||||
import { SessionManager } from './session-manager.js';
|
||||
import { ConnectionManager } from './connection-manager.js';
|
||||
import { CommandHandler } from './command-handler.js';
|
||||
import { DataHandler } from './data-handler.js';
|
||||
import { TlsHandler } from './tls-handler.js';
|
||||
import { SecurityHandler } from './security-handler.js';
|
||||
import { SMTP_DEFAULTS } from './constants.js';
|
||||
import { mergeWithDefaults } from './utils/helpers.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
import { adaptiveLogger } from './utils/adaptive-logging.js';
|
||||
import { UnifiedEmailServer } from '../../routing/classes.unified.email.server.js';
|
||||
|
||||
/**
|
||||
* SMTP Server implementation
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
* Provides an improved implementation for STARTTLS upgrades
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
import {
|
||||
loadCertificatesFromString,
|
||||
createTlsOptions,
|
||||
type ICertificateData
|
||||
} from './certificate-utils.ts';
|
||||
import { getSocketDetails } from './utils/helpers.ts';
|
||||
import type { ISmtpSession, ISessionManager, IConnectionManager } from './interfaces.ts';
|
||||
import { SmtpState } from '../interfaces.ts';
|
||||
} from './certificate-utils.js';
|
||||
import { getSocketDetails } from './utils/helpers.js';
|
||||
import type { ISmtpSession, ISessionManager, IConnectionManager } from './interfaces.js';
|
||||
import { SmtpState } from '../interfaces.js';
|
||||
|
||||
/**
|
||||
* Enhanced STARTTLS handler for more reliable TLS upgrades
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
* Responsible for handling TLS-related SMTP functionality
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../plugins.ts';
|
||||
import type { ITlsHandler, ISmtpServer, ISmtpSession } from './interfaces.ts';
|
||||
import { SmtpResponseCode, SecurityEventType, SecurityLogLevel } from './constants.ts';
|
||||
import { SmtpLogger } from './utils/logging.ts';
|
||||
import { getSocketDetails, getTlsDetails } from './utils/helpers.ts';
|
||||
import * as plugins from '../../../plugins.js';
|
||||
import type { ITlsHandler, ISmtpServer, ISmtpSession } from './interfaces.js';
|
||||
import { SmtpResponseCode, SecurityEventType, SecurityLogLevel } from './constants.js';
|
||||
import { SmtpLogger } from './utils/logging.js';
|
||||
import { getSocketDetails, getTlsDetails } from './utils/helpers.js';
|
||||
import {
|
||||
loadCertificatesFromString,
|
||||
generateSelfSignedCertificates,
|
||||
createTlsOptions,
|
||||
type ICertificateData
|
||||
} from './certificate-utils.ts';
|
||||
import { SmtpState } from '../interfaces.ts';
|
||||
} from './certificate-utils.js';
|
||||
import { SmtpState } from '../interfaces.js';
|
||||
|
||||
/**
|
||||
* Handles TLS functionality for SMTP server
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* to maintain performance during high-concurrency scenarios
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../../plugins.ts';
|
||||
import { logger } from '../../../../logger.ts';
|
||||
import { SecurityLogLevel, SecurityEventType } from '../constants.ts';
|
||||
import type { ISmtpSession } from '../interfaces.ts';
|
||||
import type { LogLevel, ISmtpLogOptions } from './logging.ts';
|
||||
import * as plugins from '../../../../plugins.js';
|
||||
import { logger } from '../../../../logger.js';
|
||||
import { SecurityLogLevel, SecurityEventType } from '../constants.js';
|
||||
import type { ISmtpSession } from '../interfaces.js';
|
||||
import type { LogLevel, ISmtpLogOptions } from './logging.js';
|
||||
|
||||
/**
|
||||
* Log modes based on server load
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Provides utility functions for SMTP server implementation
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../../plugins.ts';
|
||||
import { SMTP_DEFAULTS } from '../constants.ts';
|
||||
import type { ISmtpSession, ISmtpServerOptions } from '../interfaces.ts';
|
||||
import * as plugins from '../../../../plugins.js';
|
||||
import { SMTP_DEFAULTS } from '../constants.js';
|
||||
import type { ISmtpSession, ISmtpServerOptions } from '../interfaces.js';
|
||||
|
||||
/**
|
||||
* Formats a multi-line SMTP response according to RFC 5321
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* Provides structured logging for SMTP server components
|
||||
*/
|
||||
|
||||
import * as plugins from '../../../../plugins.ts';
|
||||
import { logger } from '../../../../logger.ts';
|
||||
import { SecurityLogLevel, SecurityEventType } from '../constants.ts';
|
||||
import type { ISmtpSession } from '../interfaces.ts';
|
||||
import * as plugins from '../../../../plugins.js';
|
||||
import { logger } from '../../../../logger.js';
|
||||
import { SecurityLogLevel, SecurityEventType } from '../constants.js';
|
||||
import type { ISmtpSession } from '../interfaces.js';
|
||||
|
||||
/**
|
||||
* SMTP connection metadata to include in logs
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Provides validation functions for SMTP server
|
||||
*/
|
||||
|
||||
import { SmtpState } from '../interfaces.ts';
|
||||
import { SMTP_PATTERNS } from '../constants.ts';
|
||||
import { SmtpState } from '../interfaces.js';
|
||||
import { SMTP_PATTERNS } from '../constants.js';
|
||||
|
||||
/**
|
||||
* Header injection patterns to detect malicious input
|
||||
@@ -88,7 +88,7 @@ export function sanitizeInput(input: string): string {
|
||||
.replace(/%0[aAdD]/gi, '') // Remove URL encoded CRLF
|
||||
.trim();
|
||||
}
|
||||
import { SmtpLogger } from './logging.ts';
|
||||
import { SmtpLogger } from './logging.js';
|
||||
|
||||
/**
|
||||
* Validates an email address
|
||||
|
||||
Reference in New Issue
Block a user