diff --git a/.github/workflows/update_hosts.yml b/.github/workflows/update_hosts.yml index 0cd5591..675d537 100644 --- a/.github/workflows/update_hosts.yml +++ b/.github/workflows/update_hosts.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 1 - + - name: Set up Python uses: actions/setup-python@v5 with: @@ -40,7 +40,7 @@ jobs: - name: Run hosts update script1 run: | - sudo python setHosts.py + sudo python setHosts.py --NotUseDnsServers # 提交并推送更新(仅在文件变更时) - name: Commit and push changes @@ -49,4 +49,5 @@ jobs: message: "Update servers list" add: | hosts - README.md \ No newline at end of file + README.md + push: "--force" \ No newline at end of file diff --git a/README.md b/README.md index 9bc5fa3..b1a1b58 100644 --- a/README.md +++ b/README.md @@ -30,78 +30,79 @@ ```bash -# cnNetTool Start in 2024-11-29 19:58:29 +08:00 -140.82.112.26 alive.github.com +# cnNetTool Start in 2024-11-29 20:24:55 +08:00 +140.82.112.25 alive.github.com 20.205.243.168 api.github.com +140.82.113.21 central.github.com 20.205.243.165 codeload.github.com 140.82.112.21 collector.github.com -140.82.112.3 gist.github.com 20.205.243.166 github.com -140.82.114.18 github.community -151.101.129.194 github.global.ssl.fastly.net -52.217.193.113 github-com.s3.amazonaws.com -3.5.25.118 github-production-release-asset-2e65be.s3.amazonaws.com -140.82.114.26 live.github.com +140.82.112.17 github.community +151.101.1.194 github.global.ssl.fastly.net +52.216.206.19 github-com.s3.amazonaws.com +52.217.85.164 github-production-release-asset-2e65be.s3.amazonaws.com +140.82.114.25 live.github.com 13.107.42.16 pipelines.actions.githubusercontent.com 185.199.110.154 github.githubassets.com 185.199.111.153 github.io 185.199.111.153 githubstatus.com 185.199.111.153 assets-cdn.github.com -185.199.109.133 avatars.githubusercontent.com -185.199.109.133 avatars0.githubusercontent.com -185.199.109.133 avatars1.githubusercontent.com -185.199.109.133 avatars2.githubusercontent.com -185.199.109.133 avatars3.githubusercontent.com -185.199.109.133 avatars4.githubusercontent.com -185.199.109.133 avatars5.githubusercontent.com -185.199.109.133 camo.githubusercontent.com -185.199.109.133 cloud.githubusercontent.com -185.199.109.133 desktop.githubusercontent.com -185.199.109.133 favicons.githubusercontent.com -185.199.109.133 github.map.fastly.net -185.199.109.133 media.githubusercontent.com -185.199.109.133 objects.githubusercontent.com -185.199.109.133 private-user-images.githubusercontent.com -185.199.109.133 raw.githubusercontent.com -185.199.109.133 user-images.githubusercontent.com -99.86.229.15 tmdb.org -99.86.229.15 api.tmdb.org -99.86.229.15 files.tmdb.org -3.166.244.54 themoviedb.org -3.166.244.54 api.themoviedb.org -3.166.244.54 www.themoviedb.org -3.166.244.54 auth.themoviedb.org -169.150.236.97 image.tmdb.org -169.150.236.97 images.tmdb.org -52.94.237.74 imdb.com +185.199.108.133 avatars.githubusercontent.com +185.199.108.133 avatars0.githubusercontent.com +185.199.108.133 avatars1.githubusercontent.com +185.199.108.133 avatars2.githubusercontent.com +185.199.108.133 avatars3.githubusercontent.com +185.199.108.133 avatars4.githubusercontent.com +185.199.108.133 avatars5.githubusercontent.com +185.199.108.133 camo.githubusercontent.com +185.199.108.133 cloud.githubusercontent.com +185.199.108.133 desktop.githubusercontent.com +185.199.108.133 favicons.githubusercontent.com +185.199.108.133 github.map.fastly.net +185.199.108.133 media.githubusercontent.com +185.199.108.133 objects.githubusercontent.com +185.199.108.133 private-user-images.githubusercontent.com +185.199.108.133 raw.githubusercontent.com +185.199.108.133 user-images.githubusercontent.com +13.225.183.56 tmdb.org +13.225.183.56 api.tmdb.org +13.225.183.56 files.tmdb.org +3.166.244.31 themoviedb.org +3.166.244.31 api.themoviedb.org +3.166.244.31 www.themoviedb.org +3.166.244.31 auth.themoviedb.org +169.150.236.100 image.tmdb.org +169.150.236.100 images.tmdb.org +52.94.228.167 imdb.com +18.67.61.135 www.imdb.com 52.94.228.167 secure.imdb.com -18.172.46.173 s.media-imdb.com +18.67.59.121 s.media-imdb.com 52.94.225.248 us.dd.imdb.com 18.172.46.173 www.imdb.to -52.94.225.248 imdb-webservice.amazon.com +52.94.237.74 imdb-webservice.amazon.com 98.82.158.179 origin-www.imdb.com -151.101.1.16 m.media-amazon.com -151.101.129.16 Images-na.ssl-images-amazon.com -3.168.89.206 images-fe.ssl-images-amazon.com -18.165.84.32 images-eu.ssl-images-amazon.com -13.225.182.66 ia.media-imdb.com -146.75.113.16 f.media-amazon.com -3.166.216.99 imdb-video.media-imdb.com -18.67.66.18 dqpnq362acqdi.cloudfront.net -172.217.31.136 translate.google.com -172.217.31.136 translate.googleapis.com -172.217.31.136 translate-pa.googleapis.com -18.65.168.59 plugins.jetbrains.com -18.65.168.59 download.jetbrains.com -18.65.168.59 cache-redirector.jetbrains.com - -# Update time: 2024-11-29 19:58:29 +08:00 +146.75.113.16 m.media-amazon.com +151.101.193.16 Images-na.ssl-images-amazon.com +3.171.83.185 images-fe.ssl-images-amazon.com +3.167.55.206 images-eu.ssl-images-amazon.com +3.165.17.68 ia.media-imdb.com +146.75.93.16 f.media-amazon.com +18.67.76.14 imdb-video.media-imdb.com +3.164.148.217 dqpnq362acqdi.cloudfront.net +172.217.31.168 translate.google.com +172.217.31.168 translate.googleapis.com +172.217.31.168 translate-pa.googleapis.com +18.65.168.15 plugins.jetbrains.com +18.65.168.15 download.jetbrains.com +18.65.168.15 cache-redirector.jetbrains.com + +# Update time: 2024-11-29 20:24:55 +08:00 # GitHub仓库: https://github.com/sinspired/cnNetTool # cnNetTool End ``` -以上内容会自动定时更新, 数据更新时间:2024-11-29 19:58:29 +08:00 +以上内容会自动定时更新, 数据更新时间:2024-11-29 20:24:55 +08:00 #### 1.2.2 修改 hosts 文件 diff --git a/hosts b/hosts index 1d006b8..047295c 100644 --- a/hosts +++ b/hosts @@ -1,69 +1,70 @@ -# cnNetTool Start in 2024-11-29 19:58:29 +08:00 -140.82.112.26 alive.github.com +# cnNetTool Start in 2024-11-29 20:24:55 +08:00 +140.82.112.25 alive.github.com 20.205.243.168 api.github.com +140.82.113.21 central.github.com 20.205.243.165 codeload.github.com 140.82.112.21 collector.github.com -140.82.112.3 gist.github.com 20.205.243.166 github.com -140.82.114.18 github.community -151.101.129.194 github.global.ssl.fastly.net -52.217.193.113 github-com.s3.amazonaws.com -3.5.25.118 github-production-release-asset-2e65be.s3.amazonaws.com -140.82.114.26 live.github.com +140.82.112.17 github.community +151.101.1.194 github.global.ssl.fastly.net +52.216.206.19 github-com.s3.amazonaws.com +52.217.85.164 github-production-release-asset-2e65be.s3.amazonaws.com +140.82.114.25 live.github.com 13.107.42.16 pipelines.actions.githubusercontent.com 185.199.110.154 github.githubassets.com 185.199.111.153 github.io 185.199.111.153 githubstatus.com 185.199.111.153 assets-cdn.github.com -185.199.109.133 avatars.githubusercontent.com -185.199.109.133 avatars0.githubusercontent.com -185.199.109.133 avatars1.githubusercontent.com -185.199.109.133 avatars2.githubusercontent.com -185.199.109.133 avatars3.githubusercontent.com -185.199.109.133 avatars4.githubusercontent.com -185.199.109.133 avatars5.githubusercontent.com -185.199.109.133 camo.githubusercontent.com -185.199.109.133 cloud.githubusercontent.com -185.199.109.133 desktop.githubusercontent.com -185.199.109.133 favicons.githubusercontent.com -185.199.109.133 github.map.fastly.net -185.199.109.133 media.githubusercontent.com -185.199.109.133 objects.githubusercontent.com -185.199.109.133 private-user-images.githubusercontent.com -185.199.109.133 raw.githubusercontent.com -185.199.109.133 user-images.githubusercontent.com -99.86.229.15 tmdb.org -99.86.229.15 api.tmdb.org -99.86.229.15 files.tmdb.org -3.166.244.54 themoviedb.org -3.166.244.54 api.themoviedb.org -3.166.244.54 www.themoviedb.org -3.166.244.54 auth.themoviedb.org -169.150.236.97 image.tmdb.org -169.150.236.97 images.tmdb.org -52.94.237.74 imdb.com +185.199.108.133 avatars.githubusercontent.com +185.199.108.133 avatars0.githubusercontent.com +185.199.108.133 avatars1.githubusercontent.com +185.199.108.133 avatars2.githubusercontent.com +185.199.108.133 avatars3.githubusercontent.com +185.199.108.133 avatars4.githubusercontent.com +185.199.108.133 avatars5.githubusercontent.com +185.199.108.133 camo.githubusercontent.com +185.199.108.133 cloud.githubusercontent.com +185.199.108.133 desktop.githubusercontent.com +185.199.108.133 favicons.githubusercontent.com +185.199.108.133 github.map.fastly.net +185.199.108.133 media.githubusercontent.com +185.199.108.133 objects.githubusercontent.com +185.199.108.133 private-user-images.githubusercontent.com +185.199.108.133 raw.githubusercontent.com +185.199.108.133 user-images.githubusercontent.com +13.225.183.56 tmdb.org +13.225.183.56 api.tmdb.org +13.225.183.56 files.tmdb.org +3.166.244.31 themoviedb.org +3.166.244.31 api.themoviedb.org +3.166.244.31 www.themoviedb.org +3.166.244.31 auth.themoviedb.org +169.150.236.100 image.tmdb.org +169.150.236.100 images.tmdb.org +52.94.228.167 imdb.com +18.67.61.135 www.imdb.com 52.94.228.167 secure.imdb.com -18.172.46.173 s.media-imdb.com +18.67.59.121 s.media-imdb.com 52.94.225.248 us.dd.imdb.com 18.172.46.173 www.imdb.to -52.94.225.248 imdb-webservice.amazon.com +52.94.237.74 imdb-webservice.amazon.com 98.82.158.179 origin-www.imdb.com -151.101.1.16 m.media-amazon.com -151.101.129.16 Images-na.ssl-images-amazon.com -3.168.89.206 images-fe.ssl-images-amazon.com -18.165.84.32 images-eu.ssl-images-amazon.com -13.225.182.66 ia.media-imdb.com -146.75.113.16 f.media-amazon.com -3.166.216.99 imdb-video.media-imdb.com -18.67.66.18 dqpnq362acqdi.cloudfront.net -172.217.31.136 translate.google.com -172.217.31.136 translate.googleapis.com -172.217.31.136 translate-pa.googleapis.com -18.65.168.59 plugins.jetbrains.com -18.65.168.59 download.jetbrains.com -18.65.168.59 cache-redirector.jetbrains.com +146.75.113.16 m.media-amazon.com +151.101.193.16 Images-na.ssl-images-amazon.com +3.171.83.185 images-fe.ssl-images-amazon.com +3.167.55.206 images-eu.ssl-images-amazon.com +3.165.17.68 ia.media-imdb.com +146.75.93.16 f.media-amazon.com +18.67.76.14 imdb-video.media-imdb.com +3.164.148.217 dqpnq362acqdi.cloudfront.net +172.217.31.168 translate.google.com +172.217.31.168 translate.googleapis.com +172.217.31.168 translate-pa.googleapis.com +18.65.168.15 plugins.jetbrains.com +18.65.168.15 download.jetbrains.com +18.65.168.15 cache-redirector.jetbrains.com -# Update time: 2024-11-29 19:58:29 +08:00 +# Update time: 2024-11-29 20:24:55 +08:00 # GitHubֿ: https://github.com/sinspired/cnNetTool # cnNetTool End diff --git a/setHosts.py b/setHosts.py index 517b05c..81b346b 100644 --- a/setHosts.py +++ b/setHosts.py @@ -81,6 +81,14 @@ def parse_args(): action="store_true", help="打印运行信息", ) + parser.add_argument( + "-n" + "--NotUseDnsServers", + action="store_true", + help="不使用DNS服务器解析(避免GitHub等被dns污染的网站获取错误地址)", + ) + + return parser.parse_args() @@ -283,8 +291,9 @@ async def resolve_domain(self, domain: str) -> Set[str]: ips = set() # 1. 首先通过常规DNS服务器解析 - dns_ips = await self._resolve_via_dns(domain) - ips.update(dns_ips) + if not args.NotUseDnsServers: + dns_ips = await self._resolve_via_dns(domain) + ips.update(dns_ips) # 2. 然后通过DNS_records解析 # 由于init时已经处理了过期文件,这里只需要检查域名是否在缓存中