Skip to content

Commit

Permalink
feat: online exit nodes & bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
asvow committed Sep 29, 2024
1 parent 06e27c6 commit 0f6cc25
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 168 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LUCI_TITLE:=LuCI for Tailscale
LUCI_DEPENDS:=+tailscale
LUCI_PKGARCH:=all

PKG_VERSION:=1.2.0
PKG_VERSION:=1.2.1

include $(TOPDIR)/feeds/luci/luci.mk

Expand Down
28 changes: 23 additions & 5 deletions htdocs/luci-static/resources/view/tailscale/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function getStatus() {
backendState: undefined,
authURL: undefined,
displayName: undefined,
routes: []
onlineExitNodes: [],
subnetRoutes: []
};
return Promise.resolve(callServiceList('tailscale')).then(res => {
try {
Expand All @@ -40,7 +41,9 @@ function getStatus() {
status.backendState = tailscaleStatus.BackendState;
status.authURL = tailscaleStatus.AuthURL;
status.displayName = (status.backendState === "Running") ? tailscaleStatus.User[tailscaleStatus.Self.UserID].DisplayName : undefined;
status.routes = Object.values(tailscaleStatus.Peer)
status.onlineExitNodes = Object.values(tailscaleStatus.Peer)
.flatMap(peer => (peer.ExitNodeOption && peer.Online) ? [peer.HostName] : []);
status.subnetRoutes = Object.values(tailscaleStatus.Peer)
.flatMap(peer => peer.PrimaryRoutes || []);
return status;
});
Expand Down Expand Up @@ -85,7 +88,8 @@ return view.extend({
render: function(data) {
var m, s, o;
var statusData = data[1];
var routes = statusData.routes;
var onlineExitNodes = statusData.onlineExitNodes;
var subnetRoutes = statusData.subnetRoutes;

m = new form.Map('tailscale', _('Tailscale'), _('Tailscale is a cross-platform and easy to use virtual LAN.'));

Expand Down Expand Up @@ -168,6 +172,20 @@ return view.extend({
o.default = o.disabled;
o.rmempty = false;

o = s.taboption('advance', form.ListValue, 'exitNode', _('Online Exit Nodes'), _('Select an online machine name to use as an exit node.'));
if (onlineExitNodes.length > 0) {
o.value('', _('-- Please choose --'));
onlineExitNodes.forEach(function(node) {
o.value(node, node);
});
} else {
o.value('', _('No Available Exit Nodes'));
o.readonly = true;
}
o.default = '';
o.depends('advertiseExitNode', '0');
o.rmempty = true;

o = s.taboption('advance', form.DynamicList, 'advertiseRoutes', _('Expose Subnets'), _('Expose physical network routes into Tailscale, e.g. <code>10.0.0.0/24</code>.'));
o.default = '';
o.rmempty = true;
Expand All @@ -178,8 +196,8 @@ return view.extend({
o.rmempty = false;

o = s.taboption('advance', form.DynamicList, 'subnetRoutes', _('Subnet Routes'), _('Select subnet routes advertised by other nodes in Tailscale network.'));
if (routes.length > 0) {
routes.forEach(function(route) {
if (subnetRoutes.length > 0) {
subnetRoutes.forEach(function(route) {
o.value(route, route);
});
} else {
Expand Down
122 changes: 69 additions & 53 deletions po/templates/tailscale.pot
Original file line number Diff line number Diff line change
@@ -1,84 +1,88 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:163
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:177
msgid "-- Please choose --"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:167
msgid "Accept DNS"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:163
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:167
msgid "Accept DNS configuration from the Tailscale admin console."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:155
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:159
msgid "Accept Routes"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:155
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:159
msgid "Accept subnet routes that other nodes advertise."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:193
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:211
msgid "Access Control"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:203
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:221
msgid "Additional Flags"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:153
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:157
msgid "Advanced Settings"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:104
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:108
msgid "Are you sure you want to logout and unbind the current device?"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:215
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:233
msgid "Auth Key"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:203
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:221
msgid "Available flags"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:118
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:122
msgid "Basic Settings"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:113
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:127
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:117
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:131
msgid "Collecting data ..."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:208
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:226
msgid "Custom Server Settings"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:159
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:163
msgid "Device Name"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:120
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:124
msgid "Enable"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:167
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:171
msgid "Exit Node"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:171
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:189
msgid "Expose Subnets"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:171
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:189
msgid "Expose physical network routes into Tailscale, e.g. <code>10.0.0.0/24</code>."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:201
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:219
msgid "Extra Settings"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:139
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:143
msgid "Firewall Mode"
msgstr ""

Expand Down Expand Up @@ -106,31 +110,31 @@ msgstr ""
msgid "Interface Name"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:196
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:214
msgid "LAN access Tailscale"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:159
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:163
msgid "Leave blank to use the device's hostname."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:203
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:221
msgid "List of extra flags. Format: --flags=value, e.g. <code>--exit-node=10.0.0.1</code>. <br> %s for enabling settings upon the initiation of Tailscale."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:145
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:149
msgid "Logging program activities."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:149
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:153
msgid "Logging program errors and exceptions."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:124
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:128
msgid "Login Status"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:69
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:72
msgid "Logout and Unbind"
msgstr ""

Expand All @@ -142,36 +146,44 @@ msgstr ""
msgid "MTU"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:56
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:71
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:59
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:74
msgid "NOT RUNNING"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:66
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:69
msgid "Needs Login"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/interface.js:87
msgid "Network Interface Information"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:186
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:182
msgid "No Available Exit Nodes"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:204
msgid "No Available Subnet Routes"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/interface.js:83
msgid "No interface online."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:167
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:171
msgid "Offer to be an exit node for outbound internet traffic from the Tailscale network."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:130
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:175
msgid "Online Exit Nodes"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:134
msgid "Port"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:54
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:57
msgid "RUNNING"
msgstr ""

Expand All @@ -185,56 +197,60 @@ msgctxt "scroll to bottom (the tail) of the log file"
msgid "Scroll to tail"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:180
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:175
msgid "Select an online machine name to use as an exit node."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:198
msgid "Select subnet routes advertised by other nodes in Tailscale network."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:211
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:229
msgid "Server Address"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:130
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:134
msgid "Set the Tailscale port number."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:175
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:193
msgid "Site To Site"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:149
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:153
msgid "StdErr Log"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:145
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:149
msgid "StdOut Log"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:180
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:198
msgid "Subnet Routes"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/interface.js:120
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:54
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:56
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:90
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:57
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:59
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:94
#: luci-app-tailscale/root/usr/share/luci/menu.d/luci-app-tailscale.json:3
msgid "Tailscale"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:194
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:212
msgid "Tailscale access LAN"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:195
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:213
msgid "Tailscale access WAN"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/interface.js:121
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:90
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:94
msgid "Tailscale is a cross-platform and easy to use virtual LAN."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:135
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:139
msgid "The working directory contains config files, audit logs, and runtime info."
msgstr ""

Expand All @@ -258,18 +274,18 @@ msgstr ""
msgid "Unable to load log data:"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:209
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:227
msgid "Use %s to deploy a private server."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:175
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:193
msgid "Use site-to-site layer 3 networking to connect subnets on the Tailscale network."
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:197
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:215
msgid "WAN access Tailscale"
msgstr ""

#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:135
#: luci-app-tailscale/htdocs/luci-static/resources/view/tailscale/setting.js:139
msgid "Workdir"
msgstr ""
Loading

0 comments on commit 0f6cc25

Please sign in to comment.