|
|
|
|
|
""" |
|
|
Minimal OpenVPN Configuration Manager |
|
|
Single file application with minimal dependencies |
|
|
""" |
|
|
|
|
|
import gradio as gr |
|
|
from datetime import datetime |
|
|
|
|
|
def create_config(client_name, server_host, port, protocol): |
|
|
"""Generate OpenVPN configuration""" |
|
|
config = f"""# OpenVPN Client Configuration |
|
|
# Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} |
|
|
# Client: {client_name} |
|
|
|
|
|
client |
|
|
dev tun |
|
|
proto {protocol} |
|
|
remote {server_host} {port} |
|
|
resolv-retry infinite |
|
|
nobind |
|
|
persist-key |
|
|
persist-tun |
|
|
remote-cert-tls server |
|
|
cipher AES-256-GCM |
|
|
auth SHA256 |
|
|
verb 3 |
|
|
""" |
|
|
return config |
|
|
|
|
|
def main(): |
|
|
with gr.Blocks(title="OpenVPN Config Generator") as app: |
|
|
gr.Markdown("# 🔒 OpenVPN Configuration Generator") |
|
|
|
|
|
with gr.Row(): |
|
|
with gr.Column(): |
|
|
client_name = gr.Textbox(value="client1", label="Client Name") |
|
|
server_host = gr.Textbox(value="vpn.example.com", label="Server Host") |
|
|
port = gr.Number(value=1194, label="Port") |
|
|
protocol = gr.Radio(["udp", "tcp"], value="udp", label="Protocol") |
|
|
|
|
|
config_output = gr.Textbox(label="Configuration File", lines=20) |
|
|
|
|
|
gr.Button("Generate Config").click( |
|
|
create_config, |
|
|
inputs=[client_name, server_host, port, protocol], |
|
|
outputs=[config_output] |
|
|
) |
|
|
|
|
|
return app |
|
|
|
|
|
if __name__ == "__main__": |
|
|
demo = main() |
|
|
demo.launch(server_name="0.0.0.0", server_port=7860, show_error=True) |