From 3953b1a5b249b09e566ca1ec4ce2fb4e23cdf69e Mon Sep 17 00:00:00 2001 From: George Iv Date: Wed, 21 Jul 2021 19:23:49 +0300 Subject: [PATCH] luci-app-yggdrasil: Update to support v0.4.0 config Signed-off-by: George Iv --- .../resources/view/yggdrasil/keys.js | 7 +-- .../view/yggdrasil/session_firewall.js | 39 --------------- .../resources/view/yggdrasil/settings.js | 30 +++++------ .../resources/view/yggdrasil/status.js | 32 ++++-------- .../view/yggdrasil/tunnel_routing.js | 50 ------------------- .../share/luci/menu.d/luci-app-yggdrasil.json | 18 ------- 6 files changed, 25 insertions(+), 151 deletions(-) delete mode 100644 applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/session_firewall.js delete mode 100644 applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/tunnel_routing.js diff --git a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/keys.js b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/keys.js index 44acaa22d6..7e9bef46e4 100644 --- a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/keys.js +++ b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/keys.js @@ -11,11 +11,8 @@ return view.extend({ s = m.section(form.TypedSection, "yggdrasil", _("Encryption keys")); s.anonymous = true; - s.option(form.Value, "EncryptionPublicKey", _("Encryption public key")); - s.option(form.Value, "EncryptionPrivateKey", _("Encryption private key"), - _("Keep this private. When compromised, generate a new keypair and IPv6.")); - s.option(form.Value, "SigningPublicKey", _("Signing public key")); - s.option(form.Value, "SigningPrivateKey", _("Signing private key"), + s.option(form.Value, "PublicKey", _("Encryption public key")); + s.option(form.Value, "PrivateKey", _("Encryption private key"), _("Keep this private. When compromised, generate a new keypair and IPv6.")); return m.render(); diff --git a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/session_firewall.js b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/session_firewall.js deleted file mode 100644 index 45fe2207b2..0000000000 --- a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/session_firewall.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; -'require view'; -'require form'; - -return view.extend({ - render: function() { - var m, s, o; - - m = new form.Map('yggdrasil', 'Yggdrasil'); - - s = m.section(form.TypedSection, "yggdrasil", _("Session firewall settings")); - s.anonymous = true; - - s.option(form.Flag, "SessionFirewall_Enable", _("Enable session firewall"), - _("If disabled, network traffic from any node will be allowed. If enabled, the below rules apply")); - s.option(form.Flag, "SessionFirewall_AllowFromDirect", _("Allow from direct"), - _("Allow network traffic from directly connected peers")); - s.option(form.Flag, "SessionFirewall_AllowFromRemote", _("Allow from remote"), - _("Allow network traffic from remote nodes on the network that you are not directly peered with")); - s.option(form.Flag, "SessionFirewall_AlwaysAllowOutbound", - _("Always allow outbound"), _("Allow outbound network traffic regardless of AllowFromDirect or AllowFromRemote")); - - s = m.section(form.TableSection, "whitelisted_encryption_public_key", - _("Whitelisted public keys"), - _("Network traffic is always accepted from those peers, regardless of AllowFromDirect or AllowFromRemote")); - s.option(form.Value, "key", _("Public key")); - s.anonymous = true; - s.addremove = true; - - s = m.section(form.TableSection, "blacklisted_encryption_public_key", - _("Blacklisted public keys"), - _("Network traffic is always rejected from those peers, regardless of AllowFromDirect or AllowFromRemote")); - s.option(form.Value, "key", _("Public key")); - s.anonymous = true; - s.addremove = true; - - return m.render(); - } -}); diff --git a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/settings.js b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/settings.js index 4278386f53..8bc63dadc2 100644 --- a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/settings.js +++ b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/settings.js @@ -12,12 +12,6 @@ return view.extend({ s.anonymous = true; s.option(form.Value, "IfName", _("Yggdrasil's network interface name")); - s.option(form.Value, "LinkLocalTCPPort", _("Link-local TCP port"), - _("The port number to be used for the link-local TCP listeners for the "+ - "configured MulticastInterfaces. This option does not affect listeners" + - "specified in the Listen option. Unless you plan to firewall link-local" + - "traffic, it is best to leave this as the default value of 0. This " + - "option cannot currently be changed by reloading config during runtime.")); s.option(form.Flag, "NodeInfoPrivacy", _("Enable NodeInfo privacy"), _("By default, nodeinfo contains some defaults including the platform," + @@ -35,17 +29,6 @@ return view.extend({ } s.option(form.Value, "IfMTU", _("MTU size for the interface")); - s.option(form.Value, "SwitchOptions_MaxTotalQueueSize", - _("Maximum size of all switch queues combined")); - - o = m.section(form.TableSection, "multicast_interface", _("Multicast interfaces"), - _("Regular expressions for which interfaces multicast peer discovery " + - "should be enabled on. If none specified, multicast peer discovery is " + - "disabled. The default value is .* which uses all interfaces.")); - o.option(form.Value, "name", _("Interface name"), - _("Set .* to multicast on all interfaces")); - o.anonymous = true; - o.addremove = true; o = m.section(form.TableSection, "listen_address", _("Listen addresses"), _("Listen addresses for incoming connections. You will need to add " + @@ -53,12 +36,23 @@ return view.extend({ "Multicast peer discovery will work regardless of any listeners set " + "here. Each listener should be specified in URI format as above, e.g. " + "tcp://0.0.0.0:0 or tcp://[::]:0 to listen on all interfaces.")); - _("Address to listen for incoming connections"), o.option(form.Value, "uri", _("e.g. tcp://0.0.0.0:0 or tcp://[::]:0")); o.anonymous = true; o.addremove = true; + o = m.section(form.TableSection, "multicast_interface", _("Multicast interface"), + _("Configuration for which interfaces multicast peer discovery should be enabled on. " + + "Regex is a regular expression which is matched against an interface name, and interfaces use the first configuration that they match gainst. " + + "Beacon configures whether or not the node should send link-local multicast beacons to advertise their presence, while listening for incoming connections on Port. " + + "Listen controls whether or not the node listens for multicast beacons and opens outgoing connections.")); + o.option(form.Value, "regex", _("Regular expression")); + o.option(form.Flag, "beacon", _("Send beacons")); + o.option(form.Flag, "listen", _("Listen for beacons")); + o.option(form.Value, "port", _("Link-local port")); + o.anonymous = true; + o.addremove = true; + return m.render(); } }); diff --git a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/status.js b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/status.js index 35078a511b..d47ccb2f5d 100644 --- a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/status.js +++ b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/status.js @@ -11,7 +11,7 @@ function init_view() { "IPv6 address": "self-address", "IPv6 subnet": "self-subnet", "Coords": "self-coords", - "Public key": "self-boxpubkey", + "Public key": "self-key", "Build name": "self-buildname", "Build version": "self-version" }; @@ -37,7 +37,7 @@ function init_view() { peerings.setAttribute("class", "table"); peerings.id = "yggdrasil-peerings"; var tr = document.createElement("tr"); tr.setAttribute("class", "tr table-titles"); - ["Endpoint", "Address", "Proto", "Uptime", "Received", "Transmitted"].forEach(function(t) { + ["Endpoint", "Address", "Coords", "Key", "Port"].forEach(function(t) { var th = document.createElement("th"); th.setAttribute("class", "th nowrap left"); th.innerText = t; tr.appendChild(th); @@ -55,14 +55,15 @@ function update_active_peers() { while (table.rows.length > 1) { table.deleteRow(1); } Object.keys(peers).forEach(function(address) { var row = table.insertRow(-1); - row.insertCell(-1).textContent = peers[address].endpoint; + row.style.fontSize = "xx-small"; + row.insertCell(-1).textContent = peers[address].remote; row.insertCell(-1).textContent = address; - row.insertCell(-1).textContent = peers[address].proto; - row.insertCell(-1).textContent = '%t'.format(peers[address].uptime); - row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_recvd); - row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_sent); + row.insertCell(-1).textContent = "[" + peers[address].coords.toString() + "]"; + row.insertCell(-1).textContent = peers[address].key; + row.insertCell(-1).textContent = peers[address].port; }); } + setTimeout(update_active_peers, 5000); }); } @@ -85,23 +86,12 @@ return view.extend({ var r = obj[address]; view.querySelector('#self-address').innerText = address; view.querySelector('#self-subnet').innerText = r.subnet; - view.querySelector('#self-coords').innerText = r.coords; - view.querySelector('#self-boxpubkey').innerText = r.box_pub_key; + view.querySelector('#self-coords').innerText = "[" + r.coords + "]"; + view.querySelector('#self-key').innerText = r.key; view.querySelector('#self-buildname').innerText = r.build_name; view.querySelector('#self-version').innerText = r.build_version; - var table = view.querySelector('#yggdrasil-peerings'); - Object.keys(peers).forEach(function(address) { - var row = table.insertRow(-1); - row.insertCell(-1).textContent = peers[address].endpoint; - row.insertCell(-1).textContent = address; - row.insertCell(-1).textContent = peers[address].proto; - row.insertCell(-1).textContent = '%t'.format(peers[address].uptime); - row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_recvd); - row.insertCell(-1).textContent = '%1024.2mB'.format(peers[address].bytes_sent); - - }); - setInterval(update_active_peers, 5000); + update_active_peers(); } else { view.innerHTML = "

Yggdrasil is not running

"; } diff --git a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/tunnel_routing.js b/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/tunnel_routing.js deleted file mode 100644 index 0b4ac6e51a..0000000000 --- a/applications/luci-app-yggdrasil/htdocs/luci-static/resources/view/yggdrasil/tunnel_routing.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; -'require view'; -'require form'; - -return view.extend({ - render: function() { - var m, s, o; - - m = new form.Map('yggdrasil', 'Yggdrasil'); - - s = m.section(form.TypedSection, "yggdrasil", _("Tunnel Routing")); - s.anonymous = true; - s.option(form.Flag, "TunnelRouting_Enable", "Enable tunnel routing", - _("Allow tunneling non-Yggdrasil traffic over Yggdrasil. This effectively " + - "allows you to use Yggdrasil to route to, or to bridge other networks, " + - "similar to a VPN tunnel. Tunnelling works between any two nodes and " + - "does not require them to be directly peered.")); - - o = m.section(form.TableSection, "ipv4_remote_subnet", _("IPv4 remote subnet"), - _("IPv4 subnets belonging to remote nodes, mapped to the node's public")); - o.option(form.Value, "key", _("Key"), _("Public encryption key")); - o.option(form.Value, "subnet", _("Subnet"), _("IPv4 subnet")); - o.anonymous = true; - o.addremove = true; - - o = m.section(form.TableSection, "ipv4_local_subnet", _("IPv4 local subnet"), - _("IPv4 subnets belonging to this node's end of the tunnels. Only traffic " + - "from these ranges will be tunnelled.")); - o.option(form.Value, "subnet", _("Subnet"), _("IPv4 subnet")); - o.anonymous = true; - o.addremove = true; - - o = m.section(form.TableSection, "ipv6_remote_subnet", _("IPv6 remote subnet"), - _("IPv6 subnets belonging to remote nodes, mapped to the node's public")); - o.option(form.Value, "key", _("Key"), _("Public encryption key")); - o.option(form.Value, "subnet", _("Subnet"), _("IPv6 subnet")); - o.anonymous = true; - o.addremove = true; - - o = m.section(form.TableSection, "ipv6_local_subnet", _("IPv6 local subnet"), - _("IPv6 subnets belonging to this node's end of the tunnels. Only traffic " + - "from these ranges (or the Yggdrasil node's IPv6 address/subnet) " + - "will be tunnelled.")); - o.option(form.Value, "subnet", _("Subnet"), _("IPv6 subnet")); - o.anonymous = true; - o.addremove = true; - - return m.render(); - } -}); diff --git a/applications/luci-app-yggdrasil/root/usr/share/luci/menu.d/luci-app-yggdrasil.json b/applications/luci-app-yggdrasil/root/usr/share/luci/menu.d/luci-app-yggdrasil.json index 2947461e58..da4e4acef9 100644 --- a/applications/luci-app-yggdrasil/root/usr/share/luci/menu.d/luci-app-yggdrasil.json +++ b/applications/luci-app-yggdrasil/root/usr/share/luci/menu.d/luci-app-yggdrasil.json @@ -44,23 +44,5 @@ "type": "view", "path": "yggdrasil/keys" } - }, - - "admin/network/yggdrasil/session_firewall": { - "title": "Session firewall", - "order": 5, - "action": { - "type": "view", - "path": "yggdrasil/session_firewall" - } - }, - - "admin/network/yggdrasil/tunnel_routing": { - "title": "Tunnel routing", - "order": 6, - "action": { - "type": "view", - "path": "yggdrasil/tunnel_routing" - } } } -- 2.30.2