Created
January 8, 2016 01:27
-
-
Save xpol/f43c5e7aaeadb78b26d9 to your computer and use it in GitHub Desktop.
This file contains 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
function proxy { | |
case $1 in | |
[1-9]*) | |
export http_proxy=socks5://127.0.0.1:$1 | |
export https_proxy=$http_proxy | |
git config --global http.proxy $http_proxy | |
git config --global https.proxy $https_proxy | |
;; | |
off) | |
unset http_proxy | |
unset https_proxy | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
;; | |
la|lantern) | |
export http_proxy=http://127.0.0.1:8787 | |
export https_proxy=$http_proxy | |
git config --global http.proxy $http_proxy | |
git config --global https.proxy $https_proxy | |
;; | |
ss|shadowsocks) | |
export http_proxy=socks5://127.0.0.1:1080 | |
export https_proxy=$http_proxy | |
git config --global http.proxy $http_proxy | |
git config --global https.proxy $https_proxy | |
;; | |
pr|privoxy) | |
export http_proxy=http://127.0.0.1:8118 | |
export https_proxy=$http_proxy | |
git config --global http.proxy $http_proxy | |
git config --global https.proxy $https_proxy | |
;; | |
"") | |
echo usage: proxy [port\|ss\|shadowsocks\|la\|lantern\|off] | |
;; | |
esac | |
echo http_proxy=$http_proxy | |
echo https_proxy=$https_proxy | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment