mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-18 13:38:14 +03:00
fix: ensure routing rule for mixed-in is always applied
This commit is contained in:
@@ -464,24 +464,19 @@ process_socks5() {
|
|||||||
config_get_bool socks5 "main" "socks5" "0"
|
config_get_bool socks5 "main" "socks5" "0"
|
||||||
if [ "$socks5" -eq 1 ]; then
|
if [ "$socks5" -eq 1 ]; then
|
||||||
log "Socks5 local enable port 2080"
|
log "Socks5 local enable port 2080"
|
||||||
jq '.inbounds += [{
|
jq \
|
||||||
|
'.inbounds += [{
|
||||||
"tag": "mixed-in",
|
"tag": "mixed-in",
|
||||||
"type": "mixed",
|
"type": "mixed",
|
||||||
"listen": "0.0.0.0",
|
"listen": "0.0.0.0",
|
||||||
"listen_port": 2080,
|
"listen_port": 2080,
|
||||||
"set_system_proxy": false
|
"set_system_proxy": false
|
||||||
|
}] |
|
||||||
|
.route.rules += [{
|
||||||
|
"inbound": ["mixed-in"],
|
||||||
|
"outbound": "main",
|
||||||
|
"action": "route"
|
||||||
}]' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
|
}]' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
|
||||||
|
|
||||||
#local rule_exists=$(jq -r '.route.rules[] | select(.inbound[] == "mixed-in")' $SING_BOX_CONFIG)
|
|
||||||
local rule_exists=$(jq -r '.route.rules // [] | map(select(.inbound // [] | index("mixed-in"))) | length' $SING_BOX_CONFIG)
|
|
||||||
|
|
||||||
if [ -z "$rule_exists" ]; then
|
|
||||||
jq '.route.rules += [{
|
|
||||||
"inbound": ["mixed-in"],
|
|
||||||
"outbound": "main",
|
|
||||||
"action": "route"
|
|
||||||
}]' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user