老鬼的博客 来都来啦,那就随便看看吧~
gost搭建http和socks代理
发布于: 2022-09-23 更新于: 2023-03-28 分类于:  阅读次数: 

一:安装gost

1
2
3
4
wget https://github.com/ginuerzh/gost/releases/download/v2.11.1/gost-linux-amd64-2.11.1.gz
gunzip gost-linux-amd64-2.11.1.gz
mv gost-linux-amd64-2.11.1 /usr/bin/gost
chmod +x /usr/bin/gost

二:开启全代理(不需要认证)

1
2
gost -L=:8627
8627是端口号可以自己设置

三:开启全代理(需要认证)

1
2
3
gost -L=userName:password@:8627
useName:用户名
password:密码

四:后台启动

1
2
nohup gost -L=:8627 &
nohup gost -L=userName:password@:8627 &

五:脚本

  • start_gost.sh
1
2
3
echo 'start gost in 8627 ...'
nohup gost -L=userName:password@:8627 &
echo 'start gost success ...'
  • stop_gost.sh
1
2
3
4
5
6
7
8
9
10
port=8627
#根据端口号查询对应的pid
pid=$(netstat -nlp | grep :$port | awk '{print $7}' | awk -F"/" '{ print $1 }');
echo "pid is :${pid}"
#杀掉对应的进程,如果pid不存在,则不执行
if [ -n "$pid" ]; then
echo 'kill socks5 start ...'
kill -9 $pid;
echi 'kill socks5 success ...'
fi
  • restart_gost.sh
1
2
sh stop_gost.sh
sh start_gost.sh
*************感谢您的阅读*************