Last active
January 6, 2025 08:49
-
-
Save bGZo/82a76ecbebf81b556a1d20a91a6bd21a to your computer and use it in GitHub Desktop.
docs: proxy command references
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
# ____ | |
# __ _|___ \ _ __ _ __ _____ ___ _ | |
# \ \ / / __) | '_ \| '__/ _ \ \/ / | | | | |
# \ V / / __/| |_) | | | (_) > <| |_| | | |
# (_)_/ |_____| .__/|_| \___/_/\_\\__, | | |
# |_| |___/ | |
# +---------------+---------------------------------------+ | |
# | author | bGZo | | |
# | test command | curl www.google.com | | |
# | software | clashMeta / proxifier | | |
# +---------------+---------------------------------------+ | |
# +-----------------+-------------------------------------------------+ | |
# | system | *nix / wsl1 / wsl2 with mirrored networkingMode | | |
# | check command | env | grep -i proxy | | |
# +-----------------+-------------------------------------------------+ | |
export http_proxy=http://127.0.0.1:7890 | |
export https_proxy=http://127.0.0.1:7890 | |
export all_proxy=http://127.0.0.1:7890 | |
# +---------+--------------------------------+ | |
# | system | wsl2 with dynamtic IP | | |
# | mark | we need to set every each time | | |
# +---------+--------------------------------+ | |
host_ip=$(cat /etc/resolv.conf | grep "nameserver" |cut -f 2 -d " ") | |
export http_proxy="http://$host_ip:7890" | |
export https_proxy="http://$host_ip:7890" | |
export all_proxy="http://$host_ip:7890" | |
# +---------+------------------------------------------------+ | |
# | distro | debian | | |
# | mark | some cases using sudo will ignore the exported | | |
# | | variable. like pacman should with `-E` to | | |
# | | preserve. Under debian use it temporarily. | | |
# +---------+------------------------------------------------+ | |
sudo apt -o Acquire::http::proxy="http://127.0.0.1:7890/" update | |
# +---------+---------------------+ | |
# | system | windows cmd | | |
# | mark | use unset to cancel | | |
# +---------+---------------------+ | |
set http_proxy=http://127.0.0.1:7890 | |
set https_proxy=http://127.0.0.1:7890 | |
set proxy_all=http://127.0.0.1:7890 | |
# +---------+---------------------+ | |
# | system | windows powershell | | |
# +---------+---------------------+ | |
$env:http_proxy="http://127.0.0.1:7890" | |
$env:https_proxy="http://127.0.0.1:7890" | |
$env:all_proxy="http://127.0.0.1:7890" | |
# Other ways could be like | |
# $ sudo netsh winhttp set proxy 127.0.0.1:7890 | |
# $ netsh winhttp show proxy | |
# $ sudo netsh winhttp reset proxy | |
# More use case via: https://gist.github.com/famousgarkin/c5138b1e13ac41920d22 | |
# +--------+------------------------------------+ | |
# | tool | winget | | |
# | cancel | winget settings reset DefaultProxy | | |
# +--------+------------------------------------+ | |
sudo winget settings --enable ProxyCommandLineOptions | |
winget --proxy http://127.0.0.1:7890 install | |
# +------+-------+ | |
# | tool | scoop | | |
# +------+-------+ | |
scoop config proxy 127.0.0.1:7890 | |
# +------+-------+ | |
# | tool | pip3 | | |
# +------+-------+ | |
pip3 install --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple | |
# +-------+-----------------+ | |
# | tool | npm/yarn | | |
# | check | npm config list | | |
# +-------+-----------------+ | |
# temporarily | |
npm install --registry=http://registry.npm.taobao.org | |
# permanently | |
npm config set proxy http://127.0.0.1:7890 | |
npm config set https-proxy http://127.0.0.1:7890 | |
# delete | |
npm config delete proxy | |
# +---------------+--------------------------------------------+ | |
# | tool | git | | |
# | reference | https://git-scm.com/docs/git-config | | |
# | | https://stackoverflow.com/questions/783811 | | |
# | only download | https://ghproxy.com, https://ghp.ci | | |
# +---------------+--------------------------------------------+ | |
git config --global http.proxy http://127.0.0.1:7890 | |
git config --global --unset http.proxy | |
git config --global --get http.proxy | |
# +-------------+--------------------------------------------------+ | |
# | tool | electron | | |
# | reference | https://code.visualstudio.com/docs/setup/network | | |
# +-------------+--------------------------------------------------+ | |
./vsode --proxy-server=http://127.0.0.1:7890 # --no-proxy-server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment