开源:GoDNS - 为动态IP VPS/NAT VPS部署固定域名

GoDNS是一个来自 [email protected] 的开源动态DNS(DDNS)客户端工具,可利用 DNSPod 和 dns.he.net,为动态IP VPS/NAT VPS部署固定域名。

godns.png

项目地址:https://github.com/TimothyYe/godns

DNSPod:https://www.dnspod.cn/

HE.net(Hurricane Electric):https://dns.he.net/

支持Linux、ARM Linux(Raspberry Pi, etc...)、Windows、MacOS等各种系统。

01.下载GoDNS

可通过 git clone 获取并安装:

git clone https://github.com/timothyye/godns.git
cd cmd/godns
go get -v
go build

也可通过 releases 从已发行版本中下载:

wget --no-check-certificate https://github.com/TimothyYe/godns/releases/download/V1.5.2/godns-linux64-1.5.2.tar.gz
tar -xvf godns-linux64-1.5.2.tar.gz

02.下载配置文件

从Github下载 config_sample.json 配置文件:

wget --no-check-certificate https://github.com/timothyye/godns/blob/master/config_sample.json
mv config_sample.json config.json

03.修改配置文件

适用于DNSPod的配置信息:

{
  "provider": "DNSPod",
  "email": "[email protected]",
  "password": "YourPassword",
  "login_token": "",
  "domains": [{
      "domain_name": "example.com",
      "sub_domains": ["www","test"]
    },{
      "domain_name": "example2.com",
      "sub_domains": ["www","test"]
    }
  ],
  "ip_url": "http://members.3322.org/dyndns/getip",
  "log_path": "./godns.log",
  "socks5_proxy": ""
}

修改项如下:

"email": "[email protected]", #将[email protected]修改为DNSPod注册账户邮箱
"password": "YourPassword", #将YourPassword修改为DNSPod账户密码
"domain_name": "example.com", #将example.com修改为主根名
"sub_domains": ["www","test"] #将www、test修改为二级域名,可以只设置一个

适用于HE.net的配置信息:

{
  "provider": "HE",
  "email": "",
  "password": "YourPassword",
  "login_token": "",
  "domains": [{
      "domain_name": "example.com",
      "sub_domains": ["www","test"]
    },{
      "domain_name": "example2.com",
      "sub_domains": ["www","test"]
    }
  ],
  "ip_url": "http://members.3322.org/dyndns/getip",
  "log_path":"/users/timothy/workspace/src/godns/godns.log",
  "socks5_proxy": ""
}

基本同上,修改项如下:

"email": "", #将其值修改为dns.he.net注册邮箱
"password": "YourPassword", #将YourPassword修改为创建的动态域名key
"domain_name": "example.com", #将example.com修改为主根名
"sub_domains": ["www","test"] #将www、test修改为二级域名,可以只设置一个

04.DDNS配置

HE.net DDNS配置,在dns.he.net处添加A记录,输入Name值、IPv4值,TTL选择5分钟,勾中 Enable entry for dynamic dns 后Submit提交:

he1.png

填写自己的DDNS密钥或生成随机DDNS密钥:

he2.png

此处的 DDNS key 将用于配置 config.json 中的密码。

DNSPod DDNS配置相对比较简单,域名解析好,然后修改配置文件即可。

05.运行GoDNS

请浏览项目页面:https://github.com/TimothyYe/godns

猜您喜欢

发表评论

icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif