WireGuard カーネルモジュール、ip コマンドを含む完全な Linux 環境で
Control + Gateway + Agent の結合テストを実行する。
- Windows 11 + Hyper-V 有効
- Vagrant (
winget install Hashicorp.Vagrant)
cd C:\Users\neo\GitHub\kakuremichi-org\test
vagrant up --provider=hyperv- ネットワークスイッチ → Default Switch を選択
- SMB共有 → Windows のログインパスワードを入力
- プロビジョニングで Go 1.24, Node.js 22, WireGuard が自動インストールされる
vagrant sshcd /kakuremichi/test
sudo bash run-full-test.shテストは 9 Phase で実行される:
| Phase | 内容 | 何を確認するか |
|---|---|---|
| 1 | Go build & unit test | Gateway/Agent のビルドとテスト |
| 2 | Control server 起動 | Next.js + WebSocket が正常起動 |
| 3 | API データ投入 | Gateway/Agent/Tunnel の登録 |
| 4 | WireGuard interface | カーネルモジュールで wg0 作成 |
| 5 | Gateway 起動 | Control接続、WG設定受信 |
| 6 | Agent 起動 | Control接続、netstack WG作成 |
| 7 | トンネル確立 | WG peer、IP割り当て、ping |
| 8 | Inbound proxy | Gateway → Agent → origin HTTP |
| 9 | Exit Node proxy | Agent HTTP/SOCKS5 → Gateway → Internet |
| 10 | Domain + SSL | 自己証明書HTTPS、ドメインルーティング |
# VM内で
tail -50 /tmp/control.log
tail -50 /tmp/gateway.log
tail -50 /tmp/agent.logsudo bash run-full-test.sh # 毎回クリーンに実行される (cleanup trap)vagrant ssh # ログイン
vagrant halt # 停止
vagrant up # 再起動
vagrant destroy -f # 完全削除test/
├── Vagrantfile # Hyper-V VM 定義 (Ubuntu 24.04)
├── run-full-test.sh # フル E2E テストスクリプト (9 Phase)
├── .gitignore
└── README.md
VM (Ubuntu 24.04, Hyper-V)
│
├── Control (Node.js, port 3000)
│ ├── Next.js API (/api/*)
│ └── WebSocket (/ws)
│
├── Gateway (Go binary)
│ ├── wg0 (kernel WireGuard, port 51820)
│ ├── HTTP proxy (port 8080)
│ └── Exit Node proxy (WG IP上)
│
├── Agent (Go binary)
│ ├── netstack WireGuard (userspace)
│ ├── Local proxy (仮想IP:80)
│ └── Exit Node proxy (localhost:8080/1080)
│
└── Origin (python3 http.server, port 9000)
vagrant upは管理者PowerShellが必要- SMB共有でプロジェクトディレクトリをVM内の
/kakuremichiにマウント - テストは毎回プロセスを起動→テスト→cleanup なのでDBは使い捨て
- Gateway の ACME/SSL は無効 (テスト不要)