mirror of
https://github.com/233boy/sing-box.git
synced 2026-05-03 06:14:41 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3750157987 | ||
|
|
7c9622df74 | ||
|
|
4ebcb332bc | ||
|
|
62c5871ddc | ||
|
|
93d550ace3 | ||
|
|
a6c37635fe |
@@ -198,7 +198,7 @@ check_status() {
|
||||
# dependent pkg install fail
|
||||
[[ ! -f $is_pkg_ok ]] && {
|
||||
msg err "安装依赖包失败"
|
||||
msg err "请尝试手动安装依赖包: $cmd update -y; $cmd install -y $pkg"
|
||||
msg err "请尝试手动安装依赖包: $cmd update -y; $cmd install -y $is_pkg"
|
||||
is_fail=1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
args=$@
|
||||
is_sh_ver=v1.10
|
||||
is_sh_ver=v1.14
|
||||
|
||||
. /etc/sing-box/sh/src/init.sh
|
||||
15
src/core.sh
15
src/core.sh
@@ -467,7 +467,7 @@ change() {
|
||||
1)
|
||||
# new port
|
||||
is_new_port=$3
|
||||
[[ $host && ! $is_caddy || $is_no_auto_tls ]] && err "($is_config_file) 不支持更改端口, 因为没啥意义."
|
||||
[[ $host && ! $is_caddy || $is_no_auto_tls ]] && err "($is_config_file) 不支持更改端口, 因为没啥意义."
|
||||
if [[ $is_new_port && ! $is_auto ]]; then
|
||||
[[ ! $(is_test port $is_new_port) ]] && err "请输入正确的端口, 可选(1-65535)"
|
||||
[[ $is_new_port != 443 && $(is_test port_used $is_new_port) ]] && err "无法使用 ($is_new_port) 端口"
|
||||
@@ -655,7 +655,7 @@ del() {
|
||||
[[ ! $old_host ]] && return # no host exist or not set new host;
|
||||
is_del_host=$old_host
|
||||
}
|
||||
[[ $is_del_host && $host != $old_host && ! $is_no_auto_tls ]] && {
|
||||
[[ $is_del_host && $host != $old_host && -f $is_caddy_conf/$is_del_host.conf ]] && {
|
||||
rm -rf $is_caddy_conf/$is_del_host.conf $is_caddy_conf/$is_del_host.conf.add
|
||||
[[ ! $is_new_json ]] && manage restart caddy &
|
||||
}
|
||||
@@ -680,7 +680,7 @@ uninstall() {
|
||||
manage stop &>/dev/null
|
||||
manage disable &>/dev/null
|
||||
rm -rf $is_core_dir $is_log_dir $is_sh_bin ${is_sh_bin/$is_core/sb} /lib/systemd/system/$is_core.service
|
||||
sed -i "/alias $is_core=/d" /root/.bashrc
|
||||
sed -i "/$is_core/d" /root/.bashrc
|
||||
# uninstall caddy; 2 is ask result
|
||||
if [[ $REPLY == '2' ]]; then
|
||||
manage stop caddy &>/dev/null
|
||||
@@ -1199,7 +1199,11 @@ get() {
|
||||
fi
|
||||
;;
|
||||
ssss | ss2022)
|
||||
$is_core_bin generate rand 32 --base64
|
||||
if [[ $(grep 128 <<<$ss_method) ]]; then
|
||||
$is_core_bin generate rand 16 --base64
|
||||
else
|
||||
$is_core_bin generate rand 32 --base64
|
||||
fi
|
||||
;;
|
||||
ping)
|
||||
# is_ip_type="-4"
|
||||
@@ -1532,7 +1536,8 @@ is_main_menu() {
|
||||
_try_enable_bbr
|
||||
;;
|
||||
2)
|
||||
get log
|
||||
load log.sh
|
||||
log_set
|
||||
;;
|
||||
3)
|
||||
get test-run
|
||||
|
||||
30
src/dns.sh
30
src/dns.sh
@@ -8,6 +8,9 @@ is_dns_list=(
|
||||
none
|
||||
)
|
||||
dns_set() {
|
||||
if [[ $(echo -e "1.11.99\n$is_core_ver" | sort -V | head -n1) == '1.11.99' ]]; then
|
||||
is_dns_new=1
|
||||
fi
|
||||
if [[ $1 ]]; then
|
||||
case ${1,,} in
|
||||
11 | 1111)
|
||||
@@ -46,11 +49,34 @@ dns_set() {
|
||||
ask string is_dns_use "请输入 DNS: "
|
||||
fi
|
||||
fi
|
||||
is_dns_use_bak=$is_dns_use
|
||||
if [[ $is_dns_use == "none" ]]; then
|
||||
cat <<<$(jq '.dns={}' $is_config_json) >$is_config_json
|
||||
else
|
||||
cat <<<$(jq '.dns.servers=[{address:"'$is_dns_use'",address_resolver:"local"},{tag:"local",address:"local"}]' $is_config_json) >$is_config_json
|
||||
if [[ $is_dns_new ]]; then
|
||||
dns_set_server $is_dns_use
|
||||
cat <<<$(jq '.dns.servers=[{type:"'$is_dns_type'",server:"'$is_dns_use'",domain_resolver:"local"},{tag:"local",type:"local"}]' $is_config_json) >$is_config_json
|
||||
else
|
||||
cat <<<$(jq '.dns.servers=[{address:"'$is_dns_use'",address_resolver:"local"},{tag:"local",address:"local"}]' $is_config_json) >$is_config_json
|
||||
fi
|
||||
fi
|
||||
manage restart &
|
||||
msg "\n已更新 DNS 为: $(_green $is_dns_use)\n"
|
||||
msg "\n已更新 DNS 为: $(_green $is_dns_use_bak)\n"
|
||||
}
|
||||
dns_set_server() {
|
||||
if [[ $(grep '://' <<<$1) ]]; then
|
||||
is_tmp_dns_set=($(awk -F '://|/' '{print $1, $2}' <<<${1,,}))
|
||||
case ${is_tmp_dns_set[0]} in
|
||||
tcp | udp | tls | https | quic | h3)
|
||||
is_dns_use=${is_tmp_dns_set[1]}
|
||||
is_dns_type=${is_tmp_dns_set[0]}
|
||||
;;
|
||||
*)
|
||||
err "无法识别 DNS 类型!"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
is_dns_use=$1
|
||||
is_dns_type=udp
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user