mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 13:27:36 +08:00
update 2024-10-01 00:24:55
This commit is contained in:
parent
206c866d93
commit
5b2003e94c
@ -408,6 +408,9 @@ return view.extend({
|
||||
o = s.taboption('dns', form.Flag, 'dns_respect_rules', _('Respect Rules'));
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.taboption('dns', form.Flag, 'dns_doh_prefer_http3', _('DoH Prefer HTTP/3'));
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.taboption('dns', form.Flag, 'dns_ipv6', _('IPv6'));
|
||||
o.rmempty = false;
|
||||
|
||||
|
@ -304,6 +304,9 @@ msgstr "Fake-IP 缓存"
|
||||
msgid "Respect Rules"
|
||||
msgstr "遵循分流规则"
|
||||
|
||||
msgid "DoH Prefer HTTP/3"
|
||||
msgstr "DoH 优先 HTTP/3"
|
||||
|
||||
msgid "Use System Hosts"
|
||||
msgstr "使用系统的 Hosts"
|
||||
|
||||
|
@ -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,24 +86,14 @@ define Package/mihomo/install
|
||||
$(INSTALL_DATA) $(CURDIR)/files/mihomo.upgrade $(1)/lib/upgrade/keep.d/mihomo
|
||||
endef
|
||||
|
||||
define Package/mihomo/postinst
|
||||
#!/bin/sh
|
||||
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
|
||||
endef
|
||||
|
||||
define Package/mihomo/postrm
|
||||
#!/bin/sh
|
||||
uci -q batch <<-EOF > /dev/null
|
||||
del firewall.mihomo
|
||||
commit firewall
|
||||
EOF
|
||||
if [ -z $${IPKG_INSTROOT} ]; then
|
||||
uci -q batch <<-EOF > /dev/null
|
||||
del firewall.mihomo
|
||||
commit firewall
|
||||
EOF
|
||||
fi
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
|
@ -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'
|
||||
|
@ -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"
|
||||
|
12
mihomo/files/uci-defaults/firewall.sh
Normal file
12
mihomo/files/uci-defaults/firewall.sh
Normal file
@ -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
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user