用着真不错()
另外关于卡网的问题我是这样解决的:
首先上ping.chinaz.com去ping:
tms17.icrc.trendmicro.com
上面会有一个独立ip地址总数,里面可以复制,然后再让gpt简单写个脚本跑一下,批量ping这些地址,取延迟最低的地址改hosts就行了
目前来看除了第一次重启更新后刚开机很卡,其他的时候性能表现都不错。网也不是很卡。
附上脚本和源码:
http://nas.dreamending.top/sharing/YuaPJw7Rw
访问密码:kafan
- import subprocess
- import re
- import os
- from statistics import mean
- # 内置IP地址列表
- ips = [
- "104.123.204.67",
- "184.29.16.89",
- "23.1.100.49",
- "23.11.240.57",
- "23.13.186.35",
- "23.195.84.101",
- "23.200.60.95",
- "23.211.56.87",
- "23.217.130.94",
- "23.219.72.85",
- "23.221.99.190",
- "23.222.141.192",
- "23.35.28.80",
- "23.37.16.102",
- "23.46.196.74",
- "23.48.120.90",
- "23.52.92.113",
- "23.56.20.93",
- "23.56.28.93",
- "72.246.156.104"
- ]
- def ping_ip(ip):
- # Windows平台下ping命令为:ping -n 4 <ip>
- command = ['ping', '-n', '4', ip]
- result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
- if result.returncode == 0:
- # 匹配延迟时间
- delay_times = re.findall(r'时间=(\d+)ms', result.stdout)
- if delay_times:
- # 转换为整数列表
- delay_times = list(map(int, delay_times))
- # 计算平均延迟
- avg_delay = mean(delay_times)
- return ip, delay_times, avg_delay
- else:
- return ip, [], None
- else:
- return ip, [], None
- def main():
- # 存储所有IP地址的ping结果
- ping_results = []
- min_ip = None
- min_avg_delay = float('inf')
- for ip in ips:
- result = ping_ip(ip)
- ping_results.append(result)
- # 打印结果
- print(f"IP地址: {result[0]}, 4次ping的延迟: {result[1]}, 平均延迟: {result[2]:.2f} ms" if result[2] is not None else f"IP地址: {result[0]}, 无法ping通")
- # 检查是否有新的最小平均延迟
- if result[2] is not None and result[2] < min_avg_delay:
- min_avg_delay = result[2]
- min_ip = result[0]
- # 将结果写入到result.txt文件中
- with open('result.txt', 'w') as file:
- for result in ping_results:
- file.write(f"IP地址: {result[0]}, 4次ping的延迟: {result[1]}, 平均延迟: {result[2]:.2f} ms\n" if result[2] is not None else f"IP地址: {result[0]}, 无法ping通\n")
- if min_ip:
- file.write(f"平均延迟最小的IP地址是: {min_ip}, 平均延迟为: {min_avg_delay:.2f} ms,推荐使用\n")
- if __name__ == "__main__":
- print("若等待时间过长, 或ping结果不足4次, 则该ip出现超时现象, 不推荐使用\n")
- main()
- os.system('cls')
- print("已将结果写入result.txt中, 可打开查看! Hosts请自行修改\n")
- print("按回车键退出程序......")
- input()
复制代码
|