update
This commit is contained in:
1
static/nst/1cg3cz.nst
Normal file
1
static/nst/1cg3cz.nst
Normal file
@@ -0,0 +1 @@
|
||||
xV0A3f33zvbv7rMnUN7uylxtGqtf0bHaOG+KpkSJnE/lrvyCCSZ3NqhluZNtDW+0vQMJnDUuISEIQn8iteBJjQ56wxDU1ZVg+tzpDckSl7DAAcK9frxLNIzXAu37QteYY6U8teCqZ9Ay6AFGOM1Ae4Qu9FaawOkZE8sWvWONd9W9pEoBcY7twPPd3GSrxu6zgYvsfxYkQtU9t+WIW66DHkRXmV5Izi/FFQzYzhvAT7IlGcseccZd8hGHfcNQfytYe+0Icbkg12FK4p3Dh9qOxABPrRxF9pPMiGZHdqvk8qA=
|
||||
1
static/nst/240G.nst
Normal file
1
static/nst/240G.nst
Normal file
@@ -0,0 +1 @@
|
||||
2neZNThvEEX8eE1qpohItSmYwSZfh0UhRwnWQdiwYg3E1i17KkKoNlj3lQp9BZ2F3VTjpKUh6jk30YQEhysisek+c6pqLSGuINp6zz9i6H6UUMA1Bv0D//9yhHVXVbELIpWORq6dxjU+0RnYmj/RY3hhhpQtyMPEhvA6WQk0xTpSVs0V/TuzxlYLWA9faJ7UWt0i3N/h0nGLoYEyKHC9aUNMli6+R5RaC5/u0DrUUeVMYDJImiRA+EkYFBNICkkPRWacXdOHZgDSQbmEwUpAvaqnfAn9xmZZm6pV6Rbx4ieZae+rr4j2UIB+KGKSAun1M4AH+YR2+wcN7dMagA2gakKIhI9XdmPUXHgmRWlcrDP5lnZP+N5O2NjSjr+XOa1v+M7JX9/c44K1tjUmT6N4EQ==
|
||||
1
static/nst/4cg.nst
Normal file
1
static/nst/4cg.nst
Normal file
@@ -0,0 +1 @@
|
||||
Et5eVgMjInRCUjyjbEIQQIAyTAXfgHDqPquqk0yW9lSPBKGEBN28Piw/IxaAftUGMLNzo41ddpsUo59iue9wN3cflHILG9IT43LxfyHgSI+jp0C0o2FYz+d4n0ovE37l6MMUv6E20UaNvMGcgLFUjF70wWCOGFygM29Vu+ddBA9G96TkWF/SRodwQuAKp6imQr6LKtuIdMdPfb38Til2/g==
|
||||
1
static/nst/4cz.nst
Normal file
1
static/nst/4cz.nst
Normal file
@@ -0,0 +1 @@
|
||||
ofglhyaldDOUKQ3YhLVpzXgmpkH7LN+1QbGLyCNin6tdPpTsJXgU73r2Lae3+JF12/6/GlKaGbGLoXxa98Oe5O1d9x4U3MVoaBEUTEvOnCJGtzgKdZolNTLKMo6bW32dRyk0+s1jJpast8+NfR50b1b+6t56iRsZ0dwXc0HPoVCyyWusSB1Qjed2jkCevcvPPt51SE9cHB15B8QcrO2mHg==
|
||||
1
static/nst/500G.nst
Normal file
1
static/nst/500G.nst
Normal file
@@ -0,0 +1 @@
|
||||
kXdkhFg1+jt5n4M5xH5/YE3LoTSPyaKg0eg8T3rLGS4Kx1cQNSko7OdhpStElxo4jwNg1/53lk2ptDP3YpfsJ6QPqUZW3bwmt1s94a22zommKv7olIxsa7YfK+/SvLV8SALJ2IrXQihYRs4N46tvDeG8crY8wo+U0QS+0GSx4EODxMkVu5bErJuSecHZMD/yREoI/ln3H2AqiGj7Sbi5MIY7cGiF/0wQ425f9qFbJi8QVP8H7XeYIGnu7sd392dEcDTtWDIUU05G1iPQo36OPecrMw+4Xv7a9phCHS2/siY60foVIhyQHDNRzBr6AwNIb9PWNyI6ISTX+1V+1JwWCtEEPs444nBUHN1fbAtqK/In7DHtRcAApS/i0u2aUH9enWOpvqqat+ADuLr4KyRqj8cX+4/qmzEnNh49und/+HkcEALXcZcHwgpEVW4z3yZMIID9JB0Yh/fC0V8RjaINLhtF9yQtu4/7rt+as5okFHayfwktka21ipzKovzZOUtjtEr5RkR+cva/wS/5x2ldtk6jDP4U4n/1BylR2soUe+cG+LkJ5Lt66oc6WBzU4wi6KONuHcEwtOg5sJCfdyHig/oxDlvAK8W+kxNqCnlMPhtQpAOK3/b27bG9WmN59U9Y
|
||||
1
static/nst/501.nst
Normal file
1
static/nst/501.nst
Normal file
@@ -0,0 +1 @@
|
||||
aDD2bP6EcXVMP7ULevznikikwbVwhLhXZiRJrmZPs7q2gl3Dw9W6t3bjXo2YlCZXHEYn+6efKnbzaZjCJuuupDNKwNe5qeQqhJeuLCQ5KAi2t/PYHic8UCX1gthWuiJyCR8vrW1FwuJg8oyk/KnofejTUXJGgoCDYO4yZ3AD2Vi9Ret+BBBSkKB8nBOnnORPJNTGN6BkUycEx8NMQk6QJvm5bOPUufmLB1D7NCl5u972V328daGmNp9zwgjHjH/gSz9ZryVcs6dz66NQKD1e1HQB3ESL3Lrs51j8ZNNtYiew8xFl5WVZDH6DpqKcR9tb9wUXEc4a4HzSVQmZclT6gV8UoS4zyiEobJZQHn7oXlc/GSJLUh2kH/N36o3P3qY75Qx3HoMt8EiUjtuBdKgi82eVs5EPa/m2ZMPZKZjUm+ImDX32xiZmngurRMICIv2tt9GnZLgeU2UgFWnwCO1ui08GyN6WiRV0KdGkilY/S6rSCx4KpGA5z/SDV41vQvZ5VCJv2UB0I4lQzH7fRvk/9w3QCTbshg9odc4215F+REyXHKxVbyxHgy7UGb2+gWMjSTZfbLG1SjQykbK23RbtRJd/JM21sHBQkc1z/LTDWbAMgoLykosG0QS7AeGDdSk/
|
||||
1
static/nst/cbczcxcyk.nst
Normal file
1
static/nst/cbczcxcyk.nst
Normal file
@@ -0,0 +1 @@
|
||||
d241vl+lqW/yYDdPnDAS9B3OKjil3vM8a8XpM+O+vSQ1sJgyTGu8BwPavSC5Dy6OcxTo3+kf50fOwhaPbRc/4QHwkhIL+E8ATyjOl+XHUtBFDSrknq4+JuDpH8fu8bbyodAPWAXkUTXpYmb4+/oRRPoh4htJzgXnpkSvh6+I9aH6CQmr+7L/bu8NXjfV/SvH39Or7CLp4nG8htqRq+uF9hO++nN8cgXrJvaVsVl78i/5QUv8vdZJrNue96iChKqaM+a+x5hBwHjxLeO19LBWwZLsi8kp6e0MRJ/Cwuzx25+K5zIsyVCYaSPeAQ3tdvHnCR70D0qgnBJKUrHl3YdDASSBW/NxqPCvRgv2gw0RcZsEWZrqytwX2AMYKg1ENAEQXQ3k1I8KwQeiIS5QBGdVJoYQuvLJowSkdTw07UBZUt5KEL+cYzGmshakqZjdWx3P
|
||||
694
static/nst/install-v2ray.sh
Normal file
694
static/nst/install-v2ray.sh
Normal file
@@ -0,0 +1,694 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2268
|
||||
|
||||
DAT_PATH=${DAT_PATH:-/usr/local/share/v2ray}
|
||||
JSON_PATH=${JSON_PATH:-/usr/local/etc/v2ray}
|
||||
|
||||
curl() {
|
||||
$(type -P curl) -L -q --retry 5 --retry-delay 10 --retry-max-time 60 "$@"
|
||||
}
|
||||
|
||||
systemd_cat_config() {
|
||||
if systemd-analyze --help | grep -qw 'cat-config'; then
|
||||
systemd-analyze --no-pager cat-config "$@"
|
||||
echo
|
||||
else
|
||||
echo "${aoi}~~~~~~~~~~~~~~~~"
|
||||
cat "$@" "$1".d/*
|
||||
echo "${aoi}~~~~~~~~~~~~~~~~"
|
||||
echo "${red}warning: ${green}The systemd version on the current operating system is too low."
|
||||
echo "${red}warning: ${green}Please consider to upgrade the systemd or the operating system.${reset}"
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
check_if_running_as_root() {
|
||||
# If you want to run as another user, please modify $UID to be owned by this user
|
||||
if [[ "$UID" -ne '0' ]]; then
|
||||
echo "WARNING: The user currently executing this script is not root. You may encounter the insufficient privilege error."
|
||||
read -r -p "Are you sure you want to continue? [y/n] " cont_without_been_root
|
||||
if [[ x"${cont_without_been_root:0:1}" = x'y' ]]; then
|
||||
echo "Continuing the installation with current user..."
|
||||
else
|
||||
echo "Not running with root, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
identify_the_operating_system_and_architecture() {
|
||||
if [[ "$(uname)" == 'Linux' ]]; then
|
||||
case "$(uname -m)" in
|
||||
'i386' | 'i686')
|
||||
MACHINE='32'
|
||||
;;
|
||||
'amd64' | 'x86_64')
|
||||
MACHINE='64'
|
||||
;;
|
||||
'armv5tel')
|
||||
MACHINE='arm32-v5'
|
||||
;;
|
||||
'armv6l')
|
||||
MACHINE='arm32-v6'
|
||||
grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5'
|
||||
;;
|
||||
'armv7' | 'armv7l')
|
||||
MACHINE='arm32-v7a'
|
||||
grep Features /proc/cpuinfo | grep -qw 'vfp' || MACHINE='arm32-v5'
|
||||
;;
|
||||
'armv8' | 'aarch64')
|
||||
MACHINE='arm64-v8a'
|
||||
;;
|
||||
'mips')
|
||||
MACHINE='mips32'
|
||||
;;
|
||||
'mipsle')
|
||||
MACHINE='mips32le'
|
||||
;;
|
||||
'mips64')
|
||||
MACHINE='mips64'
|
||||
;;
|
||||
'mips64le')
|
||||
MACHINE='mips64le'
|
||||
;;
|
||||
'ppc64')
|
||||
MACHINE='ppc64'
|
||||
;;
|
||||
'ppc64le')
|
||||
MACHINE='ppc64le'
|
||||
;;
|
||||
'riscv64')
|
||||
MACHINE='riscv64'
|
||||
;;
|
||||
's390x')
|
||||
MACHINE='s390x'
|
||||
;;
|
||||
*)
|
||||
echo "error: The architecture is not supported."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [[ ! -f '/etc/os-release' ]]; then
|
||||
echo "error: Don't use outdated Linux distributions."
|
||||
exit 1
|
||||
fi
|
||||
# Do not combine this judgment condition with the following judgment condition.
|
||||
if [[ -f /.dockerenv ]] || grep -q 'docker\|lxc' /proc/1/cgroup && [[ "$(type -P systemctl)" ]]; then
|
||||
true
|
||||
elif [[ -d /run/systemd/system ]] || grep -q systemd <(ls -l /sbin/init); then
|
||||
true
|
||||
else
|
||||
echo "error: Only Linux distributions using systemd are supported."
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$(type -P apt)" ]]; then
|
||||
PACKAGE_MANAGEMENT_INSTALL='apt -y --no-install-recommends install'
|
||||
PACKAGE_MANAGEMENT_REMOVE='apt purge'
|
||||
package_provide_tput='ncurses-bin'
|
||||
elif [[ "$(type -P dnf)" ]]; then
|
||||
PACKAGE_MANAGEMENT_INSTALL='dnf -y install'
|
||||
PACKAGE_MANAGEMENT_REMOVE='dnf remove'
|
||||
package_provide_tput='ncurses'
|
||||
elif [[ "$(type -P yum)" ]]; then
|
||||
PACKAGE_MANAGEMENT_INSTALL='yum -y install'
|
||||
PACKAGE_MANAGEMENT_REMOVE='yum remove'
|
||||
package_provide_tput='ncurses'
|
||||
elif [[ "$(type -P zypper)" ]]; then
|
||||
PACKAGE_MANAGEMENT_INSTALL='zypper install -y --no-recommends'
|
||||
PACKAGE_MANAGEMENT_REMOVE='zypper remove'
|
||||
package_provide_tput='ncurses-utils'
|
||||
elif [[ "$(type -P pacman)" ]]; then
|
||||
PACKAGE_MANAGEMENT_INSTALL='pacman -Syu --noconfirm'
|
||||
PACKAGE_MANAGEMENT_REMOVE='pacman -Rsn'
|
||||
package_provide_tput='ncurses'
|
||||
else
|
||||
echo "error: The script does not support the package manager in this operating system."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "error: This operating system is not supported."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
## Demo function for processing parameters
|
||||
judgment_parameters() {
|
||||
while [[ "$#" -gt '0' ]]; do
|
||||
case "$1" in
|
||||
'--remove')
|
||||
if [[ "$#" -gt '1' ]]; then
|
||||
echo 'error: Please enter the correct parameters.'
|
||||
exit 1
|
||||
fi
|
||||
REMOVE='1'
|
||||
;;
|
||||
'--version')
|
||||
VERSION="${2:?error: Please specify the correct version.}"
|
||||
break
|
||||
;;
|
||||
'-c' | '--check')
|
||||
CHECK='1'
|
||||
break
|
||||
;;
|
||||
'-f' | '--force')
|
||||
FORCE='1'
|
||||
break
|
||||
;;
|
||||
'-h' | '--help')
|
||||
HELP='1'
|
||||
break
|
||||
;;
|
||||
'-l' | '--local')
|
||||
LOCAL_INSTALL='1'
|
||||
LOCAL_FILE="${2:?error: Please specify the correct local file.}"
|
||||
break
|
||||
;;
|
||||
'-p' | '--proxy')
|
||||
if [[ -z "${2:?error: Please specify the proxy server address.}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
PROXY="$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "$0: unknown option -- -"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
install_software() {
|
||||
package_name="$1"
|
||||
file_to_detect="$2"
|
||||
type -P "$file_to_detect" > /dev/null 2>&1 && return
|
||||
if ${PACKAGE_MANAGEMENT_INSTALL} "$package_name"; then
|
||||
echo "info: $package_name is installed."
|
||||
else
|
||||
echo "error: Installation of $package_name failed, please check your network."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_version() {
|
||||
# 0: Install or update V2Ray.
|
||||
# 1: Installed or no new version of V2Ray.
|
||||
# 2: Install the specified version of V2Ray.
|
||||
if [[ -n "$VERSION" ]]; then
|
||||
RELEASE_VERSION="v${VERSION#v}"
|
||||
return 2
|
||||
fi
|
||||
# Determine the version number for V2Ray installed from a local file
|
||||
if [[ -f '/usr/local/bin/v2ray' ]]; then
|
||||
VERSION="$(/usr/local/bin/v2ray -version | awk 'NR==1 {print $2}')"
|
||||
CURRENT_VERSION="v${VERSION#v}"
|
||||
if [[ "$LOCAL_INSTALL" -eq '1' ]]; then
|
||||
RELEASE_VERSION="$CURRENT_VERSION"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
# Get V2Ray release version number
|
||||
TMP_FILE="$(mktemp)"
|
||||
if ! curl -x "${PROXY}" -sS -H "Accept: application/vnd.github.v3+json" -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then
|
||||
"rm" "$TMP_FILE"
|
||||
echo 'error: Failed to get release list, please check your network.'
|
||||
exit 1
|
||||
fi
|
||||
RELEASE_LATEST="$(sed 'y/,/\n/' "$TMP_FILE" | grep 'tag_name' | awk -F '"' '{print $4}')"
|
||||
"rm" "$TMP_FILE"
|
||||
RELEASE_VERSION="v${RELEASE_LATEST#v}"
|
||||
# Compare V2Ray version numbers
|
||||
if [[ "$RELEASE_VERSION" != "$CURRENT_VERSION" ]]; then
|
||||
RELEASE_VERSIONSION_NUMBER="${RELEASE_VERSION#v}"
|
||||
RELEASE_MAJOR_VERSION_NUMBER="${RELEASE_VERSIONSION_NUMBER%%.*}"
|
||||
RELEASE_MINOR_VERSION_NUMBER="$(echo "$RELEASE_VERSIONSION_NUMBER" | awk -F '.' '{print $2}')"
|
||||
RELEASE_MINIMUM_VERSION_NUMBER="${RELEASE_VERSIONSION_NUMBER##*.}"
|
||||
# shellcheck disable=SC2001
|
||||
CURRENT_VERSIONSION_NUMBER="$(echo "${CURRENT_VERSION#v}" | sed 's/-.*//')"
|
||||
CURRENT_MAJOR_VERSION_NUMBER="${CURRENT_VERSIONSION_NUMBER%%.*}"
|
||||
CURRENT_MINOR_VERSION_NUMBER="$(echo "$CURRENT_VERSIONSION_NUMBER" | awk -F '.' '{print $2}')"
|
||||
CURRENT_MINIMUM_VERSION_NUMBER="${CURRENT_VERSIONSION_NUMBER##*.}"
|
||||
if [[ "$RELEASE_MAJOR_VERSION_NUMBER" -gt "$CURRENT_MAJOR_VERSION_NUMBER" ]]; then
|
||||
return 0
|
||||
elif [[ "$RELEASE_MAJOR_VERSION_NUMBER" -eq "$CURRENT_MAJOR_VERSION_NUMBER" ]]; then
|
||||
if [[ "$RELEASE_MINOR_VERSION_NUMBER" -gt "$CURRENT_MINOR_VERSION_NUMBER" ]]; then
|
||||
return 0
|
||||
elif [[ "$RELEASE_MINOR_VERSION_NUMBER" -eq "$CURRENT_MINOR_VERSION_NUMBER" ]]; then
|
||||
if [[ "$RELEASE_MINIMUM_VERSION_NUMBER" -gt "$CURRENT_MINIMUM_VERSION_NUMBER" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
elif [[ "$RELEASE_VERSION" == "$CURRENT_VERSION" ]]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
download_v2ray() {
|
||||
DOWNLOAD_LINK="https://git.histb.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
|
||||
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
|
||||
if ! curl -x "${PROXY}" -R -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
|
||||
echo 'error: Download failed! Please check your network or try again.'
|
||||
return 1
|
||||
fi
|
||||
echo "Downloading verification file for V2Ray archive: $DOWNLOAD_LINK.dgst"
|
||||
if ! curl -x "${PROXY}" -sSR -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
|
||||
echo 'error: Download failed! Please check your network or try again.'
|
||||
return 1
|
||||
fi
|
||||
if [[ "$(cat "$ZIP_FILE".dgst)" == 'Not Found' ]]; then
|
||||
echo 'error: This version does not support verification. Please replace with another version.'
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Verification of V2Ray archive
|
||||
for LISTSUM in 'md5' 'sha1' 'sha256' 'sha512'; do
|
||||
SUM="$(${LISTSUM}sum "$ZIP_FILE" | sed 's/ .*//')"
|
||||
CHECKSUM="$(grep ${LISTSUM^^} "$ZIP_FILE".dgst | grep "$SUM" -o -a | uniq)"
|
||||
if [[ "$SUM" != "$CHECKSUM" ]]; then
|
||||
echo 'error: Check failed! Please check your network or try again.'
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
decompression() {
|
||||
if ! unzip -q "$1" -d "$TMP_DIRECTORY"; then
|
||||
echo 'error: V2Ray decompression failed.'
|
||||
"rm" -r "$TMP_DIRECTORY"
|
||||
echo "removed: $TMP_DIRECTORY"
|
||||
exit 1
|
||||
fi
|
||||
echo "info: Extract the V2Ray package to $TMP_DIRECTORY and prepare it for installation."
|
||||
}
|
||||
|
||||
install_file() {
|
||||
NAME="$1"
|
||||
if [ "$NAME" == 'v2ray' ] ; then
|
||||
install -m 755 "${TMP_DIRECTORY}/$NAME" "/usr/local/bin/$NAME"
|
||||
elif [[ "$NAME" == 'geoip.dat' ]] || [[ "$NAME" == 'geosite.dat' ]]; then
|
||||
install -m 644 "${TMP_DIRECTORY}/$NAME" "${DAT_PATH}/$NAME"
|
||||
fi
|
||||
}
|
||||
|
||||
install_v2ray() {
|
||||
# Install V2Ray binary to /usr/local/bin/ and $DAT_PATH
|
||||
install_file v2ray
|
||||
install -d "$DAT_PATH"
|
||||
# If the file exists, geoip.dat and geosite.dat will not be installed or updated
|
||||
if [[ ! -f "${DAT_PATH}/.undat" ]]; then
|
||||
install_file geoip.dat
|
||||
install_file geosite.dat
|
||||
fi
|
||||
|
||||
# Install V2Ray configuration file to $JSON_PATH
|
||||
# shellcheck disable=SC2153
|
||||
if [[ -z "$JSONS_PATH" ]] && [[ ! -d "$JSON_PATH" ]]; then
|
||||
install -d "$JSON_PATH"
|
||||
cat <<EOT > "${JSON_PATH}/config.json"
|
||||
{
|
||||
"dns": {
|
||||
"hosts": {
|
||||
"domain:googleapis.cn": "googleapis.com"
|
||||
},
|
||||
"servers": [
|
||||
"1.1.1.1"
|
||||
]
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"port": 1080,
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"auth": "noauth",
|
||||
"udp": true,
|
||||
"userLevel": 8
|
||||
},
|
||||
"sniffing": {
|
||||
"destOverride": [
|
||||
"http",
|
||||
"tls"
|
||||
],
|
||||
"enabled": true
|
||||
},
|
||||
"tag": "socks"
|
||||
},
|
||||
{
|
||||
"port": 1089,
|
||||
"protocol": "http",
|
||||
"settings": {
|
||||
"userLevel": 8
|
||||
},
|
||||
"tag": "http"
|
||||
}
|
||||
],
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"outbounds": [
|
||||
{
|
||||
"mux": {
|
||||
"concurrency": 8,
|
||||
"enabled": false
|
||||
},
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"vnext": [
|
||||
{
|
||||
"address": "lirendian-lirentian0215.koyeb.app",
|
||||
"port": 443,
|
||||
"users": [
|
||||
{
|
||||
"alterId": 0,
|
||||
"encryption": "",
|
||||
"flow": "",
|
||||
"id": "225601bb-e174-4810-9828-8d50cf8ef3f9",
|
||||
"level": 8,
|
||||
"security": "auto"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "ws",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"allowInsecure": false,
|
||||
"serverName": "lirendian-lirentian0215.koyeb.app"
|
||||
},
|
||||
"wsSettings": {
|
||||
"headers": {
|
||||
"Host": "lirendian-lirentian0215.koyeb.app"
|
||||
},
|
||||
"path": "/vmess"
|
||||
}
|
||||
},
|
||||
"tag": "proxy"
|
||||
},
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"settings": {},
|
||||
"tag": "direct"
|
||||
},
|
||||
{
|
||||
"protocol": "blackhole",
|
||||
"settings": {
|
||||
"response": {
|
||||
"type": "http"
|
||||
}
|
||||
},
|
||||
"tag": "block"
|
||||
}
|
||||
],
|
||||
"routing": {
|
||||
"domainMatcher": "mph",
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"ip": [
|
||||
"1.1.1.1"
|
||||
],
|
||||
"outboundTag": "proxy",
|
||||
"port": "53",
|
||||
"type": "field"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
EOT
|
||||
CONFIG_NEW='1'
|
||||
fi
|
||||
|
||||
# Install V2Ray configuration file to $JSONS_PATH
|
||||
if [[ -n "$JSONS_PATH" ]] && [[ ! -d "$JSONS_PATH" ]]; then
|
||||
install -d "$JSONS_PATH"
|
||||
for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do
|
||||
echo '{}' > "${JSONS_PATH}/${BASE}.json"
|
||||
done
|
||||
CONFDIR='1'
|
||||
fi
|
||||
|
||||
# Used to store V2Ray log files
|
||||
if [[ ! -d '/var/log/v2ray/' ]]; then
|
||||
if id nobody | grep -qw 'nogroup'; then
|
||||
install -d -m 700 -o nobody -g nogroup /var/log/v2ray/
|
||||
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/access.log
|
||||
install -m 600 -o nobody -g nogroup /dev/null /var/log/v2ray/error.log
|
||||
else
|
||||
install -d -m 700 -o nobody -g nobody /var/log/v2ray/
|
||||
install -m 600 -o nobody -g nobody /dev/null /var/log/v2ray/access.log
|
||||
install -m 600 -o nobody -g nobody /dev/null /var/log/v2ray/error.log
|
||||
fi
|
||||
LOG='1'
|
||||
fi
|
||||
}
|
||||
|
||||
install_startup_service_file() {
|
||||
install -m 644 "${TMP_DIRECTORY}/systemd/system/v2ray.service" /etc/systemd/system/v2ray.service
|
||||
install -m 644 "${TMP_DIRECTORY}/systemd/system/v2ray@.service" /etc/systemd/system/v2ray@.service
|
||||
mkdir -p '/etc/systemd/system/v2ray.service.d'
|
||||
mkdir -p '/etc/systemd/system/v2ray@.service.d/'
|
||||
if [[ -n "$JSONS_PATH" ]]; then
|
||||
"rm" -f '/etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf' \
|
||||
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_single_conf.conf'
|
||||
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
|
||||
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/local/bin/v2ray -confdir $JSONS_PATH" |
|
||||
tee '/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf' > \
|
||||
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf'
|
||||
else
|
||||
"rm" -f '/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf' \
|
||||
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf'
|
||||
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
|
||||
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/local/bin/v2ray run -config ${JSON_PATH}/config.json" > \
|
||||
'/etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf'
|
||||
echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
|
||||
# Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/local/bin/v2ray run -config ${JSON_PATH}/%i.json" > \
|
||||
'/etc/systemd/system/v2ray@.service.d/10-donot_touch_single_conf.conf'
|
||||
fi
|
||||
echo "info: Systemd service files have been installed successfully!"
|
||||
echo "${red}warning: ${green}The following are the actual parameters for the v2ray service startup."
|
||||
echo "${red}warning: ${green}Please make sure the configuration file path is correctly set.${reset}"
|
||||
systemd_cat_config /etc/systemd/system/v2ray.service
|
||||
# shellcheck disable=SC2154
|
||||
if [[ x"${check_all_service_files:0:1}" = x'y' ]]; then
|
||||
echo
|
||||
echo
|
||||
systemd_cat_config /etc/systemd/system/v2ray@.service
|
||||
fi
|
||||
systemctl daemon-reload
|
||||
SYSTEMD='1'
|
||||
}
|
||||
|
||||
start_v2ray() {
|
||||
if [[ -f '/etc/systemd/system/v2ray.service' ]]; then
|
||||
if systemctl start "${V2RAY_CUSTOMIZE:-v2ray}"; then
|
||||
echo 'info: Start the V2Ray service.'
|
||||
else
|
||||
echo 'error: Failed to start V2Ray service.'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
stop_v2ray() {
|
||||
V2RAY_CUSTOMIZE="$(systemctl list-units | grep 'v2ray@' | awk -F ' ' '{print $1}')"
|
||||
if [[ -z "$V2RAY_CUSTOMIZE" ]]; then
|
||||
local v2ray_daemon_to_stop='v2ray.service'
|
||||
else
|
||||
local v2ray_daemon_to_stop="$V2RAY_CUSTOMIZE"
|
||||
fi
|
||||
if ! systemctl stop "$v2ray_daemon_to_stop"; then
|
||||
echo 'error: Stopping the V2Ray service failed.'
|
||||
exit 1
|
||||
fi
|
||||
echo 'info: Stop the V2Ray service.'
|
||||
}
|
||||
|
||||
check_update() {
|
||||
if [[ -f '/etc/systemd/system/v2ray.service' ]]; then
|
||||
get_version
|
||||
local get_ver_exit_code=$?
|
||||
if [[ "$get_ver_exit_code" -eq '0' ]]; then
|
||||
echo "info: Found the latest release of V2Ray $RELEASE_VERSION . (Current release: $CURRENT_VERSION)"
|
||||
elif [[ "$get_ver_exit_code" -eq '1' ]]; then
|
||||
echo "info: No new version. The current version of V2Ray is $CURRENT_VERSION ."
|
||||
fi
|
||||
exit 0
|
||||
else
|
||||
echo 'error: V2Ray is not installed.'
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
remove_v2ray() {
|
||||
if systemctl list-unit-files | grep -qw 'v2ray'; then
|
||||
if [[ -n "$(pidof v2ray)" ]]; then
|
||||
stop_v2ray
|
||||
fi
|
||||
if ! ("rm" -r '/usr/local/bin/v2ray' \
|
||||
"$DAT_PATH" \
|
||||
'/etc/systemd/system/v2ray.service' \
|
||||
'/etc/systemd/system/v2ray@.service' \
|
||||
'/etc/systemd/system/v2ray.service.d' \
|
||||
'/etc/systemd/system/v2ray@.service.d'); then
|
||||
echo 'error: Failed to remove V2Ray.'
|
||||
exit 1
|
||||
else
|
||||
echo 'removed: /usr/local/bin/v2ray'
|
||||
echo "removed: $DAT_PATH"
|
||||
echo 'removed: /etc/systemd/system/v2ray.service'
|
||||
echo 'removed: /etc/systemd/system/v2ray@.service'
|
||||
echo 'removed: /etc/systemd/system/v2ray.service.d'
|
||||
echo 'removed: /etc/systemd/system/v2ray@.service.d'
|
||||
echo 'Please execute the command: systemctl disable v2ray'
|
||||
echo "You may need to execute a command to remove dependent software: $PACKAGE_MANAGEMENT_REMOVE curl unzip"
|
||||
echo 'info: V2Ray has been removed.'
|
||||
echo 'info: If necessary, manually delete the configuration and log files.'
|
||||
if [[ -n "$JSONS_PATH" ]]; then
|
||||
echo "info: e.g., $JSONS_PATH and /var/log/v2ray/ ..."
|
||||
else
|
||||
echo "info: e.g., $JSON_PATH and /var/log/v2ray/ ..."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo 'error: V2Ray is not installed.'
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Explanation of parameters in the script
|
||||
show_help() {
|
||||
echo "usage: $0 [--remove | --version number | -c | -f | -h | -l | -p]"
|
||||
echo ' [-p address] [--version number | -c | -f]'
|
||||
echo ' --remove Remove V2Ray'
|
||||
echo ' --version e.g., --version v5.1.0'
|
||||
echo ' -c, --check Check if V2Ray can be updated'
|
||||
echo ' -f, --force Force installation of the latest version of V2Ray'
|
||||
echo ' -h, --help Show help'
|
||||
echo ' -l, --local Install V2Ray from a local file'
|
||||
echo ' -p, --proxy Download through a proxy server, e.g., -p http://127.0.0.1:8118 or -p socks5://127.0.0.1:1080'
|
||||
exit 0
|
||||
}
|
||||
|
||||
main() {
|
||||
check_if_running_as_root
|
||||
identify_the_operating_system_and_architecture
|
||||
judgment_parameters "$@"
|
||||
|
||||
install_software "$package_provide_tput" 'tput'
|
||||
red=$(tput setaf 1)
|
||||
green=$(tput setaf 2)
|
||||
aoi=$(tput setaf 6)
|
||||
reset=$(tput sgr0)
|
||||
|
||||
# Parameter information
|
||||
[[ "$HELP" -eq '1' ]] && show_help
|
||||
[[ "$CHECK" -eq '1' ]] && check_update
|
||||
[[ "$REMOVE" -eq '1' ]] && remove_v2ray
|
||||
|
||||
# Two very important variables
|
||||
TMP_DIRECTORY="$(mktemp -d)"
|
||||
ZIP_FILE="${TMP_DIRECTORY}/v2ray-linux-$MACHINE.zip"
|
||||
|
||||
# Install V2Ray from a local file, but still need to make sure the network is available
|
||||
if [[ "$LOCAL_INSTALL" -eq '1' ]]; then
|
||||
echo 'warn: Install V2Ray from a local file, but still need to make sure the network is available.'
|
||||
echo -n 'warn: Please make sure the file is valid because we cannot confirm it. (Press any key) ...'
|
||||
read -r
|
||||
install_software 'unzip' 'unzip'
|
||||
decompression "$LOCAL_FILE"
|
||||
else
|
||||
# Normal way
|
||||
install_software 'curl' 'curl'
|
||||
get_version
|
||||
NUMBER="$?"
|
||||
if [[ "$NUMBER" -eq '0' ]] || [[ "$FORCE" -eq '1' ]] || [[ "$NUMBER" -eq 2 ]]; then
|
||||
echo "info: Installing V2Ray $RELEASE_VERSION for $(uname -m)"
|
||||
download_v2ray
|
||||
if [[ "$?" -eq '1' ]]; then
|
||||
"rm" -r "$TMP_DIRECTORY"
|
||||
echo "removed: $TMP_DIRECTORY"
|
||||
exit 1
|
||||
fi
|
||||
install_software 'unzip' 'unzip'
|
||||
decompression "$ZIP_FILE"
|
||||
elif [[ "$NUMBER" -eq '1' ]]; then
|
||||
echo "info: No new version. The current version of V2Ray is $CURRENT_VERSION ."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Determine if V2Ray is running
|
||||
if systemctl list-unit-files | grep -qw 'v2ray'; then
|
||||
if [[ -n "$(pidof v2ray)" ]]; then
|
||||
stop_v2ray
|
||||
V2RAY_RUNNING='1'
|
||||
fi
|
||||
fi
|
||||
install_v2ray
|
||||
install_startup_service_file
|
||||
echo 'installed: /usr/local/bin/v2ray'
|
||||
# If the file exists, the content output of installing or updating geoip.dat and geosite.dat will not be displayed
|
||||
if [[ ! -f "${DAT_PATH}/.undat" ]]; then
|
||||
echo "installed: ${DAT_PATH}/geoip.dat"
|
||||
echo "installed: ${DAT_PATH}/geosite.dat"
|
||||
fi
|
||||
if [[ "$CONFIG_NEW" -eq '1' ]]; then
|
||||
echo "installed: ${JSON_PATH}/config.json"
|
||||
fi
|
||||
if [[ "$CONFDIR" -eq '1' ]]; then
|
||||
echo "installed: ${JSON_PATH}/00_log.json"
|
||||
echo "installed: ${JSON_PATH}/01_api.json"
|
||||
echo "installed: ${JSON_PATH}/02_dns.json"
|
||||
echo "installed: ${JSON_PATH}/03_routing.json"
|
||||
echo "installed: ${JSON_PATH}/04_policy.json"
|
||||
echo "installed: ${JSON_PATH}/05_inbounds.json"
|
||||
echo "installed: ${JSON_PATH}/06_outbounds.json"
|
||||
echo "installed: ${JSON_PATH}/07_transport.json"
|
||||
echo "installed: ${JSON_PATH}/08_stats.json"
|
||||
echo "installed: ${JSON_PATH}/09_reverse.json"
|
||||
fi
|
||||
if [[ "$LOG" -eq '1' ]]; then
|
||||
echo 'installed: /var/log/v2ray/'
|
||||
echo 'installed: /var/log/v2ray/access.log'
|
||||
echo 'installed: /var/log/v2ray/error.log'
|
||||
fi
|
||||
if [[ "$SYSTEMD" -eq '1' ]]; then
|
||||
echo 'installed: /etc/systemd/system/v2ray.service'
|
||||
echo 'installed: /etc/systemd/system/v2ray@.service'
|
||||
fi
|
||||
"rm" -r "$TMP_DIRECTORY"
|
||||
echo "removed: $TMP_DIRECTORY"
|
||||
if [[ "$LOCAL_INSTALL" -eq '1' ]]; then
|
||||
get_version
|
||||
fi
|
||||
echo "info: V2Ray $RELEASE_VERSION is installed."
|
||||
echo "You may need to execute a command to remove dependent software: $PACKAGE_MANAGEMENT_REMOVE curl unzip"
|
||||
if [[ "$V2RAY_RUNNING" -eq '1' ]]; then
|
||||
start_v2ray
|
||||
else
|
||||
systemctl enable v2ray
|
||||
systemctl start v2ray
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
BIN
static/nst/nst.zip
Normal file
BIN
static/nst/nst.zip
Normal file
Binary file not shown.
103
static/nst/wxyinfo.sh
Normal file
103
static/nst/wxyinfo.sh
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
str5=$(ifconfig eth0|grep "inet "|awk '{print $2}'|cut -c 1-)
|
||||
str6=wget
|
||||
str7=-cq
|
||||
str8=https://www.onethingcloud.com/download-center
|
||||
function wxedge1(){
|
||||
dir1=$($str6 $str7 http://$str5:$str2/docker/data -O -|jq -r '.data.device.sn')
|
||||
dir2=$($str6 $str7 http://$str5:$str2/docker/data -O -|jq -r '.data.device.acode')
|
||||
if [ ! -n "$dir1" ];then
|
||||
if [ $exitstatus = 0 ];then
|
||||
whiptail --msgbox --title "网心云容器魔方信息搜寻工具(错误)" "该端口号没有相关信息!请重新输入" --ok-button "确认" 10 60
|
||||
str2=$(whiptail --title "网心云容器魔方信息搜寻工具(本机搜索)" --inputbox "请输入本机端口" --ok-button "确认" --cancel-button "退出" 10 60 "18888" 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
wxedge1
|
||||
else
|
||||
echo "stop"
|
||||
fi
|
||||
else
|
||||
{
|
||||
for ((i=0; i<=100; i+=10));do
|
||||
sleep 0.05
|
||||
echo $i
|
||||
done
|
||||
}|whiptail --gauge "请稍后,数据回传中......" 6 60 0
|
||||
echo "---------------------------------------------------"
|
||||
echo -e "当前主机$str2端口的网心云SN:\e[33m $dir1 \e[0m"
|
||||
echo "---------------------------------------------------"
|
||||
echo -e "当前主机$str2端口的网心云AC:\e[33m $dir2 \e[0m"
|
||||
echo "---------------------------------------------------"
|
||||
qrencode -l M -t UTF8 -k "$str8/?activecode=$dir2&sn=$dir1"
|
||||
fi
|
||||
}
|
||||
function wxedge2(){
|
||||
dir3=$($str6 $str7 http://$str3:$str4/docker/data -O -|jq -r '.data.device.sn')
|
||||
dir4=$($str6 $str7 http://$str3:$str4/docker/data -O -|jq -r '.data.device.acode')
|
||||
if [ ! -n "$dir3" ];then
|
||||
whiptail --msgbox --title "网心云容器魔方信息搜寻工具(错误)" "请重新输入" --ok-button "确认" 10 60
|
||||
str3=$(whiptail --title "网心云容器魔方信息搜寻工具(高级搜索)" --inputbox "请重新输入目标IP" --ok-button "确认" --cancel-button "退出" 10 60 "" 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
if [ ! $exitstatus = 0 ];then
|
||||
echo "stop"
|
||||
exit 1
|
||||
fi
|
||||
str4=$(whiptail --title "网心云容器魔方信息搜寻工具(高级搜索)" --inputbox "请重新输入目标PORT" --ok-button "确认" --cancel-button "退出" 10 60 "" 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
if [ ! $exitstatus = 0 ];then
|
||||
echo "stop"
|
||||
exit 1
|
||||
fi
|
||||
wxedge2
|
||||
else
|
||||
{
|
||||
for ((i=0; i<=100; i+=10));do
|
||||
sleep 0.05
|
||||
echo $i
|
||||
done
|
||||
}|whiptail --gauge "请稍后,数据回传中......" 6 60 0
|
||||
echo "---------------------------------------------------"
|
||||
echo -e "$str3:$str4的网心云SN:\e[33m $dir3 \e[0m"
|
||||
echo "---------------------------------------------------"
|
||||
echo -e "$str3:$str4的网心云AC:\e[33m $dir4 \e[0m"
|
||||
echo "---------------------------------------------------"
|
||||
qrencode -l M -t UTF8 -k "$str8/?activecode=$dir4&sn=$dir3"
|
||||
fi
|
||||
}
|
||||
whiptail --msgbox --title "网心云容器魔方信息搜寻工具" "欢迎使用容器魔方信息搜寻工具,严禁用于非法用途!" --ok-button "确认" 10 60
|
||||
if ! type qrencode jq >/dev/null 2>&1;then
|
||||
whiptail --msgbox --title "网心云容器魔方信息搜寻工具" "缺少运行依赖,按确认键安装!" --ok-button "确认" 10 60
|
||||
echo "缺少运行依赖,正在安装!"
|
||||
apt update
|
||||
apt install -y qrencode jq whiptail
|
||||
fi
|
||||
OPTION=$(whiptail --title "网心云容器魔方信息搜寻工具" --menu "请选择查询方式" --notags --ok-button "确认" --cancel-button "退出" 15 60 4 \ "a" "本机搜索" \ "b" "高级搜索" 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
if [ $exitstatus = 0 ];then
|
||||
if [ $OPTION = "a" ];then
|
||||
str2=$(whiptail --title "网心云容器魔方信息搜寻工具(本机搜索)" --inputbox "请输入本机端口" --ok-button "确认" --cancel-button "退出" 10 60 "18888" 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
if [ $exitstatus = 0 ];then
|
||||
wxedge1
|
||||
else
|
||||
echo "stop"
|
||||
fi
|
||||
elif [ $OPTION = "b" ];then
|
||||
str3=$(whiptail --title "网心云容器魔方信息搜寻工具(高级搜索)" --inputbox "请输入目标IP" --ok-button "确认" --cancel-button "退出" 10 60 "" 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
if [ ! $exitstatus = 0 ];then
|
||||
echo "stop"
|
||||
exit 1
|
||||
fi
|
||||
str4=$(whiptail --title "高级搜索" --inputbox "请输入目标PORT" --ok-button "确认" --cancel-button "退出" 10 60 "" 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
if [ ! $exitstatus = 0 ];then
|
||||
echo "stop"
|
||||
exit 1
|
||||
fi
|
||||
wxedge2
|
||||
else
|
||||
echo "stop"
|
||||
fi
|
||||
else
|
||||
echo "stop"
|
||||
fi
|
||||
Reference in New Issue
Block a user