Skip to content
This repository was archived by the owner on May 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ jobs:
CGO_ENABLED: 0
run: |
go build -ldflags="-s -w -X main.Version=${GITHUB_REF_NAME}" \
-o ../dist/zasca-tunnel-${{ matrix.goos }}-${{ matrix.goarch }}.exe \
-o ../dist/2c2a-tunnel-${{ matrix.goos }}-${{ matrix.goarch }}.exe \
./cmd/tunnel/

- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: zasca-tunnel-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/zasca-tunnel-${{ matrix.goos }}-${{ matrix.goarch }}.exe
name: 2c2a-tunnel-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/2c2a-tunnel-${{ matrix.goos }}-${{ matrix.goarch }}.exe
retention-days: 90

release:
Expand Down
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

<h1>ZASCA Tunnel</h1>
<h1>2c2a Tunnel</h1>

<p>
<strong>边缘代理 — Windows 服务 + WSS 客户端 + 多路复用</strong><br>
Expand All @@ -10,18 +10,26 @@
<p>
<img src="https://img.shields.io/badge/Go-1.22+-00ADD8?logo=go&logoColor=white" alt="Go 1.22+">
<img src="https://img.shields.io/badge/Platform-Windows-0078D4?logo=windows&logoColor=white" alt="Windows">
<img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT">
<img src="https://img.shields.io/badge/License-AGPL--3.0-blue.svg" alt="License: AGPL-3.0">
</p>

</div>

---

> **⚠️ 仓库已归档**
>
> 本仓库已停止维护并归档。所有功能(WSS 客户端、Windows 服务、远程执行等)已合并至 [gateway 仓库](../gateway),隧道客户端源码现位于 `gateway/cmd/tunnel/` 目录。
>
> 请前往 👉 **[gateway](../gateway)** 获取最新代码和文档。

---

## 架构概览

![Tunnel Architecture](./docs/architecture.svg)

zasca-tunnel 运行在被管的 Windows 主机上,通过 WSS 隧道连接到 Gateway,提供:
2c2a-tunnel 运行在被管的 Windows 主机上,通过 WSS 隧道连接到 Gateway,提供:

| 通道 | 代码 | 说明 |
|------|------|------|
Expand All @@ -37,27 +45,27 @@ zasca-tunnel 运行在被管的 Windows 主机上,通过 WSS 隧道连接到 G
### 安装为 Windows 服务

```bash
zasca-tunnel.exe install \
2c2a-tunnel.exe install \
-token <TOKEN> \
-server wss://gateway.example.com:9000
```

安装后自动:
- 创建 Windows 服务(`ZASCA Edge Service`)
- 创建 Windows 服务(`2c2a Edge Service`)
- 设置开机自启(`Auto Start`)
- 写入配置到 `C:\ProgramData\ZASCA\tunnel.yaml`
- 写入配置到 `C:\ProgramData\2c2a\tunnel.yaml`
- 立即启动服务

### 查看版本

```bash
zasca-tunnel.exe version
2c2a-tunnel.exe version
```

### 卸载

```bash
zasca-tunnel.exe uninstall
2c2a-tunnel.exe uninstall
```

## 项目结构
Expand Down Expand Up @@ -92,15 +100,15 @@ git push origin tunnel/v1.0.0
```

自动生成:
- `zasca-tunnel-windows-amd64.exe`
- `zasca-tunnel-windows-arm64.exe`
- `2c2a-tunnel-windows-amd64.exe`
- `2c2a-tunnel-windows-arm64.exe`
- `checksums-sha256.txt`
- GitHub Release(含版本说明)

## 安全特性

- **Ed25519 密钥交换**:每次连接自动生成临时密钥对,公钥发送给 Gateway
- **Token 认证**:每个主机使用唯一 Token,由 ZASCA 平台生成
- **Token 认证**:每个主机使用唯一 Token,由 2c2a 平台生成
- **TLS 加密**:WSS 连接全程 TLS 加密
- **签名验证**:RemoteExec 支持命令签名验证(防篡改)
- **SYSTEM 权限**:以 Windows 服务运行,拥有完整系统权限
Expand All @@ -114,7 +122,7 @@ git push origin tunnel/v1.0.0

## 配置文件

`C:\ProgramData\ZASCA\tunnel.yaml`:
`C:\ProgramData\2c2a\tunnel.yaml`:

```yaml
token: "your-tunnel-token"
Expand All @@ -125,4 +133,4 @@ winrm_port: "127.0.0.1:5986"

## 许可证

MIT License - 查看 [LICENSE](LICENSE) 文件了解详情。
AGPL-3.0 License - 查看 [LICENSE](LICENSE) 文件了解详情。
16 changes: 8 additions & 8 deletions cmd/tunnel/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
)

const (
serviceName = "ZASCA Edge Service"
serviceDisplay = "ZASCA Edge Service"
serviceDesc = "Provides secure tunnel connectivity for ZASCA cloud desktop management platform"
installDir = `C:\Program Files\ZASCA`
configDir = `C:\ProgramData\ZASCA`
serviceName = "2c2a Edge Service"
serviceDisplay = "2c2a Edge Service"
serviceDesc = "Provides secure tunnel connectivity for 2c2a cloud desktop management platform"
installDir = `C:\Program Files\2c2a`
configDir = `C:\ProgramData\2c2a`
configFile = `tunnel.yaml`
serviceBinary = `zasca-tunnel.exe`
serviceBinary = `2c2a-tunnel.exe`
)

func runInstall(token, server string) error {
Expand All @@ -36,7 +36,7 @@ func runInstall(token, server string) error {
return fmt.Errorf("failed to install service: %w", err)
}

fmt.Println("ZASCA Edge Service installed successfully")
fmt.Println("2c2a Edge Service installed successfully")
fmt.Printf("Config written to: %s\n", cfgPath)
fmt.Println("Service will auto-start on boot")
return nil
Expand All @@ -50,6 +50,6 @@ func runUninstall() error {
cfgPath := filepath.Join(configDir, configFile)
os.Remove(cfgPath)

fmt.Println("ZASCA Edge Service uninstalled successfully")
fmt.Println("2c2a Edge Service uninstalled successfully")
return nil
}
16 changes: 8 additions & 8 deletions cmd/tunnel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func main() {

switch os.Args[1] {
case "version":
fmt.Printf("zasca-tunnel %s\n", Version)
fmt.Printf("2c2a-tunnel %s\n", Version)
case "install":
installCmd := flag.NewFlagSet("install", flag.ExitOnError)
token := installCmd.String("token", "", "tunnel token from ZASCA platform")
server := installCmd.String("server", "", "gateway server address (e.g., wss://gateway.zasca.com:9000)")
token := installCmd.String("token", "", "tunnel token from 2c2a platform")
server := installCmd.String("server", "", "gateway server address (e.g., wss://gateway.2c2a.com:9000)")
installCmd.Parse(os.Args[2:])

if *token == "" || *server == "" {
Expand All @@ -36,7 +36,7 @@ func main() {

case "run":
runCmd := flag.NewFlagSet("run", flag.ExitOnError)
configPath := runCmd.String("config", "C:\\ProgramData\\ZASCA\\tunnel.yaml", "config file path")
configPath := runCmd.String("config", "C:\\ProgramData\\2c2a\\tunnel.yaml", "config file path")
runCmd.Parse(os.Args[2:])

if err := runService(*configPath); err != nil {
Expand All @@ -57,7 +57,7 @@ func main() {
}

func printUsage() {
fmt.Println("ZASCA Tunnel - Edge Service")
fmt.Println("2c2a Tunnel - Edge Service")
fmt.Printf("Version: %s\n", Version)
fmt.Println()
fmt.Println("Commands:")
Expand All @@ -67,7 +67,7 @@ func printUsage() {
fmt.Println(" uninstall - Uninstall the Windows service")
fmt.Println()
fmt.Println("Usage:")
fmt.Println(" zasca-tunnel.exe install -token <TOKEN> -server <WSS_URL>")
fmt.Println(" zasca-tunnel.exe run -config <PATH>")
fmt.Println(" zasca-tunnel.exe uninstall")
fmt.Println(" 2c2a-tunnel.exe install -token <TOKEN> -server <WSS_URL>")
fmt.Println(" 2c2a-tunnel.exe run -config <PATH>")
fmt.Println(" 2c2a-tunnel.exe uninstall")
}
4 changes: 2 additions & 2 deletions cmd/tunnel/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func runService(configPath string) error {
return fmt.Errorf("failed to load config: %w", err)
}

slog.Info("ZASCA Tunnel starting",
slog.Info("2c2a Tunnel starting",
"server", cfg.Server,
"rdp", cfg.RDP,
"winrm", cfg.WinRM,
Expand All @@ -42,7 +42,7 @@ func runService(configPath string) error {

if err := client.Run(ctx); err != nil {
if ctx.Err() != nil {
slog.Info("ZASCA Tunnel stopped")
slog.Info("2c2a Tunnel stopped")
return nil
}
return fmt.Errorf("tunnel run error: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/installation-flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading