Phase 3 of the Rust migration: the Rust security bridge is now mandatory and all TypeScript security fallback implementations have been removed. - UnifiedEmailServer.start() throws if Rust bridge fails to start - SpfVerifier gutted to thin wrapper (parseSpfRecord stays in TS) - DKIMVerifier gutted to thin wrapper delegating to bridge.verifyDkim() - IPReputationChecker delegates to bridge.checkIpReputation(), keeps LRU cache - DmarcVerifier keeps alignment logic (works with pre-computed results) - DKIM signing via bridge.signDkim() in all 4 locations - Removed mailauth and ip packages from plugins.ts (~1,200 lines deleted)
74 lines
2.0 KiB
TypeScript
74 lines
2.0 KiB
TypeScript
/**
|
|
* Reputation check result information
|
|
*/
|
|
export interface IReputationResult {
|
|
score: number;
|
|
isSpam: boolean;
|
|
isProxy: boolean;
|
|
isTor: boolean;
|
|
isVPN: boolean;
|
|
country?: string;
|
|
asn?: string;
|
|
org?: string;
|
|
blacklists?: string[];
|
|
timestamp: number;
|
|
error?: string;
|
|
}
|
|
/**
|
|
* Reputation threshold scores
|
|
*/
|
|
export declare enum ReputationThreshold {
|
|
HIGH_RISK = 20,// Score below this is considered high risk
|
|
MEDIUM_RISK = 50,// Score below this is considered medium risk
|
|
LOW_RISK = 80
|
|
}
|
|
/**
|
|
* IP type classifications
|
|
*/
|
|
export declare enum IPType {
|
|
RESIDENTIAL = "residential",
|
|
DATACENTER = "datacenter",
|
|
PROXY = "proxy",
|
|
TOR = "tor",
|
|
VPN = "vpn",
|
|
UNKNOWN = "unknown"
|
|
}
|
|
/**
|
|
* Options for the IP Reputation Checker
|
|
*/
|
|
export interface IIPReputationOptions {
|
|
maxCacheSize?: number;
|
|
cacheTTL?: number;
|
|
dnsblServers?: string[];
|
|
highRiskThreshold?: number;
|
|
mediumRiskThreshold?: number;
|
|
lowRiskThreshold?: number;
|
|
enableLocalCache?: boolean;
|
|
enableDNSBL?: boolean;
|
|
enableIPInfo?: boolean;
|
|
}
|
|
/**
|
|
* IP reputation checker — delegates DNSBL lookups to the Rust security bridge.
|
|
* Retains LRU caching and disk persistence in TypeScript.
|
|
*/
|
|
export declare class IPReputationChecker {
|
|
private static instance;
|
|
private reputationCache;
|
|
private options;
|
|
private storageManager?;
|
|
private static readonly DEFAULT_OPTIONS;
|
|
constructor(options?: IIPReputationOptions, storageManager?: any);
|
|
static getInstance(options?: IIPReputationOptions, storageManager?: any): IPReputationChecker;
|
|
/**
|
|
* Check an IP address's reputation via the Rust bridge
|
|
*/
|
|
checkReputation(ip: string): Promise<IReputationResult>;
|
|
private createErrorResult;
|
|
private isValidIPAddress;
|
|
private logReputationCheck;
|
|
private saveCache;
|
|
private loadCache;
|
|
static getRiskLevel(score: number): 'high' | 'medium' | 'low' | 'trusted';
|
|
updateStorageManager(storageManager: any): void;
|
|
}
|