fix(mail): align queue, outbound hostname, and DKIM selector behavior across the mail server APIs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import * as paths from '../paths.js';
|
||||
import { logger } from '../logger.js';
|
||||
import { hasStorageManagerMethods, type IStorageManagerLike } from '../mail/interfaces.storage.js';
|
||||
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from './classes.securitylogger.js';
|
||||
import { RustSecurityBridge } from './classes.rustsecuritybridge.js';
|
||||
import { LRUCache } from 'lru-cache';
|
||||
@@ -66,7 +67,7 @@ export class IPReputationChecker {
|
||||
private static instance: IPReputationChecker;
|
||||
private reputationCache: LRUCache<string, IReputationResult>;
|
||||
private options: Required<IIPReputationOptions>;
|
||||
private storageManager?: any;
|
||||
private storageManager?: IStorageManagerLike;
|
||||
|
||||
private static readonly DEFAULT_OPTIONS: Required<IIPReputationOptions> = {
|
||||
maxCacheSize: 10000,
|
||||
@@ -80,7 +81,7 @@ export class IPReputationChecker {
|
||||
enableIPInfo: true
|
||||
};
|
||||
|
||||
constructor(options: IIPReputationOptions = {}, storageManager?: any) {
|
||||
constructor(options: IIPReputationOptions = {}, storageManager?: IStorageManagerLike) {
|
||||
this.options = {
|
||||
...IPReputationChecker.DEFAULT_OPTIONS,
|
||||
...options
|
||||
@@ -100,7 +101,7 @@ export class IPReputationChecker {
|
||||
}
|
||||
}
|
||||
|
||||
public static getInstance(options: IIPReputationOptions = {}, storageManager?: any): IPReputationChecker {
|
||||
public static getInstance(options: IIPReputationOptions = {}, storageManager?: IStorageManagerLike): IPReputationChecker {
|
||||
if (!IPReputationChecker.instance) {
|
||||
IPReputationChecker.instance = new IPReputationChecker(options, storageManager);
|
||||
}
|
||||
@@ -219,7 +220,7 @@ export class IPReputationChecker {
|
||||
|
||||
const cacheData = JSON.stringify(entries);
|
||||
|
||||
if (this.storageManager) {
|
||||
if (hasStorageManagerMethods(this.storageManager, ['set'])) {
|
||||
await this.storageManager.set('/security/ip-reputation-cache.json', cacheData);
|
||||
logger.log('info', `Saved ${entries.length} IP reputation cache entries to StorageManager`);
|
||||
} else {
|
||||
@@ -239,7 +240,7 @@ export class IPReputationChecker {
|
||||
let cacheData: string | null = null;
|
||||
let fromFilesystem = false;
|
||||
|
||||
if (this.storageManager) {
|
||||
if (hasStorageManagerMethods(this.storageManager, ['get', 'set'])) {
|
||||
try {
|
||||
cacheData = await this.storageManager.get('/security/ip-reputation-cache.json');
|
||||
|
||||
@@ -302,7 +303,7 @@ export class IPReputationChecker {
|
||||
}
|
||||
}
|
||||
|
||||
public updateStorageManager(storageManager: any): void {
|
||||
public updateStorageManager(storageManager: IStorageManagerLike): void {
|
||||
this.storageManager = storageManager;
|
||||
logger.log('info', 'IPReputationChecker storage manager updated');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user