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

Add interface to shadowsocks tracker

This commit is contained in:
Ycarus 2018-05-09 11:53:45 +02:00
parent 0387798d74
commit f7b2096fa2
3 changed files with 34 additions and 4 deletions

View file

@ -3,9 +3,39 @@ local sys = require "luci.sys"
local ifaces = sys.net:devices() local ifaces = sys.net:devices()
local m, s, o local m, s, o
m = Map("omr-tracker", translate("OMR-Tracker"), translate("OMR-Tracker detect when a connection is down and execute needed scripts")) m = Map("omr-tracker", translate("OMR-Tracker"))
s = m:section(TypedSection, "defaults", translate("Defaults Settings")) s = m:section(TypedSection, "shadowsocks", translate("ShadowSocks tracker Settings"), translate("Detect if ShadowSocks is down and stop traffic redirection over it"))
s.anonymous = true
o = s:option(Flag, "enabled", translate("Enable"), translate("When tracker is disabled, connection failover is also disabled"))
o.rmempty = false
o = s:option(Value, "timeout", translate("Timeout (s)"))
o.placeholder = "1"
o.default = "1"
o.datatype = "range(1, 100)"
o.rmempty = false
o = s:option(Value, "tries", translate("Tries"))
o.placeholder = "4"
o.default = "4"
o.datatype = "range(1, 10)"
o.rmempty = false
o = s:option(Value, "interval", translate("Retry interval (s)"))
o.placeholder = "2"
o.default = "2"
o.datatype = "range(1, 100)"
o.rmempty = false
o = s:option(DynamicList, "hosts", translate("Hosts"))
o.placeholder = "bing.com"
o.default = { "bing.com", "google.com" }
o.rmempty = false
s = m:section(TypedSection, "defaults", translate("Defaults Settings"), translate("OMR-Tracker detect when a connection is down and execute needed scripts"))
s.anonymous = true s.anonymous = true
o = s:option(Flag, "enabled", translate("Enable"), translate("When tracker is disabled, connection failover is also disabled")) o = s:option(Flag, "enabled", translate("Enable"), translate("When tracker is disabled, connection failover is also disabled"))

View file

@ -14,7 +14,7 @@ config defaults 'defaults'
option type 'ping' option type 'ping'
option options '' option options ''
config defaults 'shadowsocks' config shadowsocks 'shadowsocks'
option enabled '1' option enabled '1'
list hosts 'google.com' list hosts 'google.com'
list hosts 'bing.com' list hosts 'bing.com'

View file

@ -97,7 +97,7 @@ _launch_shadowsocks_tracker() {
[ "$1" = "tracker" ] || return [ "$1" = "tracker" ] || return
_validate_section "defaults" "shadowsocks" _validate_section "shadowsocks" "shadowsocks"
config_get local_port "$1" local_port config_get local_port "$1" local_port
local disabled local disabled