GithubHelp home page GithubHelp logo

xinde / ddns-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeessy2/ddns-go

0.0 0.0 0.0 24.17 MB

Simple and easy to use DDNS. Support Aliyun, Tencent Cloud, Dnspod, Cloudflare, Callback, Huawei Cloud, Baidu Cloud, Porkbun, GoDaddy, Namecheap, NameSilo...

License: MIT License

JavaScript 7.76% Go 72.79% CSS 2.25% Makefile 0.36% HTML 16.61% Dockerfile 0.23%

ddns-go's Introduction

ddns-go

GitHub release GitHub release downloads Go version

中文 | English

自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应的域名服务。

特性

  • 支持Mac、Windows、Linux系统,支持ARM、x86架构
  • 支持的域名服务商 阿里云 腾讯云 Dnspod Cloudflare 华为云 Callback 百度云 Porkbun GoDaddy Namecheap NameSilo Dynadot
  • 支持接口/网卡/命令获取IP
  • 支持以服务的方式运行
  • 默认间隔5分钟同步一次
  • 支持同时配置多个DNS服务商
  • 支持多个域名同时解析
  • 支持多级域名
  • 网页中配置,简单又方便,默认勾选禁止从公网访问
  • 网页中方便快速查看最近50条日志
  • 支持Webhook通知
  • 支持TTL
  • 支持部分DNS服务商传递自定义参数,实现地域解析/多IP等功能

Note

建议在启用公网访问时,使用 Nginx 等反向代理软件启用 HTTPS 访问,以保证安全性。FAQ

系统中使用

  • Releases 下载并解压 ddns-go

  • 安装服务

    • Mac/Linux: sudo ./ddns-go -s install
    • Win(以管理员打开cmd): .\ddns-go.exe -s install
  • [可选] 服务卸载

    • Mac/Linux: sudo ./ddns-go -s uninstall
    • Win(以管理员打开cmd): .\ddns-go.exe -s uninstall
  • [可选] 支持安装带参数

    • -l 监听地址
    • -f 同步间隔时间(秒)
    • -cacheTimes 间隔N次与服务商比对
    • -c 自定义配置文件路径
    • -noweb 不启动web服务
    • -skipVerify 跳过证书验证
    • -dns 自定义 DNS 服务器
  • [可选] 参考示例

    • 10分钟同步一次, 并指定了配置文件地址
      ./ddns-go -s install -f 600 -c /Users/name/.ddns_go_config.yaml
    • 每 10 秒检查一次本地 IP 变化, 每 30 分钟对比一下 IP 变化, 实现 IP 变化即时触发更新且不会被服务商限流, 如果使用接口获取IP, 需要注意接口限流
      ./ddns-go -s install -f 10 -cacheTimes 180
  • [可选] 使用 Homebrew 安装 ddns-go

    brew install ddns-go

Docker中使用

  • 挂载主机目录, 使用docker host模式。可把 /opt/ddns-go 替换为你主机任意目录, 配置文件为隐藏文件

    docker run -d --name ddns-go --restart=always --net=host -v /opt/ddns-go:/root jeessy/ddns-go
  • 在浏览器中打开http://主机IP:9876,并修改你的配置

  • [可选] 使用 ghcr.io 镜像

    docker run -d --name ddns-go --restart=always --net=host -v /opt/ddns-go:/root ghcr.io/jeessy2/ddns-go
  • [可选] 支持启动带参数 -l监听地址 -f间隔时间(秒)

    docker run -d --name ddns-go --restart=always --net=host -v /opt/ddns-go:/root jeessy/ddns-go -l :9877 -f 600
  • [可选] 不使用docker host模式

    docker run -d --name ddns-go --restart=always -p 9876:9876 -v /opt/ddns-go:/root jeessy/ddns-go

使用IPv6

  • 前提:你的电脑或终端能正常获取IPv6,并能正常访问IPv6
  • Windows/Mac:推荐 系统中使用,Windows/Mac桌面版的docker不支持--net=host
  • 群晖:
    • 套件中心下载docker并打开
    • 注册表中搜索ddns-go并下载
    • 映像 -> 选择jeessy/ddns-go -> 启动 -> 高级设置 -> 网络中勾选使用与 Docker Host 相同的网络,高级设置中勾选启动自动重新启动
    • 在浏览器中打开http://群晖IP:9876,修改你的配置,成功
  • Linux的x86或arm架构,推荐使用Docker的--net=host模式。参考 Docker中使用
  • 虚拟机中使用有可能正常获取IPv6,但不能正常访问IPv6

