diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-08-27 20:11:39 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-08-27 20:11:39 -0500 |
commit | ca592cb6e6a9aeee619d3fd7311030ab34844c2f (patch) | |
tree | 11f669e706938416c6139de7650efa05a243fac9 /src/view/index.html | |
download | wg2nd-web-ca592cb6e6a9aeee619d3fd7311030ab34844c2f.tar.xz wg2nd-web-ca592cb6e6a9aeee619d3fd7311030ab34844c2f.zip |
Diffstat (limited to 'src/view/index.html')
-rw-r--r-- | src/view/index.html | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/src/view/index.html b/src/view/index.html new file mode 100644 index 0000000..5374771 --- /dev/null +++ b/src/view/index.html @@ -0,0 +1,122 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>WireGuard to Networkd Converter</title> + <link + href="/css/bootstrap.min.css" + rel="stylesheet" + integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" + > + <script src="/js/bundle.min.js"></script> + <script> + let wg2nd_cmdseq = null; + + function convert_config() { + // Get the values from the input elements + const interfaceName = document.getElementById('interfaceName'); + const wireguardConfig = document.getElementById('wireguardConfig'); + + console.log(wireguardConfig); + + // Call the wg2nd_cmdseq function + const result = wg2nd_cmdseq(interfaceName.value, wireguardConfig.value); + + // Put the result in the third box (Systemd Networkd Configuration text area) + const outputTextArea = document.getElementById('systemdConfigCmds'); + + outputTextArea.value = result; + outputTextArea.style.height = 'auto'; + outputTextArea.style.height = outputTextArea.scrollHeight + 'px'; + } + + var Module = { + onRuntimeInitialized: function() { + wg2nd_cmdseq = Module.wg2nd_cmdseq; + + convert_config(); + } + }; + + + window.addEventListener('load', function () { + // Attach event listeners + document.getElementById('genConfig').addEventListener('click', (e) => { + convert_config(); + }); + }); + + + </script> + <script src="/build/browser.js"></script> +</head> +<body> + <div class="container mt-4 font-monospace"> + <!-- Title --> + <div class="row mb-4 bg-light p-4 rounded"> + <h1 class="mb-4">wg2nd</h1> + <h3 class="mb-4">Configure WireGuard Tunnels with networkd</h3> + <p>wg2nd converts WireGuard configurations from wg-quick format into systemd-networkd compatible configurations. + This is a web port of wg2nd which converts WireGuard configurations into Bash commands to set up the networkd + device and network. Note that the output is not compatible with Zsh. <strong>The web port operates entirely on the client-side, + ensuring that no sensitive data is transmitted or stored externally.</strong> For more comprehensive control and features, + including batch conversions and the option to install a firewall, the Linux tool wg2nd is available <a href="https://www.git.flu0r1ne.net/wg2nd">here</a> and can + be installed from source.</p> + + <p>Both versions are open-source and dual-licensed under the GPL-2.0 and MIT license. Limitations and further details for each version + are elaborated in this <a href="https://www.flu0r1ne.net/logs/announcing-wg2nd">comprehensive post</a>. For installation instructions for the Linux tool and additional information, + please refer to the <a href="https://www.git.flu0r1ne.net/wg2nd/tree/README.md?h=main">README</a>.</p> + </div> + + <!-- Input Panel --> + <div class="row bg-light p-4 rounded"> + <h5 class="mb-4">WireGuard Configuration</h5> + <div class="mb-3"> + <label for="interfaceName" class="form-label">Interface Name:</label> + <input autocomplete="off" type="text" class="form-control" id="interfaceName" value="wg0" /> + </div> + + <div class="mb-3"> + <label for="wireguardConfig" class="form-label">WireGuard Config:</label> + <textarea + autocomplete="off" + autocorrect="off" + autocapitalize="off" + spellcheck="false" + id="wireguardConfig" + class="form-control" + rows="12" + > +[Interface] +PrivateKey = 0OCS+dV5wsDje6qUAEDQzPmTNWOLE9HE8kfGU1wJUE0= +Address = 10.55.127.342/32, ab00:aaaa:aaa:aa02::5:abcd/128 +DNS = 10.64.0.1 + +[Peer] +PublicKey = WBSnuq6Vswxz5G5zz9pUt60ZSA+JfZ1iTXdg0RJGjks= +AllowedIPs = 0.0.0.0/0,::0/0 +Endpoint = 128.45.210.64:51821 + </textarea> + </div> + + <!-- Convert Button --> + <div class="d-grid text-center mt-2"> + <button id="genConfig" class="btn btn-primary">Generate Commands</button> + </div> + </div> + + <!-- Output Panel --> + <div class="row mt-4 bg-light p-4 rounded"> + <h5 class="mb-4">Networkd Configuration</h5> + <textarea + id="systemdConfigCmds" + class="form-control fs-6" + placeholder="Converted configuration will appear here..." + autocomplete="off" + readonly + ></textarea> + </div> + </div> +</body> |