parent
5f9f100f9f
commit
bbf8a31143
@ -80,6 +80,7 @@ config mixin 'mixin'
|
|||||||
option 'geoip_asn_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
|
option 'geoip_asn_url' 'https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb'
|
||||||
option 'geox_auto_update' '0'
|
option 'geox_auto_update' '0'
|
||||||
option 'geox_update_interval' '24'
|
option 'geox_update_interval' '24'
|
||||||
|
option 'mixin_file_content' '0'
|
||||||
|
|
||||||
config authentication
|
config authentication
|
||||||
option 'enabled' '1'
|
option 'enabled' '1'
|
||||||
|
@ -108,6 +108,9 @@ start_service() {
|
|||||||
config_get geoip_asn_url "mixin" "geoip_asn_url"
|
config_get geoip_asn_url "mixin" "geoip_asn_url"
|
||||||
config_get_bool geox_auto_update "mixin" "geox_auto_update" 0
|
config_get_bool geox_auto_update "mixin" "geox_auto_update" 0
|
||||||
config_get geox_update_interval "mixin" "geox_update_interval" "24"
|
config_get geox_update_interval "mixin" "geox_update_interval" "24"
|
||||||
|
### mixin file content
|
||||||
|
local mixin_file_content
|
||||||
|
config_get_bool mixin_file_content "mixin" "mixin_file_content" 0
|
||||||
# prepare
|
# prepare
|
||||||
local tproxy_enable; tproxy_enable=0
|
local tproxy_enable; tproxy_enable=0
|
||||||
if [[ "$tcp_transparent_proxy_mode" == "tproxy" || "$udp_transparent_proxy_mode" == "tproxy" ]]; then
|
if [[ "$tcp_transparent_proxy_mode" == "tproxy" || "$udp_transparent_proxy_mode" == "tproxy" ]]; then
|
||||||
@ -195,10 +198,6 @@ start_service() {
|
|||||||
yq -M -i 'del(.dns.nameserver-policy)' "$RUN_PROFILE_PATH"
|
yq -M -i 'del(.dns.nameserver-policy)' "$RUN_PROFILE_PATH"
|
||||||
config_foreach mixin_nameserver_policies "nameserver_policy"
|
config_foreach mixin_nameserver_policies "nameserver_policy"
|
||||||
fi
|
fi
|
||||||
# mixin file
|
|
||||||
if [ -s "$MIXIN_FILE_PATH" ]; then
|
|
||||||
yq ea -M -i '. as $item ireduce ({}; . * $item ) | ... comments=""' "$RUN_PROFILE_PATH" "$MIXIN_FILE_PATH"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
yq -M -i 'del (.bind-address)' "$RUN_PROFILE_PATH"
|
yq -M -i 'del (.bind-address)' "$RUN_PROFILE_PATH"
|
||||||
if [ -n "$outbound_interface" ]; then
|
if [ -n "$outbound_interface" ]; then
|
||||||
@ -215,6 +214,11 @@ start_service() {
|
|||||||
if [ "$tun_enable" == 1 ]; then
|
if [ "$tun_enable" == 1 ]; then
|
||||||
yq -M -i '.tun.auto-route = false | .tun.auto-redirect = false | .tun.auto-detect-interface = false | .tun.dns-hijack = []' "$RUN_PROFILE_PATH"
|
yq -M -i '.tun.auto-route = false | .tun.auto-redirect = false | .tun.auto-detect-interface = false | .tun.dns-hijack = []' "$RUN_PROFILE_PATH"
|
||||||
fi
|
fi
|
||||||
|
if [ "$mixin_file_content" == 1 ]; then
|
||||||
|
if [ -s "$MIXIN_FILE_PATH" ]; then
|
||||||
|
yq ea -M -i '. as $item ireduce ({}; . * $item ) | ... comments=""' "$RUN_PROFILE_PATH" "$MIXIN_FILE_PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# test profile
|
# test profile
|
||||||
if [ "$test_profile" == 1 ]; then
|
if [ "$test_profile" == 1 ]; then
|
||||||
log "Profile testing..."
|
log "Profile testing..."
|
||||||
|
@ -63,7 +63,8 @@ table inet mihomo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chain router_dns_hijack {
|
chain router_dns_hijack {
|
||||||
meta nfproto @dns_hijack_nfproto meta l4proto { tcp, udp } th dport 53 oifname lo meta skuid != $MIHOMO_USER counter redirect to :$DNS_PORT
|
meta skuid $MIHOMO_USER counter return
|
||||||
|
meta nfproto @dns_hijack_nfproto meta l4proto { tcp, udp } th dport 53 oifname lo counter redirect to :$DNS_PORT
|
||||||
}
|
}
|
||||||
|
|
||||||
chain all_dns_hijack {
|
chain all_dns_hijack {
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
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
|
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
|
||||||
|
|
||||||
|
# since v1.8.7
|
||||||
|
|
||||||
|
mixin_file_content=$(uci -q get mihomo.mixin.mixin_file_content); [ -z "$mixin_file_content" ] && uci set mihomo.mixin.mixin_file_content=$(uci -q get mihomo.config.mixin)
|
||||||
|
|
||||||
# commit
|
# commit
|
||||||
uci commit mihomo
|
uci commit mihomo
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user