Skip to content

Commit 0a7c95b

Browse files
committed
tunspace: little cleanups
1 parent 385ddc3 commit 0a7c95b

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

packages/tunspace/tunspace.uc

+4-22
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
11
#!/usr/bin/ucode
22

3-
// TODO:
4-
// - [x] procd service
5-
// - [x] config via uci
6-
// - [x] load keys from file
7-
// - [x] bug: high cpu usage
8-
// - [x] generate private keys
9-
// - [x] don't abort for common failures
10-
// - [x] test olsrd and babel
11-
// - [x] test multiple ifaces
12-
// - [x] bug: possible multiple use of servers
13-
// - [x] better logging
14-
// - [x] handle dhcp renewals
15-
// - [ ] disable strom temporarily
16-
// - [ ] nftables rules for mss clamping
17-
// - [ ] retry dhcp on boot
18-
// - [ ] less logging
19-
// - [x] implement insecure_cert option
20-
// - [x] implement disabled option
21-
// - [ ] warn if ipv6 RA is disabled
22-
233
const uloop = require("uloop");
244
const rtnl = require("rtnl");
255
const wg = require("wireguard");
@@ -28,7 +8,7 @@ const math = require("math");
288
const uci = require("uci");
299

3010
const UPLINK_NETNS_IFNAME = 'ts_uplink';
31-
const WG_LOGIN = { "username": "wginstaller", "password": "wginstaller" };
11+
const UBUS_LOGIN = { "username": "wginstaller", "password": "wginstaller" };
3212

3313
let cfg = {};
3414

@@ -51,6 +31,7 @@ function load_config(name) {
5131

5232
ctx.foreach(name, "wg-server", function(c) {
5333
cfg.wireguard_servers[""+c.name] = {
34+
"name": ""+c.name,
5435
"url": ""+c.url,
5536
"insecure_cert": int(c.insecure_cert) != 0,
5637
"disabled": int(c.disabled) != 0,
@@ -59,6 +40,7 @@ function load_config(name) {
5940

6041
ctx.foreach(name, "wg-interface", function(c) {
6142
cfg.wireguard_interfaces[""+c.ifname] = {
43+
"ifname": ""+c.ifname,
6244
"ipv6": ""+c.ipv6,
6345
"ipv4": ""+c.ipv4,
6446
"mtu": int(c.mtu),
@@ -287,7 +269,7 @@ function wg_replace_endpoint(ifname, cfg, next) {
287269
"00000000000000000000000000000000",
288270
"session",
289271
"login",
290-
WG_LOGIN]};
272+
UBUS_LOGIN]};
291273
let cmd = sprintf("ip netns exec %s uclient-fetch -q -O - %s --post-data='%s' %s", cfg.uplink_netns, certopt, "%s", srvcfg.url);
292274
let p = fs.popen(sprintf(cmd, msg), "r");
293275
let out = p.read("all");

0 commit comments

Comments
 (0)