科学上网工具 Websocks

三周前,得知了一款新的科学上网工具——Websocks

网站:https://websocks.org/
Github:https://github.com/lzjluzijie/websocks

安装 Websocks:

作者提供了丰富的预编译版本,下载解压即可使用,很是方便。

wget https://github.com/lzjluzijie/websocks/releases/download/v0.5.0/websocks_Linux_x86_64.tar.gz
tar -xzvf websocks_Linux_x86_64.tar.gz
chmod +x websocks

安装 Caddy:

Websocks 采用了 TLS 加密传输。用户既可以采用内置的 TLS,也可以 使用 Caddy 实现 TLS。若采用后者,则需要安装 Caddy——一个简单易用的 Web 代理服务器,可以自动申请 Let’s Encrypt TLS 证书。

wget https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/caddy_install.sh
chmod +x caddy_install.sh
./caddy_install.sh

Caddy 的配置文件 Caddyfile(/usr/local/caddy/Caddyfile):

https://你的 VPS 的域名 {
  proxy /密码 localhost:监听端口 {
  websocket
  }
}

启动/停止/重启 Caddy

service caddy start/stop/restart   systemctl start/stop/restart caddy

Caddy自动申请SSL证书位置:/.caddy/acme/acme-v01.api.letsencrypt.org/sites/xxx.xxx(域名)/

卸载 Caddy./caddy_install.sh uninstall

参考:『原创』Go 语言 跨平台支持的极简 HTTP Server —— Caddy 一键安装脚本

Systemd 配置:

vi /etc/systemd/system/websocks.service

内容如下:

[Unit]
Description=websocks

[Service]
ExecStart=/root/websocks server -l 127.0.0.1:监听端口 -p /密码
# 若使用内置 TLS,此行应为 ExecStart=/root/websocks server -l 127.0.0.1:监听端口 -p /密码 https://www.debian.org/ --tls
Restart=always

[Install]
WantedBy=multi-user.target

运行/停止/重启 Websocks

service websocks start/stop/restart systemctl start/stop/restart websocks.service

设为自启动:systemctl enable websocks.service

客户端:

内置 TLS./websocks client -l :1080 -s wss://the-real-server.com:2333/密码 -n www.debian.org --insecure

Caddy TLS./websocks client -l :1080 -s wss://server.com/密码

 

欢迎分享或转载,转载请注明出处。

本文固定链接:https://www.oixxu.com/anti-gfw-tool-websocks/

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注