sx5486510 / cloudflare-ddns-sync

A simple package to update DNS records on Cloudflare whenever you want.

Home Page:https://cds.knaup.pw/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cloudflare-DDNS-Sync

NPM

Documentation

You may also have a look at the official CLI version of Cloudflare-DDNS-Sync:

NPM

Overview

Cloudflare-DDNS-Sync is a simple NPM package that updates the IP address of Cloudflare DNS records.

What are the goals of this project?

The goal of Cloudflare-DDNS-Sync is to make updating the IP of Cloudflare DNS records as easy as possible.

How do I set this project up?

Prerequisites

  • Node
  • Cloudflare Account

Installation

To install Cloudflare-DDNS-Sync simply run:

npm install cloudflare-ddns-sync

in your project folder.

Usage

var CloudflareDDNSSync = require("cloudflare-ddns-sync");

var ddnsSync = new CloudflareDDNSSync({
  "auth" : {
    "email"  : "your@email.com",
    "key"  : "your_cloudflare_api_key"
  },
  "domain": "your-domain.com",
  "records" : [
    "subdomain.your-domain.com",
    "subdomain2.your-domain.com"
  ],
});

ddnsSync.sync()
.then((results) => {
  for(var result of results){
    console.log(result);
  }
});

Hint: If a record is not existing, CDS will automatically create it when syncing.

Methods

  • getIp()
  • getRecordIps()
  • sync(<ip>)
  • syncOnIpChange(<callback>)
  • syncByInterval(interval, <ip>, <callback>)
  • syncOnceEveryHour(minute, <ip>, <callback>)
  • syncOnceEveryDay([hour, <minute>], <ip>, <callback>)
  • syncOnceEveryWeek([dayOfWeek, <hour>, <minute>], <ip>, <callback>)
  • syncOnceEveryMonth([dayOfMonth, <hour>, <minute>], <ip>, <callback>)
  • syncByCronTime(cronTime, <ip>, <callback>)
  • syncAtDate(date, <ip>, <callback>)
  • syncByTimestring(timestring, <ip>, <callback>)
  • stopSyncOnIpChange()

For a more detailed view, have a look at the Documentation

Get Your Cloudflare API Key

  • Go to Cloudflare
  • Log In
  • In the upper right corner: click on your email address
  • Go to "My Profile"
  • In the "API Key"-Section: click on the "View API Key"-Button of the Global Key
  • Enter your password and fill the captcha
  • Copy the API Key

Changelog

v1.5.4

  • πŸ“ Update README

v1.5.3

  • πŸ› Fix Stopping Sync On IP Change
  • πŸ› Fix Crontime Converter For Hour
  • πŸ› Fix Syncing With Crontime Without Setting an IP
  • ⚑️ Small Performance Improvements
  • πŸ’„ Improve Code Quality
  • πŸ’„ Extract Business Rules

v1.5.2

  • πŸ› Fix Wrong Using of Const

v1.5.1

  • πŸ› Fix Bug When 'public-ip' Throws An Error
  • πŸ’„ Improve Code Quality

v1.5.0

  • ✨ Add Create Not Existing Records Functionality
  • ✨ Add Fallback getIp Function

v1.4.0

  • ✨ Add Stop SyncOnIpChange Function

v1.3.4

  • πŸ› Fix ipChange Interval

v1.3.3

  • πŸ“ Add Changelog

v1.3.2

  • ✨ Add getRecordIps Function
  • ♻️ Refactor syncOnIpChange
  • βœ… Add Tests for Sync Functionality
  • πŸ“ Improve README
  • πŸ“ Add NPM Badge
  • πŸ”₯ Remove Unnecessary Code
  • 🚸 Update Description
  • 🎨 Order Dependencies
  • 🎨 Lint files

v1.3.1

  • πŸ“ Fix README

v1.3.0

  • ✨ Add syncAtDate Function
  • πŸ“ Improve README

v1.2.1

  • πŸš‘ Fix README

v1.2.0

  • ✨ Add onIpChange Function
  • πŸ“ Adjust README
  • 🚚 Move Utils to Lib
  • 🚚 Move IP Functions to Lib
  • 🚚 Move Dependencies to devDependencies
  • πŸ”§ Update Eslint Config
  • 🎨 Fix Eslit Error

v1.1.0

  • ⚑️ Improve Performance of First Sync
  • ✨ Add Schedule Functionality
  • 🚸 Improve Success Message of Sync Function
  • πŸ“ Fix Typos in README
  • πŸ“ Add Schedule Functions to README
  • βœ… Add Unittests
  • ✨ Add Eslint

v1.0.3

  • πŸ“ Fix Typo in README
  • πŸ“„ Add LICENSE

v1.0.2

  • πŸ“ Add "Get Your Cloudflare Api Key"-Section to README

v1.0.1

  • ✨ Add sync Function -> changes the IP of the configured DNS records on Cloudflare
  • ✨ Add getIp Function -> returns the external IP
  • πŸ“ Add README

About

A simple package to update DNS records on Cloudflare whenever you want.

https://cds.knaup.pw/

License:ISC License


Languages

Language:JavaScript 100.0%