98a1c196ed
This fully abstracts VPN methods, making gluon-mesh-vpn-fastd and gluon-mesh-vpn-tunneldigger completely self-contained. Provide a LUA interface for generic interacting with VPN methods in gluon-mesh-vpn-core and web packages. This also adds the ability to install tunneldigger and fastd to the same image, selecting the VPN method based on the selected domain. Signed-off-by: David Bauer <mail@david-bauer.net>
35 lines
902 B
Lua
Executable File
35 lines
902 B
Lua
Executable File
#!/usr/bin/lua
|
|
|
|
local site = require 'gluon.site'
|
|
local util = require 'gluon.util'
|
|
local vpn_core = require 'gluon.mesh-vpn'
|
|
|
|
local uci = require('simple-uci').cursor()
|
|
|
|
|
|
local enabled
|
|
|
|
-- Delete old broker config section (remove in 2019)
|
|
if not uci:get('tunneldigger', 'mesh_vpn') then
|
|
if uci:get_first('tunneldigger', 'broker', 'interface') == 'mesh-vpn' then
|
|
enabled = uci:get_first('tunneldigger', 'broker', 'enabled')
|
|
end
|
|
|
|
-- In the usual case (no migration from old tunneldigger package), the
|
|
-- enabled state is set in the 500-mesh-vpn script
|
|
|
|
uci:delete_all('tunneldigger', 'broker')
|
|
end
|
|
|
|
uci:section('tunneldigger', 'broker', 'mesh_vpn', {
|
|
enabled = enabled,
|
|
uuid = util.node_id(),
|
|
interface = vpn_core.get_interface(),
|
|
bind_interface = 'br-wan',
|
|
group = 'gluon-mesh-vpn',
|
|
broker_selection = 'usage',
|
|
address = site.mesh_vpn.tunneldigger.brokers(),
|
|
})
|
|
|
|
uci:save('tunneldigger')
|