This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
forked from ffrl/ffrl-packages
-
Notifications
You must be signed in to change notification settings - Fork 1
/
0300-mesh-vpn.lua
executable file
·47 lines (40 loc) · 1.66 KB
/
0300-mesh-vpn.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
return function(form, uci)
local msg = translate(
'Your internet connection can be used to establish a ' ..
'VPN connection with other nodes. ' ..
'Enable this option if there are no other nodes reachable ' ..
'over WLAN in your vicinity or you want to make a part of ' ..
'your connection\'s bandwidth available for the network. You can limit how ' ..
'much bandwidth the node will use at most.'
)
local s = form:section(Section, nil, msg)
local o
local meshvpn = s:option(Flag, "meshvpn", translate("Use internet connection (mesh VPN)"))
meshvpn.default = uci:get_bool("tunneldigger", "mesh_vpn", "enabled")
function meshvpn:write(data)
uci:set("tunneldigger", "mesh_vpn", "enabled", data)
end
local limit = s:option(Flag, "limit_enabled", translate("Limit bandwidth"))
limit:depends(meshvpn, true)
limit.default = uci:get_bool("simple-tc", "mesh_vpn", "enabled")
function limit:write(data)
uci:set("simple-tc", "mesh_vpn", "interface")
uci:set("simple-tc", "mesh_vpn", "enabled", data)
uci:set("simple-tc", "mesh_vpn", "ifname", "mesh-vpn")
end
o = s:option(Value, "limit_ingress", translate("Downstream (kbit/s)"))
o:depends(limit, true)
o.default = uci:get("simple-tc", "mesh_vpn", "limit_ingress")
o.datatype = "uinteger"
function o:write(data)
uci:set("simple-tc", "mesh_vpn", "limit_ingress", data)
end
o = s:option(Value, "limit_egress", translate("Upstream (kbit/s)"))
o:depends(limit, true)
o.default = uci:get("simple-tc", "mesh_vpn", "limit_egress")
o.datatype = "uinteger"
function o:write(data)
uci:set("simple-tc", "mesh_vpn", "limit_egress", data)
end
return {'tunneldigger', 'simple-tc'}
end