NSA / web_ui.py
Fred808's picture
Upload 5 files
2206dba verified
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/", response_class=HTMLResponse)
async def home():
html_content = """
<html>
<head>
<title>IKEv2 VPN Server Management</title>
</head>
<body>
<h1>Pure Python IKEv2 Server Status</h1>
<p>The IKEv2 server process is running alongside this Web UI.</p>
<p><strong>IKEv2 Status:</strong> Running (Managed by Supervisord)</p>
<p><strong>Web UI Port:</strong> TCP 8000 (Uvicorn)</p>
<p><strong>VPN Ports:</strong> UDP 500 & 4500 (pvpn)</p>
<h2>Connection Details</h2>
<ul>
<li><strong>PSK:</strong> MySecretPSK123</li>
<li><strong>URL:</strong> Your public URL</li>
</ul>
<hr>
<p>In a full implementation, this UI would show logs, connection counts, and allow configuration changes.</p>
</body>
</html>
"""
return html_content
@app.get("/status")
async def status():
# In a real app, this would check if the vpn_server process is alive
return {"status": "ok", "service": "Web UI", "vpn_server": "running (assumed)"}