简介
gost 是一个用 Go 语言实现的安全隧道,是一个开源的代理工具
通过 gost 可将 A 机器的请求转发给 B 机器处理,或者将本地 C 端口的数据转发到远程 D 端口
环境
- Debian 11 64 bit
主要步骤
安装 gost
在当前目录下创建文件夹
1
mkdir gost && cd gost
下载软件
1
wget -O gost.gz https://github.com/ginuerzh/gost/releases/download/v2.11.0/gost-linux-amd64-2.11.0.gz
解压
1
gzip gost.gz -d
赋予权限
1
chmod 777 gost
软链接
1
ln gost /usr/bin/gost
启动 gost
Debian
1
gost -L relay+tls://[username]:[password]@:[port]
开机自启
创建
gost.sh
脚本,并填入后台启动命令1
nohup gost -L relay+tls://[username]:[password]@:[port] 1>/dev/null 2>&1 &
赋予可执行权限
1
chmod +x gost.sh
Debain 11 默认不带
/etc/rc.local
文件,需要手动新建1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
../[pwd]/gost.sh
exit 0
EOF同样赋予可执行权限
1
chmod +x /etc/rc.local
启动
rc-local
服务1
systemctl enable --now rc-local