diff --git a/luasrc/model/cbi/mosdns/basic.lua b/luasrc/model/cbi/mosdns/basic.lua index 0542775..8c7e8fa 100644 --- a/luasrc/model/cbi/mosdns/basic.lua +++ b/luasrc/model/cbi/mosdns/basic.lua @@ -16,6 +16,12 @@ configfile:value("/etc/mosdns/config.yaml", translate("Def Config")) configfile:value("/etc/mosdns/config_custom.yaml", translate("Cus Config")) configfile.default = "/etc/mosdns/config.yaml" +listenport = s:option(Value, "listen_port", translate("Listen port")) +listenport.datatype = "and(port,min(1))" +listenport.default = 5335 +listenport.rmempty = false +listenport:depends( "configfile", "/etc/mosdns/config.yaml") + loglevel = s:option(ListValue, "log_level", translate("Log Level")) loglevel:value("debug") loglevel:value("info") @@ -41,15 +47,18 @@ dnsforward:depends( "configfile", "/etc/mosdns/config.yaml") cache_size = s:option(Value, "cache_size", translate("DNS Cache Size")) cache_size.datatype = "and(uinteger,min(0))" cache_size.rmempty = false +cache_size:depends( "configfile", "/etc/mosdns/config.yaml") minimal_ttl = s:option(Value, "minimal_ttl", translate("Minimum TTL")) minimal_ttl.datatype = "and(uinteger,min(1))" minimal_ttl.datatype = "and(uinteger,max(3600))" minimal_ttl.rmempty = false +minimal_ttl:depends( "configfile", "/etc/mosdns/config.yaml") maximum_ttl = s:option(Value, "maximum_ttl", translate("Maximum TTL")) maximum_ttl.datatype = "and(uinteger,min(1))" maximum_ttl.rmempty = false +maximum_ttl:depends( "configfile", "/etc/mosdns/config.yaml") redirect = s:option(Flag, "redirect", translate("Enable DNS Redirect")) redirect:depends( "configfile", "/etc/mosdns/config.yaml") diff --git a/po/zh-cn/mosdns.po b/po/zh-cn/mosdns.po index 0be743d..ddbec93 100644 --- a/po/zh-cn/mosdns.po +++ b/po/zh-cn/mosdns.po @@ -19,6 +19,9 @@ msgstr "获取数据中..." msgid "Enable" msgstr "启用" +msgid "Listen port" +msgstr "监听端口" + msgid "Enable DNS Redirect" msgstr "启用 DNS 重定向" diff --git a/root/etc/config/mosdns b/root/etc/config/mosdns index ac32946..96e4909 100644 --- a/root/etc/config/mosdns +++ b/root/etc/config/mosdns @@ -1,6 +1,7 @@ config mosdns 'mosdns' option enabled '0' + option listen_port '5335' option geo_auto_update '0' option geo_update_week_time 'all' option geo_update_day_time '2' diff --git a/root/etc/mosdns/config.yaml b/root/etc/mosdns/config.yaml index 9c630ff..bf7e555 100644 --- a/root/etc/mosdns/config.yaml +++ b/root/etc/mosdns/config.yaml @@ -13,9 +13,9 @@ plugin: - main_sequence server: - protocol: udp - addr: ":5335" + addr: ":${{ uci -q get mosdns.mosdns.listen_port }}" - protocol: tcp - addr: ":5335" + addr: ":${{ uci -q get mosdns.mosdns.listen_port }}" - tag: main_sequence type: sequence