advanced.lua 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. local m, s, o
  2. local uci = require "luci.model.uci".cursor()
  3. -- 获取 LAN IP 地址
  4. function lanip()
  5. local lan_ip
  6. lan_ip = luci.sys.exec("uci -q get network.lan.ipaddr 2>/dev/null | awk -F '/' '{print $1}' | tr -d '\n'")
  7. if not lan_ip or lan_ip == "" then
  8. lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -1 | tr -d '\n'")
  9. end
  10. if not lan_ip or lan_ip == "" then
  11. lan_ip = luci.sys.exec("ip addr show | grep -w 'inet' | grep 'global' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
  12. end
  13. return lan_ip
  14. end
  15. local lan_ip = lanip()
  16. local server_table = {}
  17. local type_table = {}
  18. local function is_finded(e)
  19. return luci.sys.exec(string.format('type -t -p "%s" 2>/dev/null', e)) ~= ""
  20. end
  21. uci:foreach("shadowsocksr", "servers", function(s)
  22. if s.alias then
  23. server_table[s[".name"]] = "[%s]:%s" % {string.upper(s.v2ray_protocol or s.type), s.alias}
  24. elseif s.server and s.server_port then
  25. server_table[s[".name"]] = "[%s]:%s:%s" % {string.upper(s.v2ray_protocol or s.type), s.server, s.server_port}
  26. end
  27. if s.type then
  28. type_table[s[".name"]] = s.type
  29. end
  30. end)
  31. local key_table = {}
  32. for key, _ in pairs(server_table) do
  33. table.insert(key_table, key)
  34. end
  35. table.sort(key_table)
  36. m = Map("shadowsocksr")
  37. -- [[ global ]]--
  38. s = m:section(TypedSection, "global", translate("Server failsafe auto swith and custom update settings"))
  39. s.anonymous = true
  40. -- o = s:option(Flag, "monitor_enable", translate("Enable Process Deamon"))
  41. -- o.rmempty = false
  42. -- o.default = "1"
  43. o = s:option(Flag, "enable_switch", translate("Enable Auto Switch"))
  44. o.rmempty = false
  45. o.default = "1"
  46. o = s:option(Value, "switch_time", translate("Switch check cycly(second)"))
  47. o.datatype = "uinteger"
  48. o:depends("enable_switch", "1")
  49. o.default = 667
  50. o = s:option(Value, "switch_timeout", translate("Check timout(second)"))
  51. o.datatype = "uinteger"
  52. o:depends("enable_switch", "1")
  53. o.default = 5
  54. o = s:option(Value, "switch_try_count", translate("Check Try Count"))
  55. o.datatype = "uinteger"
  56. o:depends("enable_switch", "1")
  57. o.default = 3
  58. o = s:option(Value, "gfwlist_url", translate("gfwlist Update url"))
  59. o:value("https://fastly.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt", translate("v2fly/domain-list-community"))
  60. o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt", translate("Loyalsoldier/v2ray-rules-dat"))
  61. o:value("https://fastly.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
  62. o:value("https://fastly.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
  63. o.default = "https://fastly.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt"
  64. o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
  65. o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
  66. o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang.CN.CIDR"))
  67. o:value("https://fastly.jsdelivr.net/gh/gaoyifan/china-operator-ip@ip-lists/china.txt", translate("china-operator-ip"))
  68. o.default = "https://ispip.clang.cn/all_cn.txt"
  69. o = s:option(Flag, "netflix_enable", translate("Enable Netflix Mode"))
  70. o.description = translate("When disabled shunt mode, will same time stopped shunt service.")
  71. o.rmempty = false
  72. o = s:option(Value, "nfip_url", translate("nfip_url"))
  73. o:value("https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt", translate("Netflix IP Only"))
  74. o:value("https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/getflix.txt", translate("Netflix and AWS"))
  75. o.default = "https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt"
  76. o.description = translate("Customize Netflix IP Url")
  77. o:depends("netflix_enable", "1")
  78. o = s:option(ListValue, "shunt_dns_mode", translate("DNS Query Mode For Shunt Mode"))
  79. if is_finded("dns2socks") then
  80. o:value("1", translate("Use DNS2SOCKS query and cache"))
  81. end
  82. if is_finded("dns2socks-rust") then
  83. o:value("2", translate("Use DNS2SOCKS-RUST query and cache"))
  84. end
  85. if is_finded("mosdns") then
  86. o:value("3", translate("Use MosDNS query"))
  87. end
  88. if is_finded("dnsproxy") then
  89. o:value("4", translate("Use DNSPROXY query and cache"))
  90. end
  91. if is_finded("chinadns-ng") then
  92. o:value("5", translate("Use ChinaDNS-NG query and cache"))
  93. end
  94. o:depends("netflix_enable", "1")
  95. o.default = 1
  96. o = s:option(Value, "shunt_dnsserver", translate("Anti-pollution DNS Server For Shunt Mode"))
  97. o:value("8.8.4.4:53", translate("Google Public DNS (8.8.4.4)"))
  98. o:value("8.8.8.8:53", translate("Google Public DNS (8.8.8.8)"))
  99. o:value("208.67.222.222:53", translate("OpenDNS (208.67.222.222)"))
  100. o:value("208.67.220.220:53", translate("OpenDNS (208.67.220.220)"))
  101. o:value("209.244.0.3:53", translate("Level 3 Public DNS (209.244.0.3)"))
  102. o:value("209.244.0.4:53", translate("Level 3 Public DNS (209.244.0.4)"))
  103. o:value("4.2.2.1:53", translate("Level 3 Public DNS (4.2.2.1)"))
  104. o:value("4.2.2.2:53", translate("Level 3 Public DNS (4.2.2.2)"))
  105. o:value("4.2.2.3:53", translate("Level 3 Public DNS (4.2.2.3)"))
  106. o:value("4.2.2.4:53", translate("Level 3 Public DNS (4.2.2.4)"))
  107. o:value("1.1.1.1:53", translate("Cloudflare DNS (1.1.1.1)"))
  108. o:depends("shunt_dns_mode", "1")
  109. o:depends("shunt_dns_mode", "2")
  110. o.description = translate("Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)")
  111. o.datatype = "ip4addrport"
  112. o = s:option(ListValue, "shunt_mosdns_dnsserver", translate("Anti-pollution DNS Server"))
  113. o:value("tcp://8.8.4.4:53,tcp://8.8.8.8:53", translate("Google Public DNS"))
  114. o:value("tcp://208.67.222.222:53,tcp://208.67.220.220:53", translate("OpenDNS"))
  115. o:value("tcp://209.244.0.3:53,tcp://209.244.0.4:53", translate("Level 3 Public DNS-1 (209.244.0.3-4)"))
  116. o:value("tcp://4.2.2.1:53,tcp://4.2.2.2:53", translate("Level 3 Public DNS-2 (4.2.2.1-2)"))
  117. o:value("tcp://4.2.2.3:53,tcp://4.2.2.4:53", translate("Level 3 Public DNS-3 (4.2.2.3-4)"))
  118. o:value("tcp://1.1.1.1:53,tcp://1.0.0.1:53", translate("Cloudflare DNS"))
  119. o:depends("shunt_dns_mode", "3")
  120. o.description = translate("Custom DNS Server for MosDNS")
  121. o = s:option(Flag, "shunt_mosdns_ipv6", translate("Disable IPv6 In MosDNS Query Mode (Shunt Mode)"))
  122. o:depends("shunt_dns_mode", "3")
  123. o.rmempty = false
  124. o.default = "0"
  125. if is_finded("dnsproxy") then
  126. o = s:option(ListValue, "shunt_parse_method", translate("Select DNS parse Mode"))
  127. o.description = translate(
  128. "<ul>" ..
  129. "<li>" .. translate("When use DNS list file, please ensure list file exists and is formatted correctly.") .. "</li>" ..
  130. "<li>" .. translate("Tips: Dnsproxy DNS Parse List Path:") ..
  131. " <a href='http://" .. lan_ip .. "/cgi-bin/luci/admin/services/shadowsocksr/control' target='_blank'>" ..
  132. translate("Click here to view or manage the DNS list file") .. "</a>" .. "</li>" ..
  133. "</ul>"
  134. )
  135. o:value("single_dns", translate("Set Single DNS"))
  136. o:value("parse_file", translate("Use DNS List File"))
  137. o:depends("shunt_dns_mode", "4")
  138. o.rmempty = true
  139. o.default = "single_dns"
  140. o = s:option(Value, "dnsproxy_shunt_forward", translate("Anti-pollution DNS Server"))
  141. o:value("sdns://AgUAAAAAAAAABzguOC40LjQgsKKKE4EwvtIbNjGjagI2607EdKSVHowYZtyvD9iPrkkHOC44LjQuNAovZG5zLXF1ZXJ5", translate("Google DNSCrypt SDNS"))
  142. o:value("sdns://AgcAAAAAAAAAACC2vD25TAYM7EnyCH8Xw1-0g5OccnTsGH9vQUUH0njRtAxkbnMudHduaWMudHcKL2Rucy1xdWVyeQ", translate("TWNIC-101 DNSCrypt SDNS"))
  143. o:value("sdns://AgcAAAAAAAAADzE4NS4yMjIuMjIyLjIyMiAOp5Svj-oV-Fz-65-8H2VKHLKJ0egmfEgrdPeAQlUFFA8xODUuMjIyLjIyMi4yMjIKL2Rucy1xdWVyeQ", translate("dns.sb DNSCrypt SDNS"))
  144. o:value("sdns://AgMAAAAAAAAADTE0OS4xMTIuMTEyLjkgsBkgdEu7dsmrBT4B4Ht-BQ5HPSD3n3vqQ1-v5DydJC8SZG5zOS5xdWFkOS5uZXQ6NDQzCi9kbnMtcXVlcnk", translate("Quad9 DNSCrypt SDNS"))
  145. o:value("sdns://AQMAAAAAAAAAETk0LjE0MC4xNC4xNDo1NDQzINErR_JS3PLCu_iZEIbq95zkSV2LFsigxDIuUso_OQhzIjIuZG5zY3J5cHQuZGVmYXVsdC5uczEuYWRndWFyZC5jb20", translate("AdGuard DNSCrypt SDNS"))
  146. o:value("sdns://AgcAAAAAAAAABzEuMC4wLjGgENk8mGSlIfMGXMOlIlCcKvq7AVgcrZxtjon911-ep0cg63Ul-I8NlFj4GplQGb_TTLiczclX57DvMV8Q-JdjgRgSZG5zLmNsb3VkZmxhcmUuY29tCi9kbnMtcXVlcnk", translate("Cloudflare DNSCrypt SDNS"))
  147. o:value("sdns://AgcAAAAAAAAADjEwNC4xNi4yNDkuMjQ5ABJjbG91ZGZsYXJlLWRucy5jb20KL2Rucy1xdWVyeQ", translate("cloudflare-dns.com DNSCrypt SDNS"))
  148. o:depends("shunt_parse_method", "single_dns")
  149. o.description = translate("Custom DNS Server (support: IP:Port or tls://IP:Port or https://IP/dns-query and other format).")
  150. o = s:option(ListValue, "shunt_upstreams_logic_mode", translate("Defines the upstreams logic mode"))
  151. o.description = translate(
  152. "<ul>" ..
  153. "<li>" .. translate("Defines the upstreams logic mode, possible values: load_balance, parallel, fastest_addr (default: load_balance).") .. "</li>" .. "<li>" .. translate("When two or more DNS servers are deployed, enable this function.") .. "</li>" ..
  154. "</ul>"
  155. )
  156. o:value("load_balance", translate("load_balance"))
  157. o:value("parallel", translate("parallel"))
  158. o:value("fastest_addr", translate("fastest_addr"))
  159. o:depends("shunt_parse_method", "parse_file")
  160. o.rmempty = true
  161. o.default = "load_balance"
  162. o = s:option(Flag, "shunt_dnsproxy_ipv6", translate("Disable IPv6 query mode"))
  163. o.description = translate("When disabled, all AAAA requests are not resolved.")
  164. o:depends("shunt_parse_method", "single_dns")
  165. o:depends("shunt_parse_method", "parse_file")
  166. o.rmempty = false
  167. o.default = "1"
  168. end
  169. if is_finded("chinadns-ng") then
  170. o = s:option(Value, "chinadns_ng_shunt_dnsserver", translate("Anti-pollution DNS Server For Shunt Mode"))
  171. o:value("8.8.4.4:53", translate("Google Public DNS (8.8.4.4)"))
  172. o:value("8.8.8.8:53", translate("Google Public DNS (8.8.8.8)"))
  173. o:value("208.67.222.222:53", translate("OpenDNS (208.67.222.222)"))
  174. o:value("208.67.220.220:53", translate("OpenDNS (208.67.220.220)"))
  175. o:value("209.244.0.3:53", translate("Level 3 Public DNS (209.244.0.3)"))
  176. o:value("209.244.0.4:53", translate("Level 3 Public DNS (209.244.0.4)"))
  177. o:value("4.2.2.1:53", translate("Level 3 Public DNS (4.2.2.1)"))
  178. o:value("4.2.2.2:53", translate("Level 3 Public DNS (4.2.2.2)"))
  179. o:value("4.2.2.3:53", translate("Level 3 Public DNS (4.2.2.3)"))
  180. o:value("4.2.2.4:53", translate("Level 3 Public DNS (4.2.2.4)"))
  181. o:value("1.1.1.1:53", translate("Cloudflare DNS (1.1.1.1)"))
  182. o:depends("shunt_dns_mode", "5")
  183. o.description = translate(
  184. "<ul>" ..
  185. "<li>" .. translate("Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)") .. "</li>" ..
  186. "<li>" .. translate("Muitiple DNS server can saperate with ','") .. "</li>" ..
  187. "</ul>"
  188. )
  189. o = s:option(ListValue, "chinadns_ng_shunt_proto", translate("ChinaDNS-NG shunt query protocol"))
  190. o:value("none", translate("UDP/TCP upstream"))
  191. o:value("tcp", translate("TCP upstream"))
  192. o:value("udp", translate("UDP upstream"))
  193. o:value("tls", translate("DoT upstream (Need use wolfssl version)"))
  194. o:depends("shunt_dns_mode", "5")
  195. end
  196. o = s:option(Flag, "apple_optimization", translate("Apple domains optimization"), translate("For Apple domains equipped with Chinese mainland CDN, always responsive to Chinese CDN IP addresses"))
  197. o.rmempty = false
  198. o.default = "1"
  199. o = s:option(Value, "apple_url", translate("Apple Domains Update url"))
  200. o:value("https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf", translate("felixonmars/dnsmasq-china-list"))
  201. o.default = "https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf"
  202. o:depends("apple_optimization", "1")
  203. o = s:option(Value, "apple_dns", translate("Apple Domains DNS"), translate("If empty, Not change Apple domains parsing DNS (Default is empty)"))
  204. o.rmempty = true
  205. o.default = ""
  206. o.datatype = "ip4addr"
  207. o:depends("apple_optimization", "1")
  208. o = s:option(Flag, "adblock", translate("Enable adblock"))
  209. o.rmempty = false
  210. o = s:option(Value, "adblock_url", translate("adblock_url"))
  211. o:value("https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_dnsmasq.conf", translate("NEO DEV HOST Lite"))
  212. o:value("https://raw.githubusercontent.com/neodevpro/neodevhost/master/dnsmasq.conf", translate("NEO DEV HOST Full"))
  213. o:value("https://anti-ad.net/anti-ad-for-dnsmasq.conf", translate("anti-AD"))
  214. o.default = "https://raw.githubusercontent.com/neodevpro/neodevhost/master/lite_dnsmasq.conf"
  215. o:depends("adblock", "1")
  216. o.description = translate("Support AdGuardHome and DNSMASQ format list")
  217. o = s:option(Button, "Reset", translate("Reset to defaults"))
  218. o.inputstyle = "reload"
  219. o.write = function()
  220. luci.sys.call("/etc/init.d/shadowsocksr reset")
  221. luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
  222. end
  223. -- [[ SOCKS5 Proxy ]]--
  224. s = m:section(TypedSection, "socks5_proxy", translate("Global SOCKS5 Proxy Server"))
  225. s.anonymous = true
  226. -- Enable/Disable Option
  227. o = s:option(Flag, "enabled", translate("Enable"))
  228. o.default = 0
  229. o.rmempty = false
  230. -- Server Selection
  231. o = s:option(ListValue, "server", translate("Server"))
  232. o:value("same", translate("Same as Global Server"))
  233. for _, key in pairs(key_table) do
  234. o:value(key, server_table[key])
  235. end
  236. o.default = "same"
  237. o.rmempty = false
  238. -- Dynamic value handling based on enabled/disabled state
  239. o.cfgvalue = function(self, section)
  240. local enabled = m:get(section, "enabled")
  241. if enabled == "0" then
  242. return m:get(section, "old_server")
  243. end
  244. return Value.cfgvalue(self, section)-- Default to `same` when enabled
  245. end
  246. o.write = function(self, section, value)
  247. local enabled = m:get(section, "enabled")
  248. if enabled == "0" then
  249. local old_server = Value.cfgvalue(self, section)
  250. if old_server ~= "nil" then
  251. m:set(section, "old_server", old_server)
  252. end
  253. m:set(section, "server", "nil")
  254. else
  255. m:del(section, "old_server")
  256. -- Write the value normally when enabled
  257. Value.write(self, section, value)
  258. end
  259. end
  260. -- Socks Auth
  261. if is_finded("xray") then
  262. o = s:option(ListValue, "socks5_auth", translate("Socks5 Auth Mode"), translate("Socks protocol auth methods, default:noauth."))
  263. o.default = "noauth"
  264. o:value("noauth", "NOAUTH")
  265. o:value("password", "PASSWORD")
  266. o.rmempty = true
  267. for key, server_type in pairs(type_table) do
  268. if server_type == "v2ray" then
  269. -- 如果服务器类型是 v2ray,则设置依赖项显示
  270. o:depends("server", key)
  271. end
  272. end
  273. o:depends({server = "same", disable = true})
  274. -- Socks User
  275. o = s:option(Value, "socks5_user", translate("Socks5 User"), translate("Only when Socks5 Auth Mode is password valid, Mandatory."))
  276. o.rmempty = true
  277. o:depends("socks5_auth", "password")
  278. -- Socks Password
  279. o = s:option(Value, "socks5_pass", translate("Socks5 Password"), translate("Only when Socks5 Auth Mode is password valid, Not mandatory."))
  280. o.password = true
  281. o.rmempty = true
  282. o:depends("socks5_auth", "password")
  283. -- Socks Mixed
  284. o = s:option(Flag, "socks5_mixed", translate("Enabled Mixed"), translate("Mixed as an alias of socks, default:Enabled."))
  285. o.default = "1"
  286. o.rmempty = false
  287. for key, server_type in pairs(type_table) do
  288. if server_type == "v2ray" then
  289. -- 如果服务器类型是 v2ray,则设置依赖项显示
  290. o:depends("server", key)
  291. end
  292. end
  293. o:depends({server = "same", disable = true})
  294. end
  295. -- Local Port
  296. o = s:option(Value, "local_port", translate("Local Port"))
  297. o.datatype = "port"
  298. o.default = 1080
  299. o.rmempty = false
  300. -- [[ fragmen Settings ]]--
  301. if is_finded("xray") then
  302. s = m:section(TypedSection, "global_xray_fragment", translate("Xray Fragment Settings"))
  303. s.anonymous = true
  304. o = s:option(Flag, "fragment", translate("Fragment"), translate("TCP fragments, which can deceive the censorship system in some cases, such as bypassing SNI blacklists."))
  305. o.default = 0
  306. o = s:option(ListValue, "fragment_packets", translate("Fragment Packets"), translate("\"1-3\" is for segmentation at TCP layer, applying to the beginning 1 to 3 data writes by the client. \"tlshello\" is for TLS client hello packet fragmentation."))
  307. o.default = "tlshello"
  308. o:value("tlshello", "tlshello")
  309. o:value("1-1", "1-1")
  310. o:value("1-2", "1-2")
  311. o:value("1-3", "1-3")
  312. o:value("1-5", "1-5")
  313. o:depends("fragment", true)
  314. o = s:option(Value, "fragment_length", translate("Fragment Length"), translate("Fragmented packet length (byte)"))
  315. o.default = "100-200"
  316. o:depends("fragment", true)
  317. o = s:option(Value, "fragment_interval", translate("Fragment Interval"), translate("Fragmentation interval (ms)"))
  318. o.default = "10-20"
  319. o:depends("fragment", true)
  320. o = s:option(Flag, "noise", translate("Noise"), translate("UDP noise, Under some circumstances it can bypass some UDP based protocol restrictions."))
  321. o.default = 0
  322. s = m:section(TypedSection, "xray_noise_packets", translate("Xray Noise Packets"))
  323. s.description = translate(
  324. "<font style='color:red'>" .. translate("To send noise packets, select \"Noise\" in Xray Settings.") .. "</font>" ..
  325. "<br/><font><b>" .. translate("For specific usage, see:") .. "</b></font>" ..
  326. "<a href='https://xtls.github.io/config/outbounds/freedom.html' target='_blank'>" ..
  327. "<font style='color:green'><b>" .. translate("Click to the page") .. "</b></font></a>")
  328. s.template = "cbi/tblsection"
  329. s.sortable = true
  330. s.anonymous = true
  331. s.addremove = true
  332. s.remove = function(self, section)
  333. for k, v in pairs(self.children) do
  334. v.rmempty = true
  335. v.validate = nil
  336. end
  337. TypedSection.remove(self, section)
  338. end
  339. o = s:option(Flag, "enabled", translate("Enable"))
  340. o.default = 1
  341. o.rmempty = false
  342. o = s:option(ListValue, "type", translate("Type"))
  343. o.default = "base64"
  344. o:value("rand", "rand")
  345. o:value("str", "str")
  346. o:value("hex", "hex")
  347. o:value("base64", "base64")
  348. o = s:option(Value, "domainStrategy", translate("Domain Strategy"))
  349. o.default = "UseIP"
  350. o:value("AsIs", "AsIs")
  351. o:value("UseIP", "UseIP")
  352. o:value("UseIPv4", "UseIPv4")
  353. o:value("ForceIP", "ForceIP")
  354. o:value("ForceIPv4", "ForceIPv4")
  355. o.rmempty = false
  356. o = s:option(Value, "packet", translate("Packet"))
  357. o.datatype = "minlength(1)"
  358. o.rmempty = false
  359. o = s:option(Value, "delay", translate("Delay (ms)"))
  360. o.datatype = "or(uinteger,portrange)"
  361. o.rmempty = false
  362. end
  363. return m