diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua index e80b60d..683e9ba 100644 --- a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua +++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua @@ -121,11 +121,15 @@ o.rmempty = false o.default = false o:depends("configfile", "/etc/mosdns/config.yaml") -o = s:taboption("advanced", Flag, "enable_ecs_remote", translate("Enable EDNS client subnet"), translate("Add the EDNS Client Subnet option (ECS) to Remote DNS") .. '
' .. translate("MosDNS will auto identify the IP address subnet segment of your remote connection (0/24)") .. '
' .. translate("If your remote access network changes, May need restart MosDNS to update the ECS request address")) +o = s:taboption("advanced", Flag, "enable_ecs_remote", translate("Enable EDNS client subnet")) o.rmempty = false o.default = false o:depends("configfile", "/etc/mosdns/config.yaml") +o = s:taboption("advanced", Value, "remote_ecs_ip", translate("IP Address"), translate("Please provide the IP address you use when accessing foreign websites. This IP subnet (0/24) will be used as the ECS address for Remote DNS requests") .. '
' .. translate("This feature is typically used when using a self-built DNS server as an Remote DNS upstream (requires support from the upstream server)")) +o.datatype = "ipaddr" +o:depends("enable_ecs_remote", "1") + o = s:taboption("advanced", Flag, "dns_leak", translate("Prevent DNS Leaks"), translate("Enable this option fallback policy forces forwarding to remote DNS")) o.rmempty = false o.default = false diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po index 1590f58..45c5d18 100644 --- a/luci-app-mosdns/po/zh-cn/mosdns.po +++ b/luci-app-mosdns/po/zh-cn/mosdns.po @@ -271,14 +271,14 @@ msgstr "禁用 TLS 服务器证书验证,当系统 CA 证书过期或系统时 msgid "Enable EDNS client subnet" msgstr "启用 EDNS 客户端子网" -msgid "Add the EDNS Client Subnet option (ECS) to Remote DNS" -msgstr "在远程 DNS 请求中加入 EDNS 客户端子网(即 ECS)选项(需要上游 DNS 服务器支持)" +msgid "IP Address" +msgstr "IP 地址" -msgid "MosDNS will auto identify the IP address subnet segment of your remote connection (0/24)" -msgstr "MosDNS 将会自动获取您访问远程连接时使用的 IP 子网段(0/24)" +msgid "Please provide the IP address you use when accessing foreign websites. This IP subnet (0/24) will be used as the ECS address for Remote DNS requests" +msgstr "请提供您在访问国外网站时使用的 IP 地址,这个 IP 子网(0/24)将用作远程 DNS 请求的 ECS 地址" -msgid "If your remote access network changes, May need restart MosDNS to update the ECS request address" -msgstr "如果您的远程访问网络发生改变时可能需要重启 MosDNS 以更新 ECS 请求地址" +msgid "This feature is typically used when using a self-built DNS server as an Remote DNS upstream (requires support from the upstream server)" +msgstr "此功能通常在使用自建 DNS 服务器作为 远程 DNS 上游时使用(需要上游服务器的支持)" msgid "Prevent DNS Leaks" msgstr "防止 DNS 泄漏" diff --git a/luci-app-mosdns/root/etc/init.d/mosdns b/luci-app-mosdns/root/etc/init.d/mosdns index 9449640..80c3391 100755 --- a/luci-app-mosdns/root/etc/init.d/mosdns +++ b/luci-app-mosdns/root/etc/init.d/mosdns @@ -59,6 +59,7 @@ get_config() { config_get insecure_skip_verify $1 insecure_skip_verify 0 config_get idle_timeout $1 idle_timeout 30 config_get enable_ecs_remote $1 enable_ecs_remote 0 + config_get remote_ecs_ip $1 remote_ecs_ip "110.34.181.1" config_get dns_leak $1 dns_leak 0 config_get cloudflare $1 cloudflare 0 } @@ -117,7 +118,7 @@ init_yaml() { [ "$dump_file" -eq 0 ] && \cp -a $DUMP_FILE_DEFAULT $DUMP_FILE # ECS if [ "$enable_ecs_remote" -eq 1 ]; then - ecs_remote=$(sh $MOSDNS_SCRIPT ecs_remote) + ecs_remote=$(echo "ecs ${remote_ecs_ip%.*}.0/24") sed -i "s,ecs_remote,$ecs_remote,g" $CONF else sed -i "/ecs_remote/d;" $CONF diff --git a/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh b/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh index 39b3d40..0cf430f 100755 --- a/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh +++ b/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh @@ -127,11 +127,6 @@ restart_service() { /etc/init.d/mosdns restart } -ecs_remote() { - ipaddr=$(curl -s --user-agent "curl/8.2.1" --connect-timeout 3 -H "Host:v4.ident.me" 49.12.234.183) || ipaddr=110.34.181.1 - echo "ecs ${ipaddr%.*}.0/24" -} - flush_cache() { curl -s 127.0.0.1:$(uci -q get mosdns.config.listen_port_api)/plugins/lazy_cache/flush || exit 1 } @@ -180,9 +175,6 @@ case $script_action in "adlist_update") adlist_update && [ "$has_update" -eq 1 ] && restart_service ;; - "ecs_remote") - ecs_remote - ;; "flush") flush_cache ;;