start the path to rust
This commit is contained in:
103
dist_ts/mail/security/classes.spfverifier.d.ts
vendored
Normal file
103
dist_ts/mail/security/classes.spfverifier.d.ts
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
import type { Email } from '../core/classes.email.js';
|
||||
/**
|
||||
* SPF result qualifiers
|
||||
*/
|
||||
export declare enum SpfQualifier {
|
||||
PASS = "+",
|
||||
NEUTRAL = "?",
|
||||
SOFTFAIL = "~",
|
||||
FAIL = "-"
|
||||
}
|
||||
/**
|
||||
* SPF mechanism types
|
||||
*/
|
||||
export declare enum SpfMechanismType {
|
||||
ALL = "all",
|
||||
INCLUDE = "include",
|
||||
A = "a",
|
||||
MX = "mx",
|
||||
IP4 = "ip4",
|
||||
IP6 = "ip6",
|
||||
EXISTS = "exists",
|
||||
REDIRECT = "redirect",
|
||||
EXP = "exp"
|
||||
}
|
||||
/**
|
||||
* SPF mechanism definition
|
||||
*/
|
||||
export interface SpfMechanism {
|
||||
qualifier: SpfQualifier;
|
||||
type: SpfMechanismType;
|
||||
value?: string;
|
||||
}
|
||||
/**
|
||||
* SPF record parsed data
|
||||
*/
|
||||
export interface SpfRecord {
|
||||
version: string;
|
||||
mechanisms: SpfMechanism[];
|
||||
modifiers: Record<string, string>;
|
||||
}
|
||||
/**
|
||||
* SPF verification result
|
||||
*/
|
||||
export interface SpfResult {
|
||||
result: 'pass' | 'neutral' | 'softfail' | 'fail' | 'temperror' | 'permerror' | 'none';
|
||||
explanation?: string;
|
||||
domain: string;
|
||||
ip: string;
|
||||
record?: string;
|
||||
error?: string;
|
||||
}
|
||||
/**
|
||||
* Class for verifying SPF records
|
||||
*/
|
||||
export declare class SpfVerifier {
|
||||
private dnsManager?;
|
||||
private lookupCount;
|
||||
constructor(dnsManager?: any);
|
||||
/**
|
||||
* Parse SPF record from TXT record
|
||||
* @param record SPF TXT record
|
||||
* @returns Parsed SPF record or null if invalid
|
||||
*/
|
||||
parseSpfRecord(record: string): SpfRecord | null;
|
||||
/**
|
||||
* Check if IP is in CIDR range
|
||||
* @param ip IP address to check
|
||||
* @param cidr CIDR range
|
||||
* @returns Whether the IP is in the CIDR range
|
||||
*/
|
||||
private isIpInCidr;
|
||||
/**
|
||||
* Check if a domain has the specified IP in its A or AAAA records
|
||||
* @param domain Domain to check
|
||||
* @param ip IP address to check
|
||||
* @returns Whether the domain resolves to the IP
|
||||
*/
|
||||
private isDomainResolvingToIp;
|
||||
/**
|
||||
* Verify SPF for a given email with IP and helo domain
|
||||
* @param email Email to verify
|
||||
* @param ip Sender IP address
|
||||
* @param heloDomain HELO/EHLO domain used by sender
|
||||
* @returns SPF verification result
|
||||
*/
|
||||
verify(email: Email, ip: string, heloDomain: string): Promise<SpfResult>;
|
||||
/**
|
||||
* Check SPF record against IP address
|
||||
* @param spfRecord Parsed SPF record
|
||||
* @param domain Domain being checked
|
||||
* @param ip IP address to check
|
||||
* @returns SPF result
|
||||
*/
|
||||
private checkSpfRecord;
|
||||
/**
|
||||
* Check if email passes SPF verification
|
||||
* @param email Email to verify
|
||||
* @param ip Sender IP address
|
||||
* @param heloDomain HELO/EHLO domain used by sender
|
||||
* @returns Whether email passes SPF
|
||||
*/
|
||||
verifyAndApply(email: Email, ip: string, heloDomain: string): Promise<boolean>;
|
||||
}
|
||||
Reference in New Issue
Block a user