From 51f5795731fd0f22c0aab4c48954735a71a246de Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 20 Dec 2025 12:54:42 +0800 Subject: [PATCH] =?UTF-8?q?~=E6=B7=BB=E5=8A=A0ss=E5=92=8Cvmess=E5=85=A5?= =?UTF-8?q?=E7=AB=99=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/libs/meta_listeners.sh | 25 ++++ scripts/libs/meta_proxies.sh | 19 +++ .../endpoints.sh => libs/sb_endpoints.sh} | 23 +--- scripts/libs/sb_inbounds.sh | 38 ++++++ scripts/menus/gateway.sh | 109 +++++++++++++++++- scripts/start.sh | 19 ++- 6 files changed, 207 insertions(+), 26 deletions(-) create mode 100644 scripts/libs/meta_listeners.sh create mode 100644 scripts/libs/meta_proxies.sh rename scripts/{menus/endpoints.sh => libs/sb_endpoints.sh} (65%) create mode 100644 scripts/libs/sb_inbounds.sh diff --git a/scripts/libs/meta_listeners.sh b/scripts/libs/meta_listeners.sh new file mode 100644 index 00000000..a2cba397 --- /dev/null +++ b/scripts/libs/meta_listeners.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (C) Juewuy + +#meta内核vmess入站生成 +[ "$vms_service" = ON ] && { + cat >>"$TMPDIR"/yamls/listeners.yaml <>"$TMPDIR"/yamls/listeners.yaml <>"$TMPDIR"/yamls/proxies.yaml <"$TMPDIR"/jsons/wireguard.json <"$TMPDIR"/jsons/wireguard.json <"$TMPDIR"/yamls/wireguard.yaml <"$TMPDIR"/jsons/vmess-in.json <"$TMPDIR"/jsons/ss-in.json < " num + case "$num" in + 0) ;; + 1) + if [ -n "$sss_port" ] && [ -n "$sss_pwd" ];then + [ "$sss_service" = ON ] && sss_service=OFF || sss_service=ON + setconfig sss_service "$sss_service" + else + echo -e "\033[31m请先完成必选设置!\033[0m" + sleep 1 + fi + set_shadowsocks + ;; + 2) + read -p "请输入端口号(输入0删除) > " text + [ "$text" = 0 ] && unset sss_port + if sh "$CRASHDIR"/libs/check_port.sh "$text"; then + sss_port="$text" + setconfig sss_port "$text" "$CFG" + else + sleep 1 + fi + set_shadowsocks + ;; + 3) + echo ----------------------------------------------- + echo -e " 1 \033[32mxchacha20-ietf-poly1305\033[0m" + echo -e " 2 \033[32mchacha20-ietf-poly1305\033[0m" + echo -e " 3 \033[32maes-128-gcm\033[0m" + echo -e " 4 \033[32maes-256-gcm\033[0m" + ckcmd openssl && { + echo ----------------------------------------------- + echo -e "\033[31m注意:\033[0m2022系列加密必须使用OpenSSL随机生成的password!" + echo -e " 5 \033[32m2022-blake3-chacha20-poly1305\033[0m" + echo -e " 6 \033[32m2022-blake3-aes-128-gcm\033[0m" + echo -e " 7 \033[32m2022-blake3-aes-256-gcm\033[0m" + } + echo ----------------------------------------------- + echo -e " 0 返回上级菜单" + read -p "请选择要使用的加密协议 > " num + case "$num" in + 1) + sss_cipher=xchacha20-ietf-poly1305 + sss_pwd=$(cat /proc/sys/kernel/random/uuid) + ;; + 2) + sss_cipher=chacha20-ietf-poly1305 + sss_pwd=$(cat /proc/sys/kernel/random/uuid) + ;; + 3) + sss_cipher=aes-128-gcm + sss_pwd=$(cat /proc/sys/kernel/random/uuid) + ;; + 4) + sss_cipher=aes-256-gcm + sss_pwd=$(cat /proc/sys/kernel/random/uuid) + ;; + 5) + sss_cipher=2022-blake3-chacha20-poly1305 + sss_pwd=$(openssl rand --base64 32) + ;; + 6) + sss_cipher=2022-blake3-aes-128-gcm + sss_pwd=$(openssl rand --base64 16) + ;; + 7) + sss_cipher=2022-blake3-aes-256-gcm + sss_pwd=$(openssl rand --base64 32) + ;; + *) + ;; + esac + setconfig sss_cipher "$sss_cipher" "$CFG" + setconfig sss_pwd "$sss_pwd" "$CFG" + set_shadowsocks + ;; + 4) + if echo "$sss_cipher" |grep -q '2022-blake3';then + echo -e "\033[31m注意:\033[0m2022系列加密必须使用脚本随机生成的password!" + sleep 1 + else + read -p "请输入秘钥(输入0删除) > " text + [ "$text" = 0 ] && unset sss_pwd + sss_pwd="$text" + setconfig sss_pwd "$text" "$CFG" + fi + set_shadowsocks + ;; + *) errornum ;; + esac +} set_tailscale(){ [ -n "$ts_auth_key" ] && ts_auth_key_info='*********' echo ----------------------------------------------- diff --git a/scripts/start.sh b/scripts/start.sh index e6e37269..60015175 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -617,6 +617,16 @@ EOF IFS="$oldIFS" done } + #添加自定义入站 + [ "$vms_service" = ON ] || [ "$sss_service" = ON ] && { + . "$CRASHDIR"/configs/gateway.cfg + . "$CRASHDIR"/libs/meta_listeners.sh + } + #生成自定义出站 + [ "$wg_service" = ON ] && { + . "$CRASHDIR"/configs/gateway.cfg + . "$CRASHDIR"/libs/meta_proxies.sh + } #节点绕过功能支持 sed -i "/#节点绕过/d" "$TMPDIR"/rules.yaml [ "$proxies_bypass" = "已启用" ] && { @@ -692,10 +702,10 @@ modify_json() { #修饰singbox1.13配置文件 cat "$TMPDIR"/format.json | sed -n '/^ "providers":/,/^ "[a-z]/p' | sed '$d' >>"$TMPDIR"/jsons/providers.json } cat "$TMPDIR"/format.json | sed -n '/"route":/,/^\( "[a-z]\|}\)/p' | sed '$d' >>"$TMPDIR"/jsons/route.json - #生成log.json + #生成endpoints.json [ "$ts_service" = ON ] || [ "$wg_service" = ON ] && { . "$CRASHDIR"/configs/gateway.cfg - . "$CRASHDIR"/components/endpoints.sh + . "$CRASHDIR"/libs/sb_endpoints.sh } #生成log.json cat >"$TMPDIR"/jsons/log.json <>"$TMPDIR"/jsons/tun.json <