V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
littlewey

分享一下我今天 GitHub 提速的 approach

  •  
  •   littlewey · Aug 24, 2019 · 2258 views
    This topic created in 2448 days ago, the information mentioned may be changed or developed.

    我注意到最近一周左右 github 访问 https/ssh repo 带宽变很小,不知道是如下哪一个原因:

    a: 出国带宽受限 b: 我路由上使用的保持更新的 gfwlist 的范围更改了(原来在 proxy 范围现在不在了)

    我决定把 github 的 ip 拿出来放到路由器中走代理的 list 里,写了这一行脚本来获取这个 list:

    使用了 github 官方提供的 api

    
    curl https://api.github.com/meta 2>/dev/null | python3 -c \
        'import json,sys;metadata=json.load(sys.stdin);print(*set([address for key in metadata.keys() if isinstance(metadata[key], list) for address in metadata[key]]), sep="\n")'
    
    

    也许符合大家的使用场景。

    Supplement 1  ·  Sep 5, 2019
    我换到跟 @missdeer 一样的方案,默认走代理,国内白名单才直连了。对我来说这更经济一些。
    6 replies    2019-08-26 09:28:18 +08:00
    est
        1
    est  
       Aug 24, 2019   ❤️ 1
    curl -s api.github.com/meta 2>/dev/null | python -m json.tool | grep -oE "\d+\.\d+\.\d+\.\d+" | sort | uniq
    est
        2
    est  
       Aug 24, 2019
    curl -Ls。。。写 https 会没法回帖。
    littlewey
        3
    littlewey  
    OP
       Aug 24, 2019
    @est #2 你的实现不错哈。👍
    missdeer
        4
    missdeer  
       Aug 25, 2019
    我一直把所有海外 IP 走代理
    QiWei
        5
    QiWei  
       Aug 25, 2019
    @est 那个版本的 grep -E 支持 \d,grep -P 倒是可以。
    est
        6
    est  
       Aug 26, 2019
    @QiWei 这个我也没搞清楚过。2333
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   922 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 21:18 · PVG 05:18 · LAX 14:18 · JFK 17:18
    ♥ Do have faith in what you're doing.