Files
smartmta/dist_ts/security/classes.ipreputationchecker.d.ts

74 lines
2.0 KiB
TypeScript
Raw Normal View History

2026-02-10 15:54:09 +00:00
/**
* 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.
2026-02-10 15:54:09 +00:00
*/
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
2026-02-10 15:54:09 +00:00
*/
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;
}