Github Access Acceleration

Github Access Acceleration

In recent years, GitHub distribution network has been seriously polluted by dns, resulting in extremely slow access speed of domestic users, and there are many solutions. For details, please refer to "contents in references"

Acceleration method

  1. Use mirror or proxy sites
  2. cdn acceleration
  3. Go to gitee acceleration

Use mirror site

Mirror site address:

  1. https://github.com.cnpmjs.org/ (common)
  2. https://hub.fastgit.org/ (common)
  3. https://gitclone.com/
  4. https://github-dotcom.gateway.web.tr/
  5. https://hub.xn–p8jhe.tw/?imyshare.com=friends
  6. https://hub.xn–gzu630h.xn–kpry57d/?imyshare.com=friends
  7. https://gh.api.99988866.xyz/
  8. https://toolwa.com/github/
  9. https://ghproxy.com/ (agent acceleration)
  10. https://www.7ed.net/gra/ (raw acceleration)

CDN acceleration

Hosts is a without an extension System file , you can use Notepad and other tools to open it. Its function is to open some commonly used web addresses domain name Corresponding IP address Establish an associated "database". When the user enters a web address to log in in in the browser, the system will automatically log in from the browser first Hosts file Find the corresponding IP address , once found, the system will immediately open the corresponding web page. If not found, the system will submit the web address to the DNS domain name resolution server for IP address resolution.

It should be noted that the Hosts file is configured mapping It is static. If the computer on the network changes, please update the IP address in time, otherwise it will not be accessible.

CDN acceleration is to modify the Hosts file, bypass the domestic dns resolution, and go directly to the ip address of github, so as to speed up access.

The following three websites are common access links:

  1. github.com
  2. assets-cdn.github.com
  3. github.global.ssl.fastly.net

First, at the website: https://www.ipaddress.com/ Query the ip address of the above domain name in, and then add it to Hosts accordingly, as shown in the following figure:

Because adding directly will have permission problems, first copy the Hosts file to the desktop, then modify the copied file, and then replace it.

A simple crawler script

Because everyone's location is different, the ip queried may be different, and the host of github may also change the ip, so I wrote a simple crawler script to deal with it, and then copied it after running. Linux users can use it directly! (the full_domain list contains almost all the domain names that will be used in github. OCD patients can open and modify them accordingly)

import requests
import time
import sys
import random
import urllib3
from bs4 import BeautifulSoup

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

heads = {'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'}

# All the options
# full_domain = [github.githubassets.com, central.github.com, desktop.githubusercontent.com, camo.githubusercontent.com, github.map.fastly.net, github.global.ssl.fastly.net, gist.github.com, github.io, github.com, assets-cdn.github.com, api.github.com, raw.githubusercontent.com, user-images.githubusercontent.com, favicons.githubusercontent.com, avatars5.githubusercontent.com, avatars4.githubusercontent.com, avatars3.githubusercontent.com, avatars2.githubusercontent.com, avatars1.githubusercontent.com, avatars0.githubusercontent.com, avatars.githubusercontent.com, codeload.github.com, github-cloud.s3.amazonaws.com, github-com.s3.amazonaws.com, github-production-release-asset-2e65be.s3.amazonaws.com, github-production-user-asset-6210df.s3.amazonaws.com, github-production-repository-file-5c1aeb.s3.amazonaws.com, githubstatus.com, github.community, media.githubusercontent.com]

website = "https://websites.ipaddress.com/"
# Necessary options
des_domain = ["github.com","assets-cdn.github.com","github.global.ssl.fastly.net"]
des_ip = []

def getip(domain):
    url = website + domain
    try:	
        res = requests.get(url,timeout=30,headers=heads,verify=False)
        res.encoding = 'UTF-8'
        content = res.text
        #print(content)

        soup = BeautifulSoup(content,'html.parser')

        iplist = soup.find('ul',class_='comma-separated')
        iptmp = str(iplist.find("li").text) + "    " + domain
        print(iptmp)
    except:
        print("[\033[31m############   Something Error  #############\033[0m](\033[31m%s\033[0m)"% (url))
        iptmp = '' 

    des.write(iptmp + "\n")

if __name__ == '__main__':
    try:
        # Used in Windows
        # des = open("/mnt/c/Windows/System32/drivers/etc/hosts","a")
        # Used in Linux
        des = open("/etc/hosts","r")
        if "github" in str(des.readlines()):
            des.close()
            print("github dns configuration is already done!\n")
            sys.exit(0)

        des.close()
        des = open("/etc/hosts","a")
        print("# Add by mxdon, you can remove duplicate options manually\n")
        des.write("# Add by mxdon, you can remove duplicate options manually\n")
        for idomain in des_domain:
            getip(idomain)

    except:
        des.close()

Go to Gitee acceleration

Gitee can directly transfer in the github or gitlab warehouse, so as long as you know the github address you want to access, you can directly import gitee: the access speed is super fast after completion!! (dozens of projects have been operated ~)

As shown in the figure above, generally famous projects have been synchronized on gitee and can also be used directly, but sometimes they are not the latest. Friends who are obsessed with cleanliness choose by themselves~

It's illegal to climb over the wall. Please don't climb over the wall at will!!

reference

github Access Acceleration - Zhihu

9 ways to improve the speed of domestic access to github- Know

Github RAW accelerator - 7ED Service

github mirror station_ CHAOS_ORDER blog - CSDN blog_ github mirror station

Those mirror websites you can use - SegmentFault

hosts_ Baidu Encyclopedia

Finally, focus on not getting lost

Keywords: github crawler cdn hosts

Added by Ivan_ on Wed, 22 Dec 2021 16:28:35 +0200