diff --git a/podkop/files/etc/init.d/podkop b/podkop/files/etc/init.d/podkop index 52979ad..d678b34 100755 --- a/podkop/files/etc/init.d/podkop +++ b/podkop/files/etc/init.d/podkop @@ -1055,105 +1055,6 @@ EOF rm -f /tmp/base_config.json } -sing_box_config_outbound_shadowsocks() { - local STRING="$1" - local outbound="$2" - local name="$3" - - local encrypted_part=$(echo "$STRING" | cut -d'/' -f3 | cut -d'@' -f1 | base64 --decode) - local method=$(echo "$encrypted_part" | cut -d':' -f1) - local password=$(echo "$encrypted_part" | cut -d':' -f2-) - - local server=$(echo "$STRING" | cut -d'@' -f2 | cut -d':' -f1) - local port=$(echo "$STRING" | cut -d':' -f3 | cut -d'#' -f1) - label=$(echo "$STRING" | cut -d'#' -f2) - - template_config="/etc/podkop/sing-box-shadowsocks-outbound-template.json" - - jq --arg server "$server" \ - --arg port "$port" \ - --arg method "$method" \ - --arg password "$password" \ - --arg tag "$name" \ - '.outbounds[] |= - if .type == "shadowsocks" then - .server = $server | - .server_port = ($port | tonumber) | - .method = $method | - .password = $password | - .tag = $tag - else - . - end' "$template_config" >$outbound -} - -sing_box_config_outbound_vless() { - local STRING="$1" - local outbound="$2" - local name="$3" - - get_param() { - echo "$STRING" | sed -n "s/.*[?&]$1=\([^&?#]*\).*/\1/p" - } - - uuid=$(echo "$STRING" | cut -d'/' -f3 | cut -d'@' -f1) - server=$(echo "$STRING" | cut -d'@' -f2 | cut -d':' -f1) - port=$(echo "$STRING" | cut -d'@' -f2 | cut -d':' -f2 | cut -d'?' -f1 | awk -F'/' '{print $1}') - - type=$(get_param "type") - flow=$(get_param "flow") - sni=$(get_param "sni") - fp=$(get_param "fp") - security=$(get_param "security") - pbk=$(get_param "pbk") - sid=$(get_param "sid") - alpn=$(echo "$(get_param "alpn" | sed 's/%2C/,/g; s/%2F/\//g')" | jq -R -s -c 'split(",")' | sed 's/\\n//g') - encoding=$(get_param "packetEncoding") - label=$(echo "$STRING" | cut -d'#' -f2) - - template_config="/etc/podkop/sing-box-vless-outbound-template.json" - - jq --arg server "$server" \ - --arg port "$port" \ - --arg uuid "$uuid" \ - --arg type "$type" \ - --arg flow "$flow" \ - --arg sni "$sni" \ - --arg fp "$fp" \ - --arg security "$security" \ - --arg pbk "$pbk" \ - --arg sid "$sid" \ - --argjson alpn "$alpn" \ - --arg encoding "$encoding" \ - --arg tag "$name" \ - '.outbounds[] |= - (.server = $server | - .server_port = ($port | tonumber) | - .uuid = $uuid | - if $security == "reality" then - if $flow == "" then del(.flow) else .flow = $flow end | - if $encoding == "" then del(.packet_encoding) else .packet_encoding = $encoding end | - .tls.server_name = $sni | - .tls.utls.fingerprint = $fp | - .tls.reality.public_key = $pbk | - .tls.reality.short_id = $sid | - .tag = $tag - elif $security == "tls" then - .tls.alpn = $alpn | - .tls.server_name = $sni | - del(.flow) | - del(.tls.utls) | - del(.tls.reality) | - .tag = $tag - elif $security == "" or $security == "none" then - del(.flow) | - del(.tls) | - .tag = $tag - else - . - end)' "$template_config" >$outbound -} - 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" diff --git a/podkop/files/etc/podkop/sing-box-shadowsocks-outbound-template.json b/podkop/files/etc/podkop/sing-box-shadowsocks-outbound-template.json deleted file mode 100644 index d2694f4..0000000 --- a/podkop/files/etc/podkop/sing-box-shadowsocks-outbound-template.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "outbounds": [ - { - "type": "shadowsocks", - "server": "$HOST", - "server_port": "$PORT", - "method": "$METHOD", - "password": "$PASS", - "udp_over_tcp": { - "enabled": true, - "version": 2 - }, - "tag": "$TAG" - } - ] -} \ No newline at end of file diff --git a/podkop/files/etc/podkop/sing-box-shadowsocks-template.json b/podkop/files/etc/podkop/sing-box-shadowsocks-template.json deleted file mode 100644 index da5999f..0000000 --- a/podkop/files/etc/podkop/sing-box-shadowsocks-template.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "log": { - "level": "warn" - }, - "inbounds": [ - { - "type": "tproxy", - "listen": "::", - "listen_port": 1602, - "sniff": false - } - ], - "outbounds": [ - { - "type": "shadowsocks", - "server": "$HOST", - "server_port": "$PORT", - "method": "$METHOD", - "password": "$PASS", - "udp_over_tcp": { - "enabled": true, - "version": 2 - } - } - ], - "route": { - "auto_detect_interface": true - } -} \ No newline at end of file diff --git a/podkop/files/etc/podkop/sing-box-vless-outbound-template.json b/podkop/files/etc/podkop/sing-box-vless-outbound-template.json deleted file mode 100644 index 12a046b..0000000 --- a/podkop/files/etc/podkop/sing-box-vless-outbound-template.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "outbounds": [ - { - "type": "vless", - "server": "$HOST", - "server_port": "$PORT", - "uuid": "$UUID", - "flow": "xtls-rprx-vision", - "tls": { - "enabled": true, - "insecure": false, - "server_name": "$FAKE_SERVER", - "utls": { - "enabled": true, - "fingerprint": "chrome" - }, - "reality": { - "enabled": true, - "public_key": "$PUBLIC_KEY", - "short_id": "$SHORT_ID" - } - }, - "tag": "$TAG" - } - ] -} \ No newline at end of file diff --git a/podkop/files/etc/podkop/sing-box-vless-template.json b/podkop/files/etc/podkop/sing-box-vless-template.json deleted file mode 100644 index 17c9913..0000000 --- a/podkop/files/etc/podkop/sing-box-vless-template.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "log": { - "level": "warn" - }, - "inbounds": [ - { - "type": "tproxy", - "listen": "::", - "listen_port": 1602, - "sniff": false - } - ], - "outbounds": [ - { - "type": "vless", - "server": "$HOST", - "server_port": "$PORT", - "uuid": "$UUID", - "flow": "xtls-rprx-vision", - "tls": { - "enabled": true, - "insecure": false, - "server_name": "$FAKE_SERVER", - "utls": { - "enabled": true, - "fingerprint": "chrome" - }, - "reality": { - "enabled": true, - "public_key": "$PUBLIC_KEY", - "short_id": "$SHORT_ID" - } - } - } - ], - "route": { - "auto_detect_interface": true - } -} \ No newline at end of file