80 lines
2.2 KiB
TypeScript
80 lines
2.2 KiB
TypeScript
import type { IEmailDomainConfig } from './interfaces.js';
|
|
/** External DcRouter interface shape used by DnsManager */
|
|
interface IDcRouterLike {
|
|
storageManager: IStorageManagerLike;
|
|
dnsServer?: any;
|
|
options?: {
|
|
dnsNsDomains?: string[];
|
|
dnsScopes?: string[];
|
|
};
|
|
}
|
|
/** External StorageManager interface shape used by DnsManager */
|
|
interface IStorageManagerLike {
|
|
get(key: string): Promise<string | null>;
|
|
set(key: string, value: string): Promise<void>;
|
|
}
|
|
/**
|
|
* DNS validation result
|
|
*/
|
|
export interface IDnsValidationResult {
|
|
valid: boolean;
|
|
errors: string[];
|
|
warnings: string[];
|
|
requiredChanges: string[];
|
|
}
|
|
/**
|
|
* Manages DNS configuration for email domains
|
|
* Handles both validation and creation of DNS records
|
|
*/
|
|
export declare class DnsManager {
|
|
private dcRouter;
|
|
private storageManager;
|
|
constructor(dcRouter: IDcRouterLike);
|
|
/**
|
|
* Validate all domain configurations
|
|
*/
|
|
validateAllDomains(domainConfigs: IEmailDomainConfig[]): Promise<Map<string, IDnsValidationResult>>;
|
|
/**
|
|
* Validate a single domain configuration
|
|
*/
|
|
validateDomain(config: IEmailDomainConfig): Promise<IDnsValidationResult>;
|
|
/**
|
|
* Validate forward mode configuration
|
|
*/
|
|
private validateForwardMode;
|
|
/**
|
|
* Validate internal DNS mode configuration
|
|
*/
|
|
private validateInternalDnsMode;
|
|
/**
|
|
* Validate external DNS mode configuration
|
|
*/
|
|
private validateExternalDnsMode;
|
|
/**
|
|
* Check DNS records for a domain
|
|
*/
|
|
private checkDnsRecords;
|
|
/**
|
|
* Resolve NS records for a domain
|
|
*/
|
|
private resolveNs;
|
|
/**
|
|
* Get base domain from email domain (e.g., mail.example.com -> example.com)
|
|
*/
|
|
private getBaseDomain;
|
|
/**
|
|
* Ensure all DNS records are created for configured domains
|
|
* This is the main entry point for DNS record management
|
|
*/
|
|
ensureDnsRecords(domainConfigs: IEmailDomainConfig[], dkimCreator?: any): Promise<void>;
|
|
/**
|
|
* Create DNS records for internal-dns mode domains
|
|
*/
|
|
private createInternalDnsRecords;
|
|
/**
|
|
* Create DKIM DNS records for all domains
|
|
*/
|
|
private createDkimRecords;
|
|
}
|
|
export {};
|