Files
smartmta/dist_ts/security/classes.ipreputationchecker.d.ts
Juergen Kunz b82468ab1e
Some checks failed
CI / Build Test (Current Platform) (push) Failing after 4s
CI / Type Check & Lint (push) Failing after 6s
CI / Build All Platforms (push) Failing after 4s
BREAKING CHANGE(rust-bridge): make Rust the primary security backend, remove all TS fallbacks
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)
2026-02-10 20:30:43 +00:00

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;
}