├── LICENSE ├── README.md ├── am_restart_vmess.sh ├── install_serv00_vless_vmess_hysteria2.sh └── install_serv00_vmess.sh /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [am-serv00-vmess](https://github.com/amclubs/am-serv00-vmess) 2 | 这个项目的脚本安装管理并运行一个VMess节点,并可以通过Cloudflare的CDN设置域名回源进行加速,解锁ChatGPT、TikTok、其它流媒体、小网站等 3 | 4 | # 5 | ▶️ **新人[YouTube](https://youtube.com/@am_clubs?sub_confirmation=1)** 需要您的支持,请务必帮我**点赞**、**关注**、**打开小铃铛**,***十分感谢!!!*** ✅ 6 |
🎁请 **follow** 我的[GitHub](https://github.com/amclubs)、给我所有项目一个 **Star** 星星(拜托了)!你的支持是我不断前进的动力! 💖 7 |
✅**解锁更多技能** [加入TG群【am_clubs】](https://t.me/am_clubs)、[YouTube频道【@am_clubs】](https://youtube.com/@am_clubs?sub_confirmation=1)、[【博客(国内)】](https://amclubss.com)、[【博客(国际)】](https://amclubs.blogspot.com) 8 |
✅点击观看教程[CLoudflare免费节点](https://www.youtube.com/playlist?list=PLGVQi7TjHKXbrY0Pk8gm3T7m8MZ-InquF) | [VPS搭建节点](https://www.youtube.com/playlist?list=PLGVQi7TjHKXaVlrHP9Du61CaEThYCQaiY) | [获取免费域名](https://www.youtube.com/playlist?list=PLGVQi7TjHKXZGODTvB8DEervrmHANQ1AR) | [免费VPN](https://www.youtube.com/playlist?list=PLGVQi7TjHKXY7V2JF-ShRSVwGANlZULdk) | [IPTV源](https://www.youtube.com/playlist?list=PLGVQi7TjHKXbkozDYVsDRJhbnNaEOC76w) | [Mac和Win工具](https://www.youtube.com/playlist?list=PLGVQi7TjHKXYBWu65yP8E08HxAu9LbCWm) | [AI分享](https://www.youtube.com/playlist?list=PLGVQi7TjHKXaodkM-mS-2Nwggwc5wRjqY) 9 | 10 | # 免费serv00服务器一键脚本部署VMess 11 | 12 | - [视频教程](https://youtu.be/6UZXHfc3zEU) 13 | - [青龙保活教程](https://youtu.be/J4lcIwBowmM) 14 | - [GitHub Actions保活教程](https://youtu.be/zkGGklEaO2I) 15 | 16 | # 部署教程: 17 | 18 | ## 一、需要准备的前提资料 19 | ### 1、首先注册一个Serv00账号,建议使用gmail邮箱注册,注册好会有一封邮箱上面写着你注册时的用户名和密码 20 | - 注册帐号地址:https://serv00.com 21 |
注册帐号请查看下面视频
22 |
[点击观看视频教程]
23 | 24 | ![image](https://github.com/user-attachments/assets/57c3ff7b-ae42-42c0-87ac-acb1b5bd177a) 25 | 26 | ### 2、加下群发送关键字 ssh 获取连接工具 27 | Telegram频道:[@AM_CLUBS](https://t.me/AM_CLUBS) 28 | 29 | ## 二、安装前需准备的初始设置 30 | - 1、登入邮件里面发你的 DevilWEB webpanel 后面的网址,进入网站后点击 Change languag 把面板改成英文 31 | - 2、然后在左边栏点击 Additonal services ,接着点击 Run your own applications 看到一个 Enable 点击 32 | - 3、找到 Port reservation 点击后面的 Add Port 新开一个端口,随便写,也可以点击 Port后面的 Random随机选择Port tybe 选择 TCP 33 | - 4、然后点击 Port list 你会看到一个端口 34 | ![image](https://github.com/user-attachments/assets/1b11ebdb-49e6-427d-a074-f51d52235f7e) 35 | 36 | 37 | - 5、 启用管理权限: 38 | serv00 39 | 40 | ***完成此步骤后,退出 SSH 并再次登录。*** 41 | 42 | ## 三、开始安装部署 43 | 44 | - 1、用我们前面下载的工具登入SSH(有些工具 第一次连接还是会弹出输出密码记得点X 然后再添加密码 ) 45 | 使用 serv00 通过电子邮件发送给您的信息(下面username、panel要修改成你邮箱收到对应的信息)。 46 | ``` 47 | ssh @.serv00.com 48 | ``` 49 | 50 | - 2、vmess、Cloudflare隧道Argo+CDN回源节点 一键安装 (1个TCP端口) 51 | ``` 52 | bash <(curl -Ls https://raw.githubusercontent.com/amclubs/am-serv00-vmess/main/install_serv00_vmess.sh) 53 | ``` 54 | - 指定UUID安装( 要换成你要生成的UUID) [在线获取UUID](https://1024tools.com/uuid) 55 | ``` 56 | bash <(curl -Ls https://raw.githubusercontent.com/amclubs/am-serv00-vmess/main/install_serv00_vmess.sh ) 57 | ``` 58 | - 例如: 59 | ``` 60 | bash <(curl -Ls https://raw.githubusercontent.com/amclubs/am-serv00-vmess/main/install_serv00_vmess.sh df4abc6a-5a79-4104-93c9-250756008e9b) 61 | ``` 62 | 63 | - 3、vless(reality)、vmess、hysteria2三协议节点 、Cloudflare隧道Argo+CDN回源节点 一键安装 (2个TCP端口 1个UDP端口) 64 | ``` 65 | bash <(curl -Ls https://raw.githubusercontent.com/amclubs/am-serv00-vmess/main/install_serv00_vless_vmess_hysteria2.sh) 66 | ``` 67 | 68 | - 4、保活教程 69 | - [青龙保活教程](https://youtu.be/J4lcIwBowmM) 70 | - [GitHub Actions保活教程](https://youtu.be/zkGGklEaO2I) 71 | 72 | ## 四、测试节点 73 | - 1、把安装成功返回的节点信息复制到订阅工具里就可以使用 74 | 75 | - 2、如果不记得节点配置,可以通过下面信息查看 76 | ``` 77 | cat /home/${USER}/.vmess/list.txt 78 | ``` 79 | - 3、节点通过Cloudflare的CDN设置域名回源进行加速 80 | - CF端口类型 81 | 82 | HTTP:80,8080,8880,2052,2082,2086,2095 83 | 84 | HTTPS:443,2053,2083,2087,2096,8443 85 | 86 | - 4、请查看视频教程(Cloudflare的CDN设置域名回源进行加速) [视频教程](https://youtu.be/6UZXHfc3zEU) 87 | - 5、[免费域名注册教程](https://youtu.be/cI36vtXuQrM) 88 | 89 | ## 五、卸载VMess 90 | ### 一键卸载命令,根据提示,选择2(2. 卸载sing-box) 直接卸载完成 91 | ``` 92 | bash <(curl -Ls https://raw.githubusercontent.com/amclubs/am-serv00-vmess/main/install_serv00_vmess.sh) 93 | ``` 94 | 95 | 重启服务 96 | ``` 97 | bash <(curl -Ls https://raw.githubusercontent.com/amclubs/am-serv00-vmess/main/am_restart_vmess.sh) 98 | ``` 99 | 100 | # 101 |
102 |
[点击展开] 赞赏支持 ~🧧 103 | *我非常感谢您的赞赏和支持,它们将极大地激励我继续创新,持续产生有价值的工作。* 104 | 105 | - **USDT-TRC20:** `TWTxUyay6QJN3K4fs4kvJTT8Zfa2mWTwDD` 106 | - **TRX-TRC20:** `TWTxUyay6QJN3K4fs4kvJTT8Zfa2mWTwDD` 107 | 108 |
109 |
110 | TRC10/TRC20扫码支付 111 |
112 |
113 |
114 | 115 | # 116 | 免责声明: 117 | - 1、该项目设计和开发仅供学习、研究和安全测试目的。请于下载后 24 小时内删除, 不得用作任何商业用途, 文字、数据及图片均有所属版权, 如转载须注明来源。 118 | - 2、使用本程序必循遵守部署服务器所在地区的法律、所在国家和用户所在国家的法律法规。对任何人或团体使用该项目时产生的任何后果由使用者承担。 119 | - 3、作者不对使用该项目可能引起的任何直接或间接损害负责。作者保留随时更新免责声明的权利,且不另行通知。 120 | 121 | 122 | -------------------------------------------------------------------------------- /am_restart_vmess.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 检查进程是否在运行 4 | pgrep -x "web" > /dev/null 5 | 6 | # 如果没有运行,则启动 vmess 7 | if [ $? -ne 0 ]; then 8 | #nohup /home/${USER}/.vmess/web run -c /home/${USER}/.vmess/config.json >/dev/null 2>&1 & 9 | nohup /home/${USER}/.vmess/web run -c /home/${USER}/.vmess/config.json > /home/${USER}/.vmess/webtest.log 2>&1 & 10 | fi 11 | 12 | # 接收用户传入的参数(端口、字符串或json格式内容) 13 | INPUT_PARAM=$1 14 | 15 | # 检查进程是否在运行 16 | pgrep -x "bot" > /dev/null 17 | 18 | if [ $? -ne 0 ]; then 19 | case $INPUT_PARAM in 20 | # 如果是端口数字,启动第一个命令 21 | [0-9]*) 22 | #nohup /home/${USER}/.vmess/bot tunnel --edge-ip-version auto --no-autoupdate --protocol http2 --logfile /home/${USER}/.vmess/boot.log --loglevel info --url http://localhost:$INPUT_PARAM >/dev/null 2>&1 & 23 | nohup /home/${USER}/.vmess/bot tunnel --edge-ip-version auto --no-autoupdate --protocol http2 --logfile /home/${USER}/.vmess/boot.log --loglevel info --url http://localhost:$INPUT_PARAM > /home/${USER}/.vmess/bottest.log 2>&1 & 24 | ;; 25 | # 如果输入的参数是JSON格式,执行json固定隧道保活命令 26 | *) 27 | echo "$INPUT_PARAM" | jq empty >/dev/null 2>&1 28 | if [ $? -eq 0 ]; then 29 | # JSON格式的内容 30 | #nohup /home/${USER}/.vmess/bot tunnel --edge-ip-version auto --config tunnel.yml run >/dev/null 2>&1 & 31 | nohup /home/${USER}/.vmess/bot tunnel --edge-ip-version auto --config tunnel.yml run > /home/${USER}/.vmess/bottest.log 2>&1 & 32 | else 33 | # token固定隧道保活命令 34 | #nohup /home/${USER}/.vmess/bot tunnel --edge-ip-version auto --no-autoupdate --protocol http2 run --token "$INPUT_PARAM" >/dev/null 2>&1 & 35 | nohup /home/${USER}/.vmess/bot tunnel --edge-ip-version auto --no-autoupdate --protocol http2 run --token "$INPUT_PARAM" > /home/${USER}/.vmess/bottest.log 2>&1 & 36 | fi 37 | ;; 38 | esac 39 | fi 40 | -------------------------------------------------------------------------------- /install_serv00_vless_vmess_hysteria2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 定义颜色 4 | re="\033[0m" 5 | red="\033[1;91m" 6 | green="\e[1;32m" 7 | yellow="\e[1;33m" 8 | purple="\e[1;35m" 9 | red() { echo -e "\e[1;91m$1\033[0m"; } 10 | green() { echo -e "\e[1;32m$1\033[0m"; } 11 | yellow() { echo -e "\e[1;33m$1\033[0m"; } 12 | purple() { echo -e "\e[1;35m$1\033[0m"; } 13 | reading() { read -p "$(red "$1")" "$2"; } 14 | 15 | USERNAME=$(whoami) 16 | HOSTNAME=$(hostname) 17 | 18 | #export UUID=${UUID:-'d36c4d9f-31c4-45f1-8c64-102a6142001e'} 19 | UUID=${1:-'d36c4d9f-31c4-45f1-8c64-102a6142001e'} 20 | export UUID 21 | echo "Using UUID: $UUID" 22 | 23 | export NEZHA_SERVER=${NEZHA_SERVER:-''} 24 | export NEZHA_PORT=${NEZHA_PORT:-'5555'} 25 | export NEZHA_KEY=${NEZHA_KEY:-''} 26 | export ARGO_DOMAIN=${ARGO_DOMAIN:-''} 27 | export ARGO_AUTH=${ARGO_AUTH:-''} 28 | 29 | [[ "$HOSTNAME" == "s1.ct8.pl" ]] && WORKDIR="/home/${USERNAME}/.vmess" || WORKDIR="/home/${USERNAME}/.vmess" 30 | [ -d "$WORKDIR" ] || (mkdir -p "$WORKDIR" && chmod 777 "$WORKDIR") 31 | 32 | 33 | read_ip() { 34 | echo 35 | cat ip.txt 36 | reading "请输入上面可选IP中的任意一个 (回车默认选择): " IP 37 | if [[ -z "$IP" ]]; then 38 | IP=$(grep -m 1 "正常" ip.txt | awk -F ':' '{print $1}') 39 | if [ -z "$IP" ]; then 40 | IP=$(head -n 1 ip.txt | awk -F ':' '{print $1}') 41 | fi 42 | fi 43 | green "您选择的IP为: $IP" 44 | } 45 | 46 | read_ym() { 47 | echo 48 | echo "--------------------" 49 | yellow "1. Cloudflare 默认域名,支持 PROXYIP 变量功能 (推荐)" 50 | yellow "2. serv00 默认域名 (推荐)" 51 | yellow "回车默认选择1" 52 | echo "--------------------" 53 | 54 | reading "请输入reality域名或输入选择 (1-2): " ym 55 | 56 | if [[ -z "$ym" || "$ym" == "1" ]]; then 57 | ym="cdnjs.cloudflare.com" 58 | elif [[ "$ym" == "2" ]]; then 59 | ym="$USERNAME.serv00.net" 60 | elif [[ "$ym" != "1" && "$ym" != "2" && ! "$ym" =~ ^[a-zA-Z0-9.-]+$ ]]; then 61 | yellow "无效输入,使用默认 Cloudflare 域名" 62 | ym="cdnjs.cloudflare.com" 63 | fi 64 | 65 | green "您的 reality 域名为: $ym" 66 | } 67 | 68 | read_uuid() { 69 | echo 70 | reading "请输入UUID (回车默认生成): " UUID 71 | if [[ -z "$UUID" ]]; then 72 | UUID=$(uuidgen -r) 73 | fi 74 | green "您的UUID为: $UUID" 75 | } 76 | 77 | read_vless_port() { 78 | echo 79 | while true; do 80 | reading "请输入vless(reality)端口 (面板开放的tcp端口): " vless_port 81 | if [[ "$vless_port" =~ ^[0-9]+$ ]] && [ "$vless_port" -ge 1 ] && [ "$vless_port" -le 65535 ]; then 82 | green "你的vless(reality)端口为: $vless_port" 83 | break 84 | else 85 | yellow "输入错误,请重新输入面板开放的TCP端口" 86 | fi 87 | done 88 | } 89 | 90 | read_vmess_port() { 91 | echo 92 | while true; do 93 | reading "请输入vmess端口 (面板开放的tcp端口): " vmess_port 94 | if [[ "$vmess_port" =~ ^[0-9]+$ ]] && [ "$vmess_port" -ge 1 ] && [ "$vmess_port" -le 65535 ]; then 95 | green "你的vmess端口为: $vmess_port" 96 | break 97 | else 98 | yellow "输入错误,请重新输入面板开放的TCP端口" 99 | fi 100 | done 101 | } 102 | 103 | read_hysteria2_port() { 104 | echo 105 | while true; do 106 | reading "请输入hysteria2端口 (面板开放的udp端口): " hysteria2_port 107 | if [[ "$hysteria2_port" =~ ^[0-9]+$ ]] && [ "$hysteria2_port" -ge 1 ] && [ "$hysteria2_port" -le 65535 ]; then 108 | green "你的hysteria2端口为: $hysteria2_port" 109 | break 110 | else 111 | yellow "输入错误,请重新输入面板开放的UDP端口" 112 | fi 113 | done 114 | } 115 | 116 | install_singbox() { 117 | echo -e "${yellow}本脚本安装reality、vmess、hysteria2 三协议节点${re}" 118 | echo -e "${yellow}开始运行前,请确保在面板${purple}已开放 2个tcp端口 1个udp端口${re}" 119 | echo -e "${yellow}请登录面板查看${purple}Additional services中的Run your own applications${yellow}已开启为${purplw}Enabled${yellow}状态${re}" 120 | reading "\n确定继续安装吗?【y/n】: " choice 121 | case "$choice" in 122 | [Yy]) 123 | cd $WORKDIR 124 | read_ip 125 | read_ym 126 | read_uuid 127 | read_vless_port 128 | read_vmess_port 129 | read_hysteria2_port 130 | download_singbox && wait 131 | argo_configure 132 | generate_config 133 | run_sb && sleep 3 134 | get_links 135 | ;; 136 | [Nn]) exit 0 ;; 137 | *) red "无效的选择,请输入y或n" && menu ;; 138 | esac 139 | } 140 | 141 | uninstall_singbox() { 142 | reading "\n确定要卸载吗?【y/n】: " choice 143 | case "$choice" in 144 | [Yy]) 145 | kill -9 $(ps aux | grep '[w]eb' | awk '{print $2}') 146 | kill -9 $(ps aux | grep '[b]ot' | awk '{print $2}') 147 | # kill -9 $(ps aux | grep '[n]pm' | awk '{print $2}') 148 | rm -rf $WORKDIR 149 | ;; 150 | [Nn]) exit 0 ;; 151 | *) red "无效的选择,请输入y或n" && menu ;; 152 | esac 153 | } 154 | 155 | kill_all_tasks() { 156 | reading "\n清理所有进程将退出ssh连接,确定继续清理吗?【y/n】: " choice 157 | case "$choice" in 158 | [Yy]) killall -9 -u $(whoami) ;; 159 | *) menu ;; 160 | esac 161 | } 162 | 163 | get_ip_info() { 164 | sn=$(echo "$HOSTNAME" | cut -d '.' -f 1 | tr -d 's') 165 | mc=("$HOSTNAME" "cache$sn.serv00.com" "web$sn.serv00.com") 166 | rm -rf $WORKDIR/ip.txt 167 | 168 | for mc_item in "${mc[@]}"; do 169 | response=$(curl -s "https://pl.amclub.us.kg/api/data?hostname=$mc_item") 170 | 171 | if [[ -z "$response" || "$response" == *unknown* ]]; then 172 | # 如果API请求失败,尝试DNS解析 173 | for ip in "${mc[@]}"; do 174 | dig @8.8.8.8 +time=2 +short $ip >> $WORKDIR/ip.txt 175 | sleep 1 176 | done 177 | break 178 | else 179 | # 使用 jq 解析JSON数据并获取第一个IP 180 | ip=$(echo "$response" | jq -r '.[0].ip') 181 | status=$(echo "$response" | jq -r '.[0].status') 182 | 183 | if [[ "$status" == "Unblocked" ]]; then 184 | echo "$ip: 正常" >> $WORKDIR/ip.txt 185 | else 186 | echo "$ip: 已墙" >> $WORKDIR/ip.txt 187 | fi 188 | fi 189 | done 190 | } 191 | 192 | system_initialize() { 193 | reading "\nserv00系统初始化,清理所有进程并清空所有安装应用,将退出ssh连接,确定继续清理吗?【y/n】: " choice 194 | case "$choice" in 195 | [Yy]) 196 | killall -9 -u $(whoami) 197 | find ~ -type f -exec chmod 644 {} \; 2>/dev/null 198 | find ~ -type d -exec chmod 755 {} \; 2>/dev/null 199 | find ~ -type f -exec rm -f {} \; 2>/dev/null 200 | find ~ -type d -empty -exec rmdir {} \; 2>/dev/null 201 | find ~ -exec rm -rf {} \; 2>/dev/null 202 | ;; 203 | *) menu ;; 204 | esac 205 | } 206 | 207 | argo_configure() { 208 | if [[ -z $ARGO_AUTH || -z $ARGO_DOMAIN ]]; then 209 | echo 210 | reading "是否需要使用固定argo隧道?【y/n】: " argo_choice 211 | [[ -z $argo_choice ]] && return 212 | [[ "$argo_choice" != "y" && "$argo_choice" != "Y" && "$argo_choice" != "n" && "$argo_choice" != "N" ]] && { red "无效的选择,请输入y或n"; return; } 213 | if [[ "$argo_choice" == "y" || "$argo_choice" == "Y" ]]; then 214 | # 读取 ARGO_DOMAIN 变量 215 | while [[ -z $ARGO_DOMAIN ]]; do 216 | reading "请输入argo固定隧道域名: " ARGO_DOMAIN 217 | if [[ -z $ARGO_DOMAIN ]]; then 218 | red "ARGO固定隧道域名不能为空,请重新输入。" 219 | else 220 | green "你的argo固定隧道域名为: $ARGO_DOMAIN" 221 | fi 222 | done 223 | 224 | # 读取 ARGO_AUTH 变量 225 | while [[ -z $ARGO_AUTH ]]; do 226 | echo 227 | reading "请输入argo固定隧道密钥(Json或Token): " ARGO_AUTH 228 | if [[ -z $ARGO_AUTH ]]; then 229 | red "ARGO固定隧道密钥不能为空,请重新输入。" 230 | else 231 | green "你的argo固定隧道密钥为: $ARGO_AUTH" 232 | fi 233 | done 234 | # reading "请输入argo固定隧道域名: " ARGO_DOMAIN 235 | # green "你的argo固定隧道域名为: $ARGO_DOMAIN" 236 | # reading "请输入argo固定隧道密钥(Json或Token): " ARGO_AUTH 237 | # green "你的argo固定隧道密钥为: $ARGO_AUTH" 238 | echo 239 | echo -e "${red}注意:${purple}使用token,需要在cloudflare后台设置隧道端口和面板开放的tcp端口一致${re}" 240 | else 241 | green "ARGO隧道变量未设置,将使用临时隧道" 242 | return 243 | fi 244 | fi 245 | 246 | if [[ $ARGO_AUTH =~ TunnelSecret ]]; then 247 | echo $ARGO_AUTH > tunnel.json 248 | cat > tunnel.yml << EOF 249 | tunnel: $(cut -d\" -f12 <<< "$ARGO_AUTH") 250 | credentials-file: tunnel.json 251 | protocol: http2 252 | 253 | ingress: 254 | - hostname: $ARGO_DOMAIN 255 | service: http://localhost:$vmess_port 256 | originRequest: 257 | noTLSVerify: true 258 | - service: http_status:404 259 | EOF 260 | else 261 | green "ARGO_AUTH mismatch TunnelSecret,use token connect to tunnel" 262 | fi 263 | } 264 | 265 | # Download Dependency Files 266 | download_singbox() { 267 | ARCH=$(uname -m) && DOWNLOAD_DIR="." && mkdir -p "$DOWNLOAD_DIR" && FILE_INFO=() 268 | if [ "$ARCH" == "arm" ] || [ "$ARCH" == "arm64" ] || [ "$ARCH" == "aarch64" ]; then 269 | FILE_INFO=("https://github.com/amclubs/am-serv00-vmess/releases/download/1.0.0/arm64-sb web" "https://github.com/amclubs/am-serv00-vmess/releases/download/1.0.0/arm64-bot13 bot") 270 | elif [ "$ARCH" == "amd64" ] || [ "$ARCH" == "x86_64" ] || [ "$ARCH" == "x86" ]; then 271 | FILE_INFO=("https://github.com/amclubs/am-serv00-vmess/releases/download/1.0.0/amd64-web web" "https://github.com/amclubs/am-serv00-vmess/releases/download/1.0.0/amd64-bot bot") 272 | else 273 | echo "Unsupported architecture: $ARCH" 274 | exit 1 275 | fi 276 | for entry in "${FILE_INFO[@]}"; do 277 | URL=$(echo "$entry" | cut -d ' ' -f 1) 278 | NEW_FILENAME=$(echo "$entry" | cut -d ' ' -f 2) 279 | FILENAME="$DOWNLOAD_DIR/$NEW_FILENAME" 280 | if [ -e "$FILENAME" ]; then 281 | green "$FILENAME already exists, Skipping download" 282 | else 283 | wget -q -O "$FILENAME" "$URL" 284 | green "Downloading $FILENAME" 285 | fi 286 | chmod +x $FILENAME 287 | done 288 | } 289 | 290 | # Generating Configuration Files 291 | generate_config() { 292 | 293 | output=$(./web generate reality-keypair) 294 | private_key=$(echo "${output}" | awk '/PrivateKey:/ {print $2}') 295 | public_key=$(echo "${output}" | awk '/PublicKey:/ {print $2}') 296 | echo "${private_key}" > private_key.txt 297 | echo "${public_key}" > public_key.txt 298 | 299 | openssl ecparam -genkey -name prime256v1 -out "private.key" 300 | openssl req -new -x509 -days 3650 -key "private.key" -out "cert.pem" -subj "/CN=$USERNAME.serv00.net" 301 | 302 | cat > config.json << EOF 303 | { 304 | "log": { 305 | "disabled": true, 306 | "level": "info", 307 | "timestamp": true 308 | }, 309 | "dns": { 310 | "servers": [ 311 | { 312 | "tag": "google", 313 | "address": "tls://8.8.8.8", 314 | "strategy": "ipv4_only", 315 | "detour": "direct" 316 | } 317 | ], 318 | "rules": [ 319 | { 320 | "rule_set": [ 321 | "geosite-openai" 322 | ], 323 | "server": "wireguard" 324 | }, 325 | { 326 | "rule_set": [ 327 | "geosite-netflix" 328 | ], 329 | "server": "wireguard" 330 | }, 331 | { 332 | "rule_set": [ 333 | "geosite-category-ads-all" 334 | ], 335 | "server": "block" 336 | } 337 | ], 338 | "final": "google", 339 | "strategy": "", 340 | "disable_cache": false, 341 | "disable_expire": false 342 | }, 343 | "inbounds": [ 344 | { 345 | "tag": "vless-reality-in", 346 | "type": "vless", 347 | "listen": "::", 348 | "listen_port": $vless_port, 349 | "users": [ 350 | { 351 | "uuid": "$UUID", 352 | "flow": "xtls-rprx-vision" 353 | } 354 | ], 355 | "tls": { 356 | "enabled": true, 357 | "server_name": "$ym", 358 | "reality": { 359 | "enabled": true, 360 | "handshake": { 361 | "server": "$ym", 362 | "server_port": 443 363 | }, 364 | "private_key": "$private_key", 365 | "short_id": [ 366 | "" 367 | ] 368 | } 369 | } 370 | }, 371 | { 372 | "tag": "vmess-ws-in", 373 | "type": "vmess", 374 | "listen": "::", 375 | "listen_port": $vmess_port, 376 | "users": [ 377 | { 378 | "uuid": "$UUID" 379 | } 380 | ], 381 | "transport": { 382 | "type": "ws", 383 | "path": "/vmess-argo", 384 | "early_data_header_name": "Sec-WebSocket-Protocol" 385 | } 386 | }, 387 | { 388 | "tag": "hysteria2-in", 389 | "type": "hysteria2", 390 | "listen": "$IP", 391 | "listen_port": $hysteria2_port, 392 | "users": [ 393 | { 394 | "password": "$UUID" 395 | } 396 | ], 397 | "masquerade": "https://www.bing.com", 398 | "ignore_client_bandwidth":false, 399 | "tls": { 400 | "enabled": true, 401 | "alpn": [ 402 | "h3" 403 | ], 404 | "certificate_path": "cert.pem", 405 | "key_path": "private.key" 406 | } 407 | } 408 | ], 409 | "outbounds": [ 410 | { 411 | "type": "direct", 412 | "tag": "direct" 413 | }, 414 | { 415 | "type": "block", 416 | "tag": "block" 417 | }, 418 | { 419 | "type": "dns", 420 | "tag": "dns-out" 421 | }, 422 | { 423 | "type": "wireguard", 424 | "tag": "wireguard-out", 425 | "server": "162.159.195.142", 426 | "server_port": 4198, 427 | "local_address": [ 428 | "172.16.0.2/32", 429 | "2606:4700:110:83c7:b31f:5858:b3a8:c6b1/128" 430 | ], 431 | "private_key": "mPZo+V9qlrMGCZ7+E6z2NI6NOV34PD++TpAR09PtCWI=", 432 | "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=", 433 | "reserved": [ 434 | 26, 435 | 21, 436 | 228 437 | ] 438 | } 439 | ], 440 | "route": { 441 | "rules": [ 442 | { 443 | "protocol": "dns", 444 | "outbound": "dns-out" 445 | }, 446 | { 447 | "ip_is_private": true, 448 | "outbound": "direct" 449 | }, 450 | { 451 | "rule_set": [ 452 | "geosite-openai" 453 | ], 454 | "outbound": "wireguard-out" 455 | }, 456 | { 457 | "rule_set": [ 458 | "geosite-netflix" 459 | ], 460 | "outbound": "wireguard-out" 461 | }, 462 | { 463 | "rule_set": [ 464 | "geosite-category-ads-all" 465 | ], 466 | "outbound": "block" 467 | } 468 | ], 469 | "rule_set": [ 470 | { 471 | "tag": "geosite-netflix", 472 | "type": "remote", 473 | "format": "binary", 474 | "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs", 475 | "download_detour": "direct" 476 | }, 477 | { 478 | "tag": "geosite-openai", 479 | "type": "remote", 480 | "format": "binary", 481 | "url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/openai.srs", 482 | "download_detour": "direct" 483 | }, 484 | { 485 | "tag": "geosite-category-ads-all", 486 | "type": "remote", 487 | "format": "binary", 488 | "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-category-ads-all.srs", 489 | "download_detour": "direct" 490 | } 491 | ], 492 | "final": "direct" 493 | }, 494 | "experimental": { 495 | "cache_file": { 496 | "path": "cache.db", 497 | "cache_id": "mycacheid", 498 | "store_fakeip": true 499 | } 500 | } 501 | } 502 | EOF 503 | } 504 | 505 | # running files 506 | run_sb() { 507 | if [ -e web ]; then 508 | nohup ./web run -c config.json >/dev/null 2>&1 & 509 | sleep 2 510 | pgrep -x "web" > /dev/null && green "web is running" || { red "web is not running, restarting..."; pkill -x "web" && nohup ./web run -c config.json >/dev/null 2>&1 & sleep 2; purple "web restarted"; } 511 | fi 512 | 513 | if [ -e bot ]; then 514 | if [[ $ARGO_AUTH =~ ^[A-Z0-9a-z=]{120,250}$ ]]; then 515 | args="tunnel --edge-ip-version auto --no-autoupdate --protocol http2 run --token ${ARGO_AUTH}" 516 | elif [[ $ARGO_AUTH =~ TunnelSecret ]]; then 517 | args="tunnel --edge-ip-version auto --config tunnel.yml run" 518 | else 519 | args="tunnel --edge-ip-version auto --no-autoupdate --protocol http2 --logfile boot.log --loglevel info --url http://localhost:$vmess_port" 520 | fi 521 | nohup ./bot $args >/dev/null 2>&1 & 522 | sleep 2 523 | pgrep -x "bot" > /dev/null && green "bot is running" || { red "bot is not running, restarting..."; pkill -x "bot" && nohup ./bot "${args}" >/dev/null 2>&1 & sleep 2; purple "bot restarted"; } 524 | fi 525 | 526 | } 527 | 528 | get_links(){ 529 | 530 | get_argodomain() { 531 | if [[ -n $ARGO_AUTH ]]; then 532 | echo "$ARGO_DOMAIN" 533 | else 534 | grep -oE 'https://[[:alnum:]+\.-]+\.trycloudflare\.com' boot.log | sed 's@https://@@' 535 | fi 536 | } 537 | argodomain=$(get_argodomain) 538 | echo -e "\e[1;32mArgoDomain:\e[1;35m${argodomain}\e[0m\n" 539 | if [ -z ${argodomain} ]; then 540 | red "Argo域名生成失败,Argo节点不可用,可卸载重新安装" 541 | fi 542 | sleep 1 543 | # get ip 544 | #IP=$(curl -s ipv4.ip.sb || { ipv6=$(curl -s --max-time 1 ipv6.ip.sb); echo "[$ipv6]"; }) 545 | #sleep 1 546 | # get ipinfo 547 | ISP=$(curl -s https://speed.cloudflare.com/meta | awk -F\" '{print $26"-"$18}' | sed -e 's/ /_/g') 548 | get_name() { if [ "$HOSTNAME" = "s1.ct8.pl" ]; then SERVER="CT8"; else SERVER=$(echo "$HOSTNAME" | cut -d '.' -f 1); fi; echo "$SERVER"; } 549 | NAME="$ISP-$(get_name)" 550 | 551 | sleep 1 552 | # yellow "注意:v2ray或其他软件的跳过证书验证需设置为true,否则hy2或tuic节点可能不通\n" 553 | rm -rf tmp.txt 554 | vless_link="vless://$UUID@$IP:$vless_port?encryption=none&flow=xtls-rprx-vision&security=reality&sni=$ym&fp=chrome&pbk=$public_key&type=tcp&headerType=none#$NAME-vless-reality" 555 | echo "$vless_link" >> tmp.txt 556 | vmess_link="vmess://$(echo "{ \"v\": \"2\", \"ps\": \"$NAME-vmess-ws\", \"add\": \"$IP\", \"port\": \"$vmess_port\", \"id\": \"$UUID\", \"aid\": \"0\", \"scy\": \"auto\", \"net\": \"ws\", \"type\": \"none\", \"host\": \"\", \"path\": \"/vmess-argo?ed=2048\", \"tls\": \"\", \"sni\": \"\", \"alpn\": \"\", \"fp\": \"\"}" | base64 -w0)" 557 | echo "$vmess_link" >> tmp.txt 558 | vmess_argo_link="vmess://$(echo "{ \"v\": \"2\", \"ps\": \"$NAME-vmess-ws-argo\", \"add\": \"visa.cn\", \"port\": \"80\", \"id\": \"$UUID\", \"aid\": \"0\", \"scy\": \"auto\", \"net\": \"ws\", \"type\": \"none\", \"host\": \"$argodomain\", \"path\": \"/vmess-argo?ed=2048\", \"tls\": \"\"}" | base64 -w0)" 559 | echo "$vmess_argo_link" >> tmp.txt 560 | vmess_argo_tls_link="vmess://$(echo "{ \"v\": \"2\", \"ps\": \"$NAME-vmess-ws-tls-argo\", \"add\": \"time.is\", \"port\": \"443\", \"id\": \"$UUID\", \"aid\": \"0\", \"scy\": \"auto\", \"net\": \"ws\", \"type\": \"none\", \"host\": \"$argodomain\", \"path\": \"/vmess-argo?ed=2048\", \"tls\": \"tls\", \"sni\": \"$argodomain\", \"alpn\": \"\", \"fp\": \"\"}" | base64 -w0)" 561 | echo "$vmess_argo_tls_link" >> tmp.txt 562 | hysteria2_link="hysteria2://$UUID@$IP:$hysteria2_port?sni=www.bing.com&alpn=h3&insecure=1#$NAME-hysteria2" 563 | echo "$hysteria2_link" >> tmp.txt 564 | url=$(cat tmp.txt 2>/dev/null) 565 | baseurl=$(echo -e "$url" | base64 -w 0) 566 | echo 567 | 568 | cat > list.txt < tunnel.json 143 | cat > tunnel.yml << EOF 144 | tunnel: $(cut -d\" -f12 <<< "$ARGO_AUTH") 145 | credentials-file: tunnel.json 146 | protocol: http2 147 | 148 | ingress: 149 | - hostname: $ARGO_DOMAIN 150 | service: http://localhost:$vmess_port 151 | originRequest: 152 | noTLSVerify: true 153 | - service: http_status:404 154 | EOF 155 | else 156 | green "ARGO_AUTH mismatch TunnelSecret,use token connect to tunnel" 157 | fi 158 | } 159 | 160 | # Download Dependency Files 161 | download_singbox() { 162 | ARCH=$(uname -m) && DOWNLOAD_DIR="." && mkdir -p "$DOWNLOAD_DIR" && FILE_INFO=() 163 | if [ "$ARCH" == "arm" ] || [ "$ARCH" == "arm64" ] || [ "$ARCH" == "aarch64" ]; then 164 | # if [[ -z $ARGO_AUTH || -z $ARGO_DOMAIN ]]; then 165 | # FILE_INFO=("https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-sb web") 166 | # else 167 | FILE_INFO=("https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-sb web" "https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-bot13 bot") 168 | # fi 169 | # FILE_INFO=("https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-sb web" "https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-bot13 bot" "https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-swith npm") 170 | elif [ "$ARCH" == "amd64" ] || [ "$ARCH" == "x86_64" ] || [ "$ARCH" == "x86" ]; then 171 | # if [[ -z $ARGO_AUTH || -z $ARGO_DOMAIN ]]; then 172 | # FILE_INFO=("https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/amd64-web web") 173 | # else 174 | FILE_INFO=("https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/amd64-web web" "https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/amd64-bot bot") 175 | # fi 176 | # FILE_INFO=("https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/amd64-web web" "https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-bot bot" "https://github.com/ansoncloud8/am-serv00-vmess/releases/download/1.0.0/arm64-npm npm") 177 | else 178 | echo "Unsupported architecture: $ARCH" 179 | exit 1 180 | fi 181 | for entry in "${FILE_INFO[@]}"; do 182 | URL=$(echo "$entry" | cut -d ' ' -f 1) 183 | NEW_FILENAME=$(echo "$entry" | cut -d ' ' -f 2) 184 | FILENAME="$DOWNLOAD_DIR/$NEW_FILENAME" 185 | if [ -e "$FILENAME" ]; then 186 | green "$FILENAME already exists, Skipping download" 187 | else 188 | wget -q -O "$FILENAME" "$URL" 189 | green "Downloading $FILENAME" 190 | fi 191 | chmod +x $FILENAME 192 | done 193 | } 194 | 195 | # Generating Configuration Files 196 | generate_config() { 197 | 198 | cat > config.json << EOF 199 | { 200 | "log": { 201 | "disabled": true, 202 | "level": "info", 203 | "timestamp": true 204 | }, 205 | "dns": { 206 | "servers": [ 207 | { 208 | "tag": "google", 209 | "address": "tls://8.8.8.8", 210 | "strategy": "ipv4_only", 211 | "detour": "direct" 212 | } 213 | ], 214 | "rules": [ 215 | { 216 | "rule_set": [ 217 | "geosite-openai" 218 | ], 219 | "server": "wireguard" 220 | }, 221 | { 222 | "rule_set": [ 223 | "geosite-netflix" 224 | ], 225 | "server": "wireguard" 226 | }, 227 | { 228 | "rule_set": [ 229 | "geosite-category-ads-all" 230 | ], 231 | "server": "block" 232 | } 233 | ], 234 | "final": "google", 235 | "strategy": "", 236 | "disable_cache": false, 237 | "disable_expire": false 238 | }, 239 | "inbounds": [ 240 | { 241 | "tag": "vmess-ws-in", 242 | "type": "vmess", 243 | "listen": "::", 244 | "listen_port": $vmess_port, 245 | "users": [ 246 | { 247 | "uuid": "$UUID" 248 | } 249 | ], 250 | "transport": { 251 | "type": "ws", 252 | "path": "/vmess", 253 | "early_data_header_name": "Sec-WebSocket-Protocol" 254 | } 255 | } 256 | ], 257 | "outbounds": [ 258 | { 259 | "type": "direct", 260 | "tag": "direct" 261 | }, 262 | { 263 | "type": "block", 264 | "tag": "block" 265 | }, 266 | { 267 | "type": "dns", 268 | "tag": "dns-out" 269 | }, 270 | { 271 | "type": "wireguard", 272 | "tag": "wireguard-out", 273 | "server": "162.159.195.142", 274 | "server_port": 4198, 275 | "local_address": [ 276 | "172.16.0.2/32", 277 | "2606:4700:110:83c7:b31f:5858:b3a8:c6b1/128" 278 | ], 279 | "private_key": "mPZo+V9qlrMGCZ7+E6z2NI6NOV34PD++TpAR09PtCWI=", 280 | "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=", 281 | "reserved": [ 282 | 26, 283 | 21, 284 | 228 285 | ] 286 | } 287 | ], 288 | "route": { 289 | "rules": [ 290 | { 291 | "protocol": "dns", 292 | "outbound": "dns-out" 293 | }, 294 | { 295 | "ip_is_private": true, 296 | "outbound": "direct" 297 | }, 298 | { 299 | "rule_set": [ 300 | "geosite-openai" 301 | ], 302 | "outbound": "wireguard-out" 303 | }, 304 | { 305 | "rule_set": [ 306 | "geosite-netflix" 307 | ], 308 | "outbound": "wireguard-out" 309 | }, 310 | { 311 | "rule_set": [ 312 | "geosite-category-ads-all" 313 | ], 314 | "outbound": "block" 315 | } 316 | ], 317 | "rule_set": [ 318 | { 319 | "tag": "geosite-netflix", 320 | "type": "remote", 321 | "format": "binary", 322 | "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs", 323 | "download_detour": "direct" 324 | }, 325 | { 326 | "tag": "geosite-openai", 327 | "type": "remote", 328 | "format": "binary", 329 | "url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/openai.srs", 330 | "download_detour": "direct" 331 | }, 332 | { 333 | "tag": "geosite-category-ads-all", 334 | "type": "remote", 335 | "format": "binary", 336 | "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-category-ads-all.srs", 337 | "download_detour": "direct" 338 | } 339 | ], 340 | "final": "direct" 341 | }, 342 | "experimental": { 343 | "cache_file": { 344 | "path": "cache.db", 345 | "cache_id": "mycacheid", 346 | "store_fakeip": true 347 | } 348 | } 349 | } 350 | EOF 351 | } 352 | 353 | # running files 354 | run_sb() { 355 | if [ -e npm ]; then 356 | tlsPorts=("443" "8443" "2096" "2087" "2083" "2053") 357 | if [[ "${tlsPorts[*]}" =~ "${NEZHA_PORT}" ]]; then 358 | NEZHA_TLS="--tls" 359 | else 360 | NEZHA_TLS="" 361 | fi 362 | if [ -n "$NEZHA_SERVER" ] && [ -n "$NEZHA_PORT" ] && [ -n "$NEZHA_KEY" ]; then 363 | export TMPDIR=$(pwd) 364 | nohup ./npm -s ${NEZHA_SERVER}:${NEZHA_PORT} -p ${NEZHA_KEY} ${NEZHA_TLS} >/dev/null 2>&1 & 365 | sleep 2 366 | pgrep -x "npm" > /dev/null && green "npm is running" || { red "npm is not running, restarting..."; pkill -x "npm" && nohup ./npm -s "${NEZHA_SERVER}:${NEZHA_PORT}" -p "${NEZHA_KEY}" ${NEZHA_TLS} >/dev/null 2>&1 & sleep 2; purple "npm restarted"; } 367 | else 368 | purple "NEZHA variable is empty,skiping runing" 369 | fi 370 | fi 371 | 372 | if [ -e web ]; then 373 | nohup ./web run -c config.json >/dev/null 2>&1 & 374 | sleep 2 375 | pgrep -x "web" > /dev/null && green "web is running" || { red "web is not running, restarting..."; pkill -x "web" && nohup ./web run -c config.json >/dev/null 2>&1 & sleep 2; purple "web restarted"; } 376 | fi 377 | 378 | if [ -e bot ]; then 379 | if [[ $ARGO_AUTH =~ ^[A-Z0-9a-z=]{120,250}$ ]]; then 380 | args="tunnel --edge-ip-version auto --no-autoupdate --protocol http2 run --token ${ARGO_AUTH}" 381 | elif [[ $ARGO_AUTH =~ TunnelSecret ]]; then 382 | args="tunnel --edge-ip-version auto --config tunnel.yml run" 383 | else 384 | args="tunnel --edge-ip-version auto --no-autoupdate --protocol http2 --logfile boot.log --loglevel info --url http://localhost:$vmess_port" 385 | fi 386 | nohup ./bot $args >/dev/null 2>&1 & 387 | sleep 2 388 | pgrep -x "bot" > /dev/null && green "bot is running" || { red "bot is not running, restarting..."; pkill -x "bot" && nohup ./bot "${args}" >/dev/null 2>&1 & sleep 2; purple "bot restarted"; } 389 | fi 390 | 391 | } 392 | 393 | get_links(){ 394 | 395 | get_argodomain() { 396 | if [[ -n $ARGO_AUTH ]]; then 397 | echo "$ARGO_DOMAIN" 398 | else 399 | grep -oE 'https://[[:alnum:]+\.-]+\.trycloudflare\.com' boot.log | sed 's@https://@@' 400 | fi 401 | } 402 | argodomain=$(get_argodomain) 403 | echo -e "\e[1;32mArgoDomain:\e[1;35m${argodomain}\e[0m\n" 404 | sleep 1 405 | # get ip 406 | IP=$(curl -s ipv4.ip.sb || { ipv6=$(curl -s --max-time 1 ipv6.ip.sb); echo "[$ipv6]"; }) 407 | sleep 1 408 | # get ipinfo 409 | ISP=$(curl -s https://speed.cloudflare.com/meta | awk -F\" '{print $26"-"$18}' | sed -e 's/ /_/g') 410 | sleep 1 411 | # yellow "注意:v2ray或其他软件的跳过证书验证需设置为true,否则hy2或tuic节点可能不通\n" 412 | cat > list.txt <