File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ python run.py -c /path/to/config.json
131
131
| ttl | number | No | ` null ` | DNS 解析 TTL 时间 | 不设置采用 DNS 默认策略 |
132
132
| proxy | string | No | 无 | http 代理` ; ` 分割 | 多代理逐个尝试直到成功,` DIRECT ` 为直连 |
133
133
| debug | bool | No | ` false ` | 是否开启调试 | 运行异常时,打开调试输出,方便诊断错误 |
134
- | cache | bool | No | ` true ` | 是否缓存记录 | 正常情况打开避免频繁更新 |
134
+ | cache | string \| bool | No | ` true ` | 是否缓存记录 | 正常情况打开避免频繁更新,默认位置为临时目录下 ` ddns.cache ` ,< br >也可以指定一个具体文件实现自定义文件缓存位置 |
135
135
136
136
#### index4 和 index6 参数说明
137
137
Original file line number Diff line number Diff line change 34
34
environ ['SSL_CERT_FILE' ] = path .join (
35
35
getattr (sys , '_MEIPASS' ), 'lib' , 'cert.pem' )
36
36
37
- CACHE_FILE = path .join (gettempdir (), 'ddns.cache' )
38
-
39
37
40
38
def get_ip (ip_type , index = "default" ):
41
39
"""
@@ -139,7 +137,9 @@ def main():
139
137
proxy_list = proxy if isinstance (
140
138
proxy , list ) else proxy .strip ('; ' ).replace (',' , ';' ).split (';' )
141
139
142
- cache = get_config ('cache' , True ) and Cache (CACHE_FILE )
140
+ cache = get_config ('cache' , True )
141
+ cache = cache is True and path .join (gettempdir (), 'ddns.cache' ) or cache
142
+ cache = Cache (cache )
143
143
if cache is False :
144
144
info ("Cache is disabled!" )
145
145
elif get_config ("config_modified_time" ) is None or get_config ("config_modified_time" ) >= cache .time :
Original file line number Diff line number Diff line change 186
186
},
187
187
"cache" : {
188
188
"$id" : " /properties/cache" ,
189
- "type" : " boolean" ,
189
+ "type" : [
190
+ " string" ,
191
+ " boolean"
192
+ ],
190
193
"title" : " Enable Cache" ,
191
194
"description" : " 是否启用缓存记录以避免频繁更新" ,
192
195
"default" : true ,
193
196
"examples" : [
194
197
true ,
195
- false
198
+ false ,
199
+ " /path/to/cache/ddns.cache"
196
200
]
197
201
}
198
202
},
You can’t perform that action at this time.
0 commit comments