Coder Social home page Coder Social logo

sx5486510 / cloudflare-ddns-sync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from steffenkn/cloudflare-ddns-sync

0.0 1.0 0.0 28 KB

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

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

License: ISC License

JavaScript 100.00%

cloudflare-ddns-sync's Introduction

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"  : "[email protected]",
    "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

cloudflare-ddns-sync's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.