Socat一键安装脚本,可转发TCP和UDP流量,支持IPv4和IPv6 https://github.com/baichal/Socat.git
Go to file
baichal 721cca630d
Update socat.sh
1.引入了配置文件 /etc/socat_forwards.conf 来存储转发信息。
2.新增 init_config、add_to_config 和 remove_from_config 函数来管理配置文件。
3.修改了 start_socat 函数,在成功启动后将信息添加到配置文件。
4.重写了 view_delete_forward 函数,现在它直接从配置文件读取信息,而不是从进程列表。
5.更新了 kill_all_socat 函数,现在它会清空配置文件。
6.将配置文件路径改为当前目录:CONFIG_FILE="./socat_forwards.conf"
7.修改了 start_socat 函数中的日志文件路径为当前目录:>> ./socat.log 2>&1 &
8.在 add_to_startup 函数中,使用 $(pwd) 获取当前目录的绝对路径,确保开机自启动时能找到正确的日志文件位置
2024-08-14 18:13:37 +08:00
LICENSE Initial commit 2024-08-14 17:57:50 +08:00
README.md Update README.md 2024-08-14 18:01:56 +08:00
socat.sh Update socat.sh 2024-08-14 18:13:37 +08:00

README.md

Socat一键安装脚本

系统要求支持CentOS 6+ 、Debian 7+、Ubuntu 14+

脚本说明脚本默认开启UDP、TCP转发带开机自启功能。

使用 root 运行以下命令:

wget https://raw.githubusercontent.com/baichal/Socat/main/socat.sh && bash socat.sh

按要求输入本地服务器端口要转发的目标端口和服务器IP即可