add 'none' in config.json - index(4,6)

This commit is contained in:
tongyifan
2018-07-20 23:39:27 +08:00
parent 502589e4c7
commit e0ca09a487
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -87,6 +87,7 @@ python run.py -c /path/to/config.json
* `default` 系统访问外网默认IP
* `public`使用公网ip(使用公网API查询)
* `nku` NKU网关ip(只支持ipv4)
* `none` 不更新ipv4/ipv6的DNS解析
### 配置示例
```json
+3 -1
View File
@@ -62,7 +62,9 @@ def get_ip(ip_type):
get IP address
"""
index = get_config('index' + ip_type) or "default"
if str(index).isdigit(): # local eth
if index == 'none':
return None
elif str(index).isdigit(): # local eth
value = getattr(ip, "local_v" + ip_type)(index)
elif any((c in index) for c in '*.:'): # regex
value = getattr(ip, "regex_v" + ip_type)(index)