Webhook

  • 支持webhook, 域名更新成功或不成功时, 会回调填写的URL

  • 支持的变量

    变量名 说明
    #{ipv4Addr} 新的IPv4地址
    #{ipv4Result} IPv4地址更新结果: 未改变 失败 成功
    #{ipv4Domains} IPv4的域名,多个以,分割
    #{ipv6Addr} 新的IPv6地址
    #{ipv6Result} IPv6地址更新结果: 未改变 失败 成功
    #{ipv6Domains} IPv6的域名,多个以,分割
  • 如 RequestBody 为空则为 GET 请求,否则为 POST 请求

  • Server酱
    https://sctapi.ftqq.com/[SendKey].send?title=你的公网IP变了&desp=主人IPv4变了#{ipv4Addr},域名更新结果:#{ipv4Result}
    
  • Bark
    https://api.day.app/[YOUR_KEY]/主人IPv4变了#{ipv4Addr},域名更新结果:#{ipv4Result}
    
  • 钉钉
    • 钉钉电脑端 -> 群设置 -> 智能群助手 -> 添加机器人 -> 自定义
    • 只勾选 自定义关键词, 输入的关键字必须包含在RequestBody的content中, 如:你的公网IP变了
    • URL中输入钉钉给你的 Webhook地址
    • RequestBody中输入
      {
          "msgtype": "markdown",
          "markdown": {
              "title": "你的公网IP变了",
              "text": "#### 你的公网IP变了 \n - IPv4地址:#{ipv4Addr} \n - 域名更新结果:#{ipv4Result} \n"
          }
      }
  • 飞书
    • 飞书电脑端 -> 群设置 -> 添加机器人 -> 自定义机器人
    • 安全设置只勾选 自定义关键词, 输入的关键字必须包含在RequestBody的content中, 如:你的公网IP变了
    • URL中输入飞书给你的 Webhook地址
    • RequestBody中输入
      {
          "msg_type": "post",
          "content": {
              "post": {
                  "zh_cn": {
                      "title": "你的公网IP变了",
                      "content": [
                          [
                              {
                                  "tag": "text",
                                  "text": "IPv4地址:#{ipv4Addr}"
                              }
                          ],
                          [
                              {
                                  "tag": "text",
                                  "text": "域名更新结果:#{ipv4Result}"
                              }
                          ]
                      ]
                  }
              }
          }
      }
  • Telegram

    ddns-telegram-bot

  • plusplus 推送加
    • 获取token
    • URL中输入 https://www.pushplus.plus/send
    • RequestBody中输入
      {
          "token": "your token",
          "title": "你的公网IP变了",
          "content": "你的公网IP变了 \n - IPv4地址:#{ipv4Addr} \n - 域名更新结果:#{ipv4Result} \n"
      }
  • Discord
    • Discord任意客户端 -> 伺服器 -> 频道设置 -> 整合 -> 查看Webhook -> 新Webhook -> 复制Webhook网址
    • URL中输入Discord复制的 Webhook网址
    • RequestBody中输入
      {
          "content": "域名 #{ipv4Domains} 动态解析 #{ipv4Result}.",
          "embeds": [
              {
                  "description": "#{ipv4Domains} 的动态解析 #{ipv4Result}, IP: #{ipv4Addr}",
                  "color": 15258703,
                  "author": {
                      "name": "DDNS"
                  },
                  "footer": {
                      "text": "DDNS #{ipv4Result}"
                  }
              }
          ]
      }
  • 查看更多Webhook配置参考

Callback

  • 通过自定义回调可支持更多的第三方DNS服务商

  • 配置的域名有几行, 就会回调几次

  • 支持的变量

    变量名 说明
    #{ip} 新的IPv4/IPv6地址
    #{domain} 当前域名
    #{recordType} 记录类型 AAAAA
    #{ttl} TTL
  • 如 RequestBody 为空则为 GET 请求,否则为 POST 请求

  • Callback配置参考

界面

screenshots

开发&自行编译

  • 如果喜欢从源代码编译自己的版本,可以使用本项目提供的 Makefile 构建
  • 使用 make build 生成本地编译后的 ddns-go 可执行文件
  • 使用 make build_docker_image 自行编译 Docker 镜像

ddns-go's People

Contributors

jeessy2 avatar waterlemons2k avatar dependabot[bot] avatar yin1999 avatar rektyfikowany avatar pairzhu avatar liuzhonghao avatar feranwq avatar ldsink avatar itzmiracleowo avatar yangerstars avatar winterbokeh avatar catofes avatar oldweipro avatar wobuxie1997 avatar mingcheng avatar dezhishen avatar yyxida avatar ngc7331 avatar xiyaowong avatar luckyboy avatar labulac avatar klzwii avatar hlskysong avatar buffge avatar redstone1024 avatar fangzhengjin avatar aheadlead avatar summonhim avatar fengyanlin 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.