Git Product home page Git Product logo

fuck-gfw's Introduction

FUCK-GFW

I do not want waste time in GFW again.

如果你的包管理器想直接使用优秀的镜像仓库,请参考这个:Thanks-Mirror

目录

pip

~/.config/pip/pip.conf

[global]
proxy=http://localhost:1087

注意不支持socks5

Reference

git

clone with ssh

在 文件 ~/.ssh/config 后添加下面两行

Host github.com
# Mac下
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
# Linux下
ProxyCommand nc --proxy-type socks5 --proxy 127.0.0.1:1080 %h %p

注意Linux和Mac下ncat/netcat区别,详见https://unix.stackexchange.com/questions/368155/what-are-the-differences-between-ncat-nc-and-netcat

clone with http

git config --global http.proxy http://127.0.0.1:1087

建议使用http, 因为socks5 在使用git-lfs时会报错proxyconnect tcp: dial tcp: lookup socks5: no such host

Reference

https://gist.github.com/laispace/666dd7b27e9116faece6

cargo

Cargo 会依次检查以下位置

  1. 环境变量 CARGO_HTTP_PROXY
export CARGO_HTTP_PROXY=http://127.0.0.1:1080
  1. 任意 config.toml 中的 http.proxy
[http]
proxy = "127.0.0.1:1080"
  1. 环境变量 HTTPS_PROXY & https_proxy & http_proxy
export https_proxy=http://127.0.0.1:1080
export http_proxy=http://127.0.0.1:1080

http_proxy 一般来讲没必要,除非使用基于 HTTP 的 Crate Repository

Cargo 使用 libcurl,故可接受任何符合 libcurl format 的地址与协议

( 127.0.0.1:1080 , http://127.0.0.1:1080, socks5://127.0.0.1:1080 )均可

Reference

https://doc.rust-lang.org/cargo/reference/config.html#httpproxy

apt (apt-get)

/etc/apt/apt.conf.d/ 目录下新增 proxy.conf 文件,加入:

Acquire::http::Proxy "http://127.0.0.1:8080/";
Acquire::https::Proxy "http://127.0.0.1:8080/";

注:无法使用Socks5代理。

Reference

https://askubuntu.com/a/349765/883355

curl

socks5 = "127.0.0.1:1080"

add to ~/.curlrc

Reference

https://www.zhihu.com/question/31360766

Gradle

这个浪费了好长时间额 ~/.gradle/gradle.properties

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1087
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1087

Reference

https://stackoverflow.com/questions/5991194/gradle-proxy-configuration

Maven

%Maven 安装目录%/conf/settings.xml

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
     <proxy>
      <id>proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0.1</host>
      <port>1087</port>
    </proxy>
  </proxies>

Reference

https://maven.apache.org/guides/mini/guide-proxies.html

go get

HTTP_PROXY=socks5://localhost:1080 go get

测试了下HTTPS_PROXY和ALL_PROXY都不起作用

OR使用goproxy.io

npm

npm config set proxy http://127.0.0.1:1087
npm config set https-proxy http://127.0.0.1:1087

用socks5就报错- -

推荐使用yarn,npm是真的慢

reference

rustup

export https_proxy=http://127.0.0.1:1080

废物**电信,不挂代理慢如龟

yarn

yarn config set proxy http://127.0.0.1:1087
yarn config set https-proxy http://127.0.0.1:1087

不支持socks5

Reference

yarnpkg/yarn#3418

yarn2

Yarn 2+ - Official

yarn config set httpProxy http://127.0.0.1:1087
yarn config set httpsProxy http://127.0.0.1:1087

不支持全局设置
支持socks5

提示: 这个命令会修改项目目录下的.yarnrc.yml文件, 请留意不要把带有如:

httpsProxy: "socks5://127.0.0.1:1080"

的代码提交到仓库, 以免造成麻烦

建议使用npm镜像而不是配置使用代理
yarn config set npmRegistryServer https://127.0.0.1:1087

注意: 此方法不适用于下载yarn官方插件!
yarn的官方插件默认会从GitHub(raw.githubusercontent.com)上下载
您可能依旧需要配置代理

Reference

gem

~/.gemrc

---
# See 'gem help env' for additional options.
http_proxy: http://localhost:1087

reference

  • google

brew

ALL_PROXY=socks5://localhost:1080 brew ...

wget

use_proxy=yes
http_proxy=127.0.0.1:1087
https_proxy=127.0.0.1:1087

~/.wgetrc

Reference

snap

sudo snap set system proxy.http="http://127.0.0.1:1087"
sudo snap set system proxy.https="http://127.0.0.1:1087"

Reference

https://askubuntu.com/questions/764610/how-to-install-snap-packages-behind-web-proxy-on-ubuntu-16-04#answer-1146047

docker

$ sudo mkdir -p /etc/systemd/system/docker.service.d
$ sudo vim /etc/systemd/system/docker.service.d/proxy.conf

[Service]
Environment="ALL_PROXY=socks5://localhost:1080"

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

必须是socks5,http不生效

Electron Dev Dependency

设置环境变量

ELECTRON_GET_USE_PROXY=true
GLOBAL_AGENT_HTTPS_PROXY=http://localhost:1080

References

Visual Studio Code Remote (WSL2)

WSL2环境下可以通过设置~/.vscode-server/server-env-setup脚本文件,设置开发环境的环境变量,使用代理。

WSL2内环境访问Win下的代理程序端口代理(例子代码中http代理端口监听17070),因为子网地址每次启动都不一样,需要动态处理。

新建~/.vscode-server/server-env-setup文件,该文件会在VSCode启动WSL环境后被source

WSL_HOST=$(sed -n '/^nameserver/p' /etc/resolv.conf | cut -d' ' -f2)
export http_proxy=http://${WSL_HOST}:17070
export https_proxy=$http_proxy
export all_proxy=$http_proxy

References

Visual Studio Code Remote (SSH)

VSCode SSH后的环境不会使用本地界面VSCode内的代理设置,如果SSH主机没有默认网络链接或在墙内,会导致问题。

SSH主机无网络

需要手动下载vscode 的server端传输部署。详情见链接

SSH主机在墙内

虽然文档未提及,但是可以使用WSL模式的方案,配置~/.vscode-server/server-env-setup文件设置代理。

SSH主机有代理程序监听在17070端口:

新建~/.vscode-server/server-env-setup文件,该文件会在VSCode启动WSL环境后被source。

export http_proxy=http://127.0.0.1:17070
export https_proxy=$http_proxy
export all_proxy=$http_proxy

References

Tips

推荐使用Clash,windows版mac版(注意:ClashX Pro 包含TUN功能,ClashX不包含),开启Tun mode可以解决大部分的GFW问题

Reference

https://docs.cfw.lbyczf.com/contents/tun.html

Scoop

scoop config proxy 127.0.0.1:1080

Reference

OpenWRT opkg

在LUCI面版菜单配置或者/etc/opkg.conf末尾追加

option http_proxy http://localhost:1080/

References

https://openwrt.org/docs/guide-user/additional-software/opkg

fuck-gfw's People

Contributors

599316527 avatar boypt avatar chenshaoju avatar clark-cui avatar cnrpman avatar comwrg avatar eryajf avatar frg2089 avatar haodongzou avatar kanna5 avatar peanut996 avatar shaokeyibb avatar spyophobia avatar tomv256 avatar zjl233 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.