1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add option to disable omr-tracker

This commit is contained in:
Ycarus 2018-03-30 11:12:14 +02:00
parent c4ec834dc9
commit 105653108a
3 changed files with 16 additions and 1 deletions

View file

@ -8,6 +8,10 @@ m = Map("omr-tracker", translate("OMR-Tracker"), translate("OMR-Tracker detect w
s = m:section(TypedSection, "defaults", translate("Defaults Settings")) s = m:section(TypedSection, "defaults", translate("Defaults Settings"))
s.anonymous = true s.anonymous = true
o = s:option(Flag, "enabled", translate("Enable"), translate("When tracker is disabled, connection failover is also disabled"))
o.default = true
o.rmempty = false
o = s:option(Value, "timeout", translate("Timeout (s)")) o = s:option(Value, "timeout", translate("Timeout (s)"))
o.placeholder = "1" o.placeholder = "1"
o.default = "1" o.default = "1"
@ -48,6 +52,10 @@ for _, iface in ipairs(ifaces) do
end end
end end
o = s:option(Flag, "enabled", translate("Enable"))
o.default = true
o.rmempty = false
o = s:option(Value, "timeout", translate("Timeout (s)")) o = s:option(Value, "timeout", translate("Timeout (s)"))
o.placeholder = "1" o.placeholder = "1"
o.default = "1" o.default = "1"

View file

@ -1,6 +1,10 @@
config defaults 'defaults' config defaults 'defaults'
list hosts '4.2.2.1' list hosts '4.2.2.1'
list hosts '8.8.8.8' list hosts '8.8.8.8'
list hosts '8.8.4.4'
list hosts '9.9.9.9'
list hosts '1.1.1.1'
list hosts '1.0.0.1'
option timeout '1' option timeout '1'
option tries '4' option tries '4'
option interval '2' option interval '2'

View file

@ -11,7 +11,7 @@
_validate_section() { _validate_section() {
local tmp_hosts=$hosts tmp_timeout=$timeout tmp_tries=$tries local tmp_hosts=$hosts tmp_timeout=$timeout tmp_tries=$tries
local tmp_interval=$interval tmp_options=$options tmp_type=$type local tmp_interval=$interval tmp_options=$options tmp_type=$type tmp_enabled=$enabled
uci_validate_section omr-tracker "$1" "$2" \ uci_validate_section omr-tracker "$1" "$2" \
'hosts:list(host)' \ 'hosts:list(host)' \
@ -19,6 +19,7 @@ _validate_section() {
'tries:uinteger' \ 'tries:uinteger' \
'interval:uinteger' \ 'interval:uinteger' \
'type:string' \ 'type:string' \
'enabled:bool:1' \
'options:string' 'options:string'
[ -z "$hosts" ] && hosts=$tmp_hosts [ -z "$hosts" ] && hosts=$tmp_hosts
@ -27,6 +28,7 @@ _validate_section() {
[ -z "$interval" ] && interval=$tmp_interval [ -z "$interval" ] && interval=$tmp_interval
[ -z "$options" ] && options=$tmp_options [ -z "$options" ] && options=$tmp_options
[ -z "$type" ] && type=$tmp_type [ -z "$type" ] && type=$tmp_type
[ -z "$enabled" ] && enabled=$tmp_enabled
} }
_launch_tracker() { _launch_tracker() {
@ -47,6 +49,7 @@ _launch_tracker() {
config_get gateway "$1" gateway config_get gateway "$1" gateway
[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && return [ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && return
[ $enabled = 0 ] && return
[ -z "$type" ] && type="ping" [ -z "$type" ] && type="ping"
procd_open_instance procd_open_instance