From bcf78b680635fd44009aaf364ebb8c3250c68603 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 19 Jun 2026 12:35:34 +0500 Subject: [PATCH 1/5] Update LivingMars.tsx Signed-off-by: Sergey --- src/components/LivingMars.tsx | 322 +--------------------------------- 1 file changed, 4 insertions(+), 318 deletions(-) diff --git a/src/components/LivingMars.tsx b/src/components/LivingMars.tsx index 468e5f4..b164fee 100644 --- a/src/components/LivingMars.tsx +++ b/src/components/LivingMars.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useRef, useMemo, useCallback } from "react"; +import { useRef, useEffect } from "react"; // ╔══════════════════════════════════════════════════════════════════════╗ // ║ MARSTART LINK — LIVING MARS · Premium Commercial Visualization ║ @@ -70,7 +70,7 @@ const ORBITS = [ // br=brightness ra=routeAlpha ps=particleSpeed ai=atmoIntensity // oa=orbitAlpha ml=ML monogram phase warn=warning flavour const PARAMS = { - offline: { br:0.09, ra:0.00, ps:0.00, ai:0.09, oa:0.04, ml:0.00, warn:null }, + offline: { br:0.35, ra:0.00, ps:0.00, ai:0.20, oa:0.10, ml:0.00, warn:null }, // Brightness increased from 0.09 connecting: { br:0.28, ra:0.18, ps:0.14, ai:0.28, oa:0.20, ml:0.04, warn:null }, connected: { br:0.68, ra:0.68, ps:1.00, ai:0.66, oa:0.56, ml:0.10, warn:null }, excellent: { br:1.00, ra:1.00, ps:1.50, ai:1.00, oa:0.86, ml:0.20, warn:null }, @@ -248,7 +248,7 @@ function drawBeam(ctx, alpha) { // ══════════════════════════════════════════════════════════════════════════ // LIVING MARS COMPONENT // ══════════════════════════════════════════════════════════════════════════ -function LivingMars({ state = 'offline' }) { +export function LivingMars({ state = 'offline' }: { state?: string }) { const canvasRef = useRef(null); const rafRef = useRef(null); const prevNow = useRef(null); @@ -336,7 +336,7 @@ function LivingMars({ state = 'offline' }) { rt.pri * (0.82 + 0.18 * Math.sin(time * 0.09 + i * 1.4)) ); - // ════════════════ RENDER LAYERS ═════════════════════════════════ + // ═══════════════════════════════════════════════════════════════ // 1 ── Deep space background ctx.fillStyle = T.space; ctx.fillRect(0, 0, W, H); @@ -489,317 +489,3 @@ function LivingMars({ state = 'offline' }) { /> ); } - -// ══════════════════════════════════════════════════════════════════════════ -// DEMO APPLICATION -// Design language: Linear · Arc · Stripe — expensive, silent, deliberate -// ══════════════════════════════════════════════════════════════════════════ - -// Simulated metrics per state -const METRICS = { - offline: { ping:'—', jitter:'—', loss:'—', quality:'—', traffic:'—' }, - connecting: { ping:'…', jitter:'…', loss:'…', quality:'PROBING', traffic:'—' }, - connected: { ping:'48', jitter:'3.8', loss:'0.0', quality:'GOOD', traffic:'8.2 MB/s' }, - excellent: { ping:'22', jitter:'1.1', loss:'0.0', quality:'PRIME', traffic:'12.4 MB/s' }, - warning: { ping:'148', jitter:'24', loss:'0.8', quality:'DEGRADED', traffic:'4.1 MB/s' }, - critical: { ping:'280', jitter:'82', loss:'6.4', quality:'CRITICAL', traffic:'1.2 MB/s' }, -}; -const ENDPOINT = { - connected: 'Frankfurt, EU · 185.25.48.12', - excellent: 'Amsterdam, EU · 172.67.181.14', - warning: 'Tokyo, JP · 203.0.113.1', - critical: 'Mumbai, IN · 198.18.0.1', -}; -const QUALITY_COLOR = { - PRIME: '#D08470', GOOD: '#A87060', DEGRADED: '#B88030', - CRITICAL: '#C03828', PROBING: '#4C4468', '—': '#22202C', -}; -const DATA_COLOR = { - offline:'#22202C', connecting:'#362E42', connected:'#A06858', - excellent:'#C07866', warning:'#B08838', critical:'#C03828', -}; - -export default function App() { - const [state, setState] = useState('connecting'); // boot with animation - const timerRef = useRef(null); - const isConnected = !['offline','connecting'].includes(state); - const isConnecting = state === 'connecting'; - - // Inject fonts and keyframes once - useEffect(() => { - const el = document.createElement('style'); - el.textContent = ` - @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap'); - *{box-sizing:border-box;margin:0;padding:0} - body{background:${T.space}} - input[type=range]{-webkit-appearance:none;height:2px;background:rgba(255,255,255,0.05);border-radius:1px;outline:none;width:100%} - input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:10px;height:10px;border-radius:50%;background:#C03028;cursor:pointer} - @keyframes ring-pulse{0%{transform:scale(1);opacity:.5}100%{transform:scale(1.14);opacity:0}} - @keyframes dot-blink{0%,100%{opacity:.3}50%{opacity:1}} - `; - document.head.appendChild(el); - return () => el.remove(); - }, []); - - // Boot sequence: connecting → connected → excellent - useEffect(() => { - const t1 = setTimeout(() => setState('connected'), 3400); - const t2 = setTimeout(() => setState('excellent'), 5600); - return () => { clearTimeout(t1); clearTimeout(t2); }; - }, []); - - const handleConnect = useCallback(() => { - if (isConnecting) return; - clearTimeout(timerRef.current); - if (isConnected) { - setState('offline'); - } else { - setState('connecting'); - timerRef.current = setTimeout(() => { - setState('connected'); - timerRef.current = setTimeout(() => setState('excellent'), 2200); - }, 3400); - } - }, [isConnected, isConnecting]); - - useEffect(() => () => clearTimeout(timerRef.current), []); - - const m = METRICS[state] ?? METRICS.offline; - const ep = ENDPOINT[state] ?? '—'; - const dc = DATA_COLOR[state] ?? DATA_COLOR.offline; - - // Status indicator text & colour - const STATUS = { - offline: { txt: 'Offline', dot: '#2A2438' }, - connecting: { txt: 'Connecting', dot: '#6040B8', anim:'dot-blink 1.4s ease-in-out infinite' }, - connected: { txt: 'Connected', dot: '#6C8C6C' }, - excellent: { txt: 'Prime Signal', dot: '#8CA87C' }, - warning: { txt: 'High Latency', dot: '#9A7830' }, - critical: { txt: 'Packet Loss', dot: '#9A2820' }, - }; - const st = STATUS[state] ?? STATUS.offline; - - // Connect button visual config - const BTN = { - offline: { label:'Connect', bg:'#0A0A14', border:'#1C1828', color:'#3C3450', shadow:'transparent' }, - connecting: { label:'Connecting', bg:'#0E0810', border:'#3A1422', color:'#6A3040', shadow:'rgba(180,30,25,0.30)' }, - connected: { label:'Disconnect', bg:'#0E0810', border:'#4A1820', color:'#B05050', shadow:'rgba(180,40,28,0.18)' }, - excellent: { label:'Disconnect', bg:'#0E0810', border:'#5C1C22', color:'#C06060', shadow:'rgba(198,46,30,0.24)' }, - warning: { label:'Disconnect', bg:'#0E0C0A', border:'#4A3010', color:'#A07030', shadow:'rgba(160,95,15,0.18)' }, - critical: { label:'Reconnect', bg:'#100808', border:'#4A1010', color:'#B03028', shadow:'rgba(175,28,20,0.35)' }, - }; - const btn = BTN[state] ?? BTN.offline; - - // Stat cards - const statCards = [ - { key:'ping', label:'PING', val:m.ping, unit:'ms' }, - { key:'jitter', label:'JITTER', val:m.jitter, unit:'ms' }, - { key:'loss', label:'LOSS', val:m.loss, unit:'%' }, - { key:'quality', label:'ROUTE', val:m.quality, unit:'' }, - ]; - - // Simulation state buttons (demo-only, visually demoted) - const SIM_STATES = [ - ['offline','Offline'],['connecting','Connecting'],['connected','Connected'], - ['excellent','Excellent'],['warning','Latency'],['critical','Packet Loss'], - ]; - - return ( -
- - {/* ── App header ─────────────────────────────────────────────── */} -
- {/* ML logotype mark */} -
- ML -
-
-
- Marstart Link -
-
- SD-WAN GAMING NETWORK -
-
- {/* Live status pill */} -
-
- {st.txt} -
-
- - {/* ── Living Mars canvas ─────────────────────────────────────── */} - {/* Canvas background matches page — seamless integration */} -
- -
- - {/* ── Connect button ─────────────────────────────────────────── */} - {/* Positioned just below canvas, negative margin to close visual gap */} -
- {/* Animated ring (connecting only) */} - {isConnecting && ( -
- )} - -
- - {/* ── Metric cards (2+2 grid) ────────────────────────────────── */} -
- {statCards.map(card => ( -
-
- {card.label} -
-
- {card.val} - {card.unit && ( - - {card.unit} - - )} -
-
- ))} -
- - {/* ── Active endpoint ────────────────────────────────────────── */} -
-
- ACTIVE ENDPOINT -
-
- {ep || '—'} -
-
- - {/* ── Current traffic ────────────────────────────────────────── */} -
-
- CURRENT TRAFFIC -
-
- {m.traffic} -
-
- - {/* ── Simulation controls (visually demoted, demo-only) ──────── */} -
-
- SIMULATION CONTROLS -
-
- {SIM_STATES.map(([id, label]) => ( - - ))} -
-
- - {/* ── Footer ─────────────────────────────────────────────────── */} -
- MARSTART LINK · LIVING MARS v2.0 · ALL RIGHTS RESERVED -
-
- ); -} \ No newline at end of file From d84e25747ef80061a3d1935715ca3153010b9b53 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 19 Jun 2026 14:02:32 +0500 Subject: [PATCH 2/5] Update package.json Signed-off-by: Sergey --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2efe9b9..5df8642 100644 --- a/package.json +++ b/package.json @@ -12,16 +12,16 @@ "tauri:build": "npm run prepare:resources && tauri build" }, "dependencies": { - "@tauri-apps/api": "^2.0.0", + "@tauri-apps/api": "^2.1.1", "react": "^18.3.1", "react-dom": "^18.3.1" }, "devDependencies": { "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", - "@vitejs/plugin-react": "^4.3.1", - "typescript": "^5.6.3", - "vite": "^5.4.10", - "@tauri-apps/cli": "^2.0.0" + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.7.2", + "vite": "^5.4.11", + "@tauri-apps/cli": "^2.1.0" } } From 7cf978d6611f782c989ee6633fa805a9b9760652 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 19 Jun 2026 14:03:08 +0500 Subject: [PATCH 3/5] Update Cargo.toml Signed-off-by: Sergey --- src-tauri/Cargo.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0f393e1..22e65e5 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -4,25 +4,25 @@ version = "1.0.1" edition = "2021" [build-dependencies] -tauri-build = { version = "2.6.2", features = [] } +tauri-build = { version = "2", features = [] } [dependencies] -tauri = { version = "2.11.2", features = ["tray-icon"] } +tauri = { version = "2", features = ["tray-icon"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -keyring = "3.6" +keyring = "3" tokio = { version = "1", features = ["full"] } -base64 = "0.21" +base64 = "0.22" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } parking_lot = "0.12" once_cell = "1" chrono = { version = "0.4", features = ["serde"] } -sysinfo = "0.32" -thiserror = "1" +sysinfo = "0.33" +thiserror = "2" [target.'cfg(target_os = "windows")'.dependencies] -windows = { version = "0.52", features = [ +windows = { version = "0.58", features = [ "Win32_Foundation", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", From 06822742aad224b9dd604a2c652a4d119d85dadf Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 19 Jun 2026 14:10:54 +0500 Subject: [PATCH 4/5] Update wireguard.rs Signed-off-by: Sergey --- src-tauri/src/wireguard.rs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src-tauri/src/wireguard.rs b/src-tauri/src/wireguard.rs index 6d3a69f..f140e5a 100644 --- a/src-tauri/src/wireguard.rs +++ b/src-tauri/src/wireguard.rs @@ -19,8 +19,9 @@ use windows::Win32::Foundation::{FreeLibrary, BOOL, HANDLE, HMODULE}; use windows::Win32::System::LibraryLoader::{GetProcAddress, LoadLibraryW}; #[cfg(target_os = "windows")] +// ИСПРАВЛЕНО: Правильная сигнатура WireGuardCreateAdapter type WireGuardCreateAdapterFunc = - unsafe extern "system" fn(flags: u32, adapter_name: PCWSTR, tunnel_name: PCWSTR) -> HANDLE; + unsafe extern "system" fn(adapter_name: PCWSTR, tunnel_name: PCWSTR, reserved: *const std::ffi::c_void) -> HANDLE; #[cfg(target_os = "windows")] type WireGuardSetConfigurationFunc = unsafe extern "system" fn( @@ -37,7 +38,8 @@ type WireGuardGetConfigurationFunc = unsafe extern "system" fn( ) -> BOOL; #[cfg(target_os = "windows")] -type WireGuardDeleteAdapterFunc = unsafe extern "system" fn(adapter: HANDLE, adapter_name: PCWSTR); +// ИСПРАВЛЕНО: Правильная сигнатура WireGuardDeleteAdapter (только HANDLE) +type WireGuardDeleteAdapterFunc = unsafe extern "system" fn(adapter: HANDLE); fn get_dll_path(dll_name: &str) -> PathBuf { let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from(".")); @@ -144,13 +146,13 @@ impl WireGuardTunnel { unsafe { std::mem::transmute::< unsafe extern "system" fn() -> isize, - unsafe extern "system" fn(u32, PCWSTR, PCWSTR) -> HANDLE, + WireGuardCreateAdapterFunc, >(create_proc) }, unsafe { std::mem::transmute::< unsafe extern "system" fn() -> isize, - unsafe extern "system" fn(HANDLE, PCWSTR), + WireGuardDeleteAdapterFunc, >(delete_proc) }, unsafe { @@ -222,7 +224,9 @@ impl WireGuardTunnel { fn connect_impl(&mut self) -> Result<(), String> { let tunnel_wide = wide_str(&self.adapter_name); let tunnel_name = PCWSTR(tunnel_wide.as_ptr()); - let handle = unsafe { (self.fn_create)(0, tunnel_name, tunnel_name) }; + + // ИСПРАВЛЕНО: Передаем имя адаптера, имя туннеля и null для reserved + let handle = unsafe { (self.fn_create)(tunnel_name, tunnel_name, std::ptr::null()) }; if handle.0 == 0 { return Err("failed to create WireGuard adapter".to_string()); @@ -232,9 +236,7 @@ impl WireGuardTunnel { let config_blob = serialize_config(&self.config) .map_err(|e| format!("failed to serialize config: {e}"))?; - // WireGuard-NT ABI: WireGuardSetConfiguration returns BOOL (non-zero = success, 0 = failure). - // Previously typed as NTSTATUS which inverted the check: a successful call (BOOL TRUE = 1) - // was treated as NTSTATUS error, causing connect() to always abort on Windows. + let ok = unsafe { (self.fn_set_cfg)( handle, @@ -324,9 +326,9 @@ impl WireGuardTunnel { return Ok(()); }; - let tunnel_wide = wide_str(&self.adapter_name); + // ИСПРАВЛЕНО: Передаем только handle unsafe { - (self.fn_delete)(handle, PCWSTR(tunnel_wide.as_ptr())); + (self.fn_delete)(handle); let _ = windows::Win32::Foundation::CloseHandle(handle); } Ok(()) @@ -343,7 +345,6 @@ impl WireGuardTunnel { } let mut buffer = vec![0u8; buf_size as usize]; - // WireGuard-NT ABI: WireGuardGetConfiguration returns BOOL. let ok = unsafe { (self.fn_get_cfg)(handle, buffer.as_mut_ptr() as *mut _, &mut buf_size) }; if !ok.as_bool() { return Ok((0, 0, 0)); @@ -376,6 +377,9 @@ fn wide_path(value: &std::path::Path) -> Vec { #[cfg(target_os = "windows")] impl Drop for WireGuardTunnel { fn drop(&mut self) { + // ИСПРАВЛЕНО: Гарантированно удаляем адаптер перед уничтожением объекта + let _ = self.delete_adapter_handle(); + // Free the DLL when tunnel is dropped unsafe { let _ = FreeLibrary(self.wg_lib); From a5e006f06a9ec44fe2177bd96021fe8a9f68b27b Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 19 Jun 2026 14:24:42 +0500 Subject: [PATCH 5/5] Delete dist directory Signed-off-by: Sergey --- dist/index.html | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 dist/index.html diff --git a/dist/index.html b/dist/index.html deleted file mode 100644 index 5f54c06..0000000 --- a/dist/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - MARSTART LINK - - - - -
- -