update = 'keep IP test' save_iplist_as_db(ipdb, []) print('IP 保留地址已保存完毕') data_source_manager = DataSourceManager() ds_APNIC = data_source_manager.add('APNIC', Url_APNIC, parse_apnic_iplist) ds_17MON = data_source_manager.add('17mon', Url_17MON, parse_cidr_iplist) ds_GAOYIFAN = data_source_manager.add('GaoYiFan', Url_GAOYIFAN, parse_cidr_iplist) ds_APNIC.add(['mo', 'hk']) #更新一般在月初几天,由于内容不包含日期信息,故记录为获取时的日期信息 ds_17MON.datefmt = '%Y%m%d' #每日 3:00 之后更新 ds_GAOYIFAN.datefmt = '%Y%m%d' is_main = __name__ == '__main__' logging = getlogger(is_main) if is_main: if len(sys.argv) < 2: print('使用 "--help" 可查看命令行参数说明\n') if '--help' in sys.argv: print(''' 用法: --help 显示此使用提示 -u 生成的数据库文件不放入脚本目录而是更新到相邻的 data 目录 交互模式下参数 "-u" 无效 指定可用数据源,交互模式中无效 --apnic[ mo][ hk] 使用 APNIC 数据源
#!/usr/bin/env python3 #-*- coding: UTF-8 -*- import os import sys sys.dont_write_bytecode = True from common import (root_dir as app_root, config_dir, icon_gotox, direct_ipdb, direct_domains, config_filename, config_user_filename, config_auto_filename, single_instance, get_dirname, getlogger, startfile, load_config as _load_config, cconfig) single_instance('gotox.win_tray') logger = getlogger() app_start = os.path.join(app_root, 'start.py') create_shortcut_js = os.path.join(app_root, 'create_shortcut.vbs') refresh_proxy = os.path.join(app_root, 'launcher', 'refresh_proxy_win.py') wintray_conf = os.path.join(config_dir, 'win_tray.conf') import winreg import ctypes from time import sleep from subprocess import Popen from local import __version__ as gotoxver SET_PATH = r'Software\Microsoft\Windows\CurrentVersion\Internet Settings' ProxyOverride_local = ';'.join(['localhost', '127.*', '192.168.*', '10.*'] + ['100.%d.*' % (64 + n) for n in range(1 << 6)] + ['172.%d.*' % (16 + n) for n in range(1 << 4)])
sys.dont_write_bytecode = True import warnings warnings.filterwarnings('ignore', '"is" with a literal', SyntaxWarning, append=True) # py38+ from common import (root_dir as app_root, config_dir, icon_gotox, direct_ipdb, direct_domains, config_filename, config_user_filename, config_auto_filename, single_instance, get_dirname, getlogger, startfile, load_config as _load_config, cconfig) single_instance('gotox.win_tray') logging = getlogger() app_start = os.path.join(app_root, 'start.py') create_shortcut_js = os.path.join(app_root, 'create_shortcut.vbs') refresh_proxy = os.path.join(app_root, 'launcher', 'refresh_proxy_win.py') import winreg import ctypes from time import sleep from subprocess import Popen from local import __version__ as gotoxver SET_PATH = r'Software\Microsoft\Windows\CurrentVersion\Internet Settings' ProxyOverride = ';'.join(['localhost', '127.*', '192.168.*', '10.*'] + ['100.%d.*' % (64 + n) for n in range(1 << 6)] + ['172.%d.*' % (16 + n) for n in range(1 << 4)])
except Exception as e: logger.warning('更新直连域名列表 %r 失败:%s', txt, e) finally: downloading = False data_source_manager.clear_source_data() data_source_manager = DataSourceManager() ds_FELIX = data_source_manager.add('Felix', Url_FCHINA, parse_dnsmasq_domains, 'felixonmars/accelerated-domains.china') ds_FAPPLE = ds_FELIX.add_child('Apple', Url_FAPPLE, fullname='felixonmars/apple.china') is_main = __name__ == '__main__' logger = getlogger(is_main) if is_main: if len(sys.argv) < 2: print('使用 "--help" 可查看命令行参数说明\n') if '--help' in sys.argv: print(''' 用法: --help 显示此使用提示 -u 生成的直连域名列表文件不放入脚本目录而是更新到相邻的 data 目录 交互模式下参数 "-u" 无效 指定可用数据源,交互模式中无效 --felix[ apple] 使用 felixonmars 数据源