Compare commits
	
		
			4 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d7f37afc30 | |||
| 27b6bb779e | |||
| d4778d15fc | |||
| 269bafc1bf | 
							
								
								
									
										18
									
								
								changelog.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								changelog.md
									
									
									
									
									
								
							| @@ -1,5 +1,23 @@ | |||||||
| # Changelog | # Changelog | ||||||
|  |  | ||||||
|  | ## 2025-10-24 - 1.2.1 - fix(mail/delivery) | ||||||
|  | Centralize runtime/plugin imports and switch modules to use plugins exports; unify EventEmitter usage; update Deno dependencies and small path/server refactors | ||||||
|  |  | ||||||
|  | - Centralized Node and third-party imports in ts/plugins.ts and re-exported commonly used utilities (net, tls, dns, fs, smartfile, smartdns, smartmail, mailauth, uuid, ip, LRUCache, etc). | ||||||
|  | - Replaced direct EventEmitter / Node built-in imports with plugins.EventEmitter across delivery, smtpclient, routing and the unified email server to standardize runtime integration. | ||||||
|  | - Updated deno.json dependency map: added @push.rocks/smartfile, @push.rocks/smartdns, @tsclass/tsclass and ip; reordered lru-cache entry. | ||||||
|  | - Stopped exporting ./dns/index.ts from ts/index.ts (DNS is available via mail/routing) to avoid duplicate exports. | ||||||
|  | - Added keysDir alias and dnsRecordsDir in ts/paths.ts and small path-related fixes. | ||||||
|  | - Added a placeholder SmtpServer and other minor delivery/smtpserver refactors and sanitizations. | ||||||
|  | - Added a local .claude/settings.local.json for development permissions (local-only configuration). | ||||||
|  |  | ||||||
|  | ## 2025-10-24 - 1.2.0 - feat(plugins) | ||||||
|  | Add smartmail, mailauth and uuid to Deno dependencies and export them from plugins; include local dev permissions file | ||||||
|  |  | ||||||
|  | - Add @push.rocks/smartmail, mailauth and uuid to deno.json dependencies so email parsing, DKIM and UUID utilities are available. | ||||||
|  | - Export smartmail, mailauth and uuid from ts/plugins.ts for centralized access across the codebase. | ||||||
|  | - Add .claude/settings.local.json to define local development permissions (tooling/dev environment configuration). | ||||||
|  |  | ||||||
| ## 2025-10-24 - 1.1.0 - feat(ci) | ## 2025-10-24 - 1.1.0 - feat(ci) | ||||||
| Add CI, release and npm-publish automation; introduce release template and local settings | Add CI, release and npm-publish automation; introduce release template and local settings | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								deno.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								deno.json
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@serve.zone/mailer", |   "name": "@serve.zone/mailer", | ||||||
|   "version": "1.1.0", |   "version": "1.2.1", | ||||||
|   "exports": "./mod.ts", |   "exports": "./mod.ts", | ||||||
|   "nodeModulesDir": "auto", |   "nodeModulesDir": "auto", | ||||||
|   "tasks": { |   "tasks": { | ||||||
| @@ -41,7 +41,13 @@ | |||||||
|     "@std/crypto": "jsr:@std/crypto@^1.0.0", |     "@std/crypto": "jsr:@std/crypto@^1.0.0", | ||||||
|     "@std/assert": "jsr:@std/assert@^1.0.0", |     "@std/assert": "jsr:@std/assert@^1.0.0", | ||||||
|     "@apiclient.xyz/cloudflare": "npm:@apiclient.xyz/cloudflare@latest", |     "@apiclient.xyz/cloudflare": "npm:@apiclient.xyz/cloudflare@latest", | ||||||
|  |     "@push.rocks/smartfile": "npm:@push.rocks/smartfile@latest", | ||||||
|  |     "@push.rocks/smartdns": "npm:@push.rocks/smartdns@latest", | ||||||
|  |     "@push.rocks/smartmail": "npm:@push.rocks/smartmail@^2.0.0", | ||||||
|  |     "@tsclass/tsclass": "npm:@tsclass/tsclass@latest", | ||||||
|     "lru-cache": "npm:lru-cache@^11.0.0", |     "lru-cache": "npm:lru-cache@^11.0.0", | ||||||
|     "mailaddress-validator": "npm:mailaddress-validator@^1.0.11" |     "mailauth": "npm:mailauth@^4.0.0", | ||||||
|  |     "uuid": "npm:uuid@^9.0.0", | ||||||
|  |     "ip": "npm:ip@^2.0.0" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@serve.zone/mailer", |   "name": "@serve.zone/mailer", | ||||||
|   "version": "1.1.0", |   "version": "1.2.1", | ||||||
|   "description": "Enterprise mail server with SMTP, HTTP API, and DNS management - built for serve.zone infrastructure", |   "description": "Enterprise mail server with SMTP, HTTP API, and DNS management - built for serve.zone infrastructure", | ||||||
|   "keywords": [ |   "keywords": [ | ||||||
|     "mailer", |     "mailer", | ||||||
|   | |||||||
| @@ -3,6 +3,6 @@ | |||||||
|  */ |  */ | ||||||
| export const commitinfo = { | export const commitinfo = { | ||||||
|   name: '@serve.zone/mailer', |   name: '@serve.zone/mailer', | ||||||
|   version: '1.1.0', |   version: '1.2.1', | ||||||
|   description: 'Enterprise mail server with SMTP, HTTP API, and DNS management - built for serve.zone infrastructure' |   description: 'Enterprise mail server with SMTP, HTTP API, and DNS management - built for serve.zone infrastructure' | ||||||
| } | } | ||||||
|   | |||||||
| @@ -8,5 +8,6 @@ export * from './mail/core/index.ts'; | |||||||
| export * from './mail/delivery/index.ts'; | export * from './mail/delivery/index.ts'; | ||||||
| export * from './mail/routing/index.ts'; | export * from './mail/routing/index.ts'; | ||||||
| export * from './api/index.ts'; | export * from './api/index.ts'; | ||||||
| export * from './dns/index.ts'; |  | ||||||
| export * from './config/index.ts'; | export * from './config/index.ts'; | ||||||
|  |  | ||||||
|  | // DNS exports are included in mail/routing, so we skip './dns/index.ts' to avoid duplication | ||||||
|   | |||||||
| @@ -1,7 +1,4 @@ | |||||||
| import * as plugins from '../../plugins.ts'; | import * as plugins from '../../plugins.ts'; | ||||||
| import { EventEmitter } from 'node:events'; |  | ||||||
| import * as fs from 'node:fs'; |  | ||||||
| import * as path from 'node:path'; |  | ||||||
| import { logger } from '../../logger.ts'; | import { logger } from '../../logger.ts'; | ||||||
| import { type EmailProcessingMode } from '../routing/classes.email.config.ts'; | import { type EmailProcessingMode } from '../routing/classes.email.config.ts'; | ||||||
| import type { IEmailRoute } from '../routing/interfaces.ts'; | import type { IEmailRoute } from '../routing/interfaces.ts'; | ||||||
| @@ -74,7 +71,7 @@ export interface IQueueStats { | |||||||
| /** | /** | ||||||
|  * A unified queue for all email modes |  * A unified queue for all email modes | ||||||
|  */ |  */ | ||||||
| export class UnifiedDeliveryQueue extends EventEmitter { | export class UnifiedDeliveryQueue extends plugins.EventEmitter { | ||||||
|   private options: Required<IQueueOptions>; |   private options: Required<IQueueOptions>; | ||||||
|   private queue: Map<string, IQueueItem> = new Map(); |   private queue: Map<string, IQueueItem> = new Map(); | ||||||
|   private checkTimer?: NodeJS.Timeout; |   private checkTimer?: NodeJS.Timeout; | ||||||
|   | |||||||
| @@ -1,7 +1,4 @@ | |||||||
| import * as plugins from '../../plugins.ts'; | import * as plugins from '../../plugins.ts'; | ||||||
| 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.ts'; | ||||||
| import {  | import {  | ||||||
|   SecurityLogger,  |   SecurityLogger,  | ||||||
| @@ -100,7 +97,7 @@ export interface IDeliveryStats { | |||||||
| /** | /** | ||||||
|  * Handles delivery for all email processing modes |  * Handles delivery for all email processing modes | ||||||
|  */ |  */ | ||||||
| export class MultiModeDeliverySystem extends EventEmitter { | export class MultiModeDeliverySystem extends plugins.EventEmitter { | ||||||
|   private queue: UnifiedDeliveryQueue; |   private queue: UnifiedDeliveryQueue; | ||||||
|   private options: Required<IMultiModeDeliveryOptions>; |   private options: Required<IMultiModeDeliveryOptions>; | ||||||
|   private stats: IDeliveryStats; |   private stats: IDeliveryStats; | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
| import * as plugins from '../../plugins.ts'; | import * as plugins from '../../plugins.ts'; | ||||||
| import { EventEmitter } from 'node:events'; |  | ||||||
| import { logger } from '../../logger.ts'; | import { logger } from '../../logger.ts'; | ||||||
| import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.ts'; | import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.ts'; | ||||||
|  |  | ||||||
| @@ -84,7 +83,7 @@ export interface IRateLimitResult { | |||||||
| /** | /** | ||||||
|  * Unified rate limiter for all email processing modes |  * Unified rate limiter for all email processing modes | ||||||
|  */ |  */ | ||||||
| export class UnifiedRateLimiter extends EventEmitter { | export class UnifiedRateLimiter extends plugins.EventEmitter { | ||||||
|   private config: IHierarchicalRateLimits; |   private config: IHierarchicalRateLimits; | ||||||
|   private counters: Map<string, ILimitCounter> = new Map(); |   private counters: Map<string, ILimitCounter> = new Map(); | ||||||
|   private patternCounters: Map<string, ILimitCounter> = new Map(); |   private patternCounters: Map<string, ILimitCounter> = new Map(); | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								ts/mail/delivery/placeholder.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								ts/mail/delivery/placeholder.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | /** | ||||||
|  |  * Placeholder delivery implementation | ||||||
|  |  * This will be replaced with actual delivery logic | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | export class DeliveryPlaceholder { | ||||||
|  |   // Placeholder for delivery functionality | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export class SmtpServer { | ||||||
|  |   // Placeholder SMTP server | ||||||
|  |   async start() {} | ||||||
|  |   async stop() {} | ||||||
|  | } | ||||||
| @@ -3,7 +3,7 @@ | |||||||
|  * SMTP command sending and response parsing |  * SMTP command sending and response parsing | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| import { EventEmitter } from 'node:events'; | import * as plugins from '../../../plugins.ts'; | ||||||
| import { SMTP_COMMANDS, SMTP_CODES, LINE_ENDINGS } from './constants.ts'; | import { SMTP_COMMANDS, SMTP_CODES, LINE_ENDINGS } from './constants.ts'; | ||||||
| import type {  | import type {  | ||||||
|   ISmtpConnection,  |   ISmtpConnection,  | ||||||
| @@ -19,7 +19,7 @@ import { | |||||||
| } from './utils/helpers.ts'; | } from './utils/helpers.ts'; | ||||||
| import { logCommand, logDebug } from './utils/logging.ts'; | import { logCommand, logDebug } from './utils/logging.ts'; | ||||||
|  |  | ||||||
| export class CommandHandler extends EventEmitter { | export class CommandHandler extends plugins.EventEmitter { | ||||||
|   private options: ISmtpClientOptions; |   private options: ISmtpClientOptions; | ||||||
|   private responseBuffer: string = ''; |   private responseBuffer: string = ''; | ||||||
|   private pendingCommand: { resolve: Function; reject: Function; command: string } | null = null; |   private pendingCommand: { resolve: Function; reject: Function; command: string } | null = null; | ||||||
|   | |||||||
| @@ -3,9 +3,7 @@ | |||||||
|  * Connection pooling and lifecycle management |  * Connection pooling and lifecycle management | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| import * as net from 'node:net'; | import * as plugins from '../../../plugins.ts'; | ||||||
| import * as tls from 'node:tls'; |  | ||||||
| import { EventEmitter } from 'node:events'; |  | ||||||
| import { DEFAULTS, CONNECTION_STATES } from './constants.ts'; | import { DEFAULTS, CONNECTION_STATES } from './constants.ts'; | ||||||
| import type { | import type { | ||||||
|   ISmtpClientOptions, |   ISmtpClientOptions, | ||||||
| @@ -16,7 +14,7 @@ import type { | |||||||
| import { logConnection, logDebug } from './utils/logging.ts'; | import { logConnection, logDebug } from './utils/logging.ts'; | ||||||
| import { generateConnectionId } from './utils/helpers.ts'; | import { generateConnectionId } from './utils/helpers.ts'; | ||||||
|  |  | ||||||
| export class ConnectionManager extends EventEmitter { | export class ConnectionManager extends plugins.EventEmitter { | ||||||
|   private options: ISmtpClientOptions; |   private options: ISmtpClientOptions; | ||||||
|   private connections: Map<string, ISmtpConnection> = new Map(); |   private connections: Map<string, ISmtpConnection> = new Map(); | ||||||
|   private pendingConnections: Set<string> = new Set(); |   private pendingConnections: Set<string> = new Set(); | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|  * Main client class with delegation to handlers |  * Main client class with delegation to handlers | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| import { EventEmitter } from 'node:events'; | import * as plugins from '../../../plugins.ts'; | ||||||
| import type { Email } from '../../core/classes.email.ts'; | import type { Email } from '../../core/classes.email.ts'; | ||||||
| import type {  | import type {  | ||||||
|   ISmtpClientOptions, |   ISmtpClientOptions, | ||||||
| @@ -30,7 +30,7 @@ interface ISmtpClientDependencies { | |||||||
|   errorHandler: SmtpErrorHandler; |   errorHandler: SmtpErrorHandler; | ||||||
| } | } | ||||||
|  |  | ||||||
| export class SmtpClient extends EventEmitter { | export class SmtpClient extends plugins.EventEmitter { | ||||||
|   private options: ISmtpClientOptions; |   private options: ISmtpClientOptions; | ||||||
|   private connectionManager: ConnectionManager; |   private connectionManager: ConnectionManager; | ||||||
|   private commandHandler: CommandHandler; |   private commandHandler: CommandHandler; | ||||||
|   | |||||||
| @@ -3,17 +3,16 @@ | |||||||
|  * Provides utilities for managing TLS certificates |  * Provides utilities for managing TLS certificates | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| import * as fs from 'fs'; | import * as plugins from '../../../plugins.ts'; | ||||||
| import * as tls from 'tls'; |  | ||||||
| import { SmtpLogger } from './utils/logging.ts'; | import { SmtpLogger } from './utils/logging.ts'; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Certificate data |  * Certificate data | ||||||
|  */ |  */ | ||||||
| export interface ICertificateData { | export interface ICertificateData { | ||||||
|   key: Buffer; |   key: plugins.Buffer; | ||||||
|   cert: Buffer; |   cert: plugins.Buffer; | ||||||
|   ca?: Buffer; |   ca?: plugins.Buffer; | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -155,7 +154,7 @@ export function loadCertificatesFromString(options: { | |||||||
|       const caBuffer = caStr ? Buffer.from(caStr, 'utf8') : undefined; |       const caBuffer = caStr ? Buffer.from(caStr, 'utf8') : undefined; | ||||||
|        |        | ||||||
|       // Test the certificates first |       // Test the certificates first | ||||||
|       const secureContext = tls.createSecureContext({ |       const secureContext = plugins.tls.createSecureContext({ | ||||||
|         key: keyBuffer, |         key: keyBuffer, | ||||||
|         cert: certBuffer, |         cert: certBuffer, | ||||||
|         ca: caBuffer |         ca: caBuffer | ||||||
| @@ -206,7 +205,7 @@ export function loadCertificatesFromString(options: { | |||||||
|        |        | ||||||
|       // Validate the certificates by attempting to create a secure context |       // Validate the certificates by attempting to create a secure context | ||||||
|       try { |       try { | ||||||
|         const secureContext = tls.createSecureContext({ |         const secureContext = plugins.tls.createSecureContext({ | ||||||
|           key: keyBuffer, |           key: keyBuffer, | ||||||
|           cert: certBuffer, |           cert: certBuffer, | ||||||
|           ca: caBuffer |           ca: caBuffer | ||||||
| @@ -253,9 +252,9 @@ export function loadCertificatesFromFiles(options: { | |||||||
| }): ICertificateData { | }): ICertificateData { | ||||||
|   try { |   try { | ||||||
|     // Read files directly as Buffers |     // Read files directly as Buffers | ||||||
|     const key = fs.readFileSync(options.keyPath); |     const key = plugins.fs.readFileSync(options.keyPath); | ||||||
|     const cert = fs.readFileSync(options.certPath); |     const cert = plugins.fs.readFileSync(options.certPath); | ||||||
|     const ca = options.caPath ? fs.readFileSync(options.caPath) : undefined; |     const ca = options.caPath ? plugins.fs.readFileSync(options.caPath) : undefined; | ||||||
|      |      | ||||||
|     // Log for debugging |     // Log for debugging | ||||||
|     SmtpLogger.debug('Certificate file properties', { |     SmtpLogger.debug('Certificate file properties', { | ||||||
| @@ -266,7 +265,7 @@ export function loadCertificatesFromFiles(options: { | |||||||
|      |      | ||||||
|     // Validate the certificates by attempting to create a secure context |     // Validate the certificates by attempting to create a secure context | ||||||
|     try { |     try { | ||||||
|       const secureContext = tls.createSecureContext({ |       const secureContext = plugins.tls.createSecureContext({ | ||||||
|         key, |         key, | ||||||
|         cert, |         cert, | ||||||
|         ca |         ca | ||||||
| @@ -364,8 +363,8 @@ ORWZbz+8rBL0JIeA7eFxEA== | |||||||
| export function createTlsOptions( | export function createTlsOptions( | ||||||
|   certificates: ICertificateData, |   certificates: ICertificateData, | ||||||
|   isServer: boolean = true |   isServer: boolean = true | ||||||
| ): tls.TlsOptions { | ): plugins.tls.TlsOptions { | ||||||
|   const options: tls.TlsOptions = { |   const options: plugins.tls.TlsOptions = { | ||||||
|     key: certificates.key, |     key: certificates.key, | ||||||
|     cert: certificates.cert, |     cert: certificates.cert, | ||||||
|     ca: certificates.ca, |     ca: certificates.ca, | ||||||
|   | |||||||
| @@ -4,8 +4,6 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| import * as plugins from '../../../plugins.ts'; | import * as plugins from '../../../plugins.ts'; | ||||||
| import * as fs from 'fs'; |  | ||||||
| import * as path from 'path'; |  | ||||||
| import { SmtpState } from './interfaces.ts'; | import { SmtpState } from './interfaces.ts'; | ||||||
| import type { ISmtpSession, ISmtpTransactionResult } from './interfaces.ts'; | import type { ISmtpSession, ISmtpTransactionResult } from './interfaces.ts'; | ||||||
| import type { IDataHandler, ISmtpServer } from './interfaces.ts'; | import type { IDataHandler, ISmtpServer } from './interfaces.ts'; | ||||||
|   | |||||||
| @@ -1,12 +1,11 @@ | |||||||
| import * as plugins from '../../plugins.ts'; | import * as plugins from '../../plugins.ts'; | ||||||
| import { EventEmitter } from 'node:events'; |  | ||||||
| import type { IEmailRoute, IEmailMatch, IEmailAction, IEmailContext } from './interfaces.ts'; | import type { IEmailRoute, IEmailMatch, IEmailAction, IEmailContext } from './interfaces.ts'; | ||||||
| import type { Email } from '../core/classes.email.ts'; | import type { Email } from '../core/classes.email.ts'; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Email router that evaluates routes and determines actions |  * Email router that evaluates routes and determines actions | ||||||
|  */ |  */ | ||||||
| export class EmailRouter extends EventEmitter { | export class EmailRouter extends plugins.EventEmitter { | ||||||
|   private routes: IEmailRoute[]; |   private routes: IEmailRoute[]; | ||||||
|   private patternCache: Map<string, boolean> = new Map(); |   private patternCache: Map<string, boolean> = new Map(); | ||||||
|   private storageManager?: any; // StorageManager instance |   private storageManager?: any; // StorageManager instance | ||||||
|   | |||||||
| @@ -1,6 +1,5 @@ | |||||||
| import * as plugins from '../../plugins.ts'; | import * as plugins from '../../plugins.ts'; | ||||||
| import * as paths from '../../paths.ts'; | import * as paths from '../../paths.ts'; | ||||||
| import { EventEmitter } from 'events'; |  | ||||||
| import { logger } from '../../logger.ts'; | import { logger } from '../../logger.ts'; | ||||||
| import {  | import {  | ||||||
|   SecurityLogger,  |   SecurityLogger,  | ||||||
| @@ -154,7 +153,7 @@ export interface IServerStats { | |||||||
| /** | /** | ||||||
|  * Unified email server that handles all email traffic with pattern-based routing |  * Unified email server that handles all email traffic with pattern-based routing | ||||||
|  */ |  */ | ||||||
| export class UnifiedEmailServer extends EventEmitter { | export class UnifiedEmailServer extends plugins.EventEmitter { | ||||||
|   private dcRouter: DcRouter; |   private dcRouter: DcRouter; | ||||||
|   private options: IUnifiedEmailServerOptions; |   private options: IUnifiedEmailServerOptions; | ||||||
|   private emailRouter: EmailRouter; |   private emailRouter: EmailRouter; | ||||||
|   | |||||||
| @@ -19,3 +19,9 @@ export const logsDir = plugins.path.join(configDir, 'logs'); | |||||||
|  |  | ||||||
| // DKIM keys directory | // DKIM keys directory | ||||||
| export const dkimKeysDir = plugins.path.join(configDir, 'dkim-keys'); | export const dkimKeysDir = plugins.path.join(configDir, 'dkim-keys'); | ||||||
|  |  | ||||||
|  | // Keys directory (alias for compatibility) | ||||||
|  | export const keysDir = dkimKeysDir; | ||||||
|  |  | ||||||
|  | // DNS records directory | ||||||
|  | export const dnsRecordsDir = plugins.path.join(configDir, 'dns-records'); | ||||||
|   | |||||||
| @@ -10,12 +10,7 @@ export * as cli from '@std/cli'; | |||||||
| export { serveDir } from '@std/http/file-server'; | export { serveDir } from '@std/http/file-server'; | ||||||
| export * as crypto from '@std/crypto'; | export * as crypto from '@std/crypto'; | ||||||
|  |  | ||||||
| // Cloudflare API client | // Node.js built-in modules (needed for SMTP and email processing) | ||||||
| import * as cloudflareImport from '@apiclient.xyz/cloudflare'; |  | ||||||
| export const cloudflare = cloudflareImport; |  | ||||||
|  |  | ||||||
| // Node.js compatibility - needed for SMTP and email processing |  | ||||||
| // We import these as npm: specifiers for Node.js modules that don't have Deno equivalents |  | ||||||
| import { EventEmitter } from 'node:events'; | import { EventEmitter } from 'node:events'; | ||||||
| import * as net from 'node:net'; | import * as net from 'node:net'; | ||||||
| import * as tls from 'node:tls'; | import * as tls from 'node:tls'; | ||||||
| @@ -24,9 +19,32 @@ import * as fs from 'node:fs'; | |||||||
| import * as os from 'node:os'; | import * as os from 'node:os'; | ||||||
| import * as process from 'node:process'; | import * as process from 'node:process'; | ||||||
| import * as buffer from 'node:buffer'; | import * as buffer from 'node:buffer'; | ||||||
|  | import * as util from 'node:util'; | ||||||
|  |  | ||||||
| export { EventEmitter }; | export { EventEmitter, net, tls, dns, fs, os, process, buffer, util }; | ||||||
| export { net, tls, dns, fs, os, process, buffer }; |  | ||||||
|  |  | ||||||
| // Re-export Buffer for convenience |  | ||||||
| export const Buffer = buffer.Buffer; | export const Buffer = buffer.Buffer; | ||||||
|  |  | ||||||
|  | // Cloudflare API client | ||||||
|  | import * as cloudflareImport from '@apiclient.xyz/cloudflare'; | ||||||
|  | export const cloudflare = cloudflareImport; | ||||||
|  |  | ||||||
|  | // @push.rocks packages | ||||||
|  | import * as smartfile from '@push.rocks/smartfile'; | ||||||
|  | import * as smartdns from '@push.rocks/smartdns'; | ||||||
|  | import * as smartmail from '@push.rocks/smartmail'; | ||||||
|  |  | ||||||
|  | export { smartfile, smartdns, smartmail }; | ||||||
|  |  | ||||||
|  | // @tsclass packages | ||||||
|  | import * as tsclass from '@tsclass/tsclass'; | ||||||
|  |  | ||||||
|  | export { tsclass }; | ||||||
|  |  | ||||||
|  | // Third-party libraries | ||||||
|  | import * as mailauth from 'mailauth'; | ||||||
|  | import { dkimSign } from 'mailauth/lib/dkim/sign.js'; | ||||||
|  | import * as uuid from 'uuid'; | ||||||
|  | import * as ip from 'ip'; | ||||||
|  | import { LRUCache } from 'lru-cache'; | ||||||
|  |  | ||||||
|  | export { mailauth, dkimSign, uuid, ip, LRUCache }; | ||||||
|   | |||||||
							
								
								
									
										23
									
								
								ts/security/classes.ipreputationchecker.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ts/security/classes.ipreputationchecker.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | /** | ||||||
|  |  * IP Reputation Checker | ||||||
|  |  * Checks IP addresses against reputation databases | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | export interface IIpReputationResult { | ||||||
|  |   ip: string; | ||||||
|  |   score: number; | ||||||
|  |   isBlacklisted: boolean; | ||||||
|  |   sources: string[]; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export class IpReputationChecker { | ||||||
|  |   public async checkReputation(ip: string): Promise<IIpReputationResult> { | ||||||
|  |     // Placeholder implementation | ||||||
|  |     return { | ||||||
|  |       ip, | ||||||
|  |       score: 100, | ||||||
|  |       isBlacklisted: false, | ||||||
|  |       sources: [], | ||||||
|  |     }; | ||||||
|  |   } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user