|
1 |
| -_HTTP_PROXY=$(cat ${HOME}/.proxy/http_proxy) |
2 |
| -_HTTPS_PROXY=$(cat ${HOME}/.proxy/https_proxy) |
3 |
| -_FTP_PROXY=$(cat ${HOME}/.proxy/ftp_proxy) |
4 |
| -_RSYNC_PROXY=$(cat ${HOME}/.proxy/rsync_proxy) |
5 |
| -_NO_PROXY=$(cat ${HOME}/.proxy/no_proxy) |
6 |
| - |
7 |
| -alias proxy="export http_proxy=${_HTTP_PROXY}; export HTTP_PROXY=${_HTTP_PROXY}; export https_proxy=${_HTTPS_PROXY}; export HTTPS_PROXY=${_HTTPS_PROXY}; export ftp_proxy=${_FTP_PROXY}; export FTP_PROXY=${_FTP_PROXY}; export rsync_proxy=${_RSYNC_PROXY}; export RSYNC_PROXY=${_RSYNC_PROXY}; export no_proxy=${_NO_PROXY}; export NO_PROXY=${_NO_PROXY}" |
8 |
| -alias noproxy="unset http_proxy; unset HTTP_PROXY; unset https_proxy; unset HTTPS_PROXY; unset ftp_proxy; unset FTP_PROXY; unset rsync_proxy; unset RSYNC_PROXY; unset no_proxy; unset NO_PROXY" |
| 1 | +_HTTP_PROXY=$(cat "${HOME}/.proxy/http_proxy") |
| 2 | +_HTTPS_PROXY=$(cat "${HOME}/.proxy/https_proxy") |
| 3 | +_FTP_PROXY=$(cat "${HOME}/.proxy/ftp_proxy") |
| 4 | +_RSYNC_PROXY=$(cat "${HOME}/.proxy/rsync_proxy") |
| 5 | +_NO_PROXY=$(cat "${HOME}/.proxy/no_proxy") |
| 6 | + |
| 7 | +enable_proxy() { |
| 8 | + export http_proxy="${_HTTP_PROXY}" |
| 9 | + export HTTP_PROXY="${_HTTP_PROXY}" |
| 10 | + export https_proxy="${_HTTPS_PROXY}" |
| 11 | + export HTTPS_PROXY="${_HTTPS_PROXY}" |
| 12 | + export ftp_proxy="${_FTP_PROXY}" |
| 13 | + export FTP_PROXY="${_FTP_PROXY}" |
| 14 | + export rsync_proxy="${_RSYNC_PROXY}" |
| 15 | + export RSYNC_PROXY="${_RSYNC_PROXY}" |
| 16 | + export no_proxy="${_NO_PROXY}" |
| 17 | + export NO_PROXY="${_NO_PROXY}" |
| 18 | +} |
| 19 | + |
| 20 | +disable_proxy() { |
| 21 | + unset http_proxy |
| 22 | + unset HTTP_PROXY |
| 23 | + unset https_proxy |
| 24 | + unset HTTPS_PROXY |
| 25 | + unset ftp_proxy |
| 26 | + unset FTP_PROXY |
| 27 | + unset rsync_proxy |
| 28 | + unset RSYNC_PROXY |
| 29 | + unset no_proxy |
| 30 | + unset NO_PROXY |
| 31 | +} |
| 32 | + |
| 33 | +list_proxy() { |
| 34 | + echo "HTTP_PROXY=\"${_HTTP_PROXY}\"" |
| 35 | + echo "HTTPS_PROXY=\"${_HTTPS_PROXY}\"" |
| 36 | + echo "FTP_PROXY=\"${_FTP_PROXY}\"" |
| 37 | + echo "RSYNC_PROXY=\"${_RSYNC_PROXY}\"" |
| 38 | + echo "NO_PROXY=\"${_NO_PROXY}\"" |
| 39 | +} |
| 40 | + |
| 41 | +# Aliases for backward compatibility |
| 42 | +alias proxy=enable_proxy |
| 43 | +alias noproxy=disable_proxy |
| 44 | +alias lsproxy=list_proxy |
0 commit comments