#proxy
HTTP='127.0.0.1:7890'
defp=$HTTP
# No Proxy
function noproxy
{
unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY all_proxy ALL_PROXY ftp_proxy FTP_PROXY dns_proxy DNS_PROXY JAVA_OPTS GRADLE_OPTS MAVEN_OPTS
echo "clear proxy done"
}
function setproxy
{
if [ $# -eq 0 ]
then
inArg=$defp
else
inArg=$1
fi
HOST=$(echo $inArg |cut -d: -f1)
PORT=$(echo $inArg |cut -d: -f2)
http_proxy=http://$HOST:$PORT
HTTP_PROXY=$http_proxy
all_proxy=$http_proxy
ALL_PROXY=$http_proxy
ftp_proxy=$http_proxy
FTP_PROXY=$http_proxy
dns_proxy=$http_proxy
DNS_PROXY=$http_proxy
https_proxy=$http_proxy
HTTPS_PROXY=$https_proxy
JAVA_OPTS="-Dhttp.proxyHost=$HOST -Dhttp.proxyPort=$PORT -Dhttps.proxyHost=$HOST -Dhttps.proxyPort=$PORT"
GRADLE_OPTS="-Dgradle.user.home=$HOME/.gradle"
MAVEN_OPTS=$JAVA_OPTS
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,.huaweicloud.com,.coding.net,.ruby-china.org"
echo "current proxy is ${http_proxy}"
export no_proxy http_proxy HTTP_PROXY https_proxy HTTPS_PROXY all_proxy ALL_PROXY ftp_proxy FTP_PROXY dns_proxy DNS_PROXY JAVA_OPTS GRADLE_OPTS MAVEN_OPTS
}
function setsocks5
{
export ALL_PROXY=socks5://127.0.0.1:1080
}