fix: resilient GitHub downloads and version lookups#5480
Open
smower476 wants to merge 1 commit into
Open
Conversation
Downloads: add download_with_fallback() in common/utils.sh — retries each source up to 3x and falls back through GitHub mirror proxies (ghproxy.net, gh-proxy.com), failing only when all sources are exhausted. All GitHub file downloads are routed through it: hiddify_installer.sh, downgrade.sh, the GeoLite DBs in hiddify-panel/install.sh, and the package_manager.sh binary downloader (xray/singbox/warp/wgcf/dnstm). The download.sh and docker-installer.sh bootstraps keep a minimal inline copy since they run before utils.sh is on disk. Version/API lookups (get_release_version, get_pre_release_version, get_commit_version) previously used curl with no timeout, so a stalled TLS handshake could hang forever. They now use --connect-timeout + --retry --retry-all-errors to bound the handshake and retry both timeouts and connection resets. No mirror fallback here: the proxies don't serve api.github.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Due to recent instability in GitHub's operation, brief download interruptions may occur, particularly in Russia, where DPI systems often reset or stall the TLS connection to GitHub. A request fails or hangs, but retrying the same request usually succeeds. Previously, installation and update processes would terminate immediately upon encountering even a transient download error (or hang indefinitely on a stalled handshake, since several downloads had no timeout).
This adds download_with_fallback() in common/utils.sh: retries each source up to 3x and falls back through GitHub mirror proxies (ghproxy.net, gh-proxy.com), failing only when all sources are exhausted. All GitHub file downloads are routed through it (hiddify_installer.sh, downgrade.sh, GeoLite DBs in hiddify-panel/install.sh, and the package_manager.sh binary downloader for xray/singbox/warp/wgcf/dnstm). The download.sh and docker-installer.sh bootstraps keep a minimal inline copy since they run before utils.sh exists on disk. The version/API lookups (get_release_version, etc.) now use --connect-timeout + --retry --retry-all-errors so a stalled handshake can't hang them.
Tested on a fresh IONOS VPS (ionos.de, 1 vCPU / 1 GB RAM / 10 GB SSD) and on local Ubuntu 24.04 VMs, including a network where raw.githubusercontent.com was actually blocked: full install completes end-to-end, the helper is exercised in the install path, and the success / retry / full mirror-fallback paths were verified.