This commit is contained in:
Yangxt
2026-09-21 16:00:26 +08:00
parent d3c2189bf5
commit 01842c59c6
+27
View File
@@ -0,0 +1,27 @@
# Tests
## Go package tests
```bat
go test ./...
```
- `internal/config` — YAML load/save, listen bind rules, URL redaction
- `internal/logger` — token/password redaction
- `internal/tunnel` — HTTP client + Navicat magic-header sniff
- `internal/navicat` — GetBlock/header parser, actn=C/Q client, mock `ntunnel_mysql.php`
- `internal/mysqlserver` — handshake, mysql_native_password, COM_QUERY/PING/QUIT, ResultSet; official Go MySQL driver against the local server
Go tests do **not** hit the live tunnel.
## Python: 与影刀同一用法
[`rpa_tunnel.py`](rpa_tunnel.py) 即影刀流程写法(硬编码,不读 yaml),`main` 返回 `args["conn"]`。
```bat
python tests\rpa_tunnel.py
```
须先启动 `mysql-tunnel.exe`,`listen` / `local_auth` 与脚本里 host/port/user/password 一致。
完整探测(读 `config.yaml`、多条 SQL、可选 `--direct`)见 [`http_tunnel.py`](http_tunnel.py)。