Files
mysql-tunnel/tests/README.md
T
2026-09-21 16:00:26 +08:00

28 lines
930 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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)。