UNPKG

@linkedmink/node-route53-dynamic-dns

Version:

Background process that updates AWS Route 53 DNS address records whenever the public IP of the hosting environment changes

25 lines (24 loc) 1.47 kB
import { DnsRecordSetSource } from "../types/dns-record-events.mjs"; import { DnsZoneRecordClient } from "../types/dns-zone-record-client.mjs"; import { PublicIpState } from "../types/public-ip-events.mjs"; import { Disposable } from "../types/utility.mjs"; export declare class Route53AddressRecordUpdater implements Disposable { private readonly client; private readonly recordSource; private readonly logger; private pendingUpdate; private eventDuringUpdate; constructor(client: DnsZoneRecordClient, recordSource: DnsRecordSetSource); dispose: () => Promise<void>; /** * When the public IP changes, check if any host records have an out of date ip. If they do, start an update for each out of * date record and wait for the change to synchronize. The AWS service updates the records asynchronously. * @param event The event emitted when the public IP address has changed * @returns Resolve when the host records have been checked and updated if necessary. If there's an update in progress, set the * event to process later and resolve immediately. We may get multiple update events while a synchronization is in progress, we * only want to use the latest IP to make the public IP update independent of the host record update without queuing events that * won't be relevant anymore. */ handlePublicIpUpdate: (event: PublicIpState) => Promise<void>; private updateRecordsIfOutdated; }