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

35 lines (34 loc) 1.29 kB
import { Logger } from '../utils/Logger'; /** * Service for detecting the current public IP address * with multiple fallback services for reliability */ export declare class IpDetectionService { private logger; private ipServices; private ipServiceEndpoints; /** * Creates a new IP detection service instance * @param logger Logger instance for recording detection activity * @param ipServices Array of service identifiers to use for IP detection */ constructor(logger: Logger, ipServices?: string[]); /** * Detects the current public IP address using multiple services with fallback * @returns Promise resolving to the current public IPv4 address * @throws Error if all configured IP detection services fail */ detectIp(): Promise<string>; /** * Validates if a string is a properly formatted IPv4 address * @param ip String to validate as an IPv4 address * @returns True if the string is a valid IPv4 address */ private isValidIpv4; /** * Attempts to get a fallback IP from an alternative source * Used as a last resort when other methods fail * @returns Promise resolving to an IP address or null if unavailable */ getFallbackIp(): Promise<string | null>; }