File size: 1,234 Bytes
2206dba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
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)"}
|