Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 1.57 KB

README.md

File metadata and controls

54 lines (43 loc) · 1.57 KB

ddns_client.dart

A Dart library for checking the public internet address and updating a dynamic dns entry.

pub package Build Status

Overview

  • PublicAddressMonitor provides functionality for both a one time check of the public internet address and continuous (periodic) monitoring of the public internet address.

  • DynamicDnsUpdater and its subclasses provide functionality for updating a dynamic dns entry such as those at dyndns.org

Example

A simple example for monitoring an internet address and updating a dyndns.org entry is provided as part of this package.

Monitoring a public internet address:

var monitor = new PublicAddressMonitor();
monitor.startWatching().listen((PublicAddressEvent event) {
  if (event.oldAddress != null &&
      event.oldAddress != event.newAddress) {
    // process changed internet address here
  }
});

Updating a dyndns.org entry:

Dyndns2Updater updater = new Dyndns2Updater(
  username: yourUsername,
  password: yourPassword,
  hostname: yourHostname);
updater.update(newAddress).then((UpdateResult result) {
  if (result.success == true) {
    // success
  } else if (result.success == null) {
    // no change
  } else {
    // failed to update dynamic dns entry
  }
});