ddns 4.0.2__py2.py3-none-any.whl → 4.1.0b1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ddns might be problematic. Click here for more details.

ddns/util/ip.py CHANGED
@@ -4,16 +4,17 @@ from re import compile
4
4
  from os import name as os_name, popen
5
5
  from socket import socket, getaddrinfo, gethostname, AF_INET, AF_INET6, SOCK_DGRAM
6
6
  from logging import debug, error
7
+
7
8
  try: # python3
8
9
  from urllib.request import urlopen, Request
9
10
  except ImportError: # python2
10
- from urllib2 import urlopen, Request
11
+ from urllib2 import urlopen, Request # type: ignore[import-untyped] # noqa: F401
11
12
 
12
13
  # IPV4正则
13
- IPV4_REG = r'((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])'
14
+ IPV4_REG = r"((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
14
15
  # IPV6正则
15
16
  # https://community.helpsystems.com/forums/intermapper/miscellaneous-topics/5acc4fcf-fa83-e511-80cf-0050568460e4
16
- IPV6_REG = r'((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))' # noqa: E501
17
+ IPV6_REG = r"((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))" # noqa: E501
17
18
 
18
19
 
19
20
  def default_v4(): # 默认连接外网的ipv4
@@ -26,7 +27,7 @@ def default_v4(): # 默认连接外网的ipv4
26
27
 
27
28
  def default_v6(): # 默认连接外网的ipv6
28
29
  s = socket(AF_INET6, SOCK_DGRAM)
29
- s.connect(('1:1:1:1:1:1:1:1', 8))
30
+ s.connect(("1:1:1:1:1:1:1:1", 8))
30
31
  ip = s.getsockname()[0]
31
32
  s.close()
32
33
  return ip
@@ -47,10 +48,12 @@ def local_v4(i=0): # 本地ipv4地址
47
48
  def _open(url, reg):
48
49
  try:
49
50
  debug("open: %s", url)
50
- res = urlopen(
51
- Request(url, headers={'User-Agent': 'Mozilla/5.0 ddns'}), timeout=60
52
- ).read().decode('utf8', 'ignore')
53
- debug("response: %s", res)
51
+ res = (
52
+ urlopen(Request(url, headers={"User-Agent": "Mozilla/5.0 ddns"}), timeout=60)
53
+ .read()
54
+ .decode("utf8", "ignore")
55
+ )
56
+ debug("response: %s", res)
54
57
  return compile(reg).search(res).group()
55
58
  except Exception as e:
56
59
  error(e)
@@ -69,10 +72,10 @@ def _ip_regex_match(parrent_regex, match_regex):
69
72
  ip_pattern = compile(parrent_regex)
70
73
  matcher = compile(match_regex)
71
74
 
72
- if os_name == 'nt': # windows:
73
- cmd = 'ipconfig'
75
+ if os_name == "nt": # windows:
76
+ cmd = "ipconfig"
74
77
  else:
75
- cmd = 'ip address || ifconfig 2>/dev/null'
78
+ cmd = "ip address || ifconfig 2>/dev/null"
76
79
 
77
80
  for s in popen(cmd).readlines():
78
81
  addr = ip_pattern.search(s)
@@ -81,16 +84,16 @@ def _ip_regex_match(parrent_regex, match_regex):
81
84
 
82
85
 
83
86
  def regex_v4(reg): # ipv4 正则提取
84
- if os_name == 'nt': # Windows: IPv4 xxx: 192.168.1.2
85
- regex_str = r'IPv4 .*: ((?:\d{1,3}\.){3}\d{1,3})\W'
87
+ if os_name == "nt": # Windows: IPv4 xxx: 192.168.1.2
88
+ regex_str = r"IPv4 .*: ((?:\d{1,3}\.){3}\d{1,3})\W"
86
89
  else:
87
- regex_str = r'inet (?:addr\:)?((?:\d{1,3}\.){3}\d{1,3})[\s/]'
90
+ regex_str = r"inet (?:addr\:)?((?:\d{1,3}\.){3}\d{1,3})[\s/]"
88
91
  return _ip_regex_match(regex_str, reg)
89
92
 
90
93
 
91
94
  def regex_v6(reg): # ipv6 正则提取
92
- if os_name == 'nt': # Windows: IPv4 xxx: ::1
93
- regex_str = r'IPv6 .*: ([\:\dabcdef]*)?\W'
95
+ if os_name == "nt": # Windows: IPv4 xxx: ::1
96
+ regex_str = r"IPv6 .*: ([\:\dabcdef]*)?\W"
94
97
  else:
95
- regex_str = r'inet6 (?:addr\:\s*)?([\:\dabcdef]*)?[\s/%]'
98
+ regex_str = r"inet6 (?:addr\:\s*)?([\:\dabcdef]*)?[\s/%]"
96
99
  return _ip_regex_match(regex_str, reg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddns
3
- Version: 4.0.2
3
+ Version: 4.1.0b1
4
4
  Summary: Dynamic DNS client for multiple providers, supporting IPv4 and IPv6.
5
5
  Author-email: NewFuture <python@newfuture.cc>
6
6
  License-Expression: MIT
@@ -36,6 +36,11 @@ License-File: LICENSE
36
36
  Provides-Extra: dev
37
37
  Requires-Dist: black; extra == "dev"
38
38
  Requires-Dist: flake8; extra == "dev"
39
+ Requires-Dist: mock; python_version < "3.3" and extra == "dev"
40
+ Provides-Extra: pytest
41
+ Requires-Dist: pytest>=6.0; extra == "pytest"
42
+ Requires-Dist: pytest-cov; extra == "pytest"
43
+ Requires-Dist: mock; python_version < "3.3" and extra == "pytest"
39
44
  Dynamic: license-file
40
45
 
41
46
  # [<img src="https://ddns.newfuture.cc/doc/img/ddns.svg" width="32px" height="32px"/>](https://ddns.newfuture.cc) [DDNS](https://github.com/NewFuture/DDNS)
@@ -62,6 +67,7 @@ Dynamic: license-file
62
67
  - [命令行参数](https://ddns.newfuture.cc/doc/cli.html)
63
68
  - [JSON 配置文件](https://ddns.newfuture.cc/doc/json.html)
64
69
  - [环境变量配置](https://ddns.newfuture.cc/doc/env.html)
70
+ - [服务商配置指南](https://ddns.newfuture.cc/doc/providers/)
65
71
 
66
72
  - 域名支持:
67
73
  - 多个域名支持
@@ -76,16 +82,21 @@ Dynamic: license-file
76
82
  - http 代理支持
77
83
  - 多代理自动切换
78
84
  - 服务商支持:
79
- - [DNSPOD](https://www.dnspod.cn/)
80
- - [阿里 DNS](http://www.alidns.com/)
85
+ - [DNSPOD](https://www.dnspod.cn/) ([配置指南](doc/providers/dnspod.md))
86
+ - [阿里 DNS](http://www.alidns.com/) ([配置指南](doc/providers/alidns.md)) ⚡
81
87
  - [DNS.COM](https://www.dns.com/) (@loftor-git)
82
88
  - [DNSPOD 国际版](https://www.dnspod.com/)
83
89
  - [CloudFlare](https://www.cloudflare.com/) (@tongyifan)
84
90
  - [HE.net](https://dns.he.net/) (@NN708) (不支持自动创建记录)
85
- - [华为云](https://huaweicloud.com/) (@cybmp3)
91
+ - [华为云](https://huaweicloud.com/) (@cybmp3)
92
+ - [腾讯云](https://cloud.tencent.com/) ([配置指南](doc/providers/tencentcloud.md)) ⚡
93
+ - 自定义回调 API ([配置指南](doc/providers/callback.md))
94
+
95
+ > ⚡ 标记的服务商使用高级 HMAC-SHA256 签名认证,提供企业级安全保障
86
96
  - 其他:
87
97
  - 可设置定时任务
88
98
  - TTL 配置支持
99
+ - DNS 线路(运营商)配置支持(国内服务商)
89
100
  - 本地文件缓存(减少 API 请求)
90
101
  - 地址变更时触发自定义回调 API(与 DDNS 功能互斥)
91
102
 
@@ -97,60 +108,66 @@ Dynamic: license-file
97
108
 
98
109
  推荐 Docker 版,兼容性最佳,体积小,性能优化。
99
110
 
100
- - #### pip 安装(需要 pip 或 easy_install
111
+ - #### Docker(需要安装 Docker
101
112
 
102
- 1. 安装 ddns: `pip install ddns` 或 `easy_install ddns`
103
- 2. 运行: `ddns`
113
+ 详细说明和高级用法请查看 [Docker 使用文档](https://ddns.newfuture.cc/doc/docker.html)
104
114
 
105
- - #### 二进制版(单文件,无需 python)
115
+ <details>
116
+ <summary markdown="span">支持命令行,配置文件,和环境变量传参</summary>
106
117
 
107
- - Windows [ddns.exe](https://github.com/NewFuture/DDNS/releases/latest)
108
- - Linux(仅 Ubuntu 测试) [ddns](https://github.com/NewFuture/DDNS/releases/latest)
109
- - Mac OSX [ddns-mac](https://github.com/NewFuture/DDNS/releases/latest)
118
+ - 命令行cli
110
119
 
111
- - #### 源码运行(无任何依赖,需 python 环境)
120
+ ```sh
121
+ docker run newfuture/ddns -h
122
+ ```
112
123
 
113
- 1. clone 或者 [下载此仓库](https://github.com/NewFuture/DDNS/archive/master.zip) 并解压
114
- 2. 运行 ./run.py(windows 双击 `run.bat` 或者运行 `python run.py`)
124
+ - 使用配置文件(docker 工作目录 `/ddns/`,默认配置位置 `/ddns/config.json`):
115
125
 
116
- - #### Docker(需要安装 Docker)
126
+ ```sh
127
+ docker run -d -v /host/config/:/ddns/ --network host newfuture/ddns
128
+ ```
117
129
 
118
130
  - 使用环境变量:
119
131
 
120
- ```sh
121
- docker run -d \
122
- -e DDNS_DNS=dnspod \
123
- -e DDNS_ID=12345 \
124
- -e DDNS_TOKEN=mytokenkey \
125
- -e DDNS_IPV4=ddns.newfuture.cc \
126
- -e DDNS_IPV6=ddns.newfuture.cc \
127
- --network host \
128
- newfuture/ddns
129
- ```
132
+ ```sh
133
+ docker run -d \
134
+ -e DDNS_DNS=dnspod \
135
+ -e DDNS_ID=12345 \
136
+ -e DDNS_TOKEN=mytokenkey \
137
+ -e DDNS_IPV4=ddns.newfuture.cc \
138
+ --network host \
139
+ newfuture/ddns
140
+ ```
130
141
 
131
- - 使用配置文件(docker 工作目录 `/ddns/`,默认配置位置 `/ddns/config.json`):
142
+ </details>
143
+
144
+ - #### pip 安装(需要 pip 或 easy_install)
145
+
146
+ 1. 安装 ddns: `pip install ddns` 或 `easy_install ddns`
147
+ 2. 运行: `ddns -h` 或者 `python -m ddns`
148
+
149
+ - #### 二进制版(单文件,无需 python)
132
150
 
133
- ```sh
134
- docker run -d \
135
- -v /local/config/path/:/ddns/ \
136
- --network host \
137
- newfuture/ddns
138
- ```
151
+ 前往[release下载对应版本](https://github.com/NewFuture/DDNS/releases/latest)
139
152
 
140
- 更多详细说明和高级用法请查看 [Docker 使用文档](doc/docker.md)。
153
+ - #### 源码运行(无任何依赖,需 python 环境)
154
+
155
+ 1. clone 或者 [下载此仓库](https://github.com/NewFuture/DDNS/archive/master.zip) 并解压
156
+ 2. 运行 `python run.py` 或者 `python -m ddns`
141
157
 
142
158
  ### ② 快速配置
143
159
 
144
160
  1. 申请 api `token`,填写到对应的 `id` 和 `token` 字段:
145
161
 
146
- - [DNSPOD(国内版)创建 token](https://support.dnspod.cn/Kb/showarticle/tsid/227/)
147
- - [阿里云 accesskey](https://help.aliyun.com/document_detail/87745.htm)
148
- - [DNS.COM API Key/Secret](https://www.dns.com/member/apiSet)
149
- - [DNSPOD(国际版)](https://www.dnspod.com/docs/info.html#get-the-user-token)
150
- - [CloudFlare API Key](https://support.cloudflare.com/hc/en-us/articles/200167836-Where-do-I-find-my-Cloudflare-API-key-)(除了 `email + API KEY`,也可使用 `Token`,需要列出 Zone 权限)
151
- - [HE.net DDNS 文档](https://dns.he.net/docs.html)(仅需将设置的密码填入 `token` 字段,`id` 字段可留空)
152
- - [华为 APIKEY 申请](https://console.huaweicloud.com/iam/)(点左边访问密钥,然后点新增访问密钥)
153
- - 自定义回调的参数填写方式请查看下方的自定义回调配置说明
162
+ - **DNSPOD(中国版)**: [创建 token](https://support.dnspod.cn/Kb/showarticle/tsid/227/) | [详细配置文档](doc/providers/dnspod.md)
163
+ - **阿里云 DNS**: [申请 accesskey](https://help.aliyun.com/document_detail/87745.htm) | [详细配置文档](doc/providers/alidns.md)
164
+ - **DNS.COM**: [API Key/Secret](https://www.dns.com/member/apiSet)
165
+ - **DNSPOD(国际版)**: [获取 token](https://www.dnspod.com/docs/info.html#get-the-user-token)
166
+ - **CloudFlare**: [API Key](https://support.cloudflare.com/hc/en-us/articles/200167836-Where-do-I-find-my-Cloudflare-API-key-)(除了 `email + API KEY`,也可使用 `Token`,**需要list Zone 权限**)
167
+ - **HE.net**: [DDNS 文档](https://dns.he.net/docs.html)(仅需将设置的密码填入 `token` 字段,`id` 字段可留空)
168
+ - **华为云 DNS**: [APIKEY 申请](https://console.huaweicloud.com/iam/)(点左边访问密钥,然后点新增访问密钥)
169
+ - **腾讯云 DNS**: [详细配置文档](doc/providers/tencentcloud.md)
170
+ - **自定义回调**: 参数填写方式请查看下方的自定义回调配置说明
154
171
 
155
172
  2. 修改配置文件,`ipv4` 和 `ipv6` 字段,为待更新的域名,详细参照配置说明
156
173
 
@@ -170,12 +187,13 @@ Dynamic: license-file
170
187
  - **JSON配置文件**:介于命令行和环境变量之间,会覆盖环境变量中的设置
171
188
  - **环境变量**:优先级最低,当其他方式未设置时使用
172
189
 
173
- **特殊情况**:
190
+ **高级用法**:
191
+
174
192
  - JSON配置中明确设为`null`的值会覆盖环境变量设置
175
193
  - `debug`参数只在命令行中有效,JSON配置文件中的同名设置无效
176
194
  - 多值参数(如`ipv4`、`ipv6`等)在命令行中使用方式为重复使用参数,如`--ipv4 domain1 --ipv4 domain2`
177
195
 
178
- 各配置方式的详细说明请查看对应文档:[命令行](doc/cli.md)、[JSON配置](doc/json.md)、[环境变量](doc/env.md)
196
+ 各配置方式的详细说明请查看对应文档:[命令行](doc/cli.md)、[JSON配置](doc/json.md)、[环境变量](doc/env.md)、[服务商配置](doc/providers/)
179
197
 
180
198
  > 📖 **环境变量详细配置**: 查看 [环境变量配置文档](doc/env.md) 了解所有环境变量的详细用法和示例
181
199
 
@@ -189,26 +207,27 @@ Dynamic: license-file
189
207
 
190
208
  ```bash
191
209
  ddns -c path/to/config.json
192
- # 或者源码运行
193
- python run.py -c /path/to/config.json
210
+ # 或者python运行
211
+ python -m ddns -c /path/to/config.json
194
212
  ```
195
213
 
196
214
  #### 配置参数表
197
215
 
198
- | key | type | required | default | description | tips |
199
- | :------: | :----------------: | :------: | :---------: | :---------------: | ----------------------------------------------------------------------------------------------------------- |
200
- | id | string | √ | 无 | api 访问 ID | Cloudflare 为邮箱(使用 Token 时留空)<br>HE.net 可留空<br>华为云为 Access Key ID (AK) |
201
- | token | string | √ | 无 | api 授权 token | 部分平台叫 secret key,**反馈粘贴时删除** |
202
- | dns | string | No | `"dnspod"` | dns 服务商 | 阿里 DNS 为 `alidns`,Cloudflare 为 `cloudflare`,dns.com 为 `dnscom`,DNSPOD 国内为 `dnspod`,DNSPOD 国际为 `dnspod_com`,HE.net 为 `he`,华为云为 `huaweidns`,自定义回调为 `callback` |
203
- | ipv4 | array | No | `[]` | ipv4 域名列表 | 为 `[]` 时,不会获取和更新 IPv4 地址 |
204
- | ipv6 | array | No | `[]` | ipv6 域名列表 | 为 `[]` 时,不会获取和更新 IPv6 地址 |
205
- | index4 | string\|int\|array | No | `"default"` | ipv4 获取方式 | 可设置 `网卡`、`内网`、`公网`、`正则` 等方式 |
206
- | index6 | string\|int\|array | No | `"default"` | ipv6 获取方式 | 可设置 `网卡`、`内网`、`公网`、`正则` 等方式 |
207
- | ttl | number | No | `null` | DNS 解析 TTL 时间 | 不设置采用 DNS 默认策略 |
208
- | proxy | string\|array | No | 无 | http 代理 `;` 分割 | 多代理逐个尝试直到成功,`DIRECT` 为直连 |
209
- | debug | bool | No | `false` | 是否开启调试 | 等同于设置 log.level=DEBUG,仅命令行参数`--debug`有效 |
210
- | cache | string\|bool | No | `true` | 是否缓存记录 | 正常情况打开避免频繁更新,默认位置为临时目录下 `ddns.cache`,也可以指定一个具体路径 |
211
- | log | object | No | `null` | 日志配置(可选) | 日志配置对象,支持`level`、`file`、`format`、`datefmt`参数 |
216
+ | key | type | required | default | description | tips |
217
+ | :----: | :----------------: | :------: | :---------: | :----------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
218
+ | id | string | √ | 无 | api 访问 ID | Cloudflare 为邮箱(使用 Token 时留空)<br>HE.net 可留空<br>华为云为 Access Key ID (AK) |
219
+ | token | string | √ | 无 | api 授权 token | 部分平台叫 secret key,**反馈粘贴时删除** |
220
+ | dns | string | No | `"dnspod"` | dns 服务商 | 阿里 DNS 为 `alidns`,Cloudflare 为 `cloudflare`,dns.com 为 `dnscom`,DNSPOD 国内为 `dnspod`,DNSPOD 国际为 `dnspod_com`,HE.net 为 `he`,华为云为 `huaweidns`,腾讯云为 `tencentcloud`,自定义回调为 `callback`。部分服务商有[详细配置文档](doc/providers/) |
221
+ | ipv4 | array | No | `[]` | ipv4 域名列表 | 为 `[]` 时,不会获取和更新 IPv4 地址 |
222
+ | ipv6 | array | No | `[]` | ipv6 域名列表 | 为 `[]` 时,不会获取和更新 IPv6 地址 |
223
+ | index4 | string\|int\|array | No | `"default"` | ipv4 获取方式 | 可设置 `网卡`、`内网`、`公网`、`正则` 等方式 |
224
+ | index6 | string\|int\|array | No | `"default"` | ipv6 获取方式 | 可设置 `网卡`、`内网`、`公网`、`正则` 等方式 |
225
+ | ttl | number | No | `null` | DNS 解析 TTL 时间 | 不设置采用 DNS 默认策略 |
226
+ | proxy | string\|array | No | 无 | http 代理 `;` 分割 | 多代理逐个尝试直到成功,`DIRECT` 为直连 |
227
+ | ssl | string\|boolean | No | `"auto"` | SSL证书验证方式 | `true`(强制验证)、`false`(禁用验证)、`"auto"`(自动降级)或自定义CA证书文件路径 |
228
+ | debug | bool | No | `false` | 是否开启调试 | 调试模式,仅命令行参数`--debug`有效 |
229
+ | cache | string\|bool | No | `true` | 是否缓存记录 | 正常情况打开避免频繁更新,默认位置为临时目录下 `ddns.cache`,也可以指定一个具体路径 |
230
+ | log | object | No | `null` | 日志配置(可选) | 日志配置对象,支持`level`、`file`、`format`、`datefmt`参数 |
212
231
 
213
232
  #### index4 和 index6 参数说明
214
233
 
@@ -227,16 +246,18 @@ python run.py -c /path/to/config.json
227
246
 
228
247
  #### 自定义回调配置说明
229
248
 
230
- - `id` 字段填写回调地址,以 HTTP 或 HTTPS 开头,推荐采用 HTTPS 方式的回调 API ,当 `token` 字段非空且 URL 参数包含下表所示的常量字符串时,会自动替换为实际内容。
231
- - `token` 字段为 POST 参数,本字段为空或不存在则使用 GET 方式发起回调,回调参数采用 JSON 格式编码,当 JSON 的首层参数值包含下表所示的常量字符串时,会自动替换为实际内容。
249
+ - `id` 字段填写回调地址,以 HTTP 或 HTTPS 开头,推荐采用 HTTPS 方式的回调 API,支持变量替换功能。
250
+ - `token` 字段为 POST 请求参数(JSON对象或JSON字符串),本字段为空或不存在则使用 GET 方式发起回调。当 JSON 的参数值包含下表所示的常量字符串时,会自动替换为实际内容。
232
251
 
233
- | 常量名称 | 常量内容 | 说明 |
234
- | ---------------- | ---------------------- | -------- |
235
- | `__DOMAIN__` | DDNS 域名 | |
236
- | `__RECORDTYPE__` | DDNS 记录类型 | |
237
- | `__TTL__` | DDNS TTL | |
238
- | `__TIMESTAMP__` | 请求发起时间戳 | 包含小数 |
252
+ 详细配置指南请查看:[Callback Provider 配置文档](doc/providers/callback.md)
253
+
254
+ | 常量名称 | 常量内容 | 说明 |
255
+ | ---------------- | ------------------------ | -------- |
256
+ | `__DOMAIN__` | DDNS 域名 | |
239
257
  | `__IP__` | 获取的对应类型的 IP 地址 | |
258
+ | `__RECORDTYPE__` | DDNS 记录类型 | |
259
+ | `__TTL__` | DDNS TTL | |
260
+ | `__TIMESTAMP__` | 请求发起时间戳 | 包含小数 |
240
261
 
241
262
  #### 配置示例
242
263
 
@@ -245,21 +266,21 @@ python run.py -c /path/to/config.json
245
266
  "$schema": "https://ddns.newfuture.cc/schema/v4.0.json",
246
267
  "id": "12345",
247
268
  "token": "mytokenkey",
248
- "dns": "dnspod 或 dnspod_com 或 alidns 或 dnscom 或 cloudflare 或 he 或 huaweidns 或 callback",
269
+ "dns": "dnspod 或 dnspod_com 或 alidns 或 dnscom 或 cloudflare 或 he 或 huaweidns 或 tencentcloud 或 callback",
249
270
  "ipv4": ["ddns.newfuture.cc", "ipv4.ddns.newfuture.cc"],
250
271
  "ipv6": ["ddns.newfuture.cc", "ipv6.ddns.newfuture.cc"],
251
272
  "index4": 0,
252
273
  "index6": "public",
253
274
  "ttl": 600,
254
- "proxy": "127.0.0.1:1080;DIRECT",
275
+ "proxy": ["127.0.0.1:1080", "DIRECT"],
255
276
  "log": {
256
277
  "level": "DEBUG",
257
278
  "file": "dns.log",
258
- "format": "%(asctime)s %(levelname)s [%(module)s]: %(message)s",
259
279
  "datefmt": "%Y-%m-%dT%H:%M:%S"
260
280
  }
261
281
  }
262
282
  ```
283
+
263
284
  </details>
264
285
 
265
286
  ## 定时任务
@@ -275,10 +296,13 @@ python run.py -c /path/to/config.json
275
296
  #### Linux
276
297
 
277
298
  - 使用 init.d 和 crontab:
299
+
278
300
  ```bash
279
301
  sudo ./task.sh
280
302
  ```
303
+
281
304
  - 使用 systemd:
305
+
282
306
  ```bash
283
307
  安装:
284
308
  sudo ./systemd.sh install
@@ -311,6 +335,7 @@ Docker 镜像在无额外参数的情况下,已默认启用每 5 分钟执行
311
335
  - dnspod.cn 打开: <https://dnsapi.cn>
312
336
  - dnspod 国际版: <https://api.dnspod.com>
313
337
  - 华为 DNS <https://dns.myhuaweicloud.com>
338
+
314
339
  </details>
315
340
 
316
341
  <details>
@@ -319,7 +344,7 @@ Docker 镜像在无额外参数的情况下,已默认启用每 5 分钟执行
319
344
  1. 先确认排查是否是系统/网络环境问题
320
345
  2. 在 [issues](https://github.com/NewFuture/DDNS/issues) 中搜索是否有类似问题
321
346
  3. 前两者均无法解决或者确定是 bug,[在此新建 issue](https://github.com/NewFuture/DDNS/issues/new)
322
- - [ ] 开启 debug 配置
347
+ - [ ] 开启 `--debug`
323
348
  - [ ] 附上这些内容 **运行版本和方式**、**系统环境**、**出错日志**、**去掉 id/token** 的配置文件
324
349
  - [ ] 源码运行注明使用的 python 环境
325
350
 
@@ -0,0 +1,26 @@
1
+ ddns/__builtins__.pyi,sha256=QTTtckbWAAZasu-uzeeyK4MLj9S9dxLtRlhty6U01jQ,109
2
+ ddns/__init__.py,sha256=i5Ys0GWwE_VEs9egtGsApbc3O_0ne0MRgaDwumTnCas,510
3
+ ddns/__main__.py,sha256=I3rjSjbB3ogSayiptGoITQx_9r0DGdxcDsbiGXEID-E,7302
4
+ ddns/provider/__init__.py,sha256=P0foc9m2RiiLw6-2JYzNXPShBCGY-G2TIefgdTg-s44,2053
5
+ ddns/provider/_base.py,sha256=ohvDJnwazDMAwciqlV430Ic54cTCrI_5l7IAgKaapWE,24600
6
+ ddns/provider/alidns.py,sha256=tNKG8CmRZaHC2n3bK0cD3MaiANysT1DsO7H7IQpriic,5514
7
+ ddns/provider/callback.py,sha256=XaAu4b4WPcuegPJJBKdQWKY87LPB6BUSRUymPtDPeTc,3006
8
+ ddns/provider/cloudflare.py,sha256=Qon3Pg24Q8mE8qouKwwvaPUAP0JNFJ5N7AakpZAv8JU,4514
9
+ ddns/provider/debug.py,sha256=3TZYcXHcIzTwUEj5_rvZTT0QqS6jFwTuBS7cMujG2tM,587
10
+ ddns/provider/dnscom.py,sha256=nQe8Wi4KTib2Ildf9I2Vz9ZhCd3jkseq9_uZBl-C7P0,3672
11
+ ddns/provider/dnspod.py,sha256=MSeB0ZpPnTD2cOjMsF35j2I9Ur4FLZzcKMio74UkX7E,4553
12
+ ddns/provider/dnspod_com.py,sha256=G291IowdjAnPGGbsL_9CXfMYyFWxz1AYun5TEY0GvbM,393
13
+ ddns/provider/he.py,sha256=gnYZMnsBIvI6ASz1U_tFqnpcUgmobvoOqGOpkWZ9Zew,1835
14
+ ddns/provider/huaweidns.py,sha256=hZVYUMPaZUYxSuG2d5QYvnRsG_xrrwfYeNxuI0LqxQM,5597
15
+ ddns/provider/tencentcloud.py,sha256=10pe-LwhFSTDMepWIKbcea66384bS2NguZVsl19y5k0,7160
16
+ ddns/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ ddns/util/cache.py,sha256=9_QVJzfKxGCysiyE-N46MEKdvXMnco0ZO47vWWOSTPk,4840
18
+ ddns/util/config.py,sha256=S0kNBMe1Ot68lLlv05aP01dFOrM07uh9Zpe5JrKZo3k,10646
19
+ ddns/util/http.py,sha256=v43Fe7RF6sQ-KTudDQXvjtnvpNoM0UaK1zSa0z5rZGo,10101
20
+ ddns/util/ip.py,sha256=-t20yx-McDFpQIrArrzSyetU9lm7irmBtjnxrIfki1w,3909
21
+ ddns-4.1.0b1.dist-info/licenses/LICENSE,sha256=MI-ECjp-Vl7WZLiSPY6r5VwrOReNiICVB1QCXiUGt_s,1111
22
+ ddns-4.1.0b1.dist-info/METADATA,sha256=8BWmyNOJ5HRvxeizMQT6VXjM90eJFZnhz-qjuchleUk,19211
23
+ ddns-4.1.0b1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
24
+ ddns-4.1.0b1.dist-info/entry_points.txt,sha256=2-VbA-WZcjebkZrGKvUCuBBRYF4xQNMoLIoGaS234WU,44
25
+ ddns-4.1.0b1.dist-info/top_level.txt,sha256=Se0wn3T8Bc4pj55dGwVrCe8BFwmFCBwQVHF1bTyV0o0,5
26
+ ddns-4.1.0b1.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- ddns/__init__.py,sha256=2pfRi5UL9__CmpZObcgnwHkCvRcFhKNwCdfuVeWayqc,503
2
- ddns/__main__.py,sha256=_seGAHUymKdEJldondL4QPerzES_x6efkNDSaaFpcdk,6358
3
- ddns/provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- ddns/provider/alidns.py,sha256=fD8mzr7FJ5QxOWLA3ekoOhjeU1IFepOpxybrgZv2c9k,5782
5
- ddns/provider/callback.py,sha256=V8AG7kxtS0jIkyD9F7xnGJpu1L3E5KUcNDwOnQjcJKs,3208
6
- ddns/provider/cloudflare.py,sha256=OBq4TJwVHHiPMM6FJo-bz20FOHPvA-RSFbuGilw3tVw,5647
7
- ddns/provider/dnscom.py,sha256=Nhyl70JGnZY2IV0j5Ebgy_gYQGFb8hXTshaRG_rC0Ww,5297
8
- ddns/provider/dnspod.py,sha256=52Hstd92-BkyEAicW5DkexfJiTww5KcNZkKs20HUIFE,6211
9
- ddns/provider/dnspod_com.py,sha256=touJksX1aPDAaP9yWRLVzbbbCtP8jzrDZSMSqtRlc0s,336
10
- ddns/provider/he.py,sha256=X_WODK6vDTpHdAvPP_vUltaeAlHeG2jMPbzFkfYxWOg,2142
11
- ddns/provider/huaweidns.py,sha256=0A2jxcJ5zGaMxMMh7C9SsDewhP2zVRLI8FznB9BBBEc,8748
12
- ddns/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- ddns/util/cache.py,sha256=LVH5jGZFimXmD7XCQCtZULhagybM7gSjMo-73yqttiA,3338
14
- ddns/util/config.py,sha256=KUHd24gLwYOCiIM59euEpJ5fkOSfHNzMSclSWiwNZX4,10165
15
- ddns/util/ip.py,sha256=GZzqrl_nq9JuGHTWhPB0fffpr94ITJA6BCVlS5KlWcE,3836
16
- ddns-4.0.2.dist-info/licenses/LICENSE,sha256=MI-ECjp-Vl7WZLiSPY6r5VwrOReNiICVB1QCXiUGt_s,1111
17
- ddns-4.0.2.dist-info/METADATA,sha256=stM5k7HTaPXWU4HBWGiyLfa6ucn9HUvc7tXgFmYdq6Q,16831
18
- ddns-4.0.2.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
19
- ddns-4.0.2.dist-info/entry_points.txt,sha256=2-VbA-WZcjebkZrGKvUCuBBRYF4xQNMoLIoGaS234WU,44
20
- ddns-4.0.2.dist-info/top_level.txt,sha256=Se0wn3T8Bc4pj55dGwVrCe8BFwmFCBwQVHF1bTyV0o0,5
21
- ddns-4.0.2.dist-info/RECORD,,
File without changes