当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;