UNPKG

@monkeyscanjump/cloudflare-dyndns

Version:

A robust TypeScript application that automatically updates Cloudflare DNS records when your public IP address changes. Perfect for maintaining consistent domain names for home servers, WireGuard VPN, self-hosted services, or any system with a dynamic IP a

52 lines (51 loc) 1.62 kB
import { IConfig } from '../types'; /** * Main application class that orchestrates the DNS update process * with continuous monitoring capability */ export declare class DynDnsApp { private configManager; private logger; private ipDetectionService; private cloudflareService; private ipFileManager; private isRunning; private checkInterval; private adaptiveInterval; private maxInterval; private minInterval; private consecutiveStableChecks; private shutdownRequested; private debugMode; /** * Creates a new DynDns application instance * @param directConfig Optional configuration overrides * @param debug Enable debug logging */ constructor(directConfig?: Partial<IConfig>, debug?: boolean); /** * Checks if configuration setup is needed * @returns True if configuration is missing or incomplete */ needsSetup(): boolean; /** * Handles graceful shutdown on SIGINT/SIGTERM */ private handleShutdown; /** * Calculates the next check interval using adaptive algorithm * @param ipChanged Whether the IP changed in the last check * @returns Time in milliseconds to wait before next check */ private calculateNextInterval; /** * Runs a single DNS update check * @returns True if check completed successfully (even if no update needed) */ runOnce(): Promise<boolean>; /** * Starts continuous monitoring for IP changes * Uses adaptive intervals to check more frequently when IP is changing */ startMonitoring(): Promise<void>; }