// Bind only your assigned private WG address, never 0.0.0.0 on a public host. // node examples/private-http.mjs 10.204.N.2 import http from 'node:http'; import net from 'node:net'; const address=process.argv[2]; if(!net.isIP(address) || !(address.startsWith('10.204.') || address.startsWith('fd77:4a4d:5747:')))throw Error('Supply your assigned WG address'); http.createServer((req,res)=>{ res.writeHead(200,{'content-type':'application/json','cache-control':'no-store'}); res.end(JSON.stringify({message:'Hello through JMPKit WG',peer:req.socket.remoteAddress})+'\n'); }).listen(8080,address,()=>console.log('Private HTTP server listening on '+address+':8080'));