advancedconfig: tun wan only (#310)

* Prevent tunnel traffic being sent over the mesh (unless explicitly enabled)
* Boolean settings will use default value if value not yet set
This commit is contained in:
Tim Wilkinson 2022-03-20 18:55:11 -07:00 committed by GitHub
parent 69c0d51216
commit 6b4ccbf5ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 6 deletions

View File

@ -179,7 +179,7 @@ local settings = {
{ {
key = "aredn.@tunnel[0].maxclients", key = "aredn.@tunnel[0].maxclients",
type = "string", type = "string",
desc = "Specifies the maximum number of tunnel clients this node can serve; must be an integer in the range [0,100]. (Only applies if tunnel software is installed)", desc = "Specifies the maximum number of tunnel clients this node can serve; must be an integer in the range [0,100].",
default = "10", default = "10",
precallback = "restrictTunnelLimitToValidRange()", precallback = "restrictTunnelLimitToValidRange()",
postcallback = "adjustTunnelInterfaceCount()" postcallback = "adjustTunnelInterfaceCount()"
@ -187,11 +187,17 @@ local settings = {
{ {
key = "aredn.@tunnel[0].maxservers", key = "aredn.@tunnel[0].maxservers",
type = "string", type = "string",
desc = "Specifies the maximum number of tunnel servers to which this node can connect; must be an integer in the range [0,100]. (Only applies if tunnel software is installed)", desc = "Specifies the maximum number of tunnel servers to which this node can connect; must be an integer in the range [0,100].",
default = "10", default = "10",
precallback = "restrictTunnelLimitToValidRange()", precallback = "restrictTunnelLimitToValidRange()",
postcallback = "adjustTunnelInterfaceCount()" postcallback = "adjustTunnelInterfaceCount()"
}, },
{
key = "aredn.@tunnel[0].wanonly",
type = "boolean",
desc = "Prevents tunnel traffic from being routed over the mesh network itself.",
default = "1"
},
{ {
key = "aredn.@meshstatus[0].lowmem", key = "aredn.@meshstatus[0].lowmem",
type = "string", type = "string",
@ -627,10 +633,15 @@ do
html.print([[<tr><td align="center"><span title="]] .. setting.desc .. [["><img src="/qmark.png" /></span></td><td>]] .. setting.key .. [[</td><td>]]) html.print([[<tr><td align="center"><span title="]] .. setting.desc .. [["><img src="/qmark.png" /></span></td><td>]] .. setting.key .. [[</td><td>]])
if setting.type == "string" then if setting.type == "string" then
html.print("<input type='text' id='field_" .. i .. "' name='newval_" .. i .. "' size='65' value='" .. sval .. "'>") html.print("<input type='text' id='field_" .. i .. "' name='newval_" .. i .. "' size='65' value='" .. sval .. "'>")
elseif setting.type == "boolean" and sval == "1" then elseif setting.type == "boolean" then
html.print("OFF<label class='switch'><input type='checkbox' id='field_" .. i .. "' name='newval_" .. i .."' value='1' checked><span class='slider round'></span></label>ON") if sval == "" then
elseif setting.type == "boolean" and sval == "0" then sval = setting.default
html.print("OFF<label class='switch'><input type='checkbox' id='field_" .. i .. "' name='newval_" .. i .. "' value='1'><span class='slider round'></span></label>ON") end
if sval == "1" then
html.print("OFF<label class='switch'><input type='checkbox' id='field_" .. i .. "' name='newval_" .. i .."' value='1' checked><span class='slider round'></span></label>ON")
else
html.print("OFF<label class='switch'><input type='checkbox' id='field_" .. i .. "' name='newval_" .. i .. "' value='1'><span class='slider round'></span></label>ON")
end
elseif setting.type == "none" then elseif setting.type == "none" then
html.print("Click EXECUTE button to trigger this action<input type='hidden' id='field_" .. i .. "' name='newval_" .. i .."' value='" .. sval .."'>") html.print("Click EXECUTE button to trigger this action<input type='hidden' id='field_" .. i .. "' name='newval_" .. i .."' value='" .. sval .."'>")
end end