Skip to content

Commit

Permalink
mesh-vpn: recognise parker as vpn type
Browse files Browse the repository at this point in the history
This change overrides the gluon-core vpn-provider logic and makes sure
that mesh-vpn get's enabled when the user set the corresponding option
in the wizzard.
It also sets the simple-tc traffic limits.
  • Loading branch information
Kasalehlia authored and SmithChart committed Nov 6, 2024
1 parent 45f0eaa commit 79ebeb1
Showing 1 changed file with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/lua

local uci = require('simple-uci').cursor()
local vpn_name, vpn = require('gluon.mesh-vpn').get_active_provider()

local vpn_config = {
enabled = uci:get_bool('gluon', 'mesh_vpn', 'enabled'),
Expand All @@ -10,20 +9,12 @@ local vpn_config = {
limit_ingress = uci:get('gluon', 'mesh_vpn', 'limit_ingress'),
}

if vpn_name ~= 'fastd' then
uci:set('fastd', 'mesh_vpn', 'enabled', false)
uci:save('fastd')
end

if vpn_name ~= 'tunneldigger' then
uci:set('tunneldigger', 'mesh_vpn', 'enabled', false)
uci:save('tunneldigger')
end

vpn.enable(vpn_config.enabled)
if vpn_config.limit_enabled then
vpn.set_limit(vpn_config.limit_ingress, vpn_config.limit_egress)
else
vpn.set_limit(nil, nil)
end

uci:delete('simple-tc', 'client')
uci:section('simple-tc', 'interface', 'client', {
ifname = 'br-client',
enabled = vpn_config.limit_enabled,
-- limits are flipped here
limit_ingress = vpn_config.limit_egress,
limit_egress = vpn_config.limit_ingress,
})
uci:commit('simple-tc')

0 comments on commit 79ebeb1

Please sign in to comment.