Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

do-dns-update

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

do-dns-update

Update a dns record through the DigitalOcean API

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

do-dns-update

Update a dns record through the DigitalOcean API.

Personally im using it to make sure that my gaming server that is sitting behind a dynamic IP got a working subdomain pointing to it :)

Installation

npm install do-dns-update

Example code

As simple as it gets, you won't really know if the change went through or not. Check out the return object below the example code.


const api_key = 'bd17aec......ec8'; // API key from Digital Ocean (https://cloud.digitalocean.com/account/api/)
const Updater = require('do-dns-update');

(async () => {

    try {
        const updater = new Updater(api_key);
        await updater.setIP('game', 'example.com'); //Sets the ip of game.example.com to your currently external resolved IP.

    } catch (error) {
        console.log(error);
    }

})();

setIP() returns an object that you can access to figure out if the change went through or not.

{
  success: true/false
  subdomain: affected subdomain with domain.
  ip: the ip that got set
  message: short message, could be that an update was done, failed or didnt run because it is already pointing to the same ip.
}

Available methods

setIP(subdomain, domain, ip=null, debug=false)

Sets the IP for a specific subdomain, will default to resolving your current external IP if none is supplied.
(using ipinfo.io as resolver).
@param {string}     subdomain       - The record/subdomain we want to set IP on.
@param {string}     domain          - The domain we want to set IP on.
@param {string}     [ip=null]       - Optional IP to set if you what to use a specific IP and not your current external IP.
@param {boolean}    [debug=false]   - Optional boolean to display some console logs.

Keywords

FAQs

Package last updated on 29 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc