├── LICENSE ├── README.md ├── Termux.sh └── install.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Peyman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Go Simple Tunnel (Gost) 2 | 3 | 4 | ## install 5 | ``` 6 | bash <(curl -fsSl https://raw.githubusercontent.com/Ptechgithub/Gost/main/install.sh) 7 | ``` 8 | ![5](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/5.jpg) 9 | 10 | - در روش اول فقط نیاز به اجرا روی سرور داخلی(ایران) دارید. 11 | - باقی روش ها روی هردو سرور ( داخلی - خارجی ) اجرا کنید. 12 | 13 | - support tcp & udp 14 | - kcp 15 | - wss 16 | - quic 17 | - ... 18 | 19 | ## Gost in Termux (No root) 20 | 21 | ``` 22 | bash <(curl -fsSl https://raw.githubusercontent.com/Ptechgithub/Gost/main/Termux.sh) 23 | ``` 24 | ![7](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/7.jpg) -------------------------------------------------------------------------------- /Termux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | check_dependencies() { 4 | local dependencies=("wget" "curl" "proot-distro") 5 | 6 | for dep in "${dependencies[@]}"; do 7 | if ! command -v "${dep}" &> /dev/null; then 8 | echo "${dep} is not installed. Installing..." 9 | pkg install "${dep}" -y 10 | fi 11 | done 12 | } 13 | 14 | step1() { 15 | # Update the system and install required packages 16 | pkg update -y 17 | pkg upgrade -y 18 | pkg update 19 | check_dependencies 20 | proot-distro install debian 21 | clear 22 | proot-distro login debian 23 | } 24 | 25 | step2() { 26 | apt update -y 27 | apt upgrade -y 28 | apt install sudo -y 29 | apt install nano -y 30 | apt install wget -y 31 | wget https://github.com/ginuerzh/gost/releases/download/v2.11.5/gost-linux-armv6-2.11.5.gz 32 | gunzip gost-linux-armv6-2.11.5.gz 33 | mv gost-linux-armv6-2.11.5 gost 34 | chmod +x gost 35 | } 36 | 37 | step3() { 38 | clear 39 | read -p "Enter your Config (vpn) Port :" config_port 40 | read -p "Enter your server IP :" ip 41 | read -p "Please Enter servers connection Port :" connection_port 42 | read -p "Enter 'udp' for UDP connection (default is: tcp): " connection_type 43 | connection_type=${connection_type:-tcp} 44 | read -p "Enter your protocol (example: relay+wss) [default : relay] : " protocol 45 | protocol=${protocol:-relay} 46 | echo "Tunnel is established at :127.0.0.1:$config_port" 47 | ./gost -L $connection_type://:$config_port/127.0.0.1:$config_port -F $protocol://$ip:$connection_port 48 | } 49 | 50 | login() { 51 | clear 52 | proot-distro login debian 53 | } 54 | 55 | 56 | clear 57 | echo "By 2--> Peyman * Github.com/Ptechgithub * " 58 | echo "" 59 | echo "-----Gost Tunnel in Termux----" 60 | echo "Select an option:" 61 | echo "" 62 | echo "1) step 1 [install debian]" 63 | echo "2) Step 2 [install Gost]" 64 | echo "3) Step 3 [Run Gost Tunnel]" 65 | echo "-----------------------------" 66 | echo "4) Login again as root" 67 | echo "0) Exit" 68 | read -p "Enter your choice: " choice 69 | case "$choice" in 70 | 1) 71 | step1 72 | ;; 73 | 2) 74 | step2 75 | ;; 76 | 3) 77 | step3 78 | ;; 79 | 4) 80 | login 81 | ;; 82 | 0) 83 | exit 84 | ;; 85 | *) 86 | echo "Invalid choice. Please select a valid option." 87 | ;; 88 | esac 89 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check if running as root 4 | root_access() { 5 | # Check if the script is running as root 6 | if [ "$EUID" -ne 0 ]; then 7 | echo "Please run as root." 8 | exit 1 9 | fi 10 | } 11 | 12 | # Detect Linux distribution 13 | detect_distribution() { 14 | local supported_distributions=("ubuntu" "debian" "centos" "fedora") 15 | 16 | if [ -f /etc/os-release ]; then 17 | source /etc/os-release 18 | if [[ "${ID}" = "ubuntu" || "${ID}" = "debian" || "${ID}" = "centos" || "${ID}" = "fedora" ]]; then 19 | package_manager="apt-get" 20 | [ "${ID}" = "centos" ] && package_manager="yum" 21 | [ "${ID}" = "fedora" ] && package_manager="dnf" 22 | else 23 | echo "Unsupported distribution!" 24 | exit 1 25 | fi 26 | else 27 | echo "Unsupported distribution!" 28 | exit 1 29 | fi 30 | } 31 | 32 | #Check dependencies 33 | check_dependencies() { 34 | root_access 35 | detect_distribution 36 | local dependencies=("wget" "nano" "gunzip") 37 | 38 | for dep in "${dependencies[@]}"; do 39 | if ! command -v "${dep}" &> /dev/null; then 40 | echo "${dep} is not installed. Installing..." 41 | sudo "${package_manager}" install "${dep}" -y 42 | fi 43 | done 44 | } 45 | 46 | #Check installed service 47 | check_installed() { 48 | if [ -f "/etc/systemd/system/gost.service" ]; then 49 | echo "The service is already installed." 50 | exit 1 51 | fi 52 | } 53 | 54 | #Install gost 55 | install_gost() { 56 | check_installed 57 | check_dependencies 58 | wget https://github.com/ginuerzh/gost/releases/download/v2.11.5/gost-linux-amd64-2.11.5.gz 59 | gunzip gost-linux-amd64-2.11.5.gz 60 | sudo mv gost-linux-amd64-2.11.5 /usr/local/bin/gost 61 | sudo chmod +x /usr/local/bin/gost 62 | 63 | } 64 | 65 | #get inputs for 1 66 | get_inputs1() { 67 | read -p "Enter foreign IP [External-ip] : " foreign_ip 68 | read -p "Enter Iran Port [Internal-port] :" port 69 | read -p "Enter Config Port [External-port] :" configport 70 | read -p "Enter 'udp' for UDP connection (default is: tcp): " connection_type 71 | connection_type=${connection_type:-tcp} 72 | argument="-L $connection_type://:$port/$foreign_ip:$configport" 73 | 74 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 75 | while [ "$add_more_ports" == "yes" ]; do 76 | read -p "Please enter additional config port(s) separated by commas (e.g., 2087,2095): " additional_config_ports 77 | IFS=',' read -r -a ports_array <<< "$additional_config_ports" 78 | for new_port in "${ports_array[@]}"; do 79 | argument="-L $connection_type://:$new_port/$foreign_ip:$new_port $argument" 80 | done 81 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 82 | done 83 | 84 | cd /etc/systemd/system 85 | 86 | cat <> gost.service 87 | [Unit] 88 | Description=GO Simple Tunnel 89 | After=network.target 90 | Wants=network.target 91 | 92 | [Service] 93 | Type=simple 94 | ExecStart=/usr/local/bin/gost $argument 95 | 96 | [Install] 97 | WantedBy=multi-user.target 98 | EOL 99 | 100 | sudo systemctl daemon-reload 101 | sudo systemctl enable gost.service 102 | sudo systemctl start gost.service 103 | } 104 | 105 | #install 106 | install() { 107 | install_gost 108 | get_inputs1 109 | } 110 | 111 | #get inputs for 2 112 | get_inputs2() { 113 | read -p "Which server do you want to use? (Enter '1' for Iran[Internal] or '2' for Foreign[External] ) : " server_choice 114 | if [ "$server_choice" == "1" ]; then 115 | read -p "Enter foreign IP [External-ip] : " foreign_ip 116 | read -p "Please Enter servers connection Port : " port 117 | read -p "Please Enter your Config Port : " config_port 118 | read -p "Enter 'udp' for UDP connection (default is: tcp): " connection_type 119 | connection_type=${connection_type:-tcp} 120 | argument="-L $connection_type://:$config_port/127.0.0.1:$config_port -F relay+kcp://$foreign_ip:$port" 121 | 122 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 123 | while [ "$add_more_ports" == "yes" ]; do 124 | read -p "Please enter additional config port(s) separated by commas (e.g., 2087,2095): " additional_config_ports 125 | IFS=',' read -r -a ports_array <<< "$additional_config_ports" 126 | for new_port in "${ports_array[@]}"; do 127 | argument="-L $connection_type://:$new_port/127.0.0.1:$new_port $argument" 128 | done 129 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 130 | done 131 | 132 | elif [ "$server_choice" == "2" ]; then 133 | read -p "Enter servers connection Port : " port 134 | argument="-L relay+kcp://:$port" 135 | else 136 | echo "Invalid choice. Please enter '1' or '2'." 137 | exit 1 138 | fi 139 | 140 | cd /etc/systemd/system 141 | 142 | cat <> gost.service 143 | [Unit] 144 | Description=GO Simple Tunnel 145 | After=network.target 146 | Wants=network.target 147 | 148 | [Service] 149 | Type=simple 150 | ExecStart=/usr/local/bin/gost $argument 151 | 152 | [Install] 153 | WantedBy=multi-user.target 154 | EOL 155 | 156 | sudo systemctl daemon-reload 157 | sudo systemctl enable gost.service 158 | sudo systemctl start gost.service 159 | } 160 | 161 | #install kcp 162 | install_kcp() { 163 | install_gost 164 | get_inputs2 165 | } 166 | 167 | #get inputs for 3 168 | get_inputs3() { 169 | read -p "Which server do you want to use? (Enter '1' for Iran[Internal] or '2' for Foreign[External] ) : " server_choice 170 | if [ "$server_choice" == "1" ]; then 171 | read -p "Enter foreign IP [External-ip] : " foreign_ip 172 | read -p "Please Enter servers connection Port : " port 173 | read -p "Please Enter your Config Port : " config_port 174 | read -p "Enter 'udp' for UDP connection (default is: tcp): " connection_type 175 | connection_type=${connection_type:-tcp} 176 | argument="-L $connection_type://:$config_port/127.0.0.1:$config_port -F relay+wss://$foreign_ip:$port" 177 | 178 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 179 | while [ "$add_more_ports" == "yes" ]; do 180 | read -p "Please enter additional config port(s) separated by commas (e.g., 2087,2095): " additional_config_ports 181 | IFS=',' read -r -a ports_array <<< "$additional_config_ports" 182 | for new_port in "${ports_array[@]}"; do 183 | argument="-L $connection_type://:$new_port/127.0.0.1:$new_port $argument" 184 | done 185 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 186 | done 187 | 188 | elif [ "$server_choice" == "2" ]; then 189 | read -p "Enter servers connection Port : " port 190 | argument="-L relay+wss://:$port" 191 | else 192 | echo "Invalid choice. Please enter '1' or '2'." 193 | exit 1 194 | fi 195 | 196 | cd /etc/systemd/system 197 | 198 | cat <> gost.service 199 | [Unit] 200 | Description=GO Simple Tunnel 201 | After=network.target 202 | Wants=network.target 203 | 204 | [Service] 205 | Type=simple 206 | ExecStart=/usr/local/bin/gost $argument 207 | 208 | [Install] 209 | WantedBy=multi-user.target 210 | EOL 211 | 212 | sudo systemctl daemon-reload 213 | sudo systemctl enable gost.service 214 | sudo systemctl start gost.service 215 | } 216 | 217 | #install wss 218 | install_wss() { 219 | install_gost 220 | get_inputs3 221 | } 222 | 223 | #get inputs for 4 224 | get_inputs4() { 225 | read -p "Which server do you want to use? (Enter '1' for Iran[Internal] or '2' for Foreign[External] ) : " server_choice 226 | if [ "$server_choice" == "1" ]; then 227 | read -p "Enter foreign IP [External-ip] : " foreign_ip 228 | read -p "Please Enter servers connection Port : " port 229 | read -p "Please Enter your Config Port : " config_port 230 | read -p "Enter 'udp' for UDP connection (default is: tcp): " connection_type 231 | connection_type=${connection_type:-tcp} 232 | argument="-L $connection_type://:$config_port/127.0.0.1:$config_port -F relay://$foreign_ip:$port" 233 | 234 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 235 | while [ "$add_more_ports" == "yes" ]; do 236 | read -p "Please enter additional config port(s) separated by commas (e.g., 2087,2095): " additional_config_ports 237 | IFS=',' read -r -a ports_array <<< "$additional_config_ports" 238 | for new_port in "${ports_array[@]}"; do 239 | argument="-L $connection_type://:$new_port/127.0.0.1:$new_port $argument" 240 | done 241 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 242 | done 243 | 244 | elif [ "$server_choice" == "2" ]; then 245 | read -p "Enter servers connection Port : " port 246 | argument="-L relay://:$port" 247 | 248 | else 249 | echo "Invalid choice. Please enter '1' or '2'." 250 | exit 1 251 | fi 252 | 253 | cd /etc/systemd/system 254 | 255 | cat <> gost.service 256 | [Unit] 257 | Description=GO Simple Tunnel 258 | After=network.target 259 | Wants=network.target 260 | 261 | [Service] 262 | Type=simple 263 | ExecStart=/usr/local/bin/gost $argument 264 | 265 | [Install] 266 | WantedBy=multi-user.target 267 | EOL 268 | 269 | sudo systemctl daemon-reload 270 | sudo systemctl enable gost.service 271 | sudo systemctl start gost.service 272 | } 273 | 274 | #install tls 275 | install_relay() { 276 | install_gost 277 | get_inputs4 278 | } 279 | 280 | get_inputs5() { 281 | read -p "Which server do you want to use? (Enter '1' for Iran[Internal] or '2' for Foreign[External]): " server_choice 282 | if [ "$server_choice" == "1" ]; then 283 | read -p "Enter foreign IP [External-ip]: " foreign_ip 284 | read -p "Please enter the server's connection port: " port 285 | read -p "Please enter your config port: " config_port 286 | read -p "Enter 'udp' for UDP connection (default is: tcp): " connection_type 287 | connection_type=${connection_type:-tcp} 288 | argument="-L $connection_type://:$config_port/127.0.0.1:$config_port -F relay+quic://$foreign_ip:$port" 289 | 290 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 291 | while [ "$add_more_ports" == "yes" ]; do 292 | read -p "Please enter additional config port(s) separated by commas (e.g., 2087,2095): " additional_config_ports 293 | IFS=',' read -r -a ports_array <<< "$additional_config_ports" 294 | for new_port in "${ports_array[@]}"; do 295 | argument="-L $connection_type://:$new_port/127.0.0.1:$new_port $argument" 296 | done 297 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 298 | done 299 | 300 | elif [ "$server_choice" == "2" ]; then 301 | read -p "Enter server's connection port: " port 302 | argument="-L relay+quic://:$port" 303 | 304 | else 305 | echo "Invalid choice. Please enter '1' or '2'." 306 | exit 1 307 | fi 308 | 309 | cd /etc/systemd/system 310 | 311 | cat <> gost.service 312 | [Unit] 313 | Description=GO Simple Tunnel 314 | After=network.target 315 | Wants=network.target 316 | 317 | [Service] 318 | Type=simple 319 | ExecStart=/usr/local/bin/gost $argument 320 | 321 | [Install] 322 | WantedBy=multi-user.target 323 | EOL 324 | 325 | sudo systemctl daemon-reload 326 | sudo systemctl enable gost.service 327 | sudo systemctl start gost.service 328 | } 329 | 330 | 331 | #install quic 332 | install_quic() { 333 | install_gost 334 | get_inputs5 335 | } 336 | 337 | get_inputs6() { 338 | read -p "Which server do you want to use? (Enter '1' for Iran[Internal] or '2' for Foreign[External]): " server_choice 339 | if [ "$server_choice" == "1" ]; then 340 | read -p "Enter foreign IP [External-ip]: " foreign_ip 341 | read -p "Please enter the server's connection port: " port 342 | read -p "Please enter your config port: " config_port 343 | read -p "Enter your protocol (e.g : relay+wss) : " protocol 344 | read -p "Enter 'udp' for UDP connection (default is: tcp): " connection_type 345 | connection_type=${connection_type:-tcp} 346 | argument="-L $connection_type://:$config_port/127.0.0.1:$config_port -F $protocol://$foreign_ip:$port" 347 | 348 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 349 | while [ "$add_more_ports" == "yes" ]; do 350 | read -p "Please enter additional config port(s) separated by commas (e.g., 2087,2095): " additional_config_ports 351 | IFS=',' read -r -a ports_array <<< "$additional_config_ports" 352 | for new_port in "${ports_array[@]}"; do 353 | argument="-L $connection_type://:$new_port/127.0.0.1:$new_port $argument" 354 | done 355 | read -p "Do you want to add more ports? (yes/no): " add_more_ports 356 | done 357 | 358 | elif [ "$server_choice" == "2" ]; then 359 | read -p "Enter server's connection port: " port 360 | read -p "Enter your protocol (e.g : relay+wss) : " protocol 361 | argument="-L $protocol://:$port" 362 | 363 | else 364 | echo "Invalid choice. Please enter '1' or '2'." 365 | exit 1 366 | fi 367 | 368 | cd /etc/systemd/system 369 | 370 | cat <> gost.service 371 | [Unit] 372 | Description=GO Simple Tunnel 373 | After=network.target 374 | Wants=network.target 375 | 376 | [Service] 377 | Type=simple 378 | ExecStart=/usr/local/bin/gost $argument 379 | 380 | [Install] 381 | WantedBy=multi-user.target 382 | EOL 383 | 384 | sudo systemctl daemon-reload 385 | sudo systemctl enable gost.service 386 | sudo systemctl start gost.service 387 | } 388 | 389 | #install custom 390 | install_custom() { 391 | install_gost 392 | get_inputs6 393 | } 394 | 395 | #Uninstall 396 | uninstall() { 397 | if ! command -v gost &> /dev/null 398 | then 399 | echo "Gost is not installed." 400 | return 401 | fi 402 | 403 | sudo systemctl stop gost.service 404 | sudo systemctl disable gost.service 405 | sudo rm /etc/systemd/system/gost.service 406 | sudo systemctl daemon-reload 407 | sudo rm /usr/local/bin/gost 408 | echo "GO Simple Tunnel (gost) has been uninstalled." 409 | } 410 | 411 | 412 | 413 | # Main menu 414 | clear 415 | echo "By --> Peyman * Github.com/Ptechgithub * " 416 | echo "" 417 | echo " --------#- Go simple Tunnel-#--------" 418 | echo "1) Install Gost [only Internal Server]" 419 | echo " ----------------------------" 420 | echo "2) Install Gost [relay]" 421 | echo " ----------------------------" 422 | echo "3) Install Gost [relay + wss]" 423 | echo " ----------------------------" 424 | echo "4) Install Gost [relay + kcp]" 425 | echo " ----------------------------" 426 | echo "5) Install Gost [relay + quic]" 427 | echo " ----------------------------" 428 | echo "6) Install Custom" 429 | echo " ----------------------------" 430 | echo "7) Uninstall Gost" 431 | echo " ----------------------------" 432 | echo "0) exit" 433 | read -p "Please choose: " choice 434 | 435 | case $choice in 436 | 437 | 1) 438 | install 439 | ;; 440 | 2) 441 | install_relay 442 | ;; 443 | 3) 444 | install_wss 445 | ;; 446 | 4) 447 | install_kcp 448 | ;; 449 | 5) 450 | install_quic 451 | ;; 452 | 6) 453 | install_custom 454 | ;; 455 | 7) 456 | uninstall 457 | ;; 458 | 0) 459 | exit 460 | ;; 461 | *) 462 | echo "Invalid choice. Please try again." 463 | ;; 464 | esac 465 | --------------------------------------------------------------------------------