npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wm-ddns

v2.6.4

Published

简单的 DNS 修改 Record 的包。 [https://DNSpod.cn](https://DNSpod.cn)。支持 callback & Promise & async/await。

Downloads

38

Readme

简单的 DNS 修改 Record 的包。 https://DNSpod.cn。支持 callback & Promise & async/await。

用法

const DDNS = require('wm-ddns');
const domain = new DDNS('email', 'passwd', 'domain.com'); // 旧版本鉴权
const newDomain = new DDNS('domain.com', { loginToken: '', loginId: '' });

目前 DNSpod 已经不推荐用账户密码进行鉴权,而是申请一套鉴权。

鉴权包含 token 和 id 两部分。 token 只有在申请成功显示一次。

Domain 对象

domai 对象

Examples:

const DDns = require('wm-ddns');
const domain = new DDns('email', 'passwd', 'domain.com');

domain.create("@", "A", '127.0.0.1', function(err, record) {
	// ..
});

domain.createRecord(subDomain, recordType, value, [options], callback)

create record

  • subDomain sub-domain, default @
  • recordType record type.like A, CANME
  • value record value.
  • options optional params
    • MX
    • recordLine default 默认
    • recordLineId
    • ttl
    • status
    • weight
  • callback
    • err
    • record record object

domain.recordList([offset, length], callback)

get records by page

  • offset default 0
  • length defualt 300
  • callback
    • err err
    • record-list records list

domain.recordByName(subDomain, callback, json)

get record by name

  • subDomain sub-domain
  • callback
    • err
    • record record object
  • json default false.if true, callback json.

domain.recordById(recordId, callback, json)

get record by record id

  • recordId record id
  • callback
    • err
    • record record object
  • json default false.if value is true, it will callback a json.

domain.recordByKeyword(keyword, [offset, length], callback)

get record by keyword.

  • keyword keyword
  • callback
    • err
    • record record object
  • json default false.if true, callback json.
  • callback
    • err
    • record record object

domain.updateRecord(recordId, subDomain, value, [options, ]callback)

update record by recordId

  • recordId recordId
  • subDomain subDomain
  • value value
  • options
    • mx
    • recordLine default 默认
    • recordLineId
    • ttl
    • status
    • weight
  • callback
    • err
    • record record object

domain.updateRecordByName(subDomain, recordType, value, [options, ]callback)

update record by subDomain

  • subDomain subDomain
  • value value
  • options
    • mx
    • recordLine default 默认
    • recordLineId
    • ttl
    • status
    • weight
  • callback
    • err
    • record record object

domain.removeRecord(recordId, callback)

remove record

  • recordId recordId

domain.ddns(value, callback)

  • value value
  • callback
    • err
    • record record object

domain.remark(remark, callback)

  • remark remark value
  • callback
    • err
    • record record object

domain.setStatus(status, callback)

  • status status value
  • callback
    • err
    • record record object

Record

DNS record

DNS 记录

record.toJSON()

convert record object to json object;

record.clone(record)

clone record from another record

record.update(subDomain, recordType, value, options, callback)

update record info

  • subDomain subDomain
  • recordType A, CNAME, etc.
  • value value
  • options
    • mx
    • recordLine default 默认
    • recordLineId
    • ttl
    • status
    • weight
  • callback
    • err
    • record record object

record.setDns(value, callback)

update record dns

  • value value
  • callback
    • err
    • record record object

record.ddns(callback)

set value by local public ip. get ip by domain.getIP().

  • callback
    • err
    • record record object

record.setRemark(remark, callback)

set remark.

  • remark remark
  • callback
    • err
    • record record object

record.setStatus(status, callback)

set status.

  • status status
  • callback
    • err
    • record record object

Promise & async/await

支持 promise

通过 util.promiseify() 转换

const DDNS = require('wm-ddns').Domain;
const domain = new DDNS('email', 'passwd', 'domain.com'); // 旧版本鉴权
const newDomain = new DDNS('domain.com', { loginToken: '', loginId: '' }); //新版本鉴权

async done() {
    const record = await domain.createRecord('name', 'type', 'value');
    await domain.removeRecord(record.id);
}

done();