當linux 代理軟件設置好后,我們需要設置命令行代理的連接方式,這樣在命令行中的軟件才能使用:
設置http/https代理:
export https_proxy="127.0.0.1:12333"
export http_proxy="127.0.0.1:12333"
如果有密碼:
export http_proxy_user=test
export http_proxy_pass=test
測試代理http/https:
curl http://www.google.com
curl https://www.google.com
當然我們也可以設置 proxychains-ng 進行設置代理:(推薦)
apt install proxychains4 或者下載倉庫代碼進行編譯;
vim /etc/proxychains4.conf 修改配置文件配置 socks5 127.0.0.1 1080
測試:proxychains4 curl www.google.com
這樣支持tcp協議的軟件也能進行使用了;
# 此種方案,適合使用 aaex 代理,electron-ssr 和 git 配合使用;用來使用github進行輔助開發;
# git 命令設置代理 2021年1月21日
# 走socks5 git config --global http.proxy 'socks5://127.0.0.1:1080' git config --global https.proxy 'socks5://127.0.0.1:1080' # 走http git config --global http.proxy http://localhost:10809 git config --global https.proxy http://localhost:10809 # 涉及到文件 cat ~/.gitconfig # 取消設置 git config --global --unset http.proxy git config --global --unset https.proxy # 設置ssh; Host github.com HostName github.com User git ProxyCommand nc -v -x localhost:10808 %h %p # 涉及 ~/.ssh/ssh_config 文件 可參考:https://github.com/yaowenxu/envfile/tree/master/ssh
# 2021年11月5日10:06:00 git windows 平台下,代理設置(基於connect 命令,7891為 clash 默認端口)
Host github.com HostName github.com User git ProxyCommand connect -S 127.0.0.1:7891 -a none %h %p
connect.c is a simple relaying command to make network connection via SOCKS and https proxy. It is mainly intended to be used as proxy command of OpenSSH.
You can make SSH session beyond the firewall with this command, Features of connect.c are: Supports SOCKS (version 4/4a/5) and https CONNECT method. Supports NO-AUTH and USERPASS authentication of SOCKS5 You can input password from tty, ssh-askpass or environment variable. Run on UNIX or Windows platform. You can compile with various C compiler (cc, gcc, Visual C, Borland C. etc.) Simple and general program independent from OpenSSH. You can also relay local socket stream instead of standard I/O.
保持更新,轉載請注明出處;更多內容請關注 cnblogs.com/xuyaowen;
