diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66dd7d6..8dee0ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,10 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Bump version based on tag + if: startsWith(github.ref, 'refs/tags/v') + run: python scripts/bump_version.py ${{ github.ref_name }} + - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@stable with: @@ -138,6 +142,10 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Bump version based on tag + if: startsWith(github.ref, 'refs/tags/v') + run: python scripts/bump_version.py ${{ github.ref_name }} + # ── Rust toolchain ───────────────────────────────────────────────────── - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@stable @@ -240,6 +248,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Bump version based on tag + if: startsWith(github.ref, 'refs/tags/v') + run: python scripts/bump_version.py ${{ github.ref_name }} + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -312,6 +324,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Bump version based on tag + if: startsWith(github.ref, 'refs/tags/v') + run: python scripts/bump_version.py ${{ github.ref_name }} + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -374,6 +390,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Bump version based on tag + if: startsWith(github.ref, 'refs/tags/v') + run: python scripts/bump_version.py ${{ github.ref_name }} + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -434,6 +454,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Bump version based on tag + if: startsWith(github.ref, 'refs/tags/v') + run: python scripts/bump_version.py ${{ github.ref_name }} + - name: Setup Java uses: actions/setup-java@v3 with: diff --git a/CRITICAL_FIXES_SUMMARY.md b/CRITICAL_FIXES_SUMMARY.md deleted file mode 100644 index d95de4a..0000000 --- a/CRITICAL_FIXES_SUMMARY.md +++ /dev/null @@ -1,174 +0,0 @@ -# CRITICAL FIXES - Summary Report - -**Date:** 2026-06-17 -**Status:** COMPLETED - -## Changes Made - -### 1. ostp-client (Commit: b5e830a) - -#### Buffer Optimization -```diff -- .stack_buffer_size(1024) → + .stack_buffer_size(65536) (64 KB) -- .tcp_buffer_size(1024) → + .tcp_buffer_size(131072) (128 KB) -- .udp_buffer_size(1024) → + .udp_buffer_size(65536) (64 KB) -``` -**Impact:** +15-20% throughput improvement, reduced blocking - -#### UDP Handler Implementation -- **Before:** `Err(anyhow!("OSTP UDP handler not yet fully migrated"))` -- **After:** Complete implementation with proper session routing - - Encodes UDP packets with OSTP protocol - - Supports ConnectOk/Data/Close relay messages - - Handles timeouts and keep-alive - -#### Router Performance -- **Problem:** `to_lowercase()` called per rule check in hot path -- **Fix:** Cache lowercase values outside iterator - - Domain matching: Single `to_lowercase()` for SNI - - Process matching: Single `to_lowercase()` for process name -- **Impact:** ~30% faster routing - -#### Cleanup -- Deleted `bridge.rs.bak` (113KB unused file) -- Deleted `runner.rs.bak` (15KB unused file) - ---- - -### 2. ostp-gui (Commit: d91d5de) - -#### IPC Security -- **Problem:** Plain JSON messages between GUI and helper -- **Solution:** ChaCha20Poly1305 encryption - - New module: `ipc_crypto.rs` - - Key derivation from auth token using SHA-256 - - All messages encrypted/decrypted before transmission - - Hex encoding for safe transport - -#### Connection Timeout -```diff -- timeout(Duration::from_secs(60)) → timeout(Duration::from_secs(15)) -``` -**Impact:** Users see errors faster, better UX - -#### Error Handling -```diff -- listener.local_addr().unwrap().port() -+ listener.local_addr().map_err(...)?.port() -``` -- Replaced `.unwrap()` with proper `?` propagation -- Better error messages for debugging - -#### Dependencies Added -```toml -chacha20poly1305 = "0.10" -sha2 = "0.10" -hex = "0.4.3" -``` - ---- - -## Metrics - -### Before Fixes -| Component | Throughput | Stability | Latency | -|-----------|-----------|-----------|---------| -| ostp-client | ~85 Mbps | 7/10 | Good | -| ostp-gui | Timeout=60s | 6/10 | Variable | - -### After Fixes -| Component | Throughput | Stability | Latency | -|-----------|-----------|-----------|---------| -| ostp-client | ~100 Mbps | 8/10 | Good | -| ostp-gui | Timeout=15s | 8/10 | Fast | - -**Improvements:** -- Client throughput: +18% (buffer optimization + UDP handler) -- GUI stability: +33% (encryption + error handling) -- GUI UX: Much faster failure detection (75% timeout reduction) - ---- - -## Remaining Critical Issues - -### ostp-flutter -- [ ] Implement event-based updates instead of polling -- [ ] Add file logging support -- [ ] Fix traffic parsing (string manipulation) -- [ ] Encrypt native bridge with TLS - -### ostp-client (Minor) -- [ ] Add physical interface detection for Windows bypass -- [ ] Implement connection rate limiting - -### ostp-gui (Minor) -- [ ] Async process list loading (don't block UI) -- [ ] Add version negotiation for IPC messages - ---- - -## Testing Recommendations - -### ostp-client -```bash -# Test buffer optimization -iperf3 -c -b 100M # Should achieve ~100Mbps - -# Test UDP handler -tcpdump -i any 'udp port 53' # Verify DNS relay works -``` - -### ostp-gui -```bash -# Test encryption -tcpdump -i lo 'port 127.0.0.1 and tcp' # Verify no plaintext config - -# Test timeout -killall ostp-tun-helper && connect # Should fail in 15s (was 60s) -``` - ---- - -## Files Modified - -### ostp-client -- `ostp-client/src/tunnel/inbounds/tun.rs` - Buffer config -- `ostp-client/src/tunnel/outbounds/ostp.rs` - UDP handler -- `ostp-client/src/tunnel/router.rs` - Performance optimization - -### ostp-gui -- `ostp-gui/src-tauri/src/lib.rs` - Encryption integration -- `ostp-gui/src-tauri/src/ipc_crypto.rs` - New crypto module -- `ostp-gui/src-tauri/Cargo.toml` - Dependencies - -### Cleanup -- Deleted `ostp-client/src/bridge.rs.bak` -- Deleted `ostp-client/src/runner.rs.bak` - ---- - -## Next Steps - -1. **Week 1 (Complete):** - - Buffer optimization ✓ - - UDP handler ✓ - - IPC encryption ✓ - - Timeout reduction ✓ - -2. **Week 2-3 (Planned):** - - Flutter polling → events - - Async process list in GUI - - Version negotiation for IPC - -3. **Month 1 (Planned):** - - Crash reporting (Sentry) - - Integration tests - - Performance benchmarks - ---- - -## Status - -**ostp-client:** 7.3/10 → **8.0/10** ✅ Ready for production -**ostp-gui:** 6.3/10 → **7.8/10** ⚠️ Beta (good security now) -**ostp-flutter:** 5.7/10 → **5.7/10** 🔴 Still needs work diff --git a/Cargo.lock b/Cargo.lock index 4af129f..c439055 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1431,7 +1431,7 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "ostp" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "base64", @@ -1453,7 +1453,7 @@ dependencies = [ [[package]] name = "ostp-client" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "base64", @@ -1488,7 +1488,7 @@ dependencies = [ [[package]] name = "ostp-core" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "bytes", @@ -1522,7 +1522,7 @@ dependencies = [ [[package]] name = "ostp-server" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "axum", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "ostp-tun" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "libc", @@ -1566,7 +1566,7 @@ dependencies = [ [[package]] name = "ostp-tun-helper" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index c5b233f..43dd584 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ resolver = "2" [workspace.package] edition = "2021" license = "BSL 1.1" -version = "0.3.2" +version = "0.3.3" [workspace.dependencies] anyhow = "1.0" diff --git a/ostp-gui/package.json b/ostp-gui/package.json index 2e89be6..187f947 100644 --- a/ostp-gui/package.json +++ b/ostp-gui/package.json @@ -1,7 +1,7 @@ { "name": "ostp-gui", "private": true, - "version": "0.1.0", + "version": "0.3.3", "type": "module", "scripts": { "tauri": "tauri", @@ -13,4 +13,4 @@ "devDependencies": { "@tauri-apps/cli": "^2" } -} +} \ No newline at end of file diff --git a/ostp-gui/src-tauri/Cargo.toml b/ostp-gui/src-tauri/Cargo.toml index b4a59c0..e5d27a6 100644 --- a/ostp-gui/src-tauri/Cargo.toml +++ b/ostp-gui/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ostp-gui" -version = "0.1.0" +version = "0.3.3" description = "A Tauri App" authors = ["you"] edition = "2021" diff --git a/ostp-gui/src-tauri/tauri.conf.json b/ostp-gui/src-tauri/tauri.conf.json index 17b3fd8..e0305f8 100644 --- a/ostp-gui/src-tauri/tauri.conf.json +++ b/ostp-gui/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "ostp-gui", - "version": "0.3.2", + "version": "0.3.3", "identifier": "com.ospab.ostp", "build": { "frontendDist": "../src" @@ -32,4 +32,4 @@ "icons/icon.ico" ] } -} +} \ No newline at end of file diff --git a/ostp/src/main.rs b/ostp/src/main.rs index 5db6e6c..49d5cd0 100644 --- a/ostp/src/main.rs +++ b/ostp/src/main.rs @@ -180,9 +180,10 @@ enum AppMode { #[derive(Debug, Deserialize, Serialize)] struct UnifiedConfig { + version: Option, + log: Option, #[serde(flatten)] mode: AppMode, - log_level: Option, } impl UnifiedConfig { @@ -791,7 +792,9 @@ fn run_setup_wizard(config_path: &std::path::Path) -> Result<()> { let server_json = serde_json::json!({ "mode": "server", "version": "0.3.1", - "log_level": "info", + "log": { + "level": "info" + }, "listen": listen, "access_keys": access_keys, "outbound": { @@ -918,7 +921,9 @@ fn run_setup_wizard(config_path: &std::path::Path) -> Result<()> { let server_json = serde_json::json!({ "mode": "server", "version": "0.3.1", - "log_level": "info", + "log": { + "level": "info" + }, "listen": listen, "access_keys": access_keys, "outbound": { @@ -1043,6 +1048,9 @@ By downloading, installing, or using the Control Panel, you agree to the followi let relay_json = serde_json::json!({ "mode": "relay", "version": "0.3.1", + "log": { + "level": "info" + }, "listen": listen, "upstream_tcp": upstream, "upstream_udp": upstream, @@ -1244,7 +1252,8 @@ async fn run_app() -> Result<()> { .map_err(|e| anyhow!("Share Link Error: {e}"))?; let unified = UnifiedConfig { mode: AppMode::Client(client_cfg), - log_level: Some("info".to_string()), + version: Some("0.3.1".to_string()), + log: Some(serde_json::json!({ "level": "info" })), }; let content = serde_json::to_string_pretty(&unified)?; if let Some(parent) = args.config.parent() { @@ -1396,9 +1405,13 @@ async fn run_app() -> Result<()> { let key = generate_secure_key("hex"); let content = if is_server { format!(r#"{{ - // OSTP Server Configuration + // OSTP Configuration v0.3.1 + // DO NOT EDIT THIS COMMENT - Migrator relies on it + "version": "0.3.1", "mode": "server", - "log_level": "info", + "log": {{ + "level": "info" + }}, // The address and port the server listens on for incoming OSTP connections. "listen": "0.0.0.0:50000", @@ -1450,8 +1463,13 @@ async fn run_app() -> Result<()> { }}"#, key) } else if mode_str == "relay" { r#"{ - // OSTP Relay Node Configuration + // OSTP Configuration v0.3.1 + // DO NOT EDIT THIS COMMENT - Migrator relies on it + "version": "0.3.1", "mode": "relay", + "log": { + "level": "info" + }, "listen": "0.0.0.0:50000", "upstream_tcp": "TARGET_SERVER_IP:50000", "upstream_udp": "TARGET_SERVER_IP:50000", diff --git a/scripts/bump_version.py b/scripts/bump_version.py new file mode 100644 index 0000000..416db8f --- /dev/null +++ b/scripts/bump_version.py @@ -0,0 +1,46 @@ +import os +import sys +import json +import re + +def main(): + if len(sys.argv) < 2: + print("Usage: python bump_version.py ") + sys.exit(1) + + version = sys.argv[1] + if version.startswith("v"): + version = version[1:] + + print(f"Bumping version to {version}") + + cargo_paths = ["Cargo.toml", "ostp-gui/src-tauri/Cargo.toml"] + for cp in cargo_paths: + if os.path.exists(cp): + content = open(cp, "r", encoding="utf-8").read() + content = re.sub(r'(?m)^version = ".*"$', f'version = "{version}"', content, count=1) + open(cp, "w", encoding="utf-8").write(content) + print(f"Updated {cp}") + + # 2. Update ostp-gui/package.json + pkg_path = "ostp-gui/package.json" + if os.path.exists(pkg_path): + with open(pkg_path, "r", encoding="utf-8") as f: + data = json.load(f) + data["version"] = version + with open(pkg_path, "w", encoding="utf-8") as f: + json.dump(data, f, indent=2) + print(f"Updated {pkg_path}") + + # 3. Update ostp-gui/src-tauri/tauri.conf.json + tauri_path = "ostp-gui/src-tauri/tauri.conf.json" + if os.path.exists(tauri_path): + with open(tauri_path, "r", encoding="utf-8") as f: + data = json.load(f) + data["version"] = version + with open(tauri_path, "w", encoding="utf-8") as f: + json.dump(data, f, indent=2) + print(f"Updated {tauri_path}") + +if __name__ == "__main__": + main()