You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 263c248
Browse filesBrowse the repository at this point in the historyBrowse files
**Automated proxy discovery, testing, and intelligent routing for OpenCode. Fix connectivity issues and IP-based rate limits with Xray/V2Ray on Linux.**
12
+
**Automated proxy discovery, testing, and intelligent routing for OpenCode. Fix connectivity issues and IP-based rate limits with Xray/V2Ray on Linux and Windows.**
> **No WSL Required**: On Windows, OpenCode Router runs directly as a native Windows application using PowerShell, CMD, Node.js, and native `xray.exe`. Windows Subsystem for Linux (WSL) is neither required nor used.
- Download the official Xray-core binary if missing from `bin/`.
158
-
- Compile the modern React frontend if `dist/` is not present.
159
-
- Ensure `bin/opencode-vpn` has executable permissions.
160
-
- Start the backend server on `http://localhost:3000`.
161
-
- Open your default web browser to the dashboard.
181
+
The Linux startup script will automatically provision Xray-core, build the frontend if missing, start the backend server, and open the dashboard at `http://localhost:3000`.
162
182
163
183
---
164
184
@@ -188,9 +208,24 @@ Available environment variables:
188
208
3. Watch the live testing feed cycle through ranked nodes.
189
209
4. Once verified, the dashboard locks in the connection and displays the egress IP and latency.
190
210
191
-
### Using the Command-Line Wrapper
192
-
Execute OpenCode commands through `bin/opencode-vpn`:
211
+
### Using the Command-Line Wrapper (Windows & Linux)
212
+
213
+
Once a working node is active in the dashboard, execute OpenCode commands through `opencode-vpn`:
193
214
215
+
#### On Windows (PowerShell, Windows Terminal, or Command Prompt):
216
+
```powershell
217
+
# Launch interactive terminal-based OpenCode CLI with active proxy
218
+
opencode-vpn
219
+
220
+
# Run non-interactive query through proxy
221
+
opencode-vpn run "Explain this codebase"
222
+
opencode-vpn run "What is 2 + 2?" --pure
223
+
224
+
# Version check
225
+
opencode-vpn --version
226
+
```
227
+
228
+
#### On Linux / macOS (Bash):
194
229
```bash
195
230
# Launch interactive OpenCode terminal through the active proxy
196
231
bin/opencode-vpn
@@ -252,10 +287,12 @@ Traffic flow:
252
287
| Symptom | Probable Cause | Recommended Solution |
253
288
| :--- | :--- | :--- |
254
289
|`curl: (7) Failed to connect to 127.0.0.1:10809`| Proxy engine is stopped or idle. | Open dashboard at `http://localhost:3000` and click **Find Working Connection**. |
290
+
|`Execution of scripts is disabled on this system` (PowerShell) | PowerShell ExecutionPolicy defaults to `Restricted`. | Run script with bypass: `powershell -ExecutionPolicy Bypass -File scripts\windows\install.ps1`. |
291
+
|`'opencode-vpn' is not recognized` (Windows) | Terminal session opened before PATH was modified. | Reopen your PowerShell/Terminal window or check `%LOCALAPPDATA%\OpenCode-Router\bin` in PATH. |
255
292
|`Error: connect ETIMEDOUT`| Candidate node remote endpoint unreachable. | The orchestrator will automatically fail over; or click **Refresh Nodes**. |
256
293
|`HTTP 429: insufficient_quota`| Account-level token budget exhausted. | Top up your provider API credits. IP switching cannot fix account balance limits. |
257
-
|`Authentication failure (401)`| Invalid API key in OpenCode configuration. | Verify your API key in `~/.config/opencode/opencode.json`. |
258
-
| Port 3000 already in use | Another service is using port 3000. |Start with custom port: `PORT=3001 ./start.sh`. |
294
+
|`Authentication failure (401)`| Invalid API key in OpenCode configuration. | Verify your API key in `~/.config/opencode/opencode.json` (or `%APPDATA%\opencode\opencode.json`). |
295
+
| Port 3000 already in use | Another service is using port 3000. |Linux: `PORT=3001 ./start.sh` <br> Windows: `$env:PORT="3001"; .\scripts\windows\start.ps1`. |
259
296
260
297
For in-depth troubleshooting guides, refer to our [Technical Articles](#technical-documentation--articles).
261
298
@@ -269,12 +306,25 @@ For in-depth troubleshooting guides, refer to our [Technical Articles](#technica
269
306
270
307
---
271
308
272
-
## 18. Testing
309
+
## 18. Testing & Validation
273
310
274
-
OpenCode Router includes a comprehensive automated test suite covering protocol parsing, Xray client JSON generation, process cleanup, rate-limit classification, and network isolation:
311
+
OpenCode Router includes automated test suites covering protocol parsing, Xray client generation, process cleanup, cross-platform path resolution, rate-limit classification, and pipeline speed benchmarks:
275
312
276
313
```bash
314
+
# Run core acceptance and security tests (Linux & POSIX)
277
315
npm test
316
+
317
+
# Run cross-platform platform abstraction & Windows compatibility tests
318
+
npm run test:windows
319
+
320
+
# Run high-speed 3-stage pipeline & canary benchmark tests
321
+
npx tsx tests/pipeline-speed-tests.ts
322
+
323
+
# Provision official Xray-core binary with SHA256 checksum verification
324
+
npm run provision:xray
325
+
326
+
# Package standalone portable distribution for Windows
327
+
npm run package:portable
278
328
```
279
329
280
330
All 8 acceptance test scenarios (A through G) execute deterministically without requiring root privileges.
# Detect explicit attach/server parameters to warn about external server routing
24
+
forargin"$@";do
25
+
if [[ "$arg"=="--attach"||"$arg"=="--server"||"$arg"=="attach"||"$arg"== --attach=*||"$arg"== --server=* ]];then
26
+
echo"[OpenCode Router WARNING] Detected explicit --attach/--server parameter. Outgoing requests from an external OpenCode server are controlled by that server's process and may NOT route through this active proxy tunnel!">&2
27
+
break
28
+
fi
29
+
done
30
+
31
+
# Decide whether to inject --standalone for private proxy-isolated execution
0 commit comments