From 2c2c8904d1cc9e95b5138015b4b708d24caaf43f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:19:54 +0800 Subject: [PATCH] update 2024-03-11 12:19:54 --- luci-app-xray/core/root/etc/init.d/xray_core | 2 +- .../core/root/usr/share/xray/feature/dns.mjs | 17 +++++++++++++++-- .../www/luci-static/resources/view/xray/core.js | 3 +++ v2ray-geodata/Makefile | 4 ++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/luci-app-xray/core/root/etc/init.d/xray_core b/luci-app-xray/core/root/etc/init.d/xray_core index 49889fba9..579f58501 100644 --- a/luci-app-xray/core/root/etc/init.d/xray_core +++ b/luci-app-xray/core/root/etc/init.d/xray_core @@ -145,5 +145,5 @@ reload_service() { } service_triggers() { - procd_add_reload_trigger "xray_core" + procd_add_reload_trigger "xray_core" "dhcp" } diff --git a/luci-app-xray/core/root/usr/share/xray/feature/dns.mjs b/luci-app-xray/core/root/usr/share/xray/feature/dns.mjs index 7375a0a19..c51ef6c00 100644 --- a/luci-app-xray/core/root/usr/share/xray/feature/dns.mjs +++ b/luci-app-xray/core/root/usr/share/xray/feature/dns.mjs @@ -7,6 +7,7 @@ import { direct_outbound } from "./outbound.mjs"; const fallback_fast_dns = "223.5.5.5:53"; const fallback_secure_dns = "8.8.8.8:53"; const fallback_default_dns = "1.1.1.1:53"; +const geoip_existence = access("/usr/share/xray/geoip.dat") || false; const geosite_existence = access("/usr/share/xray/geosite.dat") || false; function parse_ip_port(val, port_default) { @@ -161,7 +162,7 @@ export function dns_conf(proxy, config, manual_tproxy, fakedns) { continue; } if (server["domain_resolve_dns"]) { - domain_extra_options[server["server"]] = `${server["domain_resolve_dns_method"] || "udp"};${server["domain_resolve_dns"]}`; + domain_extra_options[server["server"]] = `${server["domain_resolve_dns_method"] || "udp"};${server["domain_resolve_dns"]};${join(",", server["domain_resolve_expect_ips"] || [])}`; } else { domain_names_set[`domain:${server["server"]}`] = true; } @@ -180,12 +181,24 @@ export function dns_conf(proxy, config, manual_tproxy, fakedns) { ...map(keys(resolve_merged), function (k) { const dns_split = split(k, ";"); const resolve_dns_object = format_dns(dns_split[0], dns_split[1]); - return { + let result = { address: resolve_dns_object["address"], port: resolve_dns_object["port"], domains: uniq(resolve_merged[k]), skipFallback: true, }; + if (length(dns_split[2]) > 0) { + const expect_ips = filter(split(dns_split[2], ",") || [], function (i) { + if (!geoip_existence) { + if (substr(i, 0, 6) === "geoip:") { + return false; + } + } + return true; + }); + result["expectIPs"] = expect_ips; + } + return result; }), default_dns_object, { diff --git a/luci-app-xray/core/root/www/luci-static/resources/view/xray/core.js b/luci-app-xray/core/root/www/luci-static/resources/view/xray/core.js index cea135f1c..b910e53d0 100644 --- a/luci-app-xray/core/root/www/luci-static/resources/view/xray/core.js +++ b/luci-app-xray/core/root/www/luci-static/resources/view/xray/core.js @@ -227,6 +227,9 @@ return view.extend({ o.default = "udp"; o.modalonly = true; + o = ss.taboption('resolving', form.DynamicList, 'domain_resolve_expect_ips', _('Expected Server IPs'), _("Filter resolved IPs by GeoIP or CIDR. Resource file geoip.dat is required for GeoIP filtering.")); + o.modalonly = true; + ss.tab('protocol', _('Protocol Settings')); o = ss.taboption('protocol', form.ListValue, "protocol", _("Protocol")); diff --git a/v2ray-geodata/Makefile b/v2ray-geodata/Makefile index 557a76a29..b7444e156 100644 --- a/v2ray-geodata/Makefile +++ b/v2ray-geodata/Makefile @@ -30,13 +30,13 @@ define Download/geosite HASH:=43e32e704c9b8f9d8103df87cd18e637c817dbdd5bc75f1a1e7ba0368064839e endef -GEOSITE_IRAN_VER:=202403040025 +GEOSITE_IRAN_VER:=202403110026 GEOSITE_IRAN_FILE:=iran.dat.$(GEOSITE_IRAN_VER) define Download/geosite-ir URL:=https://github.com/bootmortis/iran-hosted-domains/releases/download/$(GEOSITE_IRAN_VER)/ URL_FILE:=iran.dat FILE:=$(GEOSITE_IRAN_FILE) - HASH:=c4def60743502b5350a3b6d632b1bbd48ff523ec9e4096fa98d07a508e853389 + HASH:=4878b48160668bdd20528b0246502c9b2160ddf195c113ba4d13041c114331e7 endef define Package/v2ray-geodata/template