diff --git a/README.md b/README.md index dce360f..908cef1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ Sing-box 是一个现代、高性能、功能强大的跨平台代理核心, 本仓库主要包括singbox示例配置以及快速,智能的部署脚本,可以一键部署以下协议并给出标准链接,具体实现见手动安装部分. +

+ +

+ - 手动安装:见 [Hysteria2](https://github.com/Dichgrem/singbox-example/blob/main/hysteria2.md) / [Reality](https://github.com/Dichgrem/singbox-example/blob/main/singbox.md) - 全自动安装Reality: ``wget https://raw.githubusercontent.com/Dichgrem/singbox-example/refs/heads/main/script/singbox.sh``,随后``bash ./singbox.sh`` diff --git a/run.png b/run.png new file mode 100644 index 0000000..587c2aa Binary files /dev/null and b/run.png differ diff --git a/script/singbox.sh b/script/singbox.sh index de0b755..c7035ba 100644 --- a/script/singbox.sh +++ b/script/singbox.sh @@ -100,10 +100,7 @@ install_singbox() { printf "${CYAN}===== 安装 Sing-box 并生成配置 =====${NC}\n" printf "${YELLOW}请输入用户名称 (name 字段,例如 AK-JP-100G):${NC}" read -r NAME - [[ -z "$NAME" ]] && { - printf "${RED}名称不能为空,退出。${NC}\n" >&2 - exit 1 - } + [[ -z "$NAME" ]] && { printf "${RED}名称不能为空,退出。${NC}\n" >&2; exit 1; } printf "${YELLOW}请输入 SNI 域名 (默认: s0.awsstatic.com):${NC}" read -r SNI SNI=${SNI:-s0.awsstatic.com} @@ -131,6 +128,22 @@ install_singbox() { mkdir -p "$CONFIG_DIR" + # 根据网络类型选择 DNS + NET_TYPE=$(detect_network_type) + if [[ "$NET_TYPE" == "ipv6" ]]; then + DNS_SERVER1="2606:4700:4700::1111" # Cloudflare IPv6 + DNS_SERVER2="2620:fe::fe" # Quad9 IPv6 + DNS_STRATEGY="prefer_ipv6" + elif [[ "$NET_TYPE" == "dual" || "$NET_TYPE" == "ipv4" ]]; then + DNS_SERVER1="8.8.8.8" + DNS_SERVER2="1.1.1.1" + DNS_STRATEGY="prefer_ipv4" + else + DNS_SERVER1="8.8.8.8" + DNS_SERVER2="1.1.1.1" + DNS_STRATEGY="prefer_ipv4" + fi + cat >"$CONFIG_DIR/config.json" <