├── README.md ├── geo ├── geoip.db └── geosite.db └── install.sh /README.md: -------------------------------------------------------------------------------- 1 | # sing-box 6 protocol 2 | - vless tcp reality 3 | - vless grpc tls 4 | - vmess ws +Argo tunnel 5 | - vmess ws 6 | - Hysteria2 7 | - Tuic5 8 | 9 | ## install 10 | ``` 11 | bash <(curl -fsSL https://raw.githubusercontent.com/Ptechgithub/sing-box/main/install.sh) 12 | ``` 13 | ![9](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/9.jpg) 14 | - پس از نصب اگر روش اول یعنی Bing self-signed را انتخاب کنید 5 پروتکل به عنوان خروجی دریافت میکنید که مورد پنجم همان تانل Argo است. 15 | - پس از ریبوت شدن سرور host کانفیگ Argo تغییر میکند که میتواند از طریق منو ادرس جدید را بگیرید و در کانفیگ قبلی قرار دهید. 16 | - فایل config-sing-box.json در مسیر 17 | /root/peyman/configs 18 | قرار دارد که میتونید روی خود نرم افزار sing-box استفاده کنید. با این کار نرم افزار به طور اتوماتیک به هر کدوم از کانفیگ ها که در لحظه سرعت و پینگ بهتری داشته باشه وصل میشه. و کانفیگ شما هم قطع نمیشه. مثل تصویر زیر: 19 | - ![10](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/10.jpg) 20 | 21 | - ![13](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/13.jpg) 22 | 23 | 24 | 25 | ### Clients 26 | - Android 27 | - [v2rayNG](https://github.com/2dust/v2rayNg/releases) 28 | - [NekoBox](https://github.com/MatsuriDayo/NekoBoxForAndroid/releases) 29 | - [sing-box (SFA)](https://github.com/SagerNet/sing-box/releases) 30 | - iOS 31 | - [FoXray](https://apps.apple.com/app/foxray/id6448898396) 32 | - [Shadowrocket](https://apps.apple.com/app/shadowrocket/id932747118) 33 | - [sing-box (SFM)](https://github.com/SagerNet/sing-box/releases) 34 | - [Stash](https://apps.apple.com/app/stash/id1596063349) 35 | - Windows 36 | - [v2rayN](https://github.com/2dust/v2rayN/releases) 37 | - Windows, Linux, macOS 38 | - [NekoRay](https://github.com/MatsuriDayo/nekoray/releases) 39 | - [Furious](https://github.com/LorenEteval/Furious/releases) 40 | 41 | . 42 | 43 | thanks : [yonggekkk](https://github.com/yonggekkk) for server config. 44 | 45 | 46 | ## Thanks for 🌟 47 | 48 | [![Stargazers over time](https://starchart.cc/Ptechgithub/sing-box.svg)](https://starchart.cc/Ptechgithub/sing-box) 49 | -------------------------------------------------------------------------------- /geo/geoip.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ptechgithub/sing-box/979c6ce9bbf04e8a13b7b522e89910f5ac86edee/geo/geoip.db -------------------------------------------------------------------------------- /geo/geosite.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ptechgithub/sing-box/979c6ce9bbf04e8a13b7b522e89910f5ac86edee/geo/geosite.db -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #colors 4 | red='\033[0;31m' 5 | green='\033[0;32m' 6 | yellow='\033[0;33m' 7 | purple='\033[0;35m' 8 | cyan='\033[0;36m' 9 | rest='\033[0m' 10 | 11 | #progress bar 12 | display_progress() { 13 | local duration=$1 14 | local sleep_interval=0.1 15 | local progress=0 16 | local bar_length=40 17 | local colors=("" "" "" "" "" "" "") 18 | 19 | while [ "$progress" -lt "$duration" ]; do 20 | echo -ne "\r${colors[$((progress % 7))]}" 21 | for ((i = 0; i < bar_length; i++)); do 22 | if [ $i -lt $((progress * bar_length / duration)) ]; then 23 | echo -ne "█" 24 | else 25 | echo -ne "░" 26 | fi 27 | done 28 | echo -ne " ${progress}%" 29 | progress=$((progress + 1)) 30 | sleep $sleep_interval 31 | done 32 | echo -ne "\r${colors[0]}" 33 | for ((i = 0; i < bar_length; i++)); do 34 | echo -ne " " 35 | done 36 | echo -ne " 100%" 37 | echo 38 | } 39 | 40 | #detect_distribution 41 | detect_distribution() { 42 | 43 | if [ -f /etc/os-release ]; then 44 | source /etc/os-release 45 | 46 | case "${ID}" in 47 | ubuntu | debian) 48 | p_m="apt" 49 | ;; 50 | centos) 51 | p_m="yum" 52 | ;; 53 | fedora) 54 | p_m="dnf" 55 | ;; 56 | *) 57 | echo "Unsupported distribution!" 58 | exit 1 59 | ;; 60 | esac 61 | 62 | echo "${ID}" 63 | "${p_m}" update -y 64 | else 65 | echo "Unsupported distribution!" 66 | exit 1 67 | fi 68 | } 69 | 70 | #realip 71 | realip() { 72 | ip=$(curl -s4m8 ip.sb -k) || ip=$(curl -s6m8 ip.sb -k) 73 | } 74 | 75 | #check_and_close_port 76 | check_and_close_port() { 77 | local port=80 78 | 79 | if lsof -Pi ":$port" -sTCP:LISTEN -t >/dev/null 2>&1; then 80 | echo "Port $port is in use. Closing the port..." 81 | fuser -k "$port/tcp" 82 | fi 83 | } 84 | 85 | ip=$(hostname -I | awk '{print $1}') 86 | 87 | #check_dependencies 88 | check_dependencies() { 89 | detect_distribution 90 | 91 | local dependencies=("curl" "wget" "dnsutils" "openssl" "socat" "coreutils" "jq" "lsof" "qrencode") 92 | 93 | for dep in "${dependencies[@]}"; do 94 | if ! dpkg -s "${dep}" &>/dev/null; then 95 | echo "${dep} is not installed. Installing..." 96 | sudo "${p_m}" install "${dep}" -y 97 | fi 98 | done 99 | } 100 | 101 | download_cf() { 102 | # Check if the file already exists 103 | if [ -x /etc/s-box/cloudflared ]; then 104 | echo "cf is already installed." 105 | return 0 106 | fi 107 | [ ! -d "/etc/s-box" ] && mkdir /etc/s-box 108 | [ ! -d "/root/peyman/configs" ] && mkdir -p /root/peyman/configs 109 | # Check the operating system type 110 | if [[ "$(uname -m)" == "x86_64" ]]; then 111 | download_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64" 112 | elif [[ "$(uname -m)" == "aarch64" ]]; then 113 | download_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64" 114 | elif [[ "$(uname -m)" == "armv7l" ]]; then 115 | download_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm" 116 | elif [[ "$(uname -m)" == "i686" ]]; then 117 | download_url="https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-386" 118 | else 119 | echo "Unsupported operating system." 120 | return 1 121 | fi 122 | 123 | # Download and install if the file doesn't exist 124 | sudo wget -O /etc/s-box/cloudflared $download_url >/dev/null 2>&1 125 | sudo chmod +x /etc/s-box/cloudflared 126 | } 127 | 128 | #install certificates 129 | install_certs() { 130 | echo "" 131 | echo -e "${cyan}Methods of applying certificate :${rest}" 132 | echo -e "${green}1.${rest}Bing self-signed certificate ${yellow} (default) ${rest}" 133 | echo -e "${green}2.${rest}Acme (Domain Required)${rest}" 134 | echo "" 135 | read -rp "Please enter options [1-2]: " certInput 136 | if [[ $certInput == 2 ]]; then 137 | tf="true" 138 | 139 | if [[ -f /root/peyman/cert.crt && -f /root/peyman/private.key ]] && [[ -s /root/peyman/cert.crt && -s /root/peyman/private.key ]] && [[ -f /root/peyman/ca.log ]]; then 140 | domain=$(cat /root/peyman/ca.log) 141 | echo -e "${green}The certificate of the original domain name: $domain was detected and is being applied${rest}" 142 | hy_domain=$domain 143 | else 144 | WARPv4Status=$(curl -s4m8 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 145 | WARPv6Status=$(curl -s6m8 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 146 | if [[ $WARPv4Status =~ on|plus ]] || [[ $WARPv6Status =~ on|plus ]]; then 147 | wg-quick down wgcf >/dev/null 2>&1 148 | systemctl stop warp-go >/dev/null 2>&1 149 | realip 150 | wg-quick up wgcf >/dev/null 2>&1 151 | systemctl start warp-go >/dev/null 2>&1 152 | else 153 | realip 154 | fi 155 | 156 | read -p "Please enter the domain name: " domain 157 | [[ -z $domain ]] && red "No domain name entered, unable to perform operation!" && exit 1 158 | echo -e "${green}Domain name entered: $domain${rest}" && sleep 1 159 | check_and_close_port 160 | domainIP=$(dig +short "${domain}") 161 | if [[ $domainIP == "$ip" ]]; then 162 | if [[ $ID == "CentOS" ]]; then 163 | $p_m install cronie -y 164 | systemctl start crond 165 | systemctl enable crond 166 | else 167 | $p_m install cron -y 168 | systemctl start cron 169 | systemctl enable cron 170 | fi 171 | curl https://get.acme.sh | sh -s "email=$(date +%s%N | md5sum | cut -c 1-16)@gmail.com" 172 | source ~/.bashrc 173 | bash ~/.acme.sh/acme.sh --upgrade --auto-upgrade 174 | bash ~/.acme.sh/acme.sh --set-default-ca --server letsencrypt 175 | if echo "$ip" | grep -q ":"; then 176 | bash ~/.acme.sh/acme.sh --issue -d "${domain}" --standalone -k ec-256 --listen-v6 --insecure 177 | else 178 | bash ~/.acme.sh/acme.sh --issue -d "${domain}" --standalone -k ec-256 --insecure 179 | fi 180 | bash ~/.acme.sh/acme.sh --install-cert -d "${domain}" --key-file /root/peyman/private.key --fullchain-file /root/peyman/cert.crt --ecc 181 | if [[ -f /root/peyman/cert.crt && -f /root/peyman/private.key ]] && [[ -s /root/peyman/cert.crt && -s /root/peyman/private.key ]]; then 182 | echo "$domain" >/root/peyman/ca.log 183 | sed -i '/--cron/d' /etc/crontab >/dev/null 2>&1 184 | echo "0 0 * * * root bash /root/.acme.sh/acme.sh --cron -f >/dev/null 2>&1" >>/etc/crontab 185 | echo -e "${green}Successful! The certificate (cer.crt) and private key (private.key) saved in /root${rest}" 186 | echo -e "${green}The certificate crt file path: /root/peyman/cert.crt${rest}" 187 | echo -e "${green}The private key file path: /root/peyman/private.key${rest}" 188 | chmod 777 /root/peyman/cert.crt 189 | chmod 777 /root/peyman/private.key 190 | chmod 777 /root/peyman/ca.log 191 | hy_domain=$domain 192 | read -rp "Do you want to use a subdomain with CDN [ON] for configs with TLS? Enter a subdomain or Press Enter to skip :" subdomain 193 | if [[ -n $subdomain ]]; then 194 | domain_cdn=$subdomain 195 | echo -e "${green}Sub domain name entered: $domain_cdn${rest}" && sleep 1 196 | else 197 | domain_cdn=$domain 198 | fi 199 | fi 200 | else 201 | echo -e "${red}The IP resolved by the current domain name does not match the real IP used by the current VPS${rest}" 202 | echo -e "${green}uggestions below :${rest}" 203 | echo -e "${yellow}1. Please make sure that CloudFlare is turned off (DNS only). The same applies to other domain name resolution or CDN website settings.${rest}" 204 | echo -e "${yellow}2. Please check whether the IP set by DNS resolution is the real IP of the VPS${rest}" 205 | exit 1 206 | fi 207 | fi 208 | else 209 | echo -e "${green}You selected Bing self-signed certificate.${rest}" 210 | [ ! -d "/root/peyman/configs" ] && mkdir -p /root/peyman/configs 211 | openssl ecparam -genkey -name prime256v1 -out /root/peyman/private.key 212 | openssl req -new -x509 -days 36500 -key /root/peyman/private.key -out /root/peyman/cert.crt -subj "/CN=www.bing.com" 213 | chmod 777 /root/peyman/cert.crt 214 | chmod 777 /root/peyman/private.key 215 | hy_domain="www.bing.com" 216 | domain="$ip" 217 | tf="false" 218 | fi 219 | } 220 | 221 | #download sing-box 222 | download-sb() { 223 | if [ "$ID" == "ubuntu" ]; then 224 | bash <(curl -fsSL https://sing-box.app/deb-install.sh) 225 | elif [ "$ID" == "debian" ]; then 226 | bash <(curl -fsSL https://sing-box.app/deb-install.sh) 227 | elif [ "$ID" == "centos" ] || [ "$ID" == "redhat" ]; then 228 | bash <(curl -fsSL https://sing-box.app/rpm-install.sh) 229 | elif [ "$ID" == "arch" ]; then 230 | bash <(curl -fsSL https://sing-box.app/arch-install.sh) 231 | else 232 | echo "Unsupported distribution!" 233 | exit 1 234 | fi 235 | } 236 | 237 | install() { 238 | if systemctl is-active --quiet s-box.service; then 239 | echo "sing-box is already installed." 240 | exit 1 241 | else 242 | echo "Installing..." 243 | fi 244 | 245 | check_dependencies 246 | download_cf 247 | download-sb 248 | install_certs 249 | uuid=$(sing-box generate uuid) 250 | keys=$(sing-box generate reality-keypair) 251 | private_key=$(echo $keys | awk -F " " '{print $2}') 252 | public_key=$(echo $keys | awk -F " " '{print $4}') 253 | short_id=$(openssl rand -hex 8) 254 | read -p "Do you want to use random Ports? [y/n]: " randomPort 255 | randomPort=${randomPort:-"y"} 256 | if [ "$randomPort" == "y" ]; then 257 | vlessport=$(shuf -i 2000-65535 -n 1) 258 | vlessgport=${vlessgport:-2083} 259 | vmessport=${vmessport:-2053} 260 | hyport=$(shuf -i 2000-65535 -n 1) 261 | tuicport=$(shuf -i 2000-65535 -n 1) 262 | 263 | else 264 | read -p "Enter VLESS port [default: 2087]: " vlessport 265 | vlessport=${vlessport:-2087} 266 | while lsof -Pi :$vlessport -sTCP:LISTEN -t >/dev/null; do 267 | echo -e "${red}Error: Port $vlessport is already in use.${rest}" 268 | read -p "Enter a different VLESS port: " vlessport 269 | vlessport=${vlessport:-2087} 270 | done 271 | 272 | read -p "Enter VLESS_GRPC port [default: 2083]: " vlessgport 273 | vlessgport=${vlessgport:-2083} 274 | while lsof -Pi :$vlessgport -sTCP:LISTEN -t >/dev/null; do 275 | echo -e "${red}Error: Port $vlessgport is already in use.${rest}" 276 | read -p "Enter a different VLESS port: " vlessgport 277 | vlessgport=${vlessgport:-2083} 278 | done 279 | 280 | read -p "Enter VMESS port [default: 2053]: " vmessport 281 | vmessport=${vmessport:-2053} 282 | while lsof -Pi :$vmessport -sTCP:LISTEN -t >/dev/null; do 283 | echo -e "${red}Error: Port $vmessport is already in use.${rest}" 284 | read -p "Enter a different VMESS port: " vmessport 285 | vmessport=${vmessport:-2053} 286 | done 287 | 288 | read -p "Enter HYSTERIA port [default: 2096]: " hyport 289 | hyport=${hyport:-2096} 290 | while lsof -Pi :$hyport -sTCP:LISTEN -t >/dev/null; do 291 | echo -e "${red}Error: Port $hyport is already in use.${rest}" 292 | read -p "Enter a different HYSTERIA port: " hyport 293 | hyport=${hyport:-2096} 294 | done 295 | 296 | read -p "Enter TUIC port [default: 8443]: " tuicport 297 | tuicport=${tuicport:-8443} 298 | while lsof -Pi :$tuicport -sTCP:LISTEN -t >/dev/null; do 299 | echo -e "${red}Error: Port $tuicport is already in use.${rest}" 300 | read -p "Enter a different TUIC port: " tuicport 301 | tuicport=${tuicport:-8443} 302 | done 303 | fi 304 | server_config 305 | ( 306 | crontab -l 307 | echo "0 1 * * * systemctl restart sing-box >/dev/null 2>&1" 308 | ) | sort - | uniq - | crontab - 309 | if [[ $certInput == 2 ]]; then 310 | config-sing-box 311 | config-nekobox 312 | telegram_tls 313 | setup_service 314 | config_tls 315 | else 316 | setup_service 317 | telegram_ip 318 | fi 319 | } 320 | 321 | server_config() { 322 | cat </etc/s-box/sb.json 323 | { 324 | "log": { 325 | "disabled": false, 326 | "level": "info", 327 | "timestamp": true 328 | }, 329 | "inbounds": [ 330 | { 331 | "type": "vless", 332 | "tag": "vless-tcp-reality", 333 | "sniff": true, 334 | "sniff_override_destination": true, 335 | "listen": "::", 336 | "listen_port": $vlessport, 337 | "users": [ 338 | { 339 | "uuid": "$uuid", 340 | "flow": "xtls-rprx-vision" 341 | } 342 | ], 343 | "tls": { 344 | "enabled": true, 345 | "server_name": "www.yahoo.com", 346 | "reality": { 347 | "enabled": true, 348 | "handshake": { 349 | "server": "www.yahoo.com", 350 | "server_port": 443 351 | }, 352 | "private_key": "$private_key", 353 | "short_id": ["$short_id"] 354 | } 355 | } 356 | }, 357 | { 358 | "type": "vmess", 359 | "tag": "vmess-sb", 360 | "sniff": true, 361 | "sniff_override_destination": true, 362 | "listen": "::", 363 | "listen_port": $vmessport, 364 | "users": [ 365 | { 366 | "uuid": "$uuid", 367 | "alterId": 0 368 | } 369 | ], 370 | "transport": { 371 | "type": "ws", 372 | "path": "$uuid" 373 | }, 374 | "tls":{ 375 | "enabled": $tf, 376 | "server_name": "$domain_cdn", 377 | "min_version": "1.2", 378 | "max_version": "1.3", 379 | "certificate_path": "/root/peyman/cert.crt", 380 | "key_path": "/root/peyman/private.key" 381 | } 382 | }, 383 | { 384 | "type": "vless", 385 | "tag": "vless-grpc", 386 | "sniff": true, 387 | "sniff_override_destination": true, 388 | "listen": "::", 389 | "listen_port": $vlessgport, 390 | "users": [ 391 | { 392 | "uuid": "$uuid" 393 | } 394 | ], 395 | "transport": { 396 | "type": "grpc", 397 | "service_name": "$domain_cdn" 398 | }, 399 | "tls":{ 400 | "enabled": true, 401 | "server_name": "$domain_cdn", 402 | "min_version": "1.2", 403 | "max_version": "1.3", 404 | "certificate_path": "/root/peyman/cert.crt", 405 | "key_path": "/root/peyman/private.key" 406 | } 407 | }, 408 | { 409 | "type": "hysteria2", 410 | "tag": "hy2-sb", 411 | "sniff": true, 412 | "sniff_override_destination": true, 413 | "listen": "::", 414 | "listen_port": $hyport, 415 | "obfs": { 416 | "type": "salamander", 417 | "password": "$uuid" 418 | }, 419 | "users": [ 420 | { 421 | "password": "$uuid" 422 | } 423 | ], 424 | "ignore_client_bandwidth":false, 425 | "tls": { 426 | "enabled": true, 427 | "alpn": [ 428 | "h3" 429 | ], 430 | "enabled": true, 431 | "server_name": "www.google.com", 432 | "certificate_path": "/root/peyman/cert.crt", 433 | "key_path": "/root/peyman/private.key" 434 | } 435 | }, 436 | { 437 | "type":"tuic", 438 | "tag": "tuic5-sb", 439 | "sniff": true, 440 | "sniff_override_destination": true, 441 | "listen": "::", 442 | "listen_port": $tuicport, 443 | "users": [ 444 | { 445 | "uuid": "$uuid", 446 | "password": "$uuid" 447 | } 448 | ], 449 | "congestion_control": "bbr", 450 | "tls":{ 451 | "enabled": true, 452 | "alpn": [ 453 | "h3" 454 | ], 455 | "certificate_path": "/root/peyman/cert.crt", 456 | "key_path": "/root/peyman/private.key" 457 | } 458 | } 459 | ], 460 | "outbounds": [ 461 | { 462 | "type":"direct", 463 | "tag":"direct", 464 | "domain_strategy": "prefer_ipv4" 465 | }, 466 | { 467 | "type":"direct", 468 | "tag": "vps-outbound-v4", 469 | "domain_strategy":"ipv4_only" 470 | }, 471 | { 472 | "type":"direct", 473 | "tag": "vps-outbound-v6", 474 | "domain_strategy":"ipv6_only" 475 | }, 476 | { 477 | "type": "socks", 478 | "tag": "socks-out", 479 | "server": "127.0.0.1", 480 | "server_port": 40000, 481 | "version": "5" 482 | }, 483 | { 484 | "type":"direct", 485 | "tag":"socks-IPv4-out", 486 | "detour":"socks-out", 487 | "domain_strategy":"ipv4_only" 488 | }, 489 | { 490 | "type":"direct", 491 | "tag":"socks-IPv6-out", 492 | "detour":"socks-out", 493 | "domain_strategy":"ipv6_only" 494 | }, 495 | { 496 | "type":"direct", 497 | "tag":"warp-IPv4-out", 498 | "detour":"wireguard-out", 499 | "domain_strategy":"ipv4_only" 500 | }, 501 | { 502 | "type":"direct", 503 | "tag":"warp-IPv6-out", 504 | "detour":"wireguard-out", 505 | "domain_strategy":"ipv6_only" 506 | }, 507 | { 508 | "type":"wireguard", 509 | "tag":"wireguard-out", 510 | "server":"162.159.193.10", 511 | "server_port":1701, 512 | "local_address":[ 513 | "172.16.0.2/32", 514 | "2606:4700:110:891c:6ee2:7df4:5e99:b7cf/128" 515 | ], 516 | "private_key":"aJkrp4MMgL/Oi2bO4Fww9J8aqAW1ojeOZ22RK0nXYWY=", 517 | "peer_public_key":"bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=", 518 | "reserved":[230,25,169] 519 | }, 520 | { 521 | "type": "block", 522 | "tag": "block" 523 | } 524 | ], 525 | "route":{ 526 | "geoip":{ 527 | "download_url":"https://github.com/Ptechgithub/sing-box/blob/main/geo/geoip.db", 528 | "download_detour":"direct" 529 | }, 530 | "geosite":{ 531 | "download_url":"https://github.com/Ptechgithub/sing-box/blob/main/geo/geosite.db", 532 | "download_detour":"direct" 533 | }, 534 | "rules":[ 535 | { 536 | "protocol": ["quic"], 537 | "port": [ 443 ], 538 | "outbound": "block" 539 | }, 540 | { 541 | "outbound": "direct", 542 | "network": "udp,tcp" 543 | } 544 | ] 545 | } 546 | } 547 | EOL 548 | } 549 | 550 | setup_service() { 551 | cat <"/etc/systemd/system/s-box.service" 552 | [Unit] 553 | After=network.target nss-lookup.target 554 | 555 | [Service] 556 | User=root 557 | WorkingDirectory=/usr/bin 558 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW 559 | AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW 560 | ExecStart=/usr/bin/sing-box run -c /etc/s-box/sb.json 561 | ExecReload=/bin/kill -HUP $MAINPID 562 | Restart=on-failure 563 | RestartSec=10 564 | LimitNOFILE=infinity 565 | 566 | [Install] 567 | WantedBy=multi-user.target 568 | EOL 569 | 570 | sudo systemctl daemon-reload 571 | sudo systemctl start s-box.service 572 | sudo systemctl enable s-box.service 573 | } 574 | 575 | telegram_ip() { 576 | echo -e "${cyan}Do you want to receive the configs through Telegram bot? (y/n)${rest} \c" 577 | read configure_via_telegram 578 | 579 | if [[ "$configure_via_telegram" == "y" ]]; then 580 | echo -e "Enter your ${yellow}Telegram bot Token${rest} :\c" 581 | read token 582 | 583 | echo -e "Enter Your ${yellow}chat ID${rest}.${purple}(Get your Chat ID in: bot--> @userinfobot) ${rest}: \c" 584 | read chat_id 585 | display_progress 20 586 | echo "Please wait about 20s for connecting Argo tunnel..." 587 | config_ip 588 | 589 | message="🖐سلام، کانفیگ های شما با موفقیت ساخته شد. 590 | 591 | 1⃣ 592 | $(config_ip | grep -o 'tuic://.*#peyman-tuic5') 593 | 594 | 2⃣ 595 | $(config_ip | grep -o 'hysteria2://.*#peyman-hy2') 596 | 597 | 3⃣ 598 | $(config_ip | grep -o 'vless://.*#peyman-vless-reality') 599 | 600 | 4⃣ 601 | $(config_ip | grep -o 'vmess://.*' | head -n 1) 602 | 603 | 5️⃣ 604 | $(config_ip | grep -o 'vmess://.*' | tail -n 1)" 605 | 606 | response=$(curl -s "https://api.telegram.org/bot$token/sendMessage" \ 607 | --data-urlencode "chat_id=$chat_id" \ 608 | --data-urlencode "text=$message") 609 | 610 | json_file="/root/peyman/configs/config-nekobox.json" 611 | caption="📦 این فایل ترکیب کانفیگ با هم است. لطفا روی نرم افزار Nekobox اجرا شود." 612 | 613 | curl -s -X POST \ 614 | https://api.telegram.org/bot$token/sendDocument \ 615 | -F document=@$json_file \ 616 | -F chat_id=$chat_id \ 617 | -F caption="$caption" >/dev/null 618 | 619 | json_files="/root/peyman/configs/config-sing-box.json" 620 | captions="📦 این فایل ترکیب کانفیگ با هم است. لطفا روی نرم افزار Sing-Box اجرا شود." 621 | 622 | curl -s -X POST \ 623 | https://api.telegram.org/bot$token/sendDocument \ 624 | -F document=@$json_files \ 625 | -F chat_id=$chat_id \ 626 | -F caption="$captions" >/dev/null 627 | 628 | if [[ "$(echo "$response" | jq -r '.ok')" == "true" ]]; then 629 | echo -e "${green}Message sent to telegram successfully!${rest}" 630 | else 631 | echo -e "${red}Failed to send message. Check your bot token and chat ID.${rest}" 632 | fi 633 | else 634 | display_progress 10 635 | echo "Please Wait..." 636 | config_ip 637 | fi 638 | } 639 | 640 | config_ip() { 641 | nohup /etc/s-box/cloudflared tunnel --url http://localhost:$(jq -r .inbounds[1].listen_port /etc/s-box/sb.json) --edge-ip-version auto --no-autoupdate --protocol http2 >/etc/s-box/argo.log 2>&1 & 642 | 643 | max_wait_seconds=10 644 | seconds_waited=0 645 | 646 | while [ $seconds_waited -lt $max_wait_seconds ]; do 647 | if [ -f /etc/s-box/argo.log ] && grep -q 'https://.*trycloudflare.com' /etc/s-box/argo.log; then 648 | break 649 | fi 650 | sleep 1 651 | ((seconds_waited++)) 652 | done 653 | 654 | if [ $seconds_waited -ge $max_wait_seconds ]; then 655 | echo "Argo Can't run." 656 | echo "" 657 | echo -e "${purple}--------------------These are your configs.----------------------${rest}" 658 | echo "" 659 | tuic="tuic://$uuid:$uuid@$ip:$tuicport?congestion_control=bbr&udp_relay_mode=native&alpn=h3&sni=www.bing.com&allow_insecure=1#peyman-tuic5" 660 | echo "$tuic" 661 | echo "" 662 | echo -e "${purple}---------------------------------TUIC5-------------------------------${rest}" 663 | echo "$tuic" | qrencode -t ANSIUTF8 664 | echo "$tuic" >"/root/peyman/configs/tuic_config.txt" 665 | echo -e "${purple}----------------------------------------------------------------${rest}" 666 | 667 | hysteria2="hysteria2://$uuid@$ip:$hyport?insecure=1&mport=$hyport&sni=www.bing.com&obfs=salamander&obfs-password=$uuid#peyman-hy2" 668 | echo "$hysteria2" 669 | echo "" 670 | echo -e "${purple}-------------------------------HYSTERIA2-----------------------------${rest}" 671 | echo "$hysteria2" | qrencode -t ANSIUTF8 672 | echo "$hysteria2" >"/root/peyman/configs/hysteria2_config.txt" 673 | echo -e "${purple}----------------------------------------------------------------${rest}" 674 | 675 | vless="vless://$uuid@$ip:$vlessport?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.yahoo.com&fp=chrome&pbk=$public_key&sid=$short_id&type=tcp&headerType=none#peyman-vless-reality" 676 | echo "$vless" 677 | echo "" 678 | echo -e "${purple}----------------------------VlESS-TCP-REALITY------------------------${rest}" 679 | echo "$vless" | qrencode -t ANSIUTF8 680 | echo "$vless" >"/root/peyman/configs/vless_config.txt" 681 | echo -e "${purple}----------------------------------------------------------------${rest}" 682 | 683 | vmess="{\"add\":\"$ip\",\"aid\":\"0\",\"host\":\"www.bing.com\",\"id\":\"$uuid\",\"net\":\"ws\",\"path\":\"$uuid\",\"port\":\"$vmessport\",\"ps\":\"peyman-ws\",\"tls\":\"\",\"type\":\"none\",\"v\":\"2\"}" 684 | encoded_vmess=$(echo -n "$vmess" | base64 -w 0) 685 | echo "vmess://$encoded_vmess" 686 | echo "" 687 | echo -e "${purple}--------------------------------VMESS-WS----------------------------${rest}" 688 | echo "$vmess://$encoded_vmess" | qrencode -t ANSIUTF8 689 | echo "vmess://$encoded_vmess" >"/root/peyman/configs/vmess_config.txt" 690 | echo -e "${purple}----------------------------------------------------------------${rest}" 691 | else 692 | link=$(grep -o 'https://.*trycloudflare.com' /etc/s-box/argo.log | sed 's/https:\/\///') 693 | config-sing-boxx 694 | config-nekoboxx 695 | echo "" 696 | echo -e "${purple}--------------------These are your configs.----------------------${rest}" 697 | echo "" 698 | tuic="tuic://$uuid:$uuid@$ip:$tuicport?congestion_control=bbr&udp_relay_mode=native&alpn=h3&sni=www.bing.com&allow_insecure=1#peyman-tuic5" 699 | echo "$tuic" 700 | echo "" 701 | echo -e "${purple}---------------------------------TUIC5-------------------------------${rest}" 702 | echo "$tuic" | qrencode -t ANSIUTF8 703 | echo "$tuic" >"/root/peyman/configs/tuic_config.txt" 704 | echo -e "${purple}----------------------------------------------------------------${rest}" 705 | 706 | hysteria2="hysteria2://$uuid@$ip:$hyport?insecure=1&mport=$hyport&sni=www.bing.com&obfs=salamander&obfs-password=$uuid#peyman-hy2" 707 | echo "$hysteria2" 708 | echo "" 709 | echo -e "${purple}-------------------------------HYSTERIA2-----------------------------${rest}" 710 | echo "$hysteria2" | qrencode -t ANSIUTF8 711 | echo "$hysteria2" >"/root/peyman/configs/hysteria2_config.txt" 712 | echo -e "${purple}----------------------------------------------------------------${rest}" 713 | 714 | vless="vless://$uuid@$ip:$vlessport?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.yahoo.com&fp=chrome&pbk=$public_key&sid=$short_id&type=tcp&headerType=none#peyman-vless-reality" 715 | echo "$vless" 716 | echo "" 717 | echo -e "${purple}----------------------------VlESS-TCP-REALITY------------------------${rest}" 718 | echo "$vless" | qrencode -t ANSIUTF8 719 | echo "$vless" >"/root/peyman/configs/vless_config.txt" 720 | echo -e "${purple}----------------------------------------------------------------${rest}" 721 | 722 | vmess="{\"add\":\"$ip\",\"aid\":\"0\",\"host\":\"www.bing.com\",\"id\":\"$uuid\",\"net\":\"ws\",\"path\":\"$uuid\",\"port\":\"$vmessport\",\"ps\":\"peyman-ws\",\"tls\":\"\",\"type\":\"none\",\"v\":\"2\"}" 723 | encoded_vmess=$(echo -n "$vmess" | base64 -w 0) 724 | echo "vmess://$encoded_vmess" 725 | echo "" 726 | echo -e "${purple}----------------------------------VMESS-WS------------------------------${rest}" 727 | echo "$vmess://$encoded_vmess" | qrencode -t ANSIUTF8 728 | echo "vmess://$encoded_vmess" >"/root/peyman/configs/vmess_config.txt" 729 | echo -e "${purple}----------------------------------------------------------------${rest}" 730 | 731 | vmess="{\"add\":\"104.31.16.60\",\"aid\":\"0\",\"host\":\"$link\",\"id\":\"$uuid\",\"net\":\"ws\",\"path\":\"$uuid\",\"port\":\"443\",\"ps\":\"peyman-vmess-Argo\",\"tls\":\"tls\",\"sni\":\"$link\",\"type\":\"none\",\"v\":\"2\"}" 732 | encoded_vmess=$(echo -n "$vmess" | base64 -w 0) 733 | echo "vmess://$encoded_vmess" 734 | echo "" 735 | echo -e "${purple}-------------------------VMESS-WS-TLS+ARGO-TUNNEL------------------${rest}" 736 | echo "$vmess://$encoded_vmess" | qrencode -t ANSIUTF8 737 | echo "vmess://$encoded_vmess" >"/root/peyman/configs/vmess_Argo_config.txt" 738 | echo -e "${purple}----------------------------------------------------------------${rest}" 739 | 740 | (crontab -l 2>/dev/null | grep -q -F "@reboot /bin/bash -c \"/etc/s-box/cloudflared tunnel --url http://localhost:$(jq -r .inbounds[1].listen_port /etc/s-box/sb.json) --edge-ip-version auto --no-autoupdate --protocol http2 > /etc/s-box/argo.log 2>&1\"") || ( 741 | crontab -l 2>/dev/null 742 | echo "@reboot /bin/bash -c \"/etc/s-box/cloudflared tunnel --url http://localhost:$(jq -r .inbounds[1].listen_port /etc/s-box/sb.json) --edge-ip-version auto --no-autoupdate --protocol http2 > /etc/s-box/argo.log 2>&1\"" 743 | ) | crontab - >/dev/null 2>&1 744 | fi 745 | } 746 | 747 | telegram_tls() { 748 | echo -e "${cyan}Do you want to receive the configs through Telegram bot? (y/n)${rest} \c" 749 | read configure_via_telegram 750 | 751 | if [[ "$configure_via_telegram" == "y" ]]; then 752 | echo -e "Enter your ${yellow}Telegram bot Token${rest} :\c" 753 | read token 754 | 755 | echo -e "Enter Your ${yellow}chat ID${rest}.${purple}(Get your Chat ID in: bot--> @userinfobot) ${rest}: \c" 756 | read chat_id 757 | display_progress 10 758 | sleep 1 759 | echo "Please Wait..." 760 | 761 | message="🖐سلام، کانفیگ های شما با موفقیت ساخته شد. 762 | 763 | 1⃣ 764 | $(config_tls | grep -o 'tuic://.*#peyman-tuic5') 765 | 766 | 2⃣ 767 | $(config_tls | grep -o 'hysteria2://.*#peyman-hy2') 768 | 769 | 3⃣ 770 | $(config_tls | grep -o 'vless://.*#peyman-vless-reality') 771 | 772 | 4⃣ 773 | $(config_tls | grep -o 'vmess://.*') 774 | 775 | 5️⃣ 776 | $(config_tls | grep -o 'vless://.*' | tail -n 1)" 777 | 778 | response=$(curl -s "https://api.telegram.org/bot$token/sendMessage" \ 779 | --data-urlencode "chat_id=$chat_id" \ 780 | --data-urlencode "text=$message") 781 | 782 | file="/root/peyman/configs/config-nekobox.json" 783 | caption="📦 این فایل ترکیب کانفیگ با هم است. لطفا روی نرم افزار Nekobox اجرا شود." 784 | 785 | curl -s -X POST \ 786 | https://api.telegram.org/bot$token/sendDocument \ 787 | -F document=@$file \ 788 | -F chat_id=$chat_id \ 789 | -F caption="$caption" >/dev/null 790 | 791 | files="/root/peyman/configs/config-sing-box.json" 792 | captions="📦 این فایل ترکیب کانفیگ با هم است. لطفا روی نرم افزار Sing-Box اجرا شود." 793 | 794 | curl -s -X POST \ 795 | https://api.telegram.org/bot$token/sendDocument \ 796 | -F document=@$files \ 797 | -F chat_id=$chat_id \ 798 | -F caption="$captions" >/dev/null 799 | 800 | if [[ "$(echo "$response" | jq -r '.ok')" == "true" ]]; then 801 | echo -e "${green}Message sent to telegram successfully!${rest}" 802 | else 803 | echo -e "${red}Failed to send message. Check your bot token and chat ID.${rest}" 804 | fi 805 | else 806 | show_output=$(config_tls) 807 | fi 808 | } 809 | 810 | config_tls() { 811 | sleep 1 812 | echo "" 813 | echo -e "${purple}--------------------These are your configs.----------------------${rest}" 814 | echo "" 815 | echo -e "${purple}---------------------------------TUIC5-------------------------------${rest}" 816 | tuic="tuic://$uuid:$uuid@$domain:$tuicport?congestion_control=bbr&udp_relay_mode=native&alpn=h3&sni=$domain&allow_insecure=0#peyman-tuic5" 817 | echo "$tuic" 818 | echo "" 819 | echo "$tuic" | qrencode -t ANSIUTF8 820 | echo "$tuic" >"/root/peyman/configs/tuic_config.txt" 821 | echo -e "${purple}----------------------------------------------------------------${rest}" 822 | 823 | hysteria2="hysteria2://$uuid@$domain:$hyport?insecure=0&mport=$hyport&sni=$domain&obfs=salamander&obfs-password=$uuid#peyman-hy2" 824 | echo "$hysteria2" 825 | echo "" 826 | echo -e "${purple}-------------------------------HYSTERIA2-----------------------------${rest}" 827 | echo "$hysteria2" | qrencode -t ANSIUTF8 828 | echo "$hysteria2" >"/root/peyman/configs/hysteria2_config.txt" 829 | echo -e "${purple}----------------------------------------------------------------${rest}" 830 | 831 | vless="vless://$uuid@$domain:$vlessport?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.yahoo.com&fp=chrome&pbk=$public_key&sid=$short_id&type=tcp&headerType=none#peyman-vless-reality" 832 | echo "$vless" 833 | echo "" 834 | echo -e "${purple}----------------------------VlESS-TCP-REALITY------------------------${rest}" 835 | echo "$vless" | qrencode -t ANSIUTF8 836 | echo "$vless" >"/root/peyman/configs/vless_config.txt" 837 | echo -e "${purple}----------------------------------------------------------------${rest}" 838 | 839 | vlessg="vless://$uuid@$domain_cdn:$vlessgport/?type=grpc&encryption=none&serviceName=$domain_cdn&security=tls&sni=$domain_cdn&alpn=h2&fp=chrome#peyman-Vless-GRPC-Tls" 840 | echo "$vlessg" 841 | echo "" 842 | echo -e "${purple}---------------------------------VLESS-GRPC-TLS-----------------------------${rest}" 843 | echo "$vlessg" | qrencode -t ANSIUTF8 844 | echo "$vlessg" >"/root/peyman/configs/vless_grpc_config.txt" 845 | echo -e "${purple}----------------------------------------------------------------${rest}" 846 | 847 | vmess='{"add":"'$domain_cdn'","aid":"0","host":"'$domain_cdn'","id":"'$uuid'","net":"ws","path":"'$uuid'","port":"'$vmessport'","ps":"peyman-ws-tls","tls":"tls","sni":"'$domain_cdn'","type":"none","v":"2"}' 848 | encoded_vmess=$(echo -n "$vmess" | base64 -w 0) 849 | echo "vmess://$encoded_vmess" 850 | echo "" 851 | echo -e "${purple}--------------------------------VMESS-WS-TLS----------------------------${rest}" 852 | echo "$vmess://$encoded_vmess" | qrencode -t ANSIUTF8 853 | echo "vmess://$encoded_vmess" >"/root/peyman/configs/vmess_config.txt" 854 | echo -e "${purple}----------------------------------------------------------------${rest}" 855 | } 856 | 857 | uninstall() { 858 | # Check if the service is installed 859 | if [ ! -f "/etc/systemd/system/s-box.service" ]; then 860 | echo "The service is not installed." 861 | return 862 | fi 863 | 864 | # Stop and disable the service 865 | sudo systemctl stop s-box.service 866 | sudo systemctl disable s-box.service >/dev/null 2>&1 867 | 868 | # Remove service file 869 | sudo rm /etc/systemd/system/s-box.service >/dev/null 2>&1 870 | sudo rm -rf /etc/s-box 871 | sudo rm -rf /root/peyman 872 | sudo systemctl reset-failed 873 | echo "Uninstallation completed." 874 | } 875 | 876 | config-sing-box() { 877 | cat </root/peyman/configs/config-sing-box.json 878 | { 879 | "log": { 880 | "level": "info", 881 | "timestamp": true 882 | }, 883 | "dns": { 884 | "servers": [ 885 | { 886 | "tag": "proxydns", 887 | "address": "tls://8.8.8.8/dns-query", 888 | "detour": "select" 889 | }, 890 | { 891 | "tag": "localdns", 892 | "address": "h3://223.5.5.5/dns-query", 893 | "detour": "direct" 894 | }, 895 | { 896 | "tag": "block", 897 | "address": "rcode://refused" 898 | }, 899 | { 900 | "tag": "dns_fakeip", 901 | "address": "fakeip" 902 | } 903 | ], 904 | "rules": [ 905 | { 906 | "outbound": "any", 907 | "server": "localdns", 908 | "disable_cache": true 909 | }, 910 | { 911 | "clash_mode": "Global", 912 | "server": "proxydns" 913 | }, 914 | { 915 | "clash_mode": "Direct", 916 | "server": "localdns" 917 | }, 918 | { 919 | "rule_set": "geosite-cn", 920 | "server": "localdns" 921 | }, 922 | { 923 | "rule_set": "geosite-geolocation-!cn", 924 | "server": "proxydns" 925 | }, 926 | { 927 | "query_type": [ 928 | "A", 929 | "AAAA" 930 | ], 931 | "rule_set": "geosite-geolocation-!cn", 932 | "server": "dns_fakeip" 933 | } 934 | ], 935 | "final": "proxydns", 936 | "fakeip": { 937 | "enabled": true, 938 | "inet4_range": "198.18.0.0/15", 939 | "inet6_range": "fc00::/18" 940 | }, 941 | "independent_cache": true 942 | }, 943 | "ntp": { 944 | "enabled": true, 945 | "interval": "30m0s", 946 | "server": "time.apple.com", 947 | "server_port": 123, 948 | "detour": "direct" 949 | }, 950 | "inbounds": [ 951 | { 952 | "type": "tun", 953 | "auto_route": true, 954 | "strict_route": true, 955 | "sniff": true, 956 | "sniff_override_destination": true, 957 | "domain_strategy": "prefer_ipv4", 958 | "inet4_address": "172.19.0.1/30", 959 | "inet6_address": "fd00::1/126" 960 | } 961 | ], 962 | "outbounds": [ 963 | { 964 | "type": "selector", 965 | "tag": "select", 966 | "outbounds": [ 967 | "auto", 968 | "vless-tcp-reality", 969 | "vless-grpc", 970 | "vmess-sb", 971 | "hy2-sb", 972 | "tuic5-sb" 973 | ], 974 | "default": "auto" 975 | }, 976 | { 977 | "type": "vless", 978 | "tag": "vless-tcp-reality", 979 | "server": "$domain", 980 | "server_port": $vlessport, 981 | "uuid": "$uuid", 982 | "flow": "xtls-rprx-vision", 983 | "tls": { 984 | "enabled": true, 985 | "server_name": "www.yahoo.com", 986 | "utls": { 987 | "enabled": true, 988 | "fingerprint": "chrome" 989 | }, 990 | "reality": { 991 | "enabled": true, 992 | "public_key": "$public_key", 993 | "short_id": "$short_id" 994 | } 995 | } 996 | }, 997 | { 998 | "type": "vless", 999 | "tag": "vless-grpc", 1000 | "server": "$domain_cdn", 1001 | "server_port": $vlessgport, 1002 | "uuid": "$uuid", 1003 | "tls": { 1004 | "enabled": true, 1005 | "utls": { 1006 | "enabled": true, 1007 | "fingerprint": "chrome" 1008 | } 1009 | }, 1010 | "transport": { 1011 | "type": "grpc", 1012 | "service_name": "$domain_cdn" 1013 | }, 1014 | "packet_encoding": "xudp" 1015 | }, 1016 | { 1017 | "type": "vmess", 1018 | "tag": "vmess-sb", 1019 | "server": "$domain", 1020 | "server_port": $vmessport, 1021 | "uuid": "$uuid", 1022 | "security": "auto", 1023 | "tls": { 1024 | "enabled": $tf, 1025 | "server_name": "$domain_cdn", 1026 | "insecure": $tf, 1027 | "utls": { 1028 | "enabled": true, 1029 | "fingerprint": "chrome" 1030 | } 1031 | }, 1032 | "transport": { 1033 | "type": "ws", 1034 | "path": "$uuid", 1035 | "headers": { 1036 | "Host": "$domain_cdn" 1037 | } 1038 | } 1039 | }, 1040 | { 1041 | "type": "hysteria2", 1042 | "tag": "hy2-sb", 1043 | "server": "$domain", 1044 | "server_port": $hyport, 1045 | "obfs": { 1046 | "type": "salamander", 1047 | "password": "$uuid" 1048 | }, 1049 | "password": "$uuid", 1050 | "tls": { 1051 | "enabled": true, 1052 | "server_name": "www.bing.com", 1053 | "insecure": true, 1054 | "alpn": "h3" 1055 | } 1056 | }, 1057 | { 1058 | "type": "tuic", 1059 | "tag": "tuic5-sb", 1060 | "server": "$domain", 1061 | "server_port": $tuicport, 1062 | "uuid": "$uuid", 1063 | "password": "$uuid", 1064 | "congestion_control": "bbr", 1065 | "udp_relay_mode": "native", 1066 | "heartbeat": "10s", 1067 | "tls": { 1068 | "enabled": true, 1069 | "server_name": "www.bing.com", 1070 | "insecure": true, 1071 | "alpn": "h3" 1072 | } 1073 | }, 1074 | { 1075 | "type": "direct", 1076 | "tag": "direct" 1077 | }, 1078 | { 1079 | "type": "block", 1080 | "tag": "block" 1081 | }, 1082 | { 1083 | "type": "dns", 1084 | "tag": "dns-out" 1085 | }, 1086 | { 1087 | "type": "urltest", 1088 | "tag": "auto", 1089 | "outbounds": [ 1090 | "vless-tcp-reality", 1091 | "vless-grpc", 1092 | "vmess-sb", 1093 | "hy2-sb", 1094 | "tuic5-sb" 1095 | ], 1096 | "url": "https://www.gstatic.com/generate_204", 1097 | "interval": "1m0s", 1098 | "tolerance": 50 1099 | } 1100 | ], 1101 | "route": { 1102 | "rules": [ 1103 | { 1104 | "protocol": "dns", 1105 | "outbound": "dns-out" 1106 | }, 1107 | { 1108 | "clash_mode": "Direct", 1109 | "outbound": "direct" 1110 | }, 1111 | { 1112 | "clash_mode": "Global", 1113 | "outbound": "select" 1114 | }, 1115 | { 1116 | "rule_set": "geoip-cn", 1117 | "outbound": "direct" 1118 | }, 1119 | { 1120 | "rule_set": "geosite-cn", 1121 | "outbound": "direct" 1122 | }, 1123 | { 1124 | "ip_is_private": true, 1125 | "outbound": "direct" 1126 | }, 1127 | { 1128 | "rule_set": "geosite-geolocation-!cn", 1129 | "outbound": "select" 1130 | } 1131 | ], 1132 | "rule_set": [ 1133 | { 1134 | "type": "remote", 1135 | "tag": "geosite-geolocation-!cn", 1136 | "format": "binary", 1137 | "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/geolocation-!cn.srs", 1138 | "download_detour": "select", 1139 | "update_interval": "24h0m0s" 1140 | }, 1141 | { 1142 | "type": "remote", 1143 | "tag": "geosite-cn", 1144 | "format": "binary", 1145 | "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/geolocation-cn.srs", 1146 | "download_detour": "select", 1147 | "update_interval": "24h0m0s" 1148 | }, 1149 | { 1150 | "type": "remote", 1151 | "tag": "geoip-cn", 1152 | "format": "binary", 1153 | "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geoip/cn.srs", 1154 | "download_detour": "select", 1155 | "update_interval": "24h0m0s" 1156 | } 1157 | ], 1158 | "final": "select", 1159 | "auto_detect_interface": true 1160 | }, 1161 | "experimental": { 1162 | "cache_file": { 1163 | "enabled": true, 1164 | "path": "cache.db", 1165 | "store_fakeip": true 1166 | }, 1167 | "clash_api": { 1168 | "external_controller": "127.0.0.1:9090", 1169 | "external_ui": "ui", 1170 | "default_mode": "Rule" 1171 | } 1172 | } 1173 | } 1174 | EOL 1175 | } 1176 | 1177 | #config2 1178 | config-sing-boxx() { 1179 | cat </root/peyman/configs/config-sing-box.json 1180 | { 1181 | "log": { 1182 | "level": "info", 1183 | "timestamp": true 1184 | }, 1185 | "dns": { 1186 | "servers": [ 1187 | { 1188 | "tag": "proxydns", 1189 | "address": "tls://8.8.8.8/dns-query", 1190 | "detour": "select" 1191 | }, 1192 | { 1193 | "tag": "localdns", 1194 | "address": "h3://223.5.5.5/dns-query", 1195 | "detour": "direct" 1196 | }, 1197 | { 1198 | "tag": "block", 1199 | "address": "rcode://refused" 1200 | }, 1201 | { 1202 | "tag": "dns_fakeip", 1203 | "address": "fakeip" 1204 | } 1205 | ], 1206 | "rules": [ 1207 | { 1208 | "outbound": "any", 1209 | "server": "localdns", 1210 | "disable_cache": true 1211 | }, 1212 | { 1213 | "clash_mode": "Global", 1214 | "server": "proxydns" 1215 | }, 1216 | { 1217 | "clash_mode": "Direct", 1218 | "server": "localdns" 1219 | }, 1220 | { 1221 | "rule_set": "geosite-cn", 1222 | "server": "localdns" 1223 | }, 1224 | { 1225 | "rule_set": "geosite-geolocation-!cn", 1226 | "server": "proxydns" 1227 | }, 1228 | { 1229 | "query_type": [ 1230 | "A", 1231 | "AAAA" 1232 | ], 1233 | "rule_set": "geosite-geolocation-!cn", 1234 | "server": "dns_fakeip" 1235 | } 1236 | ], 1237 | "final": "proxydns", 1238 | "fakeip": { 1239 | "enabled": true, 1240 | "inet4_range": "198.18.0.0/15", 1241 | "inet6_range": "fc00::/18" 1242 | }, 1243 | "independent_cache": true 1244 | }, 1245 | "ntp": { 1246 | "enabled": true, 1247 | "interval": "30m0s", 1248 | "server": "time.apple.com", 1249 | "server_port": 123, 1250 | "detour": "direct" 1251 | }, 1252 | "inbounds": [ 1253 | { 1254 | "type": "tun", 1255 | "auto_route": true, 1256 | "strict_route": true, 1257 | "sniff": true, 1258 | "sniff_override_destination": true, 1259 | "domain_strategy": "prefer_ipv4", 1260 | "inet4_address": "172.19.0.1/30", 1261 | "inet6_address": "fd00::1/126" 1262 | } 1263 | ], 1264 | "outbounds": [ 1265 | { 1266 | "type": "selector", 1267 | "tag": "select", 1268 | "outbounds": [ 1269 | "auto", 1270 | "vless-tcp-reality", 1271 | "vmess-sb", 1272 | "vmess-ws-+ARGO-Tunnel", 1273 | "hy2-sb", 1274 | "tuic5-sb" 1275 | ], 1276 | "default": "auto" 1277 | }, 1278 | { 1279 | "type": "vless", 1280 | "tag": "vless-tcp-reality", 1281 | "server": "$domain", 1282 | "server_port": $vlessport, 1283 | "uuid": "$uuid", 1284 | "flow": "xtls-rprx-vision", 1285 | "tls": { 1286 | "enabled": true, 1287 | "server_name": "www.yahoo.com", 1288 | "utls": { 1289 | "enabled": true, 1290 | "fingerprint": "chrome" 1291 | }, 1292 | "reality": { 1293 | "enabled": true, 1294 | "public_key": "$public_key", 1295 | "short_id": "$short_id" 1296 | } 1297 | } 1298 | }, 1299 | { 1300 | "type": "vmess", 1301 | "tag": "vmess-sb", 1302 | "server": "$domain", 1303 | "server_port": $vmessport, 1304 | "uuid": "$uuid", 1305 | "security": "auto", 1306 | "tls": { 1307 | "server_name": "$domain", 1308 | "insecure": true, 1309 | "utls": { 1310 | "enabled": true, 1311 | "fingerprint": "chrome" 1312 | } 1313 | }, 1314 | "transport": { 1315 | "type": "ws", 1316 | "path": "$uuid", 1317 | "headers": { 1318 | "Host": "$domain" 1319 | } 1320 | } 1321 | }, 1322 | { 1323 | "type": "vmess", 1324 | "tag": "vmess-ws-+ARGO-Tunnel", 1325 | "server": "104.31.16.60", 1326 | "server_port": 443, 1327 | "uuid": "$uuid", 1328 | "security": "auto", 1329 | "tls": { 1330 | "enabled": true, 1331 | "server_name": "$link", 1332 | "utls": { 1333 | "enabled": true, 1334 | "fingerprint": "chrome" 1335 | } 1336 | }, 1337 | "transport": { 1338 | "type": "ws", 1339 | "path": "$uuid", 1340 | "headers": { 1341 | "Host": "$link" 1342 | } 1343 | } 1344 | }, 1345 | { 1346 | "type": "hysteria2", 1347 | "tag": "hy2-sb", 1348 | "server": "$domain", 1349 | "server_port": $hyport, 1350 | "obfs": { 1351 | "type": "salamander", 1352 | "password": "$uuid" 1353 | }, 1354 | "password": "$uuid", 1355 | "tls": { 1356 | "enabled": true, 1357 | "server_name": "www.bing.com", 1358 | "insecure": true, 1359 | "alpn": "h3" 1360 | } 1361 | }, 1362 | { 1363 | "type": "tuic", 1364 | "tag": "tuic5-sb", 1365 | "server": "$domain", 1366 | "server_port": $tuicport, 1367 | "uuid": "$uuid", 1368 | "password": "$uuid", 1369 | "congestion_control": "bbr", 1370 | "udp_relay_mode": "native", 1371 | "heartbeat": "10s", 1372 | "tls": { 1373 | "enabled": true, 1374 | "server_name": "www.bing.com", 1375 | "insecure": true, 1376 | "alpn": "h3" 1377 | } 1378 | }, 1379 | { 1380 | "type": "direct", 1381 | "tag": "direct" 1382 | }, 1383 | { 1384 | "type": "block", 1385 | "tag": "block" 1386 | }, 1387 | { 1388 | "type": "dns", 1389 | "tag": "dns-out" 1390 | }, 1391 | { 1392 | "type": "urltest", 1393 | "tag": "auto", 1394 | "outbounds": [ 1395 | "vless-tcp-reality", 1396 | "vmess-sb", 1397 | "vmess-ws-+ARGO-Tunnel", 1398 | "hy2-sb", 1399 | "tuic5-sb" 1400 | ], 1401 | "url": "https://www.gstatic.com/generate_204", 1402 | "interval": "1m0s", 1403 | "tolerance": 50 1404 | } 1405 | ], 1406 | "route": { 1407 | "rules": [ 1408 | { 1409 | "protocol": "dns", 1410 | "outbound": "dns-out" 1411 | }, 1412 | { 1413 | "clash_mode": "Direct", 1414 | "outbound": "direct" 1415 | }, 1416 | { 1417 | "clash_mode": "Global", 1418 | "outbound": "select" 1419 | }, 1420 | { 1421 | "rule_set": "geoip-cn", 1422 | "outbound": "direct" 1423 | }, 1424 | { 1425 | "rule_set": "geosite-cn", 1426 | "outbound": "direct" 1427 | }, 1428 | { 1429 | "ip_is_private": true, 1430 | "outbound": "direct" 1431 | }, 1432 | { 1433 | "rule_set": "geosite-geolocation-!cn", 1434 | "outbound": "select" 1435 | } 1436 | ], 1437 | "rule_set": [ 1438 | { 1439 | "type": "remote", 1440 | "tag": "geosite-geolocation-!cn", 1441 | "format": "binary", 1442 | "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/geolocation-!cn.srs", 1443 | "download_detour": "select", 1444 | "update_interval": "24h0m0s" 1445 | }, 1446 | { 1447 | "type": "remote", 1448 | "tag": "geosite-cn", 1449 | "format": "binary", 1450 | "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/geolocation-cn.srs", 1451 | "download_detour": "select", 1452 | "update_interval": "24h0m0s" 1453 | }, 1454 | { 1455 | "type": "remote", 1456 | "tag": "geoip-cn", 1457 | "format": "binary", 1458 | "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geoip/cn.srs", 1459 | "download_detour": "select", 1460 | "update_interval": "24h0m0s" 1461 | } 1462 | ], 1463 | "final": "select", 1464 | "auto_detect_interface": true 1465 | }, 1466 | "experimental": { 1467 | "cache_file": { 1468 | "enabled": true, 1469 | "path": "cache.db", 1470 | "store_fakeip": true 1471 | }, 1472 | "clash_api": { 1473 | "external_controller": "127.0.0.1:9090", 1474 | "external_ui": "ui", 1475 | "default_mode": "Rule" 1476 | } 1477 | } 1478 | } 1479 | EOL 1480 | } 1481 | 1482 | config-nekobox() { 1483 | cat </root/peyman/configs/config-nekobox.json 1484 | { 1485 | "dns": { 1486 | "independent_cache": true, 1487 | "rules": [ 1488 | { 1489 | "domain": [ 1490 | "$domain" 1491 | ], 1492 | "server": "dns-direct" 1493 | } 1494 | ], 1495 | "servers": [ 1496 | { 1497 | "address": "https://1.1.1.1/dns-query", 1498 | "address_resolver": "dns-direct", 1499 | "strategy": "ipv4_only", 1500 | "tag": "dns-remote" 1501 | }, 1502 | { 1503 | "address": "local", 1504 | "address_resolver": "dns-local", 1505 | "detour": "direct", 1506 | "strategy": "ipv4_only", 1507 | "tag": "dns-direct" 1508 | }, 1509 | { 1510 | "address": "local", 1511 | "detour": "direct", 1512 | "tag": "dns-local" 1513 | }, 1514 | { 1515 | "address": "rcode://success", 1516 | "tag": "dns-block" 1517 | } 1518 | ] 1519 | }, 1520 | "experimental": { 1521 | "clash_api": { 1522 | "cache_file": "../cache/clash.db", 1523 | "external_controller": "127.0.0.1:9090", 1524 | "external_ui": "../files/yacd" 1525 | } 1526 | }, 1527 | "inbounds": [ 1528 | { 1529 | "listen": "127.0.0.1", 1530 | "listen_port": 6450, 1531 | "override_address": "8.8.8.8", 1532 | "override_port": 53, 1533 | "tag": "dns-in", 1534 | "type": "direct" 1535 | }, 1536 | { 1537 | "domain_strategy": "", 1538 | "endpoint_independent_nat": true, 1539 | "inet4_address": [ 1540 | "172.19.0.1/28" 1541 | ], 1542 | "mtu": 9000, 1543 | "sniff": true, 1544 | "sniff_override_destination": false, 1545 | "stack": "mixed", 1546 | "tag": "tun-in", 1547 | "type": "tun" 1548 | }, 1549 | { 1550 | "domain_strategy": "", 1551 | "listen": "127.0.0.1", 1552 | "listen_port": 2080, 1553 | "sniff": true, 1554 | "sniff_override_destination": false, 1555 | "tag": "mixed-in", 1556 | "type": "mixed" 1557 | } 1558 | ], 1559 | "log": { 1560 | "level": "panic" 1561 | }, 1562 | "outbounds": [ 1563 | { 1564 | "alter_id": 0, 1565 | "packet_encoding": "", 1566 | "security": "auto", 1567 | "server": "$domain", 1568 | "server_port": $vmessport, 1569 | "tls": { 1570 | "enabled": true, 1571 | "insecure": false, 1572 | "server_name": "$domain" 1573 | }, 1574 | "transport": { 1575 | "headers": { 1576 | "Host": "$domain" 1577 | }, 1578 | "path": "$uuid", 1579 | "type": "ws" 1580 | }, 1581 | "uuid": "$uuid", 1582 | "type": "vmess", 1583 | "domain_strategy": "", 1584 | "tag": "vmess-ws-tls" 1585 | }, 1586 | { 1587 | "tag": "direct", 1588 | "type": "direct" 1589 | }, 1590 | { 1591 | "flow": "xtls-rprx-vision", 1592 | "packet_encoding": "", 1593 | "server": "$domain", 1594 | "server_port": $vlessport, 1595 | "tls": { 1596 | "enabled": true, 1597 | "insecure": false, 1598 | "reality": { 1599 | "enabled": true, 1600 | "public_key": "$public_key", 1601 | "short_id": "$short_id" 1602 | }, 1603 | "server_name": "www.yahoo.com", 1604 | "utls": { 1605 | "enabled": true, 1606 | "fingerprint": "chrome" 1607 | } 1608 | }, 1609 | "uuid": "$uuid", 1610 | "type": "vless", 1611 | "domain_strategy": "", 1612 | "tag": "Vless-reality" 1613 | }, 1614 | { 1615 | "packet_encoding": "", 1616 | "server": "$domain_cdn", 1617 | "server_port": $vlessgport, 1618 | "tls": { 1619 | "alpn": [ 1620 | "h2" 1621 | ], 1622 | "enabled": true, 1623 | "insecure": false, 1624 | "server_name": "$domain_cdn", 1625 | "utls": { 1626 | "enabled": true, 1627 | "fingerprint": "chrome" 1628 | } 1629 | }, 1630 | "transport": { 1631 | "service_name": "$domain_cdn", 1632 | "type": "grpc" 1633 | }, 1634 | "uuid": "$uuid", 1635 | "type": "vless", 1636 | "domain_strategy": "", 1637 | "tag": "Vless-Grpc-tls" 1638 | }, 1639 | { 1640 | "congestion_control": "bbr", 1641 | "password": "$uuid", 1642 | "server": "$domain", 1643 | "server_port": $tuicport, 1644 | "tls": { 1645 | "alpn": [ 1646 | "h3" 1647 | ], 1648 | "disable_sni": false, 1649 | "enabled": true, 1650 | "insecure": false, 1651 | "server_name": "$domain" 1652 | }, 1653 | "uuid": "$uuid", 1654 | "zero_rtt_handshake": false, 1655 | "type": "tuic", 1656 | "domain_strategy": "", 1657 | "tag": "TUIC5" 1658 | }, 1659 | { 1660 | "down_mbps": 0, 1661 | "hop_interval": 10, 1662 | "password": "$uuid", 1663 | "server": "$domain", 1664 | "server_port": $hyport, 1665 | "tls": { 1666 | "alpn": [ 1667 | "h3" 1668 | ], 1669 | "enabled": true, 1670 | "insecure": false, 1671 | "server_name": "$domain" 1672 | }, 1673 | "up_mbps": 0, 1674 | "type": "hysteria2", 1675 | "domain_strategy": "", 1676 | "tag": "HYSTERIA2" 1677 | }, 1678 | { 1679 | "tag": "💚Internet💚", 1680 | "type": "selector", 1681 | "outbounds":[ 1682 | "❤️Best Latency❤️", 1683 | "Vless-reality", 1684 | "TUIC5", 1685 | "HYSTERIA2", 1686 | "Vless-Grpc-tls", 1687 | "vmess-ws-tls" 1688 | ] 1689 | }, 1690 | { 1691 | "tag": "❤️Best Latency❤️", 1692 | "type": "urltest", 1693 | "outbounds":[ 1694 | "Vless-reality", 1695 | "TUIC5", 1696 | "HYSTERIA2", 1697 | "Vless-Grpc-tls", 1698 | "vmess-ws-tls" 1699 | ], 1700 | "url": "https://detectportal.firefox.com/success.txt", 1701 | "interval": "60s", 1702 | "tolerance": 0 1703 | }, 1704 | { 1705 | "tag": "bypass", 1706 | "type": "direct" 1707 | }, 1708 | { 1709 | "tag": "block", 1710 | "type": "block" 1711 | }, 1712 | { 1713 | "tag": "dns-out", 1714 | "type": "dns" 1715 | } 1716 | ], 1717 | "route": { 1718 | "auto_detect_interface": true, 1719 | "rules": [ 1720 | { 1721 | "outbound": "dns-out", 1722 | "port": [ 1723 | 53 1724 | ] 1725 | }, 1726 | { 1727 | "inbound": [ 1728 | "dns-in" 1729 | ], 1730 | "outbound": "dns-out" 1731 | }, 1732 | { 1733 | "ip_cidr": [ 1734 | "224.0.0.0/3", 1735 | "ff00::/8" 1736 | ], 1737 | "outbound": "block", 1738 | "source_ip_cidr": [ 1739 | "224.0.0.0/3", 1740 | "ff00::/8" 1741 | ] 1742 | } 1743 | ] 1744 | } 1745 | } 1746 | EOL 1747 | } 1748 | 1749 | config-nekoboxx() { 1750 | cat </root/peyman/configs/config-nekobox.json 1751 | { 1752 | "dns": { 1753 | "independent_cache": true, 1754 | "rules": [ 1755 | { 1756 | "domain": [ 1757 | "dns.google" 1758 | ], 1759 | "server": "dns-direct" 1760 | } 1761 | ], 1762 | "servers": [ 1763 | { 1764 | "address": "https://dns.google/dns-query", 1765 | "address_resolver": "dns-direct", 1766 | "strategy": "ipv4_only", 1767 | "tag": "dns-remote" 1768 | }, 1769 | { 1770 | "address": "local", 1771 | "address_resolver": "dns-local", 1772 | "detour": "direct", 1773 | "strategy": "ipv4_only", 1774 | "tag": "dns-direct" 1775 | }, 1776 | { 1777 | "address": "local", 1778 | "detour": "direct", 1779 | "tag": "dns-local" 1780 | }, 1781 | { 1782 | "address": "rcode://success", 1783 | "tag": "dns-block" 1784 | } 1785 | ] 1786 | }, 1787 | "experimental": { 1788 | "clash_api": { 1789 | "cache_file": "../cache/clash.db", 1790 | "external_controller": "127.0.0.1:9090", 1791 | "external_ui": "../files/yacd" 1792 | } 1793 | }, 1794 | "inbounds": [ 1795 | { 1796 | "listen": "127.0.0.1", 1797 | "listen_port": 6450, 1798 | "override_address": "8.8.8.8", 1799 | "override_port": 53, 1800 | "tag": "dns-in", 1801 | "type": "direct" 1802 | }, 1803 | { 1804 | "domain_strategy": "", 1805 | "endpoint_independent_nat": true, 1806 | "inet4_address": [ 1807 | "172.19.0.1/28" 1808 | ], 1809 | "mtu": 9000, 1810 | "sniff": true, 1811 | "sniff_override_destination": false, 1812 | "stack": "mixed", 1813 | "tag": "tun-in", 1814 | "type": "tun" 1815 | }, 1816 | { 1817 | "domain_strategy": "", 1818 | "listen": "127.0.0.1", 1819 | "listen_port": 2080, 1820 | "sniff": true, 1821 | "sniff_override_destination": false, 1822 | "tag": "mixed-in", 1823 | "type": "mixed" 1824 | } 1825 | ], 1826 | "log": { 1827 | "level": "panic" 1828 | }, 1829 | "outbounds": [ 1830 | { 1831 | "flow": "xtls-rprx-vision", 1832 | "packet_encoding": "", 1833 | "server": "$domain", 1834 | "server_port": $vlessport, 1835 | "tls": { 1836 | "enabled": true, 1837 | "insecure": false, 1838 | "reality": { 1839 | "enabled": true, 1840 | "public_key": "$public_key", 1841 | "short_id": "$short_id" 1842 | }, 1843 | "server_name": "www.yahoo.com", 1844 | "utls": { 1845 | "enabled": true, 1846 | "fingerprint": "chrome" 1847 | } 1848 | }, 1849 | "uuid": "$uuid", 1850 | "type": "vless", 1851 | "domain_strategy": "", 1852 | "tag": "Vless-reality" 1853 | }, 1854 | { 1855 | "congestion_control": "bbr", 1856 | "password": "$uuid", 1857 | "server": "$domain", 1858 | "server_port": $tuicport, 1859 | "tls": { 1860 | "alpn": [ 1861 | "h3" 1862 | ], 1863 | "disable_sni": false, 1864 | "enabled": true, 1865 | "insecure": true, 1866 | "server_name": "www.bing.com" 1867 | }, 1868 | "uuid": "$uuid", 1869 | "zero_rtt_handshake": false, 1870 | "type": "tuic", 1871 | "domain_strategy": "", 1872 | "tag": "TUIC5" 1873 | }, 1874 | { 1875 | "down_mbps": 0, 1876 | "hop_interval": 10, 1877 | "password": "$uuid", 1878 | "server": "$domain", 1879 | "server_port": $hyport, 1880 | "tls": { 1881 | "alpn": [ 1882 | "h3" 1883 | ], 1884 | "enabled": true, 1885 | "insecure": true, 1886 | "server_name": "www.bing.com" 1887 | }, 1888 | "up_mbps": 0, 1889 | "type": "hysteria2", 1890 | "domain_strategy": "", 1891 | "tag": "HYSTERIA2" 1892 | }, 1893 | { 1894 | "alter_id": 0, 1895 | "packet_encoding": "", 1896 | "security": "auto", 1897 | "server": "$domain", 1898 | "server_port": $vmessport, 1899 | "transport": { 1900 | "headers": { 1901 | "Host": "www.bing.com" 1902 | }, 1903 | "path": "$uuid", 1904 | "type": "ws" 1905 | }, 1906 | "uuid": "$uuid", 1907 | "type": "vmess", 1908 | "domain_strategy": "", 1909 | "tag": "vmess-ws" 1910 | }, 1911 | { 1912 | "alter_id": 0, 1913 | "packet_encoding": "", 1914 | "security": "auto", 1915 | "server": "104.31.16.60", 1916 | "server_port": 443, 1917 | "tls": { 1918 | "enabled": true, 1919 | "insecure": false, 1920 | "server_name": "$link" 1921 | }, 1922 | "transport": { 1923 | "headers": { 1924 | "Host": "$link" 1925 | }, 1926 | "path": "$uuid", 1927 | "type": "ws" 1928 | }, 1929 | "uuid": "$uuid", 1930 | "type": "vmess", 1931 | "domain_strategy": "", 1932 | "tag": "vmess-ws-+ARGO-Tunnel" 1933 | }, 1934 | { 1935 | "tag": "💚Internet💚", 1936 | "type": "selector", 1937 | "outbounds":[ 1938 | "❤️Best Latency❤️", 1939 | "Vless-reality", 1940 | "TUIC5", 1941 | "HYSTERIA2", 1942 | "vmess-ws", 1943 | "vmess-ws-+ARGO-Tunnel" 1944 | ] 1945 | }, 1946 | { 1947 | "tag": "❤️Best Latency❤️", 1948 | "type": "urltest", 1949 | "outbounds":[ 1950 | "Vless-reality", 1951 | "TUIC5", 1952 | "HYSTERIA2", 1953 | "vmess-ws", 1954 | "vmess-ws-+ARGO-Tunnel" 1955 | ], 1956 | "url": "https://detectportal.firefox.com/success.txt", 1957 | "interval": "60s", 1958 | "tolerance": 0 1959 | }, 1960 | { 1961 | "tag": "direct", 1962 | "type": "direct" 1963 | }, 1964 | { 1965 | "tag": "bypass", 1966 | "type": "direct" 1967 | }, 1968 | { 1969 | "tag": "block", 1970 | "type": "block" 1971 | }, 1972 | { 1973 | "tag": "dns-out", 1974 | "type": "dns" 1975 | } 1976 | ], 1977 | "route": { 1978 | "auto_detect_interface": true, 1979 | "rules": [ 1980 | { 1981 | "outbound": "dns-out", 1982 | "port": [ 1983 | 53 1984 | ] 1985 | }, 1986 | { 1987 | "inbound": [ 1988 | "dns-in" 1989 | ], 1990 | "outbound": "dns-out" 1991 | }, 1992 | { 1993 | "ip_cidr": [ 1994 | "224.0.0.0/3", 1995 | "ff00::/8" 1996 | ], 1997 | "outbound": "block", 1998 | "source_ip_cidr": [ 1999 | "224.0.0.0/3", 2000 | "ff00::/8" 2001 | ] 2002 | } 2003 | ] 2004 | } 2005 | } 2006 | EOL 2007 | } 2008 | 2009 | #check_status 2010 | check_status() { 2011 | if sudo systemctl is-active --quiet s-box.service; then 2012 | echo -e "${yellow}Sing-Box is:${green} [running ✔]${rest}" 2013 | else 2014 | echo -e "${yellow}Sing-Box is:${red} [Not running ✗ ]${rest}" 2015 | fi 2016 | } 2017 | 2018 | # Main menu 2019 | menu() { 2020 | clear 2021 | echo "By --> Peyman * Github.com/Ptechgithub * " 2022 | echo "" 2023 | echo "-- VLESS --VMESS --TUIC-- HYSTERIA2-- ARGO--" 2024 | check_status 2025 | echo -e "${green} --------${rest}#-${purple} Sing-Box ${rest}-#${green}--------${rest}" 2026 | echo -e "${purple}1)${rest} Install" 2027 | echo -e "${purple}2)${rest} Uninstall" 2028 | echo -e "${purple}3)${rest} Options" 2029 | echo -e "${red}0)${rest} Exit" 2030 | echo -e "${cyan}Enter your choice${rest} : \c" 2031 | read choice 2032 | 2033 | case $choice in 2034 | 1) 2035 | install 2036 | ;; 2037 | 2) 2038 | uninstall 2039 | ;; 2040 | 3) 2041 | options 2042 | ;; 2043 | 0) 2044 | exit 0 2045 | ;; 2046 | *) 2047 | echo "Invalid choice. Please select a valid option." 2048 | ;; 2049 | esac 2050 | } 2051 | 2052 | show_files() { 2053 | files=("/root/peyman/configs/vless_config.txt" 2054 | "/root/peyman/configs/vmess_config.txt" 2055 | "/root/peyman/configs/tuic_config.txt" 2056 | "/root/peyman/configs/hysteria2_config.txt" 2057 | "/root/peyman/configs/vmess_Argo_config.txt" 2058 | "/root/peyman/configs/vless_grpc_config.txt") 2059 | 2060 | for file in "${files[@]}"; do 2061 | if [ -e "$file" ]; then 2062 | echo -e "${purple}~~~~~~~~~~~~~~~~~${rest}" 2063 | cat "$file" 2064 | echo -e "${purple}~~~~~~~~~~~~~~~~~${rest}" 2065 | fi 2066 | done 2067 | } 2068 | 2069 | options() { 2070 | clear 2071 | 2072 | echo"" 2073 | echo -e "${purple}1)${rest} Show Argo Host" 2074 | echo -e "${purple}2)${rest} Show All Configs" 2075 | echo -e "${purple}3)${rest} Change Vless SNI" 2076 | echo -e "${red}0)${rest} Back to Menu" 2077 | echo -e "${cyan}Enter your choice${rest} : \c" 2078 | read choice 2079 | 2080 | case $choice in 2081 | 1) 2082 | argo_host 2083 | ;; 2084 | 2) 2085 | show_files 2086 | ;; 2087 | 3) 2088 | update_vless_sni 2089 | ;; 2090 | 0) 2091 | menu 2092 | ;; 2093 | *) 2094 | echo "Invalid choice. Returning to the menu." 2095 | menu 2096 | ;; 2097 | esac 2098 | } 2099 | 2100 | #change sni 2101 | update_vless_sni() { 2102 | if [ -f "/etc/s-box/sb.json" ] && systemctl is-active --quiet s-box.service; then 2103 | read -p "Enter the new SNI (use: www --> www.yahoo.com): " new_sni 2104 | sed -i "/\"type\": \"vless\"/,/\"type\":/s/\"server\": \".*\"/\"server\": \"$new_sni\"/" /etc/s-box/sb.json 2105 | sed -i "/\"type\": \"vless\"/,/\"type\":/s/\"server_name\": \".*\"/\"server_name\": \"$new_sni\"/" /etc/s-box/sb.json 2106 | sed -i "s/sni=[^\&]*/sni=$new_sni/" /root/peyman/configs/vless_config.txt 2107 | systemctl stop s-box.service 2108 | systemctl start s-box.service 2109 | echo "SNI updated successfully! to $new_sni" 2110 | else 2111 | echo -e "${red}Error:${rest}Service is not Installed" 2112 | fi 2113 | } 2114 | 2115 | #show new argo host after reboot server 2116 | argo_host() { 2117 | if [ -f "/etc/s-box/argo.log" ] && systemctl is-active --quiet s-box.service; then 2118 | echo -e "${purple}Change your Argo Host to below link: ${rest}" 2119 | echo "---------------------------------------------" 2120 | echo -e "${yellow}$(grep -o 'https://.*trycloudflare.com' /etc/s-box/argo.log | sed 's/https:\/\///')${rest}" 2121 | echo "----------------------------------------------" 2122 | else 2123 | echo -e "${red}Error:${rest}The file '/etc/s-box/argo.log' doesn't exist or the service is not Installed" 2124 | fi 2125 | } 2126 | 2127 | menu 2128 | --------------------------------------------------------------------------------