/** * Shared types for certificate management and domain options */ /** * Domain forwarding configuration */ export interface IForwardConfig { ip: string; port: number; } /** * Domain configuration options */ export interface IDomainOptions { domainName: string; sslRedirect: boolean; // if true redirects the request to port 443 acmeMaintenance: boolean; // tries to always have a valid cert for this domain forward?: IForwardConfig; // forwards all http requests to that target acmeForward?: IForwardConfig; // forwards letsencrypt requests to this config } /** * Certificate data that can be emitted via events or set from outside */ export interface ICertificateData { domain: string; certificate: string; privateKey: string; expiryDate: Date; } /** * Events emitted by the Port80Handler */ export enum Port80HandlerEvents { CERTIFICATE_ISSUED = 'certificate-issued', CERTIFICATE_RENEWED = 'certificate-renewed', CERTIFICATE_FAILED = 'certificate-failed', CERTIFICATE_EXPIRING = 'certificate-expiring', MANAGER_STARTED = 'manager-started', MANAGER_STOPPED = 'manager-stopped', REQUEST_FORWARDED = 'request-forwarded', } /** * Certificate failure payload type */ export interface ICertificateFailure { domain: string; error: string; isRenewal: boolean; } /** * Certificate expiry payload type */ export interface ICertificateExpiring { domain: string; expiryDate: Date; daysRemaining: number; } /** * Forwarding configuration for specific domains in ACME setup */ export interface IDomainForwardConfig { domain: string; forwardConfig?: IForwardConfig; acmeForwardConfig?: IForwardConfig; sslRedirect?: boolean; } /** * Unified ACME configuration options used across proxies and handlers */ export interface IAcmeOptions { enabled?: boolean; // Whether ACME is enabled port?: number; // Port to listen on for ACME challenges (default: 80) contactEmail?: string; // Email for Let's Encrypt account useProduction?: boolean; // Use production environment (default: staging) httpsRedirectPort?: number; // Port to redirect HTTP requests to HTTPS (default: 443) renewThresholdDays?: number; // Days before expiry to renew certificates renewCheckIntervalHours?: number; // How often to check for renewals (in hours) autoRenew?: boolean; // Whether to automatically renew certificates certificateStore?: string; // Directory to store certificates skipConfiguredCerts?: boolean; // Skip domains with existing certificates domainForwards?: IDomainForwardConfig[]; // Domain-specific forwarding configs }