sock5协议转换http协议工具polipo使用笔记(Centos7)

  • A+
所属分类:Linux

一、安装

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等文件来实现更大的代理范围

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: