xpol
2016-01-08 09:24:30 +08:00
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
}