Open FRANKASEE opened 3 hours ago
目前IPv6的接口都会添加$IPv6,其余IPv4则默认不添加
能否把IPV6和IPV4分别设置获取数量, 比如:
ipv6_streams = [url for url in filtered_urls if is_ipv6(url)][:20]
ipv4_streams = [url for url in filtered_urls if not is_ipv6(url)][:20]
# 将IPv6放在前面,IPv4放在后面
combined_streams = ipv6_streams + ipv4_streams
total_urls = len(combined_streams)
for index, url in enumerate(combined_streams, start=1):
if is_ipv6(url):
url_suffix = f"$IPV6" if total_urls == 1 else f"$IPV6『线路{index}』"
else:
url_suffix = f"$IPV4" if total_urls == 1 else f"$IPV4『线路{index}』"
base_url = url.split('$', 1)[0] if '$' in url else url
new_url = f"{base_url}{url_suffix}"
这个逻辑是先测试出IPV6和IPV4各50个有效的结果,再对延迟结果从小到大排序,提取延迟低的20个IPV6和IPV4作为最终生成的文件。还可以根据每个人的使用习惯不同,可以自己设置IPV6在前,还是IPV4在前。
好提议,关于接口协议偏好设置会与接口来源偏好设置一起在后面的版本实现
期待
如下示例: 凤凰资讯,http://118.251.63.148:8888/udp/239.76.246.135:1234$IPV4『线路1』 凤凰资讯,http://124.230.56.55:55555/udp/239.76.246.135:1234$IPV4『线路2』 凤凰资讯,http://124.230.56.93:55555/udp/239.76.246.135:1234$IPV4『线路3』 凤凰资讯,http://[2409:8087:2001:20:2800:0:df6e:eb27]/ott.mobaibox.com/PLTV/3/224/3221228524/index.m3u8$IPV6『线路4』 凤凰资讯,http://[2409:8087:2001:20:2800:0:df6e:eb27]/ott.mobaibox.com/PLTV/3/224/3221228524/index.m3u8$IPV6『线路5』