# sing-box **Repository Path**: bwlab/sing-box ## Basic Information - **Project Name**: sing-box - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: dev-next - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-23 - **Last Updated**: 2026-01-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sing-box (wstunnel fork) 基于 [sing-box](https://github.com/SagerNet/sing-box) 的修改版,新增 **wstunnel** 协议支持。 ## 新增功能:wstunnel 协议 wstunnel 是一种基于 WebSocket 的隧道协议,通过 HTTP Header 中的 `Target-Address` 字段动态指定目标地址。 ### 特性 - 支持动态目标地址(每次连接时通过 `Target-Address` 头传递) - 支持 TLS 加密(WSS) - 兼容 IPv4、IPv6 和域名 - 可与 `urltest` 配合实现自动选优 ### 配置示例 ```json { "outbounds": [ { "type": "wstunnel", "tag": "my-proxy", "server": "example.com", "server_port": 443, "path": "/ws-path/", "tls": { "enabled": true, "insecure": true } } ] } ``` ### 配置参数 | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | `server` | string | ✓ | 服务器地址 | | `server_port` | int | ✓ | 服务器端口 | | `path` | string | | WebSocket 路径,默认 `/` | | `tls` | object | | TLS 配置 | ### 自动选优配置 ```json { "outbounds": [ { "type": "urltest", "tag": "auto", "outbounds": ["node1", "node2", "node3"], "url": "https://www.gstatic.com/generate_204", "interval": "3m", "tolerance": 50 }, { "type": "wstunnel", "tag": "node1", "server": "server1.example.com", "server_port": 443, "path": "/path/", "tls": { "enabled": true } } ], "route": { "final": "auto" } } ``` ## 编译 ```bash # 当前系统 go build -o sing-box ./cmd/sing-box # 交叉编译 GOOS=windows GOARCH=amd64 go build -o sing-box.exe ./cmd/sing-box GOOS=linux GOARCH=amd64 go build -o sing-box-linux ./cmd/sing-box GOOS=darwin GOARCH=arm64 go build -o sing-box-darwin ./cmd/sing-box ``` ## 使用 ```bash # 运行 ./sing-box run -c config.json # 验证配置 ./sing-box check -c config.json ``` 代理监听后,可通过 SOCKS5 或 HTTP 方式使用: ```bash curl -x socks5h://127.0.0.1:1080 https://httpbin.org/ip curl -x http://127.0.0.1:1080 https://httpbin.org/ip ``` --- ## 原项目 sing-box - The universal proxy platform. - 官方文档: https://sing-box.sagernet.org - 原仓库: https://github.com/SagerNet/sing-box ## License ``` Copyright (C) 2022 by nekohasekai This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ```