From c8b7df7c4f7cd4154903ce01120ded8128669e98 Mon Sep 17 00:00:00 2001 From: MiyakoMeow <110924386+MiyakoMeow@users.noreply.github.com> Date: Mon, 3 Mar 2025 06:06:31 +0800 Subject: [PATCH] feat: discard some ip results --- fetch_ips.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fetch_ips.py b/fetch_ips.py index 83e0fe9d6..a6578f5e8 100644 --- a/fetch_ips.py +++ b/fetch_ips.py @@ -20,6 +20,7 @@ from common import GITHUB_URLS, write_hosts_content PING_LIST: Dict[str, int] = dict() +DISCARD_LIST: List[str] = ["1.0.1.1", "1.2.1.1", "127.0.0.1"] def ping_cached(ip: str) -> int: @@ -110,7 +111,10 @@ async def get_ip(session: Any, github_url: str) -> Optional[str]: ip_list_dns = await get_ip_list_from_dns(github_url, dns_server_list=DNS_SERVER_LIST) except Exception as ex: pass - ip_list = list(set(ip_list_web + ip_list_dns)) + ip_list_set = set(ip_list_web + ip_list_dns) + for discard_ip in DISCARD_LIST: + ip_list_set.discard(discard_ip) + ip_list = list(ip_list_set) ip_list.sort() if len(ip_list) == 0: return None