Skip to content

Add mirrors, DoH, and progress bar for cloudflared download #93

@minc-nice-100

Description

@minc-nice-100

Is your feature request related to a problem? Please describe.

这个功能请求是否与一个问题有关?请描述一下。

For users in mainland China, downloading the cloudflared executable directly from GitHub Releases often encounters several issues due to the specific network environment.
对于身处中国大陆的用户来说,由于网络环境的特殊性,直接从 GitHub Releases 下载 cloudflared 可执行文件时经常会遇到以下问题。

  1. Extremely slow or completely failed downloads: The connection quality to GitHub's servers (github.com and objects.githubusercontent.com) is very unstable in mainland China, leading to long and easily interrupted downloads.
    下载速度极慢或完全失败:GitHub 的服务器 (github.comobjects.githubusercontent.com) 在中国大陆的连接质量非常不稳定,导致下载过程漫长且容易中断。
  2. DNS Poisoning: DNS servers in certain regions may poison GitHub-related domains, resolving them to incorrect IP addresses and making the download impossible from the start.
    DNS 污染:特定地区的 DNS 服务器可能会污染 GitHub 相关域名,导致解析到错误的 IP 地址,使得下载从一开始就无法进行。

These problems severely impact the user experience for users in mainland China, making the program's initialization and update processes very difficult and unreliable.
这些问题严重影响了中国大陆用户的使用体验,使得程序的初始化和更新过程变得非常困难和不可靠。

Describe the solution you'd like

描述您期望的解决方案

To address the aforementioned issues, I suggest implementing the following three features:
为了解决上述问题,我建议实现以下三个功能:

  1. Add a GitHub download mirror for cloudflared:
    cloudflared 添加 GitHub 下载镜像

    • When downloading cloudflared, the program could first attempt to download from one or more mirror sources located in or near mainland China.
      在下载 cloudflared 时,程序可以优先尝试从一个或多个位于中国大陆或周边地区的镜像源下载。
    • Reliable public mirror services, such as ghproxy.com or download.fastgit.org, could be used as alternative download addresses.
      一些可靠的公共镜像服务,例如 ghproxy.com, download.fastgit.org 等,可以作为备选下载地址。
    • The program should automatically switch to a mirror address to retry when the default GitHub URL fails or is too slow.
      当默认的 GitHub 地址下载失败或过慢时,程序应能自动切换到镜像地址进行重试。
  2. Use DoH (DNS over HTTPS) to bypass DNS tampering:
    使用 DoH (DNS over HTTPS) 来规避 DNS 篡改

    • Embed a DoH client for any network requests, especially for downloading cloudflared and other operations requiring domain resolution.
      在进行任何网络请求(特别是下载 cloudflared 和其他需要域名解析的操作)时,内置一个 DoH 客户端。
    • Send DNS queries via DoH to reliable public DNS providers like 1.1.1.1, 8.8.8.8, or 223.5.5.5 in China.
      通过 DoH 向可靠的公共 DNS 服务商(如 1.1.1.1, 8.8.8.8 或国内的 223.5.5.5)发送 DNS 查询请求。
    • This can effectively bypass local ISP's DNS poisoning, ensuring domains are correctly resolved to their real IP addresses, fundamentally improving connection success rates.
      这可以有效绕过本地 ISP 的 DNS 污染,确保域名能被正确解析到其真实的 IP 地址,从根本上提高连接成功率。
  3. Add a progress indicator for the cloudflared executable download:
    cloudflared 可执行文件的下载添加进度指示

    • Display a clear progress bar or percentage in the UI or command-line log while downloading cloudflared.
      在下载 cloudflared 时,在界面或命令行日志中显示一个明确的下载进度条或百分比。
    • For example, it could show information like Downloading cloudflared... [████░░░░░░] 40% (4.0/10.0 MB).
      例如,可以显示 Downloading cloudflared... [████░░░░░░] 40% (4.0/10.0 MB) 这样的信息。
    • This provides immediate feedback to the user, letting them know the program is not stuck but downloading normally.
      这为用户提供了即时反馈,让他们知道程序没有卡住,而是在正常下载。
    • When the download is slow, the user can decide whether to wait or interrupt the operation based on the progress.
      当下载速度慢时,用户可以根据进度决定是继续等待还是中断操作。

Describe alternatives you've considered

描述您考虑过的替代方案

  1. Letting users handle network issues manually: This would require users to use proxy tools (like VPN or Clash) themselves to solve network problems.
    让用户手动处理网络问题:要求用户自己使用代理工具(如 VPN 或 Clash)来解决网络问题。
    • While this is a feasible workaround, it significantly increases the operational barrier and is unfriendly to users unfamiliar with network tools.
      这是一个可行的办法,但大大增加了用户的操作门槛,对于不熟悉网络工具的用户非常不友好。
    • An ideal software should solve these environmental issues for the user as much as possible.
      理想的软件应该尽可能地为用户解决这些环境问题。
  2. Only prompting users to download manually: When the automatic download fails, the program could prompt the user to manually download cloudflared from the website and place it in the specified directory.
    仅提示用户手动下载:当自动下载失败时,可以提示用户手动去网站下载 cloudflared 并放置到指定目录。
    • This is better than the current situation but is still not automated or convenient enough.
      这比现状要好,但仍然不够自动化和方便。
    • The best experience is for the program to complete this process automatically.
      最好的体验是程序能够自动完成这个过程。

Additional context

其他信息

cloudflared is a critical dependency for the program's core network

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions