Fix: remove duplicate function sing_box_config_outbound_json

This commit is contained in:
Ivan K
2024-12-01 14:12:56 +03:00
parent 00ee716236
commit 63acd224e8

View File

@@ -857,7 +857,6 @@ sing_box_config_outbound_json() {
local json_config="$1"
local listen_port="$2"
# Create temporary file with base config structure
cat > /tmp/base_config.json << EOF
{
"log": {
@@ -878,10 +877,7 @@ sing_box_config_outbound_json() {
}
EOF
# Add the outbound config using jq
jq --argjson outbound "$json_config" '.outbounds += [$outbound]' /tmp/base_config.json > /etc/sing-box/config.json
# Cleanup
rm -f /tmp/base_config.json
}
@@ -1096,34 +1092,6 @@ EOF
rm -f /tmp/vless_temp.json
}
sing_box_config_outbound_json() {
local json_config="$1"
local listen_port="$2"
cat > /tmp/base_config.json << EOF
{
"log": {
"level": "warn"
},
"inbounds": [
{
"type": "tproxy",
"listen": "::",
"listen_port": $listen_port,
"sniff": false
}
],
"outbounds": [],
"route": {
"auto_detect_interface": true
}
}
EOF
jq --argjson outbound "$json_config" '.outbounds += [$outbound]' /tmp/base_config.json > /etc/sing-box/config.json
rm -f /tmp/base_config.json
}
sing_box_config_check() {
if ! sing-box -c /etc/sing-box/config.json check >/dev/null 2>&1; then
log "Sing-box configuration is invalid"