wireshade 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml ADDED
@@ -0,0 +1,27 @@
1
+ [package]
2
+ name = "wireshade"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+
6
+ [lib]
7
+ crate-type = ["cdylib"]
8
+
9
+ [dependencies]
10
+ napi = { version = "2.12", features = ["tokio_rt", "async"] }
11
+ napi-derive = "2.12"
12
+ # Core networking
13
+ tokio = { version = "1", features = ["full"] }
14
+ # The userspace TCP/IP stack
15
+ smoltcp = { version = "0.12", features = ["std", "medium-ip", "proto-ipv4", "socket-tcp", "async"] }
16
+ # WireGuard implementation (Cloudflare)
17
+ boringtun = "0.6"
18
+ # Utilities
19
+ bytes = "1"
20
+ thiserror = "1"
21
+ hex = "0.4"
22
+ base64 = "0.21"
23
+ log = "0.4"
24
+ env_logger = "0.10"
25
+
26
+ [build-dependencies]
27
+ napi-build = "2.0"
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WireShade Authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.de.md ADDED
@@ -0,0 +1,256 @@
1
+ # 👻 WireShade - Node.js WireGuard Client
2
+
3
+ **Die ultimative Userspace WireGuard® Implementierung für Node.js**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/wireshade.svg)](https://www.npmjs.com/package/wireshade)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ **WireShade** ermöglicht es deiner Node.js-Anwendung, sich direkt mit einem WireGuard-VPN zu verbinden – **ohne Root-Rechte**, Kernel-Module oder Änderungen an den Systemeinstellungen. Es läuft vollständig im Userspace unter Verwendung eines benutzerdefinierten Rust-basierten TCP/IP-Stacks (`smoltcp`), der direkt in Node.js integriert ist.
9
+
10
+ <div align="center">
11
+
12
+ [🇺🇸 English](README.md) | [🇩🇪 Deutsch](README.de.md) | [🇪🇸 Español](README.es.md) | [🇫🇷 Français](README.fr.md) | [🇨🇳 中文](README.zh.md)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## 🚀 Warum WireShade?
19
+
20
+ WireShade löst komplexe Netzwerk-Herausforderungen mit einer sauberen, nativen Lösung:
21
+
22
+ * **🛡️ Sicherheit & Stealth:** Route spezifischen Node.js-Traffic durch ein sicheres WireGuard-VPN, während der Rest deines Systems das normale Internet nutzt. Perfekt für **Web-Scraping**, **Bots** oder **sichere Kommunikation**.
23
+ * **🌍 Reverse Tunneling:** Mache einen lokalen Express-Server, WebSocket-Server oder Next.js App im privaten VPN-Netzwerk verfügbar, selbst hinter NAT oder Firewalls.
24
+ * **🔌 Zero-Config Client:** Keine Installation von WireGuard auf dem Host-System notwendig. Einfach `npm install` und loslegen.
25
+ * **🔄 Automatischer Reconnect:** Eingebaute Logik, um Verbindungsabbrüche und Netzwerkwechsel nahtlos zu handhaben.
26
+ * **⚡ Hohe Performance:** Angetrieben durch Rust und NAPI-RS für nahezu native Geschwindigkeit.
27
+
28
+ ## 🧠 Wie es funktioniert (Technical Deep Dive)
29
+
30
+ WireShade umgeht den Netzwerkstack des Host-Betriebssystems, indem es einen **Userspace TCP/IP-Stack** ([smoltcp](https://github.com/smoltcp-rs/smoltcp)) direkt in deinem Node.js-Prozess ausführt.
31
+
32
+ 1. **Handshake:** WireShade baut einen WireGuard-Handshake über UDP auf.
33
+ 2. **Kapselung:** IP-Pakete werden verschlüsselt und in UDP-Pakete verpackt.
34
+ 3. **Userspace Routing:** Entschlüsselte Pakete werden von `smoltcp` in Rust verarbeitet (TCP-State, Retransmission, Buffering).
35
+ 4. **Node.js Integration:** Daten fließen über hochperformante NAPI-Bindings zwischen Rust-Streams und Node.js `net.Socket`/`http.Agent`-Instanzen.
36
+
37
+ Diese Architektur bedeutet:
38
+ - **Kein virtuelles Netzwerkinterface (TUN/TAP)** wird auf deinem OS erstellt.
39
+ - **Root-Rechte sind NICHT erforderlich.**
40
+ - **Kein Konflikt** mit bestehenden VPNs oder Systemnetzwerken.
41
+ - **Plattformunabhängige** Kompatibilität (Windows, macOS, Linux, **Raspberry Pi**, Docker Container) ohne Kernel-Module.
42
+
43
+ ## 📦 Installation
44
+
45
+ ```bash
46
+ npm install wireshade
47
+ ```
48
+
49
+ ---
50
+
51
+ ## 🛠️ Anwendungsbeispiele
52
+
53
+ Alle Beispiele gehen davon aus, dass der Client initialisiert ist:
54
+ ```javascript
55
+ const { WireShade, readConfig } = require('wireshade');
56
+ const client = new WireShade(readConfig('./wg0.conf'));
57
+ await client.start();
58
+ ```
59
+
60
+ ### 1. HTTP/HTTPS Requests (Client)
61
+ Nutze WireShade als transparenten Agent für deine Requests.
62
+
63
+ **Vereinfachte API:**
64
+ ```javascript
65
+ const html = await client.get('https://internal.service/api');
66
+ console.log(html);
67
+ ```
68
+
69
+ **Natives `http`/`https` Modul:**
70
+ ```javascript
71
+ const https = require('https');
72
+
73
+ https.get('https://api.internal/data', { agent: client.getHttpsAgent() }, (res) => {
74
+ res.pipe(process.stdout);
75
+ });
76
+ ```
77
+
78
+ **Axios:**
79
+ ```javascript
80
+ const axios = require('axios');
81
+
82
+ // Nutze die Agents in der Axios-Config
83
+ const response = await axios.get('https://internal.service/api', {
84
+ httpAgent: client.getHttpAgent(),
85
+ httpsAgent: client.getHttpsAgent()
86
+ });
87
+ ```
88
+
89
+ **Fetch (`node-fetch`):**
90
+ ```javascript
91
+ const fetch = require('node-fetch');
92
+
93
+ const response = await fetch('https://internal.service/api', {
94
+ agent: (parsedUrl) => {
95
+ return parsedUrl.protocol === 'https:'
96
+ ? client.getHttpsAgent()
97
+ : client.getHttpAgent();
98
+ }
99
+ });
100
+ ```
101
+
102
+ ### 2. TCP & WebSockets ins VPN (Client)
103
+ Verbinde dich zu reinen TCP-Diensten oder WebSockets, die im VPN laufen.
104
+
105
+ **Raw TCP:**
106
+ ```javascript
107
+ const socket = client.connect({ host: '10.0.0.5', port: 22 });
108
+ socket.write('SSH-2.0-MyClient\r\n');
109
+ ```
110
+
111
+ **WebSockets (mit `ws` Library):**
112
+ ```javascript
113
+ const WebSocket = require('ws');
114
+
115
+ // Nutze den WireShade Agent für den Handshake
116
+ const ws = new WebSocket('ws://10.0.0.5:8080/stream', {
117
+ agent: client.getHttpAgent()
118
+ });
119
+
120
+ ws.on('open', () => console.log('Verbunden mit VPN WebSocket!'));
121
+ ```
122
+
123
+ ### 3. Server veröffentlichen (Express, Next.js, WebSockets)
124
+ Mache deinen lokalen Server **nur** über das VPN erreichbar (Reverse Tunneling).
125
+
126
+ **Express / Next.js / Fastify:**
127
+ ```javascript
128
+ const express = require('express');
129
+ const http = require('http');
130
+ const { WireShadeServer } = require('wireshade');
131
+
132
+ // 1. Setup der App
133
+ const app = express();
134
+ app.get('/', (req, res) => res.send('🎉 Versteckt im VPN!'));
135
+
136
+ // 2. HTTP Server vorbereiten (noch nicht listen())
137
+ const httpServer = http.createServer(app);
138
+
139
+ // 3. Auf dem VPN lauschen
140
+ const vpnServer = new WireShadeServer(client);
141
+ vpnServer.on('connection', (socket) => {
142
+ httpServer.emit('connection', socket); // Leite VPN-Socket an HTTP-Server
143
+ });
144
+
145
+ await vpnServer.listen(80); // Lausche auf Port 80 der VPN-IP
146
+ console.log('Server online unter http://<VPN-IP>/');
147
+ ```
148
+
149
+ **WebSocket Server:**
150
+ ```javascript
151
+ const { WebSocketServer } = require('ws');
152
+ const wss = new WebSocketServer({ noServer: true });
153
+
154
+ httpServer.on('upgrade', (req, socket, head) => {
155
+ wss.handleUpgrade(req, socket, head, (ws) => {
156
+ wss.emit('connection', ws, req);
157
+ });
158
+ });
159
+ ```
160
+
161
+ ### 4. Port Forwarding
162
+ WireShade unterstützt sowohl **Local Forwarding** (Zugriff auf VPN-Dienst lokal) als auch **Remote Forwarding** (Lokalen Dienst ins VPN stellen).
163
+
164
+ **Local Forwarding (VPN -> Localhost):**
165
+ Greife auf eine PostgreSQL-Datenbank (`10.0.0.5:5432`) im VPN über `localhost:3333` zu.
166
+ ```javascript
167
+ await client.forwardLocal(3333, '10.0.0.5', 5432);
168
+ console.log('Verbinde deinen DB-Client mit localhost:3333');
169
+ ```
170
+
171
+ **Remote Forwarding (Localhost -> VPN):**
172
+ Stelle deinen lokalen Entwicklungsserver (`localhost:3000`) im VPN auf Port `8080` bereit.
173
+ ```javascript
174
+ // Lausche auf VPN Port 8080 -> Leite weiter an localhost:3000
175
+ await client.forwardRemote(8080, 'localhost', 3000);
176
+ console.log('VPN-Nutzer können deinen Server unter http://<VPN-IP>:8080 erreichen');
177
+ ```
178
+
179
+ ---
180
+
181
+ ## ⚙️ Konfiguration & Features
182
+
183
+ ### Auto-Reconnection (Verbindungswiederherstellung)
184
+ WireShade enthält robuste Logik für Reconnects.
185
+
186
+ ```javascript
187
+ const client = new WireShadeClient({
188
+ wireguard: { ... },
189
+ reconnect: {
190
+ enabled: true,
191
+ maxAttempts: 10,
192
+ delay: 1000,
193
+ backoffMultiplier: 1.5
194
+ }
195
+ });
196
+
197
+ client.on('reconnecting', (attempt) => console.log(`🔄 Verbinde neu... (${attempt})`));
198
+ ```
199
+
200
+ ### Custom DNS / Hosts
201
+ Mappe interne VPN-Hostnamen auf IP-Adressen, ohne `/etc/hosts` anzufassen.
202
+
203
+ ```javascript
204
+ const client = new WireShadeClient({
205
+ wireguard: { ... },
206
+ hosts: {
207
+ 'intern-api.local': '10.0.0.4',
208
+ 'db-prod': '10.0.0.5'
209
+ }
210
+ });
211
+ ```
212
+
213
+ ## 📚 API Referenz
214
+
215
+ **`new WireShadeClient(config)`**
216
+ - Erstellt eine neue VPN-Instanz. `config` entspricht den Standard-WireGuard-Parametern (`privateKey`, `endpoint`, etc.).
217
+
218
+ **`client.start()`**
219
+ - Verbindet mit dem VPN. Gibt ein `Promise` zurück, das bei Verbindung aufgelöst wird.
220
+
221
+ **`client.get(url, [options])`**
222
+ - Helper für einfache HTTP GET Requests durch den Tunnel. Gibt den Body zurück.
223
+
224
+ **`client.connect(options)`**
225
+ - Erstellt einen rohen TCP-Socket (`net.Socket`), der durch den Tunnel verbunden ist.
226
+
227
+ **`client.listen(port, [callback])`**
228
+ - Startet einen TCP-Server, der auf der **VPN-IP** am angegebenen Port lauscht.
229
+
230
+ **`client.forwardLocal(localPort, remoteHost, remotePort)`**
231
+ - Leitet einen lokalen Port an ein Ziel im VPN weiter.
232
+
233
+ **`client.forwardRemote(vpnPort, targetHost, targetPort)`**
234
+ - Leitet einen Port der VPN-IP an ein lokales Ziel weiter (Reverse Port Forwarding).
235
+
236
+ **`client.getHttpAgent() / client.getHttpsAgent()`**
237
+ - Gibt einen Node.js `http.Agent` / `https.Agent` zurück, der so konfiguriert ist, dass er Traffic durch den Tunnel leitet.
238
+
239
+ ---
240
+
241
+ ---
242
+
243
+ ## 🎯 Use Cases (Einsatzgebiete)
244
+
245
+ * **Microservices Kommunikation:** Verbinde sichere Dienste über verschiedene Clouds hinweg, ohne öffentliche Ports zu öffnen.
246
+ * **Web Scraping:** Rotiere IP-Adressen durch Erstellung mehrerer WireShade-Instanzen mit verschiedenen VPN-Endpunkten.
247
+ * **Entwickler-Zugang:** Gib Entwicklern sicheren Zugriff auf interne Datenbanken direkt von ihrem lokalen Rechner.
248
+ * **IoT & Edge:** Verbinde Geräte hinter restriktiven Firewalls sicher mit einem zentralen Server (Reverse Tunneling).
249
+
250
+ ---
251
+
252
+ ## 📜 Lizenz
253
+
254
+ MIT Lizenz.
255
+
256
+ *WireGuard ist eine eingetragene Marke von Jason A. Donenfeld.*
package/README.es.md ADDED
@@ -0,0 +1,109 @@
1
+ # 👻 WireShade usando Node.js
2
+
3
+ **La implementación definitiva de WireGuard® en espacio de usuario para Node.js**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/wireshade.svg)](https://www.npmjs.com/package/wireshade)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ **WireShade** permite que tu aplicación Node.js se conecte directamente a una VPN WireGuard **sin privilegios de root**, módulos del kernel ni modificaciones en la configuración de red del sistema. Se ejecuta completamente en espacio de usuario utilizando una pila TCP/IP basada en Rust (`smoltcp`) integrada directamente en Node.js.
9
+
10
+ <div align="center">
11
+
12
+ [🇺🇸 English](README.md) | [🇩🇪 Deutsch](README.de.md) | [🇪🇸 Español](README.es.md) | [🇫🇷 Français](README.fr.md) | [🇨🇳 中文](README.zh.md)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## 🚀 ¿Por qué WireShade?
19
+
20
+ WireShade resuelve desafíos complejos de implementación de redes con una solución limpia y nativa en espacio de usuario:
21
+
22
+ * **🛡️ Sigilo y Seguridad:** Enruta tráfico específico de Node.js a través de una VPN WireGuard segura mientras mantienes el resto del tráfico de tu sistema normal. Perfecto para **web scraping**, **bots** o **comunicación segura**.
23
+ * **🌍 Túnel Inverso:** Expone un servidor Express local, un servidor WebSocket o una aplicación Next.js a la red VPN privada, incluso si estás detrás de un NAT o firewall.
24
+ * **🔌 Cliente Cero Configuración:** No es necesario instalar WireGuard en la máquina host. Simplemente `npm install` y listo.
25
+ * **🔄 Reconexión Automática:** Lógica integrada para manejar caídas de conexión y cambios de red sin problemas.
26
+ * **⚡ Alto Rendimiento:** Impulsado por Rust y NAPI-RS para un rendimiento casi nativo.
27
+
28
+ ## 📦 Instalación
29
+
30
+ ```bash
31
+ npm install wireshade
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 🛠️ Ejemplos de Uso
37
+
38
+ Todos los ejemplos asumen que has inicializado el cliente:
39
+ ```javascript
40
+ const { WireShade, readConfig } = require('wireshade');
41
+ const client = new WireShade(readConfig('./wg0.conf'));
42
+ await client.start();
43
+ ```
44
+
45
+ ### 1. Solicitudes HTTP/HTTPS (Cliente)
46
+ Usa WireShade como un agente transparente para tus solicitudes.
47
+
48
+ **Módulo nativo `http`/`https`:**
49
+ ```javascript
50
+ const https = require('https');
51
+
52
+ https.get('https://api.internal/data', { agent: client.getHttpsAgent() }, (res) => {
53
+ res.pipe(process.stdout);
54
+ });
55
+ ```
56
+
57
+ **Axios:**
58
+ ```javascript
59
+ const axios = require('axios');
60
+
61
+ const response = await axios.get('https://internal.service/api', {
62
+ httpAgent: client.getHttpAgent(),
63
+ httpsAgent: client.getHttpsAgent()
64
+ });
65
+ ```
66
+
67
+ ### 2. TCP y WebSockets a VPN (Cliente)
68
+ Conéctate a servicios TCP sin procesar o WebSockets que se ejecutan dentro de la VPN.
69
+
70
+ **WebSockets:**
71
+ ```javascript
72
+ const WebSocket = require('ws');
73
+
74
+ const ws = new WebSocket('ws://10.0.0.5:8080/stream', {
75
+ agent: client.getHttpAgent()
76
+ });
77
+
78
+ ws.on('open', () => console.log('¡Conectado al WebSocket VPN!'));
79
+ ```
80
+
81
+ ### 3. Exponer Servidores Locales (Túnel Inverso)
82
+ Haz que tu servidor local sea accesible **solo** a través de la VPN.
83
+
84
+ **Express / Next.js:**
85
+ ```javascript
86
+ const express = require('express');
87
+ const http = require('http');
88
+ const { WireShadeServer } = require('wireshade');
89
+
90
+ const app = express();
91
+ app.get('/', (req, res) => res.send('🎉 ¡Oculto dentro de la VPN!'));
92
+
93
+ const httpServer = http.createServer(app);
94
+ const vpnServer = new WireShadeServer(client);
95
+
96
+ // Alimentar el socket VPN al servidor HTTP
97
+ vpnServer.on('connection', (socket) => httpServer.emit('connection', socket));
98
+
99
+ await vpnServer.listen(80);
100
+ console.log('Servidor en línea en http://<VPN-IP>/');
101
+ ```
102
+
103
+ ---
104
+
105
+ ## 📜 Licencia
106
+
107
+ Licencia MIT.
108
+
109
+ *WireGuard es una marca registrada de Jason A. Donenfeld.*
package/README.fr.md ADDED
@@ -0,0 +1,109 @@
1
+ # 👻 WireShade avec Node.js
2
+
3
+ **L'implémentation ultime de WireGuard® en espace utilisateur pour Node.js**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/wireshade.svg)](https://www.npmjs.com/package/wireshade)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ **WireShade** permet à votre application Node.js de se connecter directement à un VPN WireGuard **sans privilèges root**, sans modules noyau, et sans modifier les paramètres réseau du système. Il s'exécute entièrement dans l'espace utilisateur en utilisant une pile TCP/IP personnalisée basée sur Rust (`smoltcp`) intégrée directement dans Node.js.
9
+
10
+ <div align="center">
11
+
12
+ [🇺🇸 English](README.md) | [🇩🇪 Deutsch](README.de.md) | [🇪🇸 Español](README.es.md) | [🇫🇷 Français](README.fr.md) | [🇨🇳 中文](README.zh.md)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## 🚀 Pourquoi WireShade ?
19
+
20
+ WireShade résout les défis complexes d'implémentation réseau avec une solution propre et native :
21
+
22
+ * **🛡️ Discrétion & Sécurité :** Acheminez le trafic spécifique de Node.js via un VPN WireGuard sécurisé tout en gardant le reste du trafic de votre système normal. Parfait pour le **web scraping**, les **bots**, ou la **communication sécurisée**.
23
+ * **🌍 Tunnel Inverse (Reverse Tunneling) :** Exposez un serveur Express local, un serveur WebSocket ou une application Next.js au réseau VPN privé, même si vous êtes derrière un NAT ou un pare-feu.
24
+ * **🔌 Client Zéro Configuration :** Pas besoin d'installer WireGuard sur la machine hôte. Juste `npm install` et c'est parti.
25
+ * **🔄 Reconnexion Automatique :** Logique intégrée pour gérer les pertes de connexion et les changements de réseau de manière transparente.
26
+ * **⚡ Haute Performance :** Propulsé par Rust et NAPI-RS pour des performances quasi-natives.
27
+
28
+ ## 📦 Installation
29
+
30
+ ```bash
31
+ npm install wireshade
32
+ ```
33
+
34
+ ---
35
+
36
+ ## 🛠️ Exemples d'Utilisation
37
+
38
+ Tous les exemples supposent que vous avez initialisé le client :
39
+ ```javascript
40
+ const { WireShade, readConfig } = require('wireshade');
41
+ const client = new WireShade(readConfig('./wg0.conf'));
42
+ await client.start();
43
+ ```
44
+
45
+ ### 1. Requêtes HTTP/HTTPS (Client)
46
+ Utilisez WireShade comme un agent transparent pour vos requêtes.
47
+
48
+ **Module natif `http`/`https` :**
49
+ ```javascript
50
+ const https = require('https');
51
+
52
+ https.get('https://api.internal/data', { agent: client.getHttpsAgent() }, (res) => {
53
+ res.pipe(process.stdout);
54
+ });
55
+ ```
56
+
57
+ **Axios :**
58
+ ```javascript
59
+ const axios = require('axios');
60
+
61
+ const response = await axios.get('https://internal.service/api', {
62
+ httpAgent: client.getHttpAgent(),
63
+ httpsAgent: client.getHttpsAgent()
64
+ });
65
+ ```
66
+
67
+ ### 2. TCP & WebSockets vers VPN (Client)
68
+ Connectez-vous à des services TCP bruts ou WebSockets s'exécutant à l'intérieur du VPN.
69
+
70
+ **WebSockets :**
71
+ ```javascript
72
+ const WebSocket = require('ws');
73
+
74
+ const ws = new WebSocket('ws://10.0.0.5:8080/stream', {
75
+ agent: client.getHttpAgent()
76
+ });
77
+
78
+ ws.on('open', () => console.log('Connecté au WebSocket VPN !'));
79
+ ```
80
+
81
+ ### 3. Exposer des Serveurs Locaux (Tunnel Inverse)
82
+ Rendez votre serveur local accessible **uniquement** via le VPN.
83
+
84
+ **Express / Next.js :**
85
+ ```javascript
86
+ const express = require('express');
87
+ const http = require('http');
88
+ const { WireShadeServer } = require('wireshade');
89
+
90
+ const app = express();
91
+ app.get('/', (req, res) => res.send('🎉 Caché dans le VPN !'));
92
+
93
+ const httpServer = http.createServer(app);
94
+ const vpnServer = new WireShadeServer(client);
95
+
96
+ // Transmettre le socket VPN au serveur HTTP
97
+ vpnServer.on('connection', (socket) => httpServer.emit('connection', socket));
98
+
99
+ await vpnServer.listen(80);
100
+ console.log('Serveur en ligne sur http://<VPN-IP>/');
101
+ ```
102
+
103
+ ---
104
+
105
+ ## 📜 Licence
106
+
107
+ Licence MIT.
108
+
109
+ *WireGuard est une marque déposée de Jason A. Donenfeld.*