Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 576209e0cc | |||
| 2d78583b5a | |||
| 4376b9a907 | |||
| fc79047a2e | |||
| a075e3e1dc | |||
| 3cc47489a2 | |||
| b1c634a0cc | |||
| 2b970915ee | |||
| 2199ef62ce | |||
| 4b18389b35 | |||
| 7effde1e08 |
@@ -1,55 +1,23 @@
|
|||||||
# 介绍
|
# sing-box 一键安装及管理脚本
|
||||||
|
|
||||||
最好用的 sing-box 一键安装脚本 & 管理脚本
|
这是一个用于快速部署 and 管理 sing-box 的一键脚本。
|
||||||
|
|
||||||
# 特点
|
## 特点
|
||||||
|
|
||||||
- 快速安装
|
- 快速安装
|
||||||
- 无敌好用
|
|
||||||
- 零学习成本
|
- 零学习成本
|
||||||
- 自动化 TLS
|
- 自动化 TLS
|
||||||
- 简化所有流程
|
|
||||||
- 兼容 sing-box 命令
|
- 兼容 sing-box 命令
|
||||||
- 强大的快捷参数
|
- 强大的快捷参数
|
||||||
- 支持所有常用协议
|
- 支持所有常用协议(VLESS-REALITY, TUIC, Trojan, Hysteria2, Shadowsocks, VMess 等)
|
||||||
- 一键添加 VLESS-REALITY (默认)
|
|
||||||
- 一键添加 TUIC
|
|
||||||
- 一键添加 Trojan
|
|
||||||
- 一键添加 Hysteria2
|
|
||||||
- 一键添加 Shadowsocks 2022
|
|
||||||
- 一键添加 VMess-(TCP/HTTP/QUIC)
|
|
||||||
- 一键添加 VMess-(WS/H2/HTTPUpgrade)-TLS
|
|
||||||
- 一键添加 VLESS-(WS/H2/HTTPUpgrade)-TLS
|
|
||||||
- 一键添加 Trojan-(WS/H2/HTTPUpgrade)-TLS
|
|
||||||
- 一键启用 BBR
|
- 一键启用 BBR
|
||||||
- 一键更改伪装网站
|
|
||||||
- 一键更改 (端口/UUID/密码/域名/路径/加密方式/SNI/等...)
|
|
||||||
- 还有更多...
|
|
||||||
|
|
||||||
# 设计理念
|
## 帮助信息
|
||||||
|
|
||||||
设计理念为:**高效率,超快速,极易用**
|
|
||||||
|
|
||||||
脚本基于作者的自身使用需求,以 **多配置同时运行** 为核心设计
|
|
||||||
|
|
||||||
并且专门优化了,添加、更改、查看、删除、这四项常用功能
|
|
||||||
|
|
||||||
你只需要一条命令即可完成 添加、更改、查看、删除、等操作
|
|
||||||
|
|
||||||
例如,添加一个配置仅需不到 1 秒!瞬间完成添加!其他操作亦是如此!
|
|
||||||
|
|
||||||
脚本的参数非常高效率并且超级易用,请掌握参数的使用
|
|
||||||
|
|
||||||
# 文档
|
|
||||||
|
|
||||||
安装及使用:https://233boy.com/sing-box/sing-box-script/
|
|
||||||
|
|
||||||
# 帮助
|
|
||||||
|
|
||||||
使用:`sing-box help`
|
使用:`sing-box help`
|
||||||
|
|
||||||
```
|
```
|
||||||
sing-box script v1.0 by 233boy
|
sing-box script v1.0
|
||||||
Usage: sing-box [options]... [args]...
|
Usage: sing-box [options]... [args]...
|
||||||
|
|
||||||
基本:
|
基本:
|
||||||
@@ -67,6 +35,7 @@ Usage: sing-box [options]... [args]...
|
|||||||
qr [name] 二维码信息
|
qr [name] 二维码信息
|
||||||
url [name] URL 信息
|
url [name] URL 信息
|
||||||
log 查看日志
|
log 查看日志
|
||||||
|
|
||||||
更改:
|
更改:
|
||||||
full [name] [...] 更改多个参数
|
full [name] [...] 更改多个参数
|
||||||
id [name] [uuid | auto] 更改 UUID
|
id [name] [uuid | auto] 更改 UUID
|
||||||
@@ -74,7 +43,7 @@ Usage: sing-box [options]... [args]...
|
|||||||
port [name] [port | auto] 更改端口
|
port [name] [port | auto] 更改端口
|
||||||
path [name] [path | auto] 更改路径
|
path [name] [path | auto] 更改路径
|
||||||
passwd [name] [password | auto] 更改密码
|
passwd [name] [password | auto] 更改密码
|
||||||
key [name] [Private key | atuo] [Public key] 更改密钥
|
key [name] [Private key | auto] [Public key] 更改密钥
|
||||||
method [name] [method | auto] 更改加密方式
|
method [name] [method | auto] 更改加密方式
|
||||||
sni [name] [ ip | domain] 更改 serverName
|
sni [name] [ ip | domain] 更改 serverName
|
||||||
new [name] [...] 更改协议
|
new [name] [...] 更改协议
|
||||||
@@ -109,6 +78,4 @@ Usage: sing-box [options]... [args]...
|
|||||||
h, help 显示此帮助界面
|
h, help 显示此帮助界面
|
||||||
|
|
||||||
谨慎使用 del, ddel, 此选项会直接删除配置; 无需确认
|
谨慎使用 del, ddel, 此选项会直接删除配置; 无需确认
|
||||||
反馈问题) https://github.com/233boy/sing-box/issues
|
|
||||||
文档(doc) https://233boy.com/sing-box/sing-box-script/
|
|
||||||
```
|
```
|
||||||
+9
-5
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
author=233boy
|
author=sb
|
||||||
# github=https://github.com/233boy/sing-box
|
|
||||||
|
|
||||||
# bash fonts colors
|
# bash fonts colors
|
||||||
red='\e[31m'
|
red='\e[31m'
|
||||||
@@ -303,7 +302,7 @@ exit_and_del_tmpdir() {
|
|||||||
[[ ! $1 ]] && {
|
[[ ! $1 ]] && {
|
||||||
msg err "哦豁.."
|
msg err "哦豁.."
|
||||||
msg err "安装过程出现错误..."
|
msg err "安装过程出现错误..."
|
||||||
echo -e "反馈问题) https://github.com/${is_sh_repo}/issues"
|
echo -e "反馈问题) 请前往项目平台提交 Issue"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@@ -324,7 +323,7 @@ main() {
|
|||||||
# show welcome msg
|
# show welcome msg
|
||||||
clear
|
clear
|
||||||
echo
|
echo
|
||||||
echo "........... $is_core_name script by $author .........."
|
echo "........... $is_core_name script .........."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# start installing...
|
# start installing...
|
||||||
@@ -353,7 +352,10 @@ main() {
|
|||||||
|
|
||||||
# install dependent pkg
|
# install dependent pkg
|
||||||
if [[ $cmd =~ apk ]]; then
|
if [[ $cmd =~ apk ]]; then
|
||||||
install_pkg $is_pkg
|
# Alpine: force install full versions to replace BusyBox applets
|
||||||
|
apk update &>/dev/null
|
||||||
|
apk add $is_pkg &>/dev/null
|
||||||
|
[[ $? == 0 ]] && >$is_pkg_ok
|
||||||
else
|
else
|
||||||
install_pkg $is_pkg &
|
install_pkg $is_pkg &
|
||||||
fi
|
fi
|
||||||
@@ -448,6 +450,8 @@ main() {
|
|||||||
load core.sh
|
load core.sh
|
||||||
# create a reality config
|
# create a reality config
|
||||||
add reality
|
add reality
|
||||||
|
# wait for background tasks (e.g., OpenRC service start)
|
||||||
|
wait
|
||||||
# remove tmp dir and exit.
|
# remove tmp dir and exit.
|
||||||
exit_and_del_tmpdir ok
|
exit_and_del_tmpdir ok
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
args=$@
|
args=$@
|
||||||
is_sh_ver=v1.15
|
is_sh_ver=v1.18
|
||||||
|
|
||||||
. /etc/sing-box/sh/src/init.sh
|
. /etc/sing-box/sh/src/init.sh
|
||||||
+2
-6
@@ -4,11 +4,7 @@ caddy_config() {
|
|||||||
new)
|
new)
|
||||||
mkdir -p $is_caddy_dir $is_caddy_dir/sites $is_caddy_conf
|
mkdir -p $is_caddy_dir $is_caddy_dir/sites $is_caddy_conf
|
||||||
cat >$is_caddyfile <<-EOF
|
cat >$is_caddyfile <<-EOF
|
||||||
# don't edit this file #
|
# caddy configuration #
|
||||||
# for more info, see https://233boy.com/$is_core/caddy-auto-tls/
|
|
||||||
# 不要编辑这个文件 #
|
|
||||||
# 更多相关请阅读此文章: https://233boy.com/$is_core/caddy-auto-tls/
|
|
||||||
# https://caddyserver.com/docs/caddyfile/options
|
|
||||||
{
|
{
|
||||||
admin off
|
admin off
|
||||||
http_port $is_http_port
|
http_port $is_http_port
|
||||||
@@ -52,6 +48,6 @@ reverse_proxy https://$proxy_site {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
[[ $1 != "new" && $1 != 'proxy' ]] && {
|
[[ $1 != "new" && $1 != 'proxy' ]] && {
|
||||||
[[ ! -f ${is_caddy_site_file}.add ]] && echo "# see https://233boy.com/$is_core/caddy-auto-tls/" >${is_caddy_site_file}.add
|
[[ ! -f ${is_caddy_site_file}.add ]] && echo "# caddy site configuration" >${is_caddy_site_file}.add
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+87
-48
@@ -20,6 +20,7 @@ protocol_list=(
|
|||||||
Trojan-HTTPUpgrade-TLS
|
Trojan-HTTPUpgrade-TLS
|
||||||
VLESS-REALITY
|
VLESS-REALITY
|
||||||
VLESS-HTTP2-REALITY
|
VLESS-HTTP2-REALITY
|
||||||
|
AnyTLS
|
||||||
# Direct
|
# Direct
|
||||||
Socks
|
Socks
|
||||||
)
|
)
|
||||||
@@ -42,7 +43,6 @@ mainmenu=(
|
|||||||
"卸载"
|
"卸载"
|
||||||
"帮助"
|
"帮助"
|
||||||
"其他"
|
"其他"
|
||||||
"关于"
|
|
||||||
)
|
)
|
||||||
info_list=(
|
info_list=(
|
||||||
"协议 (protocol)"
|
"协议 (protocol)"
|
||||||
@@ -227,7 +227,7 @@ ask() {
|
|||||||
[[ $is_no_auto_tls ]] && {
|
[[ $is_no_auto_tls ]] && {
|
||||||
unset is_tmp_list
|
unset is_tmp_list
|
||||||
for v in ${protocol_list[@]}; do
|
for v in ${protocol_list[@]}; do
|
||||||
[[ $(grep -i tls$ <<<$v) ]] && is_tmp_list=(${is_tmp_list[@]} $v)
|
[[ $(grep -i "\-tls$" <<<$v) ]] && is_tmp_list=(${is_tmp_list[@]} $v)
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
is_opt_msg="\n请选择协议:\n"
|
is_opt_msg="\n请选择协议:\n"
|
||||||
@@ -323,6 +323,8 @@ create() {
|
|||||||
if [[ $host ]]; then
|
if [[ $host ]]; then
|
||||||
is_config_name=$2-${host}.json
|
is_config_name=$2-${host}.json
|
||||||
is_listen='listen: "127.0.0.1"'
|
is_listen='listen: "127.0.0.1"'
|
||||||
|
elif [[ $is_anytls_domain ]]; then
|
||||||
|
is_config_name=$2-${is_anytls_domain}.json
|
||||||
else
|
else
|
||||||
is_config_name=$2-${port}.json
|
is_config_name=$2-${port}.json
|
||||||
fi
|
fi
|
||||||
@@ -615,9 +617,6 @@ change() {
|
|||||||
[[ $is_auto ]] && is_new_servername=$is_random_servername
|
[[ $is_auto ]] && is_new_servername=$is_random_servername
|
||||||
[[ ! $is_new_servername ]] && ask string is_new_servername "请输入新的 serverName:"
|
[[ ! $is_new_servername ]] && ask string is_new_servername "请输入新的 serverName:"
|
||||||
is_servername=$is_new_servername
|
is_servername=$is_new_servername
|
||||||
[[ $(grep -i "^233boy.com$" <<<$is_servername) ]] && {
|
|
||||||
err "你干嘛~哎呦~"
|
|
||||||
}
|
|
||||||
add $net
|
add $net
|
||||||
;;
|
;;
|
||||||
11)
|
11)
|
||||||
@@ -629,13 +628,9 @@ change() {
|
|||||||
[[ ! -f $is_caddy_conf/${host}.conf.add ]] && err "无法配置伪装网站."
|
[[ ! -f $is_caddy_conf/${host}.conf.add ]] && err "无法配置伪装网站."
|
||||||
[[ ! $is_new_proxy_site ]] && ask string is_new_proxy_site "请输入新的伪装网站 (例如 example.com):"
|
[[ ! $is_new_proxy_site ]] && ask string is_new_proxy_site "请输入新的伪装网站 (例如 example.com):"
|
||||||
proxy_site=$(sed 's#^.*//##;s#/$##' <<<$is_new_proxy_site)
|
proxy_site=$(sed 's#^.*//##;s#/$##' <<<$is_new_proxy_site)
|
||||||
[[ $(grep -i "^233boy.com$" <<<$proxy_site) ]] && {
|
load caddy.sh
|
||||||
err "你干嘛~哎呦~"
|
caddy_config proxy
|
||||||
} || {
|
manage restart caddy &
|
||||||
load caddy.sh
|
|
||||||
caddy_config proxy
|
|
||||||
manage restart caddy &
|
|
||||||
}
|
|
||||||
msg "\n已更新伪装网站为: $(_green $proxy_site) \n"
|
msg "\n已更新伪装网站为: $(_green $proxy_site) \n"
|
||||||
;;
|
;;
|
||||||
12)
|
12)
|
||||||
@@ -768,7 +763,7 @@ manage() {
|
|||||||
fi
|
fi
|
||||||
[[ $is_test_run && ! $is_new_install ]] && {
|
[[ $is_test_run && ! $is_new_install ]] && {
|
||||||
sleep 2
|
sleep 2
|
||||||
if [[ ! $(pgrep -f $is_run_bin 2>/dev/null || grep -l "$is_run_bin" /proc/*/cmdline 2>/dev/null) ]]; then
|
if [[ ! $(pgrep -f $is_run_bin) ]]; then
|
||||||
is_run_fail=${is_do_name_msg,,}
|
is_run_fail=${is_do_name_msg,,}
|
||||||
[[ ! $is_no_manage_msg ]] && {
|
[[ ! $is_no_manage_msg ]] && {
|
||||||
msg
|
msg
|
||||||
@@ -813,6 +808,9 @@ add() {
|
|||||||
trojan)
|
trojan)
|
||||||
is_new_protocol=Trojan
|
is_new_protocol=Trojan
|
||||||
;;
|
;;
|
||||||
|
anytls)
|
||||||
|
is_new_protocol=AnyTLS
|
||||||
|
;;
|
||||||
socks)
|
socks)
|
||||||
is_new_protocol=Socks
|
is_new_protocol=Socks
|
||||||
;;
|
;;
|
||||||
@@ -829,6 +827,14 @@ add() {
|
|||||||
# no prefer protocol
|
# no prefer protocol
|
||||||
[[ ! $is_new_protocol ]] && ask set_protocol
|
[[ ! $is_new_protocol ]] && ask set_protocol
|
||||||
|
|
||||||
|
if [[ ${is_new_protocol,,} == 'anytls' ]]; then
|
||||||
|
is_core_major=$(echo "$is_core_ver" | cut -d. -f1)
|
||||||
|
is_core_minor=$(echo "$is_core_ver" | cut -d. -f2)
|
||||||
|
if [[ ${is_core_major:-0} -lt 1 || ${is_core_major:-0} -eq 1 && ${is_core_minor:-0} -lt 12 ]]; then
|
||||||
|
err "当前 sing-box 版本 ($is_core_ver) 不支持 AnyTLS,请先升级 sing-box core 到 1.12.0 或更高版本。"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
case ${is_new_protocol,,} in
|
case ${is_new_protocol,,} in
|
||||||
*-tls)
|
*-tls)
|
||||||
is_use_tls=1
|
is_use_tls=1
|
||||||
@@ -866,6 +872,12 @@ add() {
|
|||||||
is_use_door_port=$4
|
is_use_door_port=$4
|
||||||
is_add_opts="[port] [remote_addr] [remote_port]"
|
is_add_opts="[port] [remote_addr] [remote_port]"
|
||||||
;;
|
;;
|
||||||
|
anytls*)
|
||||||
|
is_use_port=$2
|
||||||
|
is_use_pass=$3
|
||||||
|
[[ $4 ]] && is_anytls_domain=$4
|
||||||
|
is_add_opts="[port] [password] [domain]"
|
||||||
|
;;
|
||||||
socks)
|
socks)
|
||||||
is_socks=1
|
is_socks=1
|
||||||
is_use_port=$2
|
is_use_port=$2
|
||||||
@@ -963,6 +975,14 @@ add() {
|
|||||||
[[ $is_use_socks_pass ]] && is_socks_pass=$is_use_socks_pass
|
[[ $is_use_socks_pass ]] && is_socks_pass=$is_use_socks_pass
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# anytls with domain (ACME TLS)
|
||||||
|
if [[ $is_anytls_domain && ! $is_change && ! $is_gen ]]; then
|
||||||
|
get_ip
|
||||||
|
host=$is_anytls_domain
|
||||||
|
get host-test
|
||||||
|
host=
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $is_use_tls ]]; then
|
if [[ $is_use_tls ]]; then
|
||||||
if [[ ! $is_no_auto_tls && ! $is_caddy && ! $is_gen && ! $is_dont_test_host ]]; then
|
if [[ ! $is_no_auto_tls && ! $is_caddy && ! $is_gen && ! $is_dont_test_host ]]; then
|
||||||
# test auto tls
|
# test auto tls
|
||||||
@@ -972,7 +992,6 @@ add() {
|
|||||||
get_port
|
get_port
|
||||||
is_https_port=$tmp_port
|
is_https_port=$tmp_port
|
||||||
warn "端口 (80 或 443) 已经被占用, 你也可以考虑使用 no-auto-tls"
|
warn "端口 (80 或 443) 已经被占用, 你也可以考虑使用 no-auto-tls"
|
||||||
msg "\e[41m no-auto-tls 帮助(help)\e[0m: $(msg_ul https://233boy.com/$is_core/no-auto-tls/)\n"
|
|
||||||
msg "\n Caddy 将使用非标准端口实现自动配置 TLS, HTTP:$is_http_port HTTPS:$is_https_port\n"
|
msg "\n Caddy 将使用非标准端口实现自动配置 TLS, HTTP:$is_http_port HTTPS:$is_https_port\n"
|
||||||
msg "请确定是否继续???"
|
msg "请确定是否继续???"
|
||||||
pause
|
pause
|
||||||
@@ -1105,6 +1124,11 @@ get() {
|
|||||||
is_socks_user=$username
|
is_socks_user=$username
|
||||||
is_socks_pass=$password
|
is_socks_pass=$password
|
||||||
|
|
||||||
|
# extract anytls ACME domain
|
||||||
|
[[ $is_protocol == 'anytls' ]] && {
|
||||||
|
is_anytls_domain=$(jq -r '(.inbounds[0].tls.certificate_provider.domain[0] // .inbounds[0].tls.acme.domain[0]) // empty' <<<$is_json_str 2>/dev/null)
|
||||||
|
}
|
||||||
|
|
||||||
is_config_name=$is_config_file
|
is_config_name=$is_config_file
|
||||||
|
|
||||||
if [[ $is_caddy && $host && -f $is_caddy_conf/$host.conf ]]; then
|
if [[ $is_caddy && $host && -f $is_caddy_conf/$host.conf ]]; then
|
||||||
@@ -1169,10 +1193,28 @@ get() {
|
|||||||
is_protocol=$net
|
is_protocol=$net
|
||||||
json_str="override_port:$door_port,override_address:\"$door_addr\""
|
json_str="override_port:$door_port,override_address:\"$door_addr\""
|
||||||
;;
|
;;
|
||||||
|
anytls*)
|
||||||
|
net=anytls
|
||||||
|
is_protocol=$net
|
||||||
|
[[ ! $password ]] && password=$uuid
|
||||||
|
is_users="users:[{password:\"$password\"}]"
|
||||||
|
if [[ $is_anytls_domain ]]; then
|
||||||
|
# sing-box >= 1.14.0 uses certificate_provider; older uses acme
|
||||||
|
is_core_minor=$(echo "$is_core_ver" | cut -d. -f2)
|
||||||
|
if [[ ${is_core_minor:-0} -ge 14 ]]; then
|
||||||
|
is_anytls_tls="tls:{enabled:true,certificate_provider:{type:\"acme\",domain:[\"$is_anytls_domain\"]}}"
|
||||||
|
else
|
||||||
|
is_anytls_tls="tls:{enabled:true,acme:{domain:[\"$is_anytls_domain\"]}}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
is_anytls_tls="${is_tls_json/alpn\:\[\"h3\"\],/}"
|
||||||
|
fi
|
||||||
|
json_str="$is_users,$is_anytls_tls"
|
||||||
|
;;
|
||||||
socks*)
|
socks*)
|
||||||
net=socks
|
net=socks
|
||||||
is_protocol=$net
|
is_protocol=$net
|
||||||
[[ ! $is_socks_user ]] && is_socks_user=233boy
|
[[ ! $is_socks_user ]] && is_socks_user=admin
|
||||||
[[ ! $is_socks_pass ]] && is_socks_pass=$uuid
|
[[ ! $is_socks_pass ]] && is_socks_pass=$uuid
|
||||||
json_str="users:[{username: \"$is_socks_user\", password: \"$is_socks_pass\"}]"
|
json_str="users:[{username: \"$is_socks_user\", password: \"$is_socks_pass\"}]"
|
||||||
;;
|
;;
|
||||||
@@ -1273,7 +1315,7 @@ get() {
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
is_no_manage_msg=1
|
is_no_manage_msg=1
|
||||||
if [[ ! $(pgrep -f $is_core_bin 2>/dev/null || grep -l "$is_core_bin" /proc/*/cmdline 2>/dev/null) ]]; then
|
if [[ ! $(pgrep -f $is_core_bin) ]]; then
|
||||||
_yellow "\n测试运行 $is_core_name ..\n"
|
_yellow "\n测试运行 $is_core_name ..\n"
|
||||||
manage start &>/dev/null
|
manage start &>/dev/null
|
||||||
if [[ $is_run_fail == $is_core ]]; then
|
if [[ $is_run_fail == $is_core ]]; then
|
||||||
@@ -1286,7 +1328,7 @@ get() {
|
|||||||
_green "\n$is_core_name 正在运行, 跳过测试\n"
|
_green "\n$is_core_name 正在运行, 跳过测试\n"
|
||||||
fi
|
fi
|
||||||
if [[ $is_caddy ]]; then
|
if [[ $is_caddy ]]; then
|
||||||
if [[ ! $(pgrep -f $is_caddy_bin 2>/dev/null || grep -l "$is_caddy_bin" /proc/*/cmdline 2>/dev/null) ]]; then
|
if [[ ! $(pgrep -f $is_caddy_bin) ]]; then
|
||||||
_yellow "\n测试运行 Caddy ..\n"
|
_yellow "\n测试运行 Caddy ..\n"
|
||||||
manage start caddy &>/dev/null
|
manage start caddy &>/dev/null
|
||||||
if [[ $is_run_fail == 'caddy' ]]; then
|
if [[ $is_run_fail == 'caddy' ]]; then
|
||||||
@@ -1317,7 +1359,7 @@ info() {
|
|||||||
is_can_change=(0 1 2 3 5)
|
is_can_change=(0 1 2 3 5)
|
||||||
is_info_show=(0 1 2 3 4 6 7 8)
|
is_info_show=(0 1 2 3 4 6 7 8)
|
||||||
[[ $is_protocol == 'vmess' ]] && {
|
[[ $is_protocol == 'vmess' ]] && {
|
||||||
is_vmess_url=$(jq -c '{v:2,ps:'\"233boy-$net-$host\"',add:'\"$is_addr\"',port:'\"$is_https_port\"',id:'\"$uuid\"',aid:"0",net:'\"$net\"',host:'\"$host\"',path:'\"$path\"',tls:'\"tls\"'}' <<<{})
|
is_vmess_url=$(jq -c '{v:2,ps:'\"sb-$net-$host\"',add:'\"$is_addr\"',port:'\"$is_https_port\"',id:'\"$uuid\"',aid:"0",net:'\"$net\"',host:'\"$host\"',path:'\"$path\"',tls:'\"tls\"'}' <<<{})
|
||||||
is_url=vmess://$(echo -n $is_vmess_url | base64 -w 0)
|
is_url=vmess://$(echo -n $is_vmess_url | base64 -w 0)
|
||||||
} || {
|
} || {
|
||||||
[[ $is_protocol == "trojan" ]] && {
|
[[ $is_protocol == "trojan" ]] && {
|
||||||
@@ -1326,7 +1368,7 @@ info() {
|
|||||||
is_can_change=(0 1 2 3 4)
|
is_can_change=(0 1 2 3 4)
|
||||||
is_info_show=(0 1 2 10 4 6 7 8)
|
is_info_show=(0 1 2 10 4 6 7 8)
|
||||||
}
|
}
|
||||||
is_url="$is_protocol://$uuid@$host:$is_https_port?encryption=none&security=tls&type=$net&host=$host&path=$path#233boy-$net-$host"
|
is_url="$is_protocol://$uuid@$host:$is_https_port?encryption=none&security=tls&type=$net&host=$host&path=$path#sb-$net-$host"
|
||||||
}
|
}
|
||||||
[[ $is_caddy ]] && is_can_change+=(11)
|
[[ $is_caddy ]] && is_can_change+=(11)
|
||||||
is_info_str=($is_protocol $is_addr $is_https_port $uuid $net $host $path 'tls')
|
is_info_str=($is_protocol $is_addr $is_https_port $uuid $net $host $path 'tls')
|
||||||
@@ -1348,34 +1390,36 @@ info() {
|
|||||||
is_info_str+=(tls h3 true)
|
is_info_str+=(tls h3 true)
|
||||||
is_quic_add=",tls:\"tls\",alpn:\"h3\"" # cant add allowInsecure
|
is_quic_add=",tls:\"tls\",alpn:\"h3\"" # cant add allowInsecure
|
||||||
}
|
}
|
||||||
is_vmess_url=$(jq -c "{v:2,ps:\"233boy-${net}-$is_addr\",add:\"$is_addr\",port:\"$port\",id:\"$uuid\",aid:\"0\",net:\"$net\",type:\"$is_type\"$is_quic_add}" <<<{})
|
is_vmess_url=$(jq -c "{v:2,ps:\"sb-${net}-$is_addr\",add:\"$is_addr\",port:\"$port\",id:\"$uuid\",aid:\"0\",net:\"$net\",type:\"$is_type\"$is_quic_add}" <<<{})
|
||||||
is_url=vmess://$(echo -n $is_vmess_url | base64 -w 0)
|
is_url=vmess://$(echo -n $is_vmess_url | base64 -w 0)
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ss)
|
ss)
|
||||||
is_can_change=(0 1 4 6)
|
is_can_change=(0 1 4 6)
|
||||||
is_info_show=(0 1 2 10 11)
|
is_info_show=(0 1 2 10 11)
|
||||||
is_url="ss://$(echo -n ${ss_method}:${ss_password} | base64 -w 0)@${is_addr}:${port}#233boy-$net-${is_addr}"
|
is_url="ss://$(echo -n ${ss_method}:${ss_password} | base64 -w 0)@${is_addr}:${port}#sb-$net-${is_addr}"
|
||||||
is_info_str=($is_protocol $is_addr $port $ss_password $ss_method)
|
is_info_str=($is_protocol $is_addr $port $ss_password $ss_method)
|
||||||
;;
|
;;
|
||||||
trojan)
|
trojan)
|
||||||
is_insecure=1
|
is_insecure=1
|
||||||
is_can_change=(0 1 4)
|
is_can_change=(0 1 4)
|
||||||
is_info_show=(0 1 2 10 4 8 20)
|
is_info_show=(0 1 2 10 4 8 20)
|
||||||
is_url="$is_protocol://$password@$is_addr:$port?type=tcp&security=tls&allowInsecure=1#233boy-$net-$is_addr"
|
is_url="$is_protocol://$password@$is_addr:$port?type=tcp&security=tls&insecure=1&allowInsecure=1#sb-$net-$is_addr"
|
||||||
is_info_str=($is_protocol $is_addr $port $password tcp tls true)
|
is_info_str=($is_protocol $is_addr $port $password tcp tls true)
|
||||||
;;
|
;;
|
||||||
hy*)
|
hy*)
|
||||||
is_can_change=(0 1 4)
|
is_can_change=(0 1 4)
|
||||||
is_info_show=(0 1 2 10 8 9 20)
|
is_info_show=(0 1 2 10 8 9 20)
|
||||||
is_url="$is_protocol://$password@$is_addr:$port?alpn=h3&insecure=1#233boy-$net-$is_addr"
|
# fix xray core for client use.
|
||||||
is_info_str=($is_protocol $is_addr $port $password tls h3 true)
|
is_sha256=$(openssl x509 -noout -fingerprint -sha256 -in $is_core_dir/bin/tls.cer | sed 's/.*=//;s/://g')
|
||||||
|
is_url="$is_protocol://$password@$is_addr:$port?alpn=h3&insecure=1&allowInsecure=1&pinSHA256=$is_sha256#sb-$net-$is_addr"
|
||||||
|
is_info_str=($is_protocol $is_addr $port $password tls h3 "true (设置, 固定证书>证书指纹(SHA-256): $is_sha256)")
|
||||||
;;
|
;;
|
||||||
tuic)
|
tuic)
|
||||||
is_insecure=1
|
is_insecure=1
|
||||||
is_can_change=(0 1 4 5)
|
is_can_change=(0 1 4 5)
|
||||||
is_info_show=(0 1 2 3 10 8 9 20 21)
|
is_info_show=(0 1 2 3 10 8 9 20 21)
|
||||||
is_url="$is_protocol://$uuid:$password@$is_addr:$port?alpn=h3&allow_insecure=1&congestion_control=bbr#233boy-$net-$is_addr"
|
is_url="$is_protocol://$uuid:$password@$is_addr:$port?alpn=h3&insecure=1&allowInsecure=1&congestion_control=bbr#sb-$net-$is_addr"
|
||||||
is_info_str=($is_protocol $is_addr $port $uuid $password tls h3 true bbr)
|
is_info_str=($is_protocol $is_addr $port $uuid $password tls h3 true bbr)
|
||||||
;;
|
;;
|
||||||
reality)
|
reality)
|
||||||
@@ -1390,7 +1434,20 @@ info() {
|
|||||||
is_info_show=(${is_info_show[@]/15/})
|
is_info_show=(${is_info_show[@]/15/})
|
||||||
}
|
}
|
||||||
is_info_str=($is_protocol $is_addr $port $uuid $is_flow $is_net_type reality $is_servername chrome $is_public_key)
|
is_info_str=($is_protocol $is_addr $port $uuid $is_flow $is_net_type reality $is_servername chrome $is_public_key)
|
||||||
is_url="$is_protocol://$uuid@$is_addr:$port?encryption=none&security=reality&flow=$is_flow&type=$is_net_type&sni=$is_servername&pbk=$is_public_key&fp=chrome#233boy-$net-$is_addr"
|
is_url="$is_protocol://$uuid@$is_addr:$port?encryption=none&security=reality&flow=$is_flow&type=$is_net_type&sni=$is_servername&pbk=$is_public_key&fp=chrome#sb-$net-$is_addr"
|
||||||
|
;;
|
||||||
|
anytls)
|
||||||
|
is_can_change=(0 1 4)
|
||||||
|
if [[ $is_anytls_domain ]]; then
|
||||||
|
is_info_show=(0 1 2 10 8)
|
||||||
|
is_info_str=($is_protocol $is_anytls_domain $port $password tls)
|
||||||
|
is_url="anytls://$password@$is_anytls_domain:$port#sb-$net-$is_anytls_domain"
|
||||||
|
else
|
||||||
|
is_insecure=1
|
||||||
|
is_info_show=(0 1 2 10 8 20)
|
||||||
|
is_info_str=($is_protocol $is_addr $port $password tls true)
|
||||||
|
is_url="anytls://$password@$is_addr:$port?insecure=1&allowInsecure=1#sb-$net-$is_addr"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
direct)
|
direct)
|
||||||
is_can_change=(0 1 7 8)
|
is_can_change=(0 1 7 8)
|
||||||
@@ -1401,7 +1458,7 @@ info() {
|
|||||||
is_can_change=(0 1 12 4)
|
is_can_change=(0 1 12 4)
|
||||||
is_info_show=(0 1 2 19 10)
|
is_info_show=(0 1 2 19 10)
|
||||||
is_info_str=($is_protocol $is_addr $port $is_socks_user $is_socks_pass)
|
is_info_str=($is_protocol $is_addr $port $is_socks_user $is_socks_pass)
|
||||||
is_url="socks://$(echo -n ${is_socks_user}:${is_socks_pass} | base64 -w 0)@${is_addr}:${port}#233boy-$net-${is_addr}"
|
is_url="socks://$(echo -n ${is_socks_user}:${is_socks_pass} | base64 -w 0)@${is_addr}:${port}#sb-$net-${is_addr}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
[[ $is_dont_show_info || $is_gen || $is_dont_auto_exit ]] && return # dont show info
|
[[ $is_dont_show_info || $is_gen || $is_dont_auto_exit ]] && return # dont show info
|
||||||
@@ -1416,7 +1473,7 @@ info() {
|
|||||||
msg "$a $tt= \e[${is_color}m${is_info_str[$i]}\e[0m"
|
msg "$a $tt= \e[${is_color}m${is_info_str[$i]}\e[0m"
|
||||||
done
|
done
|
||||||
if [[ $is_new_install ]]; then
|
if [[ $is_new_install ]]; then
|
||||||
warn "首次安装请查看脚本帮助文档: $(msg_ul https://233boy.com/$is_core/$is_core-script/)"
|
warn "首次安装建议运行 sing-box help 查看帮助信息"
|
||||||
fi
|
fi
|
||||||
if [[ $is_url ]]; then
|
if [[ $is_url ]]; then
|
||||||
msg "------------- ${info_list[12]} -------------"
|
msg "------------- ${info_list[12]} -------------"
|
||||||
@@ -1429,7 +1486,6 @@ info() {
|
|||||||
msg "------------- no-auto-tls INFO -------------"
|
msg "------------- no-auto-tls INFO -------------"
|
||||||
msg "端口(port): $port"
|
msg "端口(port): $port"
|
||||||
msg "路径(path): $path"
|
msg "路径(path): $path"
|
||||||
msg "\e[41m帮助(help)\e[0m: $(msg_ul https://233boy.com/$is_core/no-auto-tls/)"
|
|
||||||
fi
|
fi
|
||||||
footer_msg
|
footer_msg
|
||||||
}
|
}
|
||||||
@@ -1438,13 +1494,7 @@ info() {
|
|||||||
footer_msg() {
|
footer_msg() {
|
||||||
[[ $is_core_stop && ! $is_new_json ]] && warn "$is_core_name 当前处于停止状态."
|
[[ $is_core_stop && ! $is_new_json ]] && warn "$is_core_name 当前处于停止状态."
|
||||||
[[ $is_caddy_stop && $host ]] && warn "Caddy 当前处于停止状态."
|
[[ $is_caddy_stop && $host ]] && warn "Caddy 当前处于停止状态."
|
||||||
####### 要点13脸吗只会改我链接的小人 #######
|
|
||||||
unset c n m s b
|
|
||||||
msg "------------- END -------------"
|
msg "------------- END -------------"
|
||||||
msg "关注(tg): $(msg_ul https://t.me/tg2333)"
|
|
||||||
msg "文档(doc): $(msg_ul https://233boy.com/$is_core/$is_core-script/)"
|
|
||||||
msg "推广(ads): 机场推荐($is_core_name services): $(msg_ul https://g${c}e${n}t${m}j${s}m${b}s.com/)\n"
|
|
||||||
####### 要点13脸吗只会改我链接的小人 #######
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# URL or qrcode
|
# URL or qrcode
|
||||||
@@ -1457,7 +1507,6 @@ url_qr() {
|
|||||||
msg "\n\e[${is_color}m${is_url}\e[0m\n"
|
msg "\n\e[${is_color}m${is_url}\e[0m\n"
|
||||||
footer_msg
|
footer_msg
|
||||||
} || {
|
} || {
|
||||||
link="https://233boy.github.io/tools/qr.html#${is_url}"
|
|
||||||
msg "\n------------- $is_config_name & QR code 二维码 -------------"
|
msg "\n------------- $is_config_name & QR code 二维码 -------------"
|
||||||
msg
|
msg
|
||||||
if [[ $(type -P qrencode) ]]; then
|
if [[ $(type -P qrencode) ]]; then
|
||||||
@@ -1466,8 +1515,6 @@ url_qr() {
|
|||||||
msg "请安装 qrencode: $(_green "$cmd update -y; $cmd install qrencode -y")"
|
msg "请安装 qrencode: $(_green "$cmd update -y; $cmd install qrencode -y")"
|
||||||
fi
|
fi
|
||||||
msg
|
msg
|
||||||
msg "如果无法正常显示或识别, 请使用下面的链接来生成二维码:"
|
|
||||||
msg "\n\e[4;${is_color}m${link}\e[0m\n"
|
|
||||||
footer_msg
|
footer_msg
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1489,10 +1536,7 @@ update() {
|
|||||||
is_update_repo=$is_core_repo
|
is_update_repo=$is_core_repo
|
||||||
;;
|
;;
|
||||||
2 | sh)
|
2 | sh)
|
||||||
is_update_name=sh
|
err "当前项目已净化,已禁用自动更新脚本以防止覆盖净化修改。"
|
||||||
is_show_name="$is_core_name 脚本"
|
|
||||||
is_run_ver=$is_sh_ver
|
|
||||||
is_update_repo=$is_sh_repo
|
|
||||||
;;
|
;;
|
||||||
3 | caddy)
|
3 | caddy)
|
||||||
[[ ! $is_caddy ]] && err "不支持更新 Caddy."
|
[[ ! $is_caddy ]] && err "不支持更新 Caddy."
|
||||||
@@ -1530,9 +1574,8 @@ update() {
|
|||||||
|
|
||||||
# main menu; if no prefer args.
|
# main menu; if no prefer args.
|
||||||
is_main_menu() {
|
is_main_menu() {
|
||||||
msg "\n------------- $is_core_name script $is_sh_ver by $author -------------"
|
msg "\n------------- $is_core_name script $is_sh_ver -------------"
|
||||||
msg "$is_core_name $is_core_ver: $is_core_status"
|
msg "$is_core_name $is_core_ver: $is_core_status"
|
||||||
msg "群组(Chat): $(msg_ul https://t.me/tg233boy)"
|
|
||||||
is_main_start=1
|
is_main_start=1
|
||||||
ask mainmenu
|
ask mainmenu
|
||||||
case $REPLY in
|
case $REPLY in
|
||||||
@@ -1590,10 +1633,6 @@ is_main_menu() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
10)
|
|
||||||
load help.sh
|
|
||||||
about
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-15
@@ -5,7 +5,7 @@ show_help() {
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
[[ $1 ]] && warn "未知选项 '$1'"
|
[[ $1 ]] && warn "未知选项 '$1'"
|
||||||
msg "$is_core_name script $is_sh_ver by $author"
|
msg "$is_core_name script $is_sh_ver"
|
||||||
msg "Usage: $is_core [options]... [args]... "
|
msg "Usage: $is_core [options]... [args]... "
|
||||||
msg
|
msg
|
||||||
help_info=(
|
help_info=(
|
||||||
@@ -32,7 +32,7 @@ show_help() {
|
|||||||
" port [name] [port | auto] 更改端口"
|
" port [name] [port | auto] 更改端口"
|
||||||
" path [name] [path | auto] 更改路径"
|
" path [name] [path | auto] 更改路径"
|
||||||
" passwd [name] [password | auto] 更改密码"
|
" passwd [name] [password | auto] 更改密码"
|
||||||
" key [name] [Private key | atuo] [Public key] 更改密钥"
|
" key [name] [Private key | auto] [Public key] 更改密钥"
|
||||||
# " type [name] [type | auto] 更改伪装类型"
|
# " type [name] [type | auto] 更改伪装类型"
|
||||||
" method [name] [method | auto] 更改加密方式"
|
" method [name] [method | auto] 更改加密方式"
|
||||||
" sni [name] [ ip | domain] 更改 serverName"
|
" sni [name] [ ip | domain] 更改 serverName"
|
||||||
@@ -49,8 +49,7 @@ show_help() {
|
|||||||
" import 导入 xray/v2ray 脚本配置\n"
|
" import 导入 xray/v2ray 脚本配置\n"
|
||||||
"管理:"
|
"管理:"
|
||||||
" un, uninstall 卸载"
|
" un, uninstall 卸载"
|
||||||
" u, update [core | sh | caddy] [ver] 更新"
|
" u, update [core | caddy] [ver] 更新\n"
|
||||||
" U, update.sh 更新脚本"
|
|
||||||
" s, status 运行状态"
|
" s, status 运行状态"
|
||||||
" start, stop, restart [caddy] 启动, 停止, 重启"
|
" start, stop, restart [caddy] 启动, 停止, 重启"
|
||||||
" t, test 测试运行"
|
" t, test 测试运行"
|
||||||
@@ -70,25 +69,15 @@ show_help() {
|
|||||||
for v in "${help_info[@]}"; do
|
for v in "${help_info[@]}"; do
|
||||||
msg "$v"
|
msg "$v"
|
||||||
done
|
done
|
||||||
msg "谨慎使用 del, ddel, 此选项会直接删除配置; 无需确认"
|
msg "反馈问题) 请前往项目平台提交 Issue"
|
||||||
msg "反馈问题) $(msg_ul https://github.com/${is_sh_repo}/issues) "
|
|
||||||
msg "文档(doc) $(msg_ul https://233boy.com/$is_core/$is_core-script/)"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
about() {
|
about() {
|
||||||
####### 要点13脸吗只会改我链接的小人 #######
|
|
||||||
unset c n m s b
|
|
||||||
msg
|
msg
|
||||||
msg "网站: $(msg_ul https://233boy.com)"
|
|
||||||
msg "频道: $(msg_ul https://t.me/tg2333)"
|
|
||||||
msg "群组: $(msg_ul https://t.me/tg233boy)"
|
|
||||||
msg "Github: $(msg_ul https://github.com/${is_sh_repo})"
|
|
||||||
msg "Twitter: $(msg_ul https://twitter.com/ai233boy)"
|
|
||||||
msg "$is_core_name site: $(msg_ul https://sing-box.sagernet.org/)"
|
msg "$is_core_name site: $(msg_ul https://sing-box.sagernet.org/)"
|
||||||
msg "$is_core_name core: $(msg_ul https://github.com/${is_core_repo})"
|
msg "$is_core_name core: $(msg_ul https://github.com/${is_core_repo})"
|
||||||
msg
|
msg
|
||||||
####### 要点13脸吗只会改我链接的小人 #######
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
author=233boy
|
author=sb
|
||||||
# github=https://github.com/233boy/sing-box
|
|
||||||
|
|
||||||
# bash fonts colors
|
# bash fonts colors
|
||||||
red='\e[31m'
|
red='\e[31m'
|
||||||
@@ -90,7 +89,7 @@ is_caddy_bin=/usr/local/bin/caddy
|
|||||||
is_caddy_dir=/etc/caddy
|
is_caddy_dir=/etc/caddy
|
||||||
is_caddy_repo=caddyserver/caddy
|
is_caddy_repo=caddyserver/caddy
|
||||||
is_caddyfile=$is_caddy_dir/Caddyfile
|
is_caddyfile=$is_caddy_dir/Caddyfile
|
||||||
is_caddy_conf=$is_caddy_dir/$author
|
is_caddy_conf=$is_caddy_dir/sing-box
|
||||||
is_systemd=$(type -P systemctl)
|
is_systemd=$(type -P systemctl)
|
||||||
is_openrc=$(type -P rc-service)
|
is_openrc=$(type -P rc-service)
|
||||||
if [[ $is_systemd ]]; then
|
if [[ $is_systemd ]]; then
|
||||||
@@ -115,7 +114,7 @@ is_tls_key=$is_core_dir/bin/tls.key
|
|||||||
rm $is_tls_tmp
|
rm $is_tls_tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $(pgrep -f $is_core_bin 2>/dev/null || grep -l "$is_core_bin" /proc/*/cmdline 2>/dev/null) ]]; then
|
if [[ $(pgrep -f $is_core_bin) ]]; then
|
||||||
is_core_status=$(_green running)
|
is_core_status=$(_green running)
|
||||||
else
|
else
|
||||||
is_core_status=$(_red_bg stopped)
|
is_core_status=$(_red_bg stopped)
|
||||||
@@ -135,7 +134,7 @@ if [[ -f $is_caddy_bin && -d $is_caddy_dir && $is_caddy_service ]]; then
|
|||||||
is_tmp_https_port=$(grep -E '^ {2,}https_port|^https_port' $is_caddyfile | grep -E -o [0-9]+)
|
is_tmp_https_port=$(grep -E '^ {2,}https_port|^https_port' $is_caddyfile | grep -E -o [0-9]+)
|
||||||
[[ $is_tmp_http_port ]] && is_http_port=$is_tmp_http_port
|
[[ $is_tmp_http_port ]] && is_http_port=$is_tmp_http_port
|
||||||
[[ $is_tmp_https_port ]] && is_https_port=$is_tmp_https_port
|
[[ $is_tmp_https_port ]] && is_https_port=$is_tmp_https_port
|
||||||
if [[ $(pgrep -f $is_caddy_bin 2>/dev/null || grep -l "$is_caddy_bin" /proc/*/cmdline 2>/dev/null) ]]; then
|
if [[ $(pgrep -f $is_caddy_bin) ]]; then
|
||||||
is_caddy_status=$(_green running)
|
is_caddy_status=$(_green running)
|
||||||
else
|
else
|
||||||
is_caddy_status=$(_red_bg stopped)
|
is_caddy_status=$(_red_bg stopped)
|
||||||
|
|||||||
Reference in New Issue
Block a user