首页 登录
返回 首页

python实现的翻墙工具, 基于 WebSocket 的 SOCKS5 代理工具,


原理

本地应用 <--SOCKS5--> 客户端 <--WebSocket--> 服务端 <--TCP--> 目标服务器

对比

同一服务器与v2ray对比

对比图

安装

pip install wsocks

使用方法

1. 服务端配置

编辑 config_server.json

{
  "server": {
    "host": "0.0.0.0",
    "port": 8888,
    "path": "/ws",
    "password": "your-password-here"
  },
  "log_level": "INFO"
}

2. 启动服务端

在有公网 IP 的服务器上运行:

wsocks_server -c config_server.json

3. 客户端配置

编辑 config_client.json

{
  "server": {
    "url": "ws://your-server.com:8888/ws",
    "password": "your-password-here"
  },
  "local": {
    "host": "127.0.0.1",
    "port": 1080
  },
  "log_level": "INFO"
}

4. 启动客户端

wsocks_client -c config_client.json

5. 配置代理

在浏览器或应用中设置 SOCKS5 代理: - 服务器:127.0.0.1 - 端口:1080

配置参数说明

服务端参数

参数 说明 默认值
host 监听地址 0.0.0.0
port 监听端口 8888
password 连接密码 -
timeout 连接超时(秒) 30
max_connections 最大并发连接数 1000

客户端参数

参数 说明 默认值
server.url 服务端地址 -
server.password 连接密码 -
server.ws_pool_size WebSocket 连接池大小 8
local.port 本地 SOCKS5 端口 1080

打包:

pyinstaller --onefile --hidden-import=websockets --hidden-import=tornado wsocks/run_client.py


评论(0)

点击加载验证码