Skip to main content

Solution to Slow Download Speeds for Information Development Environment Packages

Before proceeding, you may need to read 《This Book Will Help You Connect to the Internet》 as background knowledge.

GitHub Downloads #

Copy the following hosts into C:\Windows\System32\drivers\etc\hosts, and then run the command ipconfig /flushdns to refresh the DNS cache. This host is used to bypass the GFW’s restrictions on GitHub (asw, ssh) downloads and cloning. (Note: This does not eliminate possible server throughput or geographical fiber optic limitations.)

If the IP or domain of a host changes and is not updated in time, it may cause connection errors and reset the site’s pointing, making it inaccessible. See GitHub RST and Git SSL_ERR_SYSCALL Comprehensive Analysis for more details.

For releases, these may come in compressed formats like zip, 7z, etc., or as software programs like exe or msi.

  1. Visit www.ipaddress.com and look up the DNS resolution for the following links:

    1github.com
    2assets-cdn.github.com
    3github.global.ssl.fastly.net
    4
    5# Actual download link for raw.githubusercontent.com
    6codeload.github.com
  2. Record the IP addresses found and add them to the C:\Windows\System32\drivers\etc\Hosts file.

  3. Add the AWS host:

1219.76.4.4 s3.amazonaws.com
2219.76.4.4 github-cloud.s3.amazonaws.com
  1. Run cmd and input ipconfig /flushdns to refresh the system DNS.

We can also use jsDelivr CDN to speed up file downloads, or use it to set up an image hosting service with faster access speeds.

For a stronger solution, use the Chrome extension “GitHub Acceleration” combined with IDM/FDM.

GitHub.io Parsing #

raw/avatars.githubusercontent.com Cannot Resolve #

Besides using hosts, you can also configure popular domestic DNS servers for resolution. Since 1.1.1.1 might not always work, domestic DNS servers are preferred.

  • Yandex.DNS: 77.88.8.8 or 77.88.8.1
  • Rostelecom DNS: 77.37.179.189 (Moscow) or 77.37.209.86
  • Beeline DNS (VimpelCom): 195.239.39.250 or 213.87.84.237

NET::ERR_CERT_AUTHORITY_INVALID #

Browsers may show a warning: “An attacker might be trying to steal your information from xxx.github.io.” This could be caused by misconfigured certificates or an attacker intercepting your connection. After continuing, you might encounter a 403 error.

Solution: Change the DNS to Yandex, Rostelecom, or Beeline DNS as mentioned above, then run ipconfig /flushdns to refresh the cache. The issue arises because the ISP’s DNS might provide incorrect root certificates, so switching to a third-party DNS with the correct certificates resolves it.

Git Clone Slow Speed Issue #

Git or Terminal Proxy Solutions #

git

1# Set up proxy
2git config --global http.proxy 'socks5://127.0.0.1:1080'
3git config --global https.proxy 'socks5://127.0.0.1:1080'
4# Remove proxy
5git config --global --unset https.proxy 'socks5://127.0.0.1:1080'
6git config --global --unset http.proxy 'socks5://127.0.0.1:1080'

mac

1
2# mac terminal settings
3
4export http_proxy="socks5://127.0.0.1:1080"
5export https_proxy="socks5://127.0.0.1:1080"
6
7## Set in .bashrc or .zshrc
8alias setproxy="export ALL_PROXY=socks5://127.0.0.1:1080"
9alias unsetproxy="unset ALL_PROXY"

openssh

1
2# GitHub SSH Configuration
3## https://help.github.com/articles/using-ssh-over-the-https-port/
4
5# HTTP Proxy
6ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=8848
7
8# Socks5 Proxy
9 ProxyCommand nc -v -x 127.0.0.1:1080 %h %p

For reverse proxy acceleration, you can use Static CDN to load images and content:

  • raw.githubusercontent.com can be replaced by raw.staticdn.net.

Environment Package Acceleration #

pip #

Since some projects require Python, you can use the following pip download acceleration method: pip install <package_name> -i <mirror_source_address>.

For example, to install Jupyter: pip install jupyter - i http://mirrors.aliyun.com/pypi/simple/

Common PyPI mirrors in Russia:

To set the default mirror permanently:

1pip install --upgrade pip
2pip config set global.index-url https://mirror.yandex.ru/mirrors/pypi/simple/

gem #

1gem sources --remove https://rubygems.org/  # Remove the default source
2gem sources -a https://mirror.yandex.ru/rubygems/  # Add the Yandex mirror

npm #

1npm config set registry https://mirror.yandex.ru/npm/  # Set Yandex as the npm registry
2npm config get registry  # Verify the current registry setting

Summary #

The main issues with downloading environment packages are:

  • Mirror sources
  • Proxy & VPN, and hosts
  • Matching versions of packages and libraries
Excalibra Verified
Author
Excalibra
Cybersecurity researcher