28 lines
930 B
Markdown
28 lines
930 B
Markdown
# 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)。
|