一、安裝
Shadowsocks使用socks5協議,而終端很多工具目前只支持http和https等協議,所以我們為終端設置Shadowsocks的思路就是將socks5協議轉換成http協議,然后為終端設置即可。
安裝polipo(github地址:https://github.com/jech/polipo)
yum install -y texi2html texinfo
git clone https://github.com/jech/polipo.git cd polipo make all make install
二、配置polipo
vi /etc/polipo/config
socksParentProxy = "127.0.0.1:10080" socksProxyType = socks5 proxyAddress="0.0.0.0" proxyPort=58888 logFile = /var/log/polipo logLevel = 99 logSyslog = true daemonise=true chunkHighMark = 50331648 objectHighMark = 16384 serverMaxSlots = 64 serverSlots = 16 serverSlots1 = 32
polipo -v 可以查看支持的選項
三、啟動polipo
polipo -c /etc/polipo/config
四、polipo監聽58888端口
[root@k8s polipo]# ss -lntup|grep polipo tcp LISTEN 0 128 *:58888 *:* users:(("polipo",pid=57160,fd=5))
五、測試
curl -x 10.0.0.x:58888 ip.gs
六、添加http_proxy環境變量,實現全局代理
當前會話生效
[root@k8s ~]# export http_proxy=http://10.0.0.32:58888
[root@k8s ~]# export https_proxy=http://10.0.0.32:58888 [root@k8s ~]# curl ip.gs Current IP / 當前 IP: xx.xx.xx.xx ISP / 運營商: xxxxx City / 城市: xx Country / 國家: xx IP.GS is now IP.SB, please visit https://ip.sb/ for more information. / IP.GS 已更改為 IP.SB ,請訪問 https://ip.sb/ 獲取更詳細 IP 信息! Please join Telegram group https://t.me/sbfans if you have any issues. / 如有問題,請加入 Telegram 群 https://t.me/sbfans /\_/\ =( °w° )= ) ( // (__ __)//
取消此環境變量,關閉代理
unset http_proxy
同時可以將下面環境變量設置的語句添加到/etc/profile、~/.bashrc等文件來實現更大的代理范圍