add custom listen port

This commit is contained in:
sbwml 2022-04-09 10:17:57 +08:00
parent 640f37a61f
commit 5d25b7bf88
4 changed files with 15 additions and 2 deletions

View File

@ -16,6 +16,12 @@ configfile:value("/etc/mosdns/config.yaml", translate("Def Config"))
configfile:value("/etc/mosdns/config_custom.yaml", translate("Cus Config")) configfile:value("/etc/mosdns/config_custom.yaml", translate("Cus Config"))
configfile.default = "/etc/mosdns/config.yaml" 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 = s:option(ListValue, "log_level", translate("Log Level"))
loglevel:value("debug") loglevel:value("debug")
loglevel:value("info") 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 = s:option(Value, "cache_size", translate("DNS Cache Size"))
cache_size.datatype = "and(uinteger,min(0))" cache_size.datatype = "and(uinteger,min(0))"
cache_size.rmempty = false cache_size.rmempty = false
cache_size:depends( "configfile", "/etc/mosdns/config.yaml")
minimal_ttl = s:option(Value, "minimal_ttl", translate("Minimum TTL")) minimal_ttl = s:option(Value, "minimal_ttl", translate("Minimum TTL"))
minimal_ttl.datatype = "and(uinteger,min(1))" minimal_ttl.datatype = "and(uinteger,min(1))"
minimal_ttl.datatype = "and(uinteger,max(3600))" minimal_ttl.datatype = "and(uinteger,max(3600))"
minimal_ttl.rmempty = false minimal_ttl.rmempty = false
minimal_ttl:depends( "configfile", "/etc/mosdns/config.yaml")
maximum_ttl = s:option(Value, "maximum_ttl", translate("Maximum TTL")) maximum_ttl = s:option(Value, "maximum_ttl", translate("Maximum TTL"))
maximum_ttl.datatype = "and(uinteger,min(1))" maximum_ttl.datatype = "and(uinteger,min(1))"
maximum_ttl.rmempty = false maximum_ttl.rmempty = false
maximum_ttl:depends( "configfile", "/etc/mosdns/config.yaml")
redirect = s:option(Flag, "redirect", translate("Enable DNS Redirect")) redirect = s:option(Flag, "redirect", translate("Enable DNS Redirect"))
redirect:depends( "configfile", "/etc/mosdns/config.yaml") redirect:depends( "configfile", "/etc/mosdns/config.yaml")

View File

@ -19,6 +19,9 @@ msgstr "获取数据中..."
msgid "Enable" msgid "Enable"
msgstr "启用" msgstr "启用"
msgid "Listen port"
msgstr "监听端口"
msgid "Enable DNS Redirect" msgid "Enable DNS Redirect"
msgstr "启用 DNS 重定向" msgstr "启用 DNS 重定向"

View File

@ -1,6 +1,7 @@
config mosdns 'mosdns' config mosdns 'mosdns'
option enabled '0' option enabled '0'
option listen_port '5335'
option geo_auto_update '0' option geo_auto_update '0'
option geo_update_week_time 'all' option geo_update_week_time 'all'
option geo_update_day_time '2' option geo_update_day_time '2'

View File

@ -13,9 +13,9 @@ plugin:
- main_sequence - main_sequence
server: server:
- protocol: udp - protocol: udp
addr: ":5335" addr: ":${{ uci -q get mosdns.mosdns.listen_port }}"
- protocol: tcp - protocol: tcp
addr: ":5335" addr: ":${{ uci -q get mosdns.mosdns.listen_port }}"
- tag: main_sequence - tag: main_sequence
type: sequence type: sequence