Socket
Socket
Sign inDemoInstall

yandex-pdd-dns

Package Overview
Dependencies
51
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yandex-pdd-dns

Yandex PDD DNS API


Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Install size
4.04 MB
Created
Weekly downloads
 

Readme

Source

yandex-pdd-dns

Installation

yandex-pdd-dns can be installed using npm:

npm install yandex-pdd-dns

CLI Usage

Example:

./node_modules/.bin/yandex-pdd-dns list --domain example.com --token d508b88981b8511f8b5051dc631451cd4b000db8d854b1c9d4b4b918

DynDNS usage:

./node_modules/.bin/yandex-pdd-dns dyndns --domain example.com --token d508b88981b8511f8b5051dc631451cd4b000db8d854b1c9d4b4b918 --subdomain local

API Usage

Example:

var dns = require('yandex-pdd-dns');
var Domain = dns.Domain;
var Api = dns.Api;

var domain = new Domain(new Api(
    'example.com',
    'd508b88981b8511f8b5051dc631451cd4b000db8d854b1c9d4b4b918'
));

var ip = '127.0.0.1';
var subdomain = 'local';

domain.getRecords().then(function (records) {
    var foundRecord;
    records.forEach(function (record) {
        if (record.getType() === 'A' && record.getSubdomain() === subdomain) {
            foundRecord = record;
        }
    });
    if (foundRecord) {
        if (foundRecord.getContent() !== ip) {
            foundRecord.setContent(ip);
            return domain.updateRecord(foundRecord).then(function () {
                console.log('DNS Record was updated');
            });
        } else {
            console.log('DNS Record is up to date');
        }
    } else {
        return domain.addRecord(DomainRecord.fromJSON({
            type: 'A',
            subdomain: subdomain,
            content: ip
        })).then(function () {
            console.log('DNS Record was added');
        });
    }
});

FAQs

Last updated on 03 Jul 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc