From afd6be561e7c9b14e1aa3065a928918f1d80105d Mon Sep 17 00:00:00 2001 From: gitea-action Date: Mon, 30 Sep 2024 22:30:29 +0800 Subject: [PATCH] mihomo: sync upstream last commit: https://github.com/morytyann/OpenWrt-mihomo/commit/f41356a78f6f3b5289ad9f199bbcffdeb50f272d --- mihomo/Makefile | 15 +-------------- mihomo/files/mihomo.conf | 1 + mihomo/files/mihomo.init | 7 ++++--- mihomo/files/uci-defaults/firewall.sh | 12 ++++++++++++ mihomo/files/uci-defaults/migrate.sh | 4 ++++ 5 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 mihomo/files/uci-defaults/firewall.sh diff --git a/mihomo/Makefile b/mihomo/Makefile index 521e1c201..c0c1e05fc 100644 --- a/mihomo/Makefile +++ b/mihomo/Makefile @@ -75,6 +75,7 @@ define Package/mihomo/install $(INSTALL_BIN) $(CURDIR)/files/mihomo.init $(1)/etc/init.d/mihomo $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(CURDIR)/files/uci-defaults/firewall.sh $(1)/etc/uci-defaults/99_firewall_mihomo $(INSTALL_BIN) $(CURDIR)/files/uci-defaults/init.sh $(1)/etc/uci-defaults/99_init_mihomo $(INSTALL_BIN) $(CURDIR)/files/uci-defaults/migrate.sh $(1)/etc/uci-defaults/99_migrate_mihomo @@ -85,20 +86,6 @@ define Package/mihomo/install $(INSTALL_DATA) $(CURDIR)/files/mihomo.upgrade $(1)/lib/upgrade/keep.d/mihomo endef -define Package/mihomo/postinst -#!/bin/sh -if [ -z $${IPKG_INSTROOT} ]; then - uci -q batch <<-EOF > /dev/null - del firewall.mihomo - set firewall.mihomo=include - set firewall.mihomo.type=script - set firewall.mihomo.path=/etc/mihomo/scripts/tun.sh - set firewall.mihomo.fw4_compatible=1 - commit firewall - EOF -fi -endef - define Package/mihomo/postrm #!/bin/sh if [ -z $${IPKG_INSTROOT} ]; then diff --git a/mihomo/files/mihomo.conf b/mihomo/files/mihomo.conf index ca8cfcaef..6319e411b 100644 --- a/mihomo/files/mihomo.conf +++ b/mihomo/files/mihomo.conf @@ -65,6 +65,7 @@ config mixin 'mixin' list 'fake_ip_filters' '+.local' option 'fake_ip_cache' '1' option 'dns_respect_rules' '0' + option 'dns_doh_prefer_http3' '0' option 'dns_ipv6' '0' option 'dns_system_hosts' '0' option 'dns_hosts' '0' diff --git a/mihomo/files/mihomo.init b/mihomo/files/mihomo.init index 1639742d7..59b3d62a9 100644 --- a/mihomo/files/mihomo.init +++ b/mihomo/files/mihomo.init @@ -83,7 +83,7 @@ start_service() { config_get tun_gso_max_size "mixin" "tun_gso_max_size" "65536" config_get_bool tun_endpoint_independent_nat "mixin" "tun_endpoint_independent_nat" 0 ### dns - local dns_port dns_mode fake_ip_range fake_ip_filter fake_ip_filter_mode fake_ip_cache dns_respect_rules dns_ipv6 dns_system_hosts dns_hosts hosts dns_nameserver dns_nameserver_policy + local dns_port dns_mode fake_ip_range fake_ip_filter fake_ip_filter_mode fake_ip_cache dns_respect_rules dns_doh_prefer_http3 dns_ipv6 dns_system_hosts dns_hosts hosts dns_nameserver dns_nameserver_policy config_get dns_port "mixin" "dns_port" "1053" config_get dns_mode "mixin" "dns_mode" "redir-host" config_get fake_ip_range "mixin" "fake_ip_range" "198.18.0.1/16" @@ -91,6 +91,7 @@ start_service() { config_get fake_ip_filter_mode "mixin" "fake_ip_filter_mode" "blacklist" config_get_bool fake_ip_cache "mixin" "fake_ip_cache" 0 config_get_bool dns_respect_rules "mixin" "dns_respect_rules" 0 + config_get_bool dns_doh_prefer_http3 "mixin" "dns_doh_prefer_http3" 0 config_get_bool dns_ipv6 "mixin" "dns_ipv6" 0 config_get_bool dns_system_hosts "mixin" "dns_system_hosts" 0 config_get_bool dns_hosts "mixin" "dns_hosts" 0 @@ -163,7 +164,7 @@ start_service() { allow_lan="$allow_lan" http_port="$http_port" socks_port="$socks_port" mixed_port="$mixed_port" redir_port="$redir_port" tproxy_port="$tproxy_port" \ tun_enable="$tun_enable" tun_stack="$tun_stack" tun_device="$TUN_DEVICE" tun_mtu="$tun_mtu" tun_gso="$tun_gso" tun_gso_max_size="$tun_gso_max_size" tun_endpoint_independent_nat="$tun_endpoint_independent_nat" \ dns_enable="true" dns_listen="0.0.0.0:$dns_port" dns_mode="$dns_mode" fake_ip_range="$fake_ip_range" fake_ip_cache="$fake_ip_cache" \ - dns_respect_rules="$dns_respect_rules" dns_ipv6="$dns_ipv6" dns_system_hosts="$dns_system_hosts" dns_hosts="$dns_hosts" \ + dns_respect_rules="$dns_respect_rules" dns_doh_prefer_http3="$dns_doh_prefer_http3" dns_ipv6="$dns_ipv6" dns_system_hosts="$dns_system_hosts" dns_hosts="$dns_hosts" \ geoip_format="$geoip_format" geodata_loader="$geodata_loader" geosite_url="$geosite_url" geoip_mmdb_url="$geoip_mmdb_url" geoip_dat_url="$geoip_dat_url" geoip_asn_url="$geoip_asn_url" \ geox_auto_update="$geox_auto_update" geox_update_interval="$geox_update_interval" \ yq -M -i ' @@ -172,7 +173,7 @@ start_service() { .allow-lan = env(allow_lan) == 1 | .port = env(http_port) | .socks-port = env(socks_port) | .mixed-port = env(mixed_port) | .redir-port = env(redir_port) | .tproxy-port = env(tproxy_port) | .tun.enable = env(tun_enable) == 1 | .tun.stack = env(tun_stack) | .tun.device = env(tun_device) | .tun.mtu = env(tun_mtu) | .tun.gso = env(tun_gso) == 1 | .tun.gso-max-size = env(tun_gso_max_size) | .tun.endpoint-independent-nat = env(tun_endpoint_independent_nat) == 1 | .dns.enable = env(dns_enable) | .dns.listen = env(dns_listen) | .dns.enhanced-mode = env(dns_mode) | .dns.fake-ip-range = env(fake_ip_range) | .profile.store-fake-ip = env(fake_ip_cache) == 1 | - .dns.respect-rules = env(dns_respect_rules) == 1 | .dns.ipv6 = env(dns_ipv6) == 1 | .dns.use-system-hosts = env(dns_system_hosts) == 1 | .dns.use-hosts = env(dns_hosts) == 1 | + .dns.respect-rules = env(dns_respect_rules) == 1 | .dns.prefer-h3 = env(dns_doh_prefer_http3) == 1 | .dns.ipv6 = env(dns_ipv6) == 1 | .dns.use-system-hosts = env(dns_system_hosts) == 1 | .dns.use-hosts = env(dns_hosts) == 1 | .geodata-mode = env(geoip_format) == "dat" | .geodata-loader = env(geodata_loader) | .geox-url.geosite = env(geosite_url) | .geox-url.mmdb = env(geoip_mmdb_url) | .geox-url.geoip = env(geoip_dat_url) | .geox-url.asn = env(geoip_asn_url) | .geo-auto-update = env(geox_auto_update) == 1 | .geo-update-interval = env(geox_update_interval) ' "$RUN_PROFILE_PATH" diff --git a/mihomo/files/uci-defaults/firewall.sh b/mihomo/files/uci-defaults/firewall.sh new file mode 100644 index 000000000..3a0cb09b2 --- /dev/null +++ b/mihomo/files/uci-defaults/firewall.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "$IPKG_INSTROOT/etc/mihomo/scripts/constants.sh" + +uci -q batch <<-EOF > /dev/null + del firewall.mihomo + set firewall.mihomo=include + set firewall.mihomo.type=script + set firewall.mihomo.path=$TUN_SH + set firewall.mihomo.fw4_compatible=1 + commit firewall +EOF diff --git a/mihomo/files/uci-defaults/migrate.sh b/mihomo/files/uci-defaults/migrate.sh index bfd6d9b1a..0febd30e6 100644 --- a/mihomo/files/uci-defaults/migrate.sh +++ b/mihomo/files/uci-defaults/migrate.sh @@ -2,6 +2,10 @@ . "$IPKG_INSTROOT/etc/mihomo/scripts/constants.sh" +# since v1.8.4 + +dns_doh_prefer_http3=$(uci -q get mihomo.mixin.dns_doh_prefer_http3); [ -z "$dns_doh_prefer_http3" ] && uci set mihomo.mixin.dns_doh_prefer_http3=0 + # commit uci commit mihomo