Coder Social home page Coder Social logo

charliexp / ddns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from newfuture/ddns

0.0 1.0 0.0 50 KB

:triangular_flag_on_post: 自动更新DNS解析到本机IP(支持dnspod,AliDNS和DNSCOM)

License: MIT License

Batchfile 2.00% Python 97.06% Shell 0.94%

ddns's Introduction

DDNS

自动更新DNS解析 到本机IP地址,支持 ipv4和ipv6 以 本地(内网)IP 和 公网IP。 代理模式,支持自动创建域名记录。

功能

  • 多个域名支持
  • 多级域名解析
  • 内网IP
  • 公网IP
  • ipv6支持
  • 代理模式(http代理)
  • 定时任务
  • 自动创建记录
  • 多系统(Widnows, Linux, MacOS)
  • 兼容 python2 和 python3 或无python环境
  • 多厂商兼容支持:
  • 正则选取支持(@rufengsuixing)

TODO:

  • 文件缓存(减少服务器IP请求)
  • 二进制打包
  • 腾讯云
  • 同线路多记录支持
  • socks代理
  • 多代理自动切换
  • 简化混合配置

使用

1.下载

  • 二进制版(无需python环境,preview)
  • 源码运行(需要python环境)
    1. clone 或者下载此仓库并解压
    2. 运行./run.py (widnows 双击run.bat或者运行python run.py)
  • 历史版本

2.快速配置

  1. 复制 example.config.jsonconfig.json

  2. 申请 api token:

  3. 修改配置,ipv4ipv6字段,无则设为[],详细参照配置说明

配置

config.json

可以使用 -c使用指定的配置文件 (默认读取当前目录的 config.json)

python run.py -c /path/to/config.json 

配置说明

key type required default comment
id string Yes api授权id
token string Yes api授权token
dns string No dnspod dns服务商,阿里为alidns,DNS.COM为dnscom,DNSPOD国际版为(dnspod_com)
ipv4 array No [] ipv4 域名列表
ipv6 array No [] ipv6 域名列表
index4 string/int No 'default' ipv4获取方式
index6 string/int No 'default' ipv6获取方式
proxy string No 多个代理;分割,DIRECT表示直连,从第一个代理尝试
debug boolean No false 是否开启调试(输出调试信息)

index4和index6参数说明

  • 数字(0,1,2,3等)第i个网卡ip
  • 正则表达(如192.*) 提取ifconfig/ipconfig中与之匹配的首个IP地址,注意json转义(\要写成\\)
    • 192.*表示192开头的所有ip
    • 如果想匹配10.00.xxxx应该写成10\\.00\\..*(\\json转义成\)
  • default 系统访问外网默认IP
  • public使用公网ip(使用公网API查询)
  • nku NKU网关ip(只支持ipv4)

配置示例

{
	"id": "12345",
	"token": "mythokenkey",
	"dns": "dnspod 或者 dnspod_com 或者 alidns 或者 dnscom",
	"ipv4": [
		"dns.newfuture.xyz",
		"ipv4.dns.newfuture.xyz"
	],
	"ipv6": [
		"dns.newfuture.xyz",
		"ipv6.dns.newfuture.xyz"
	],
	"index4": "0",
	"index6": "public",
	"proxy": "127.0.0.1:1111",
	"debug": false
}

定时任务 (暂时需要源码)

可以通过脚本方便的设置定时任务(默认没5分钟检查一次ip变化,自动更新)

windows

需要已经安装python

  • 以当前用户身份运行定时任务,双击或者运行task.bat (执行时会闪黑框)
  • 以系统身份运行定时任务,右键"以管理员身份运行"task.bat(或者在管理员命令行中运行)

linux

运行 sudo ./task.sh

ddns's People

Contributors

newfuture avatar yhx5768 avatar

Watchers

James Cloos 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.