This is an example Electron application demonstrating how to use the Lingti SDK Node.js native addon.
- ✅ Simple, modern UI
- ✅ Start/Stop Lingti SDK tunnel
- ✅ Real-time traffic statistics
- ✅ Ping monitoring
- ✅ Token persistence (localStorage)
- ✅ Status indicator
- ✅ Error handling
- Windows OS (required for the native addon)
- Node.js 16+ and npm/yarn
- Built Lingti SDK native addon - IMPORTANT: Run
yarnin the parent directory first:cd .. yarn cd example
# Install dependencies
npm install
# or
yarnnpm start
# or
yarn startnpm run dev
# or
yarn dev- Enter Encrypted Token: Input your encrypted token in the text field
- Start SDK: Click the "Start SDK" button to initialize the tunnel
- Monitor Status: Watch the status indicator and statistics
- Stop SDK: Click the "Stop SDK" button to terminate the tunnel
The app uses the following default configuration when starting the SDK:
{
Mode: "tun_switch",
Server: "server.lingti.com:443",
Token: "<your-encrypted-token>",
LogLevel: "info",
GameExes: [],
GameID: "EXAMPLE_GAME"
}You can modify these settings in main.js (search for the sdk:start handler).
The app exposes the following APIs to the renderer process via contextBridge:
window.lingtiApi.startSdk(encryptedToken)- Start the SDK with encrypted tokenwindow.lingtiApi.stopSdk()- Stop the SDKwindow.lingtiApi.isRunning()- Check if SDK is runningwindow.lingtiApi.getVersion()- Get SDK versionwindow.lingtiApi.getStats()- Get traffic and ping statisticswindow.lingtiApi.checkAddon()- Check if native addon is available
When the SDK is running, the app displays:
- TX/RX Bytes: Total transmitted and received bytes
- Router Ping: Latency to router (ms)
- Landing Ping: Latency to landing server (ms)
Statistics are updated every 2 seconds.
The app handles various error scenarios:
- Missing or invalid token
- SDK already running
- SDK not running when trying to stop
- Platform incompatibility (non-Windows)
- Native addon not available
Errors are displayed in a user-friendly message box.
- The app uses Electron's
contextIsolationandpreloadscript for security - Direct Node.js integration is disabled in the renderer process
- Only specific SDK APIs are exposed to the renderer via IPC
If you see "Native addon not available":
- Make sure you're running on Windows
- Build the native addon first:
cd .. yarn
- Verify your encrypted token is correct
- Check that no other instance is running
- Look at error messages for specific error codes
example/
├── package.json # Project metadata and dependencies
├── main.js # Electron main process (SDK integration)
├── preload.js # Preload script (IPC bridge)
├── index.html # Application UI
├── renderer.js # Renderer process logic
└── README.md # This file
UNLICENSED