Code Monkey home page Code Monkey logo

dnspod-ddns-node-lite's Introduction

dnspod-ddns-node-lite

用来设定 dnspod 动态域名的微型 node 脚本

说明

只有一个文件 ddns.js ;只实现一个功能,向 dnspod 的动态域名接口发送一个请求,更新相应的域名解析信息。

设置

替换脚本中用星号占位的内容:

  • login_email 你登录 dnspod 使用的邮箱
  • login_password 你登录 dnspod 使用的密码
  • domain_id 域名 id
  • record_id 记录 id
  • sub_domain 子域名

获取 domain_id , record_idsub_domain 的方法:

方法一,通过浏览器的开发者工具

登录 dnspod ,进入相应域名的管理界面,编辑你想设置动态域名的那个条目

编辑条目

打开浏览器的开发者工具(现在的浏览器多数有类似功能,此处以 Chrome 为例),然后点击上图中的保存按钮,你会在网络页卡看到一条新的记录

请求记录

点击这条记录打开它的详情,在 header 页卡里

请求头

你能找到 domain_id , record_idsub_domain

方法二,使用 curl 访问 dnspod 的接口 (此方法来自 https://gist.github.com/chuangbo/833369)

获得 domain_id

curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得 record_id

curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&login_password=xxx&domain_id=xxx"

使用

执行下面的命令可以立刻更新一次域名信息

./ddns.js

如果需要定时执行,可以写入 crontab ,下面是每 10 分钟执行一次的示例

*/10 * * * * /path/of/ddns.js

Released under the MIT license

dnspod-ddns-node-lite's People

Contributors

xiongliding avatar

Watchers

johncan 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.