跳转至内容
  • 版块
  • 最新
  • 标签
  • 称号
  • 广告
  • 商家收集
  • 帮助中心
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠

HostEvaluate BBS

  1. HostEvaluate BBS
  2. 教程
  3. 【转载】GOST 隧道一键安装脚本

【转载】GOST 隧道一键安装脚本

已定时 已固定 已锁定 已移动 教程
gost隧道
9 帖子 7 发布者 1.7k 浏览 9 关注中
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • Leonnundefined 离线
    Leonnundefined 离线
    Leonn
    萌新
    写于 最后由 Leonn 编辑
    #1

    简介

    看到其他频道推送的信息,发现论坛有人在卖,就干脆转载过来吧。转载地址:风萧萧兮易水寒

    一键安装

    一键脚本安装方法

    wget https://www.fiisi.com/gost/gost.sh && chmod +x gost.sh && bash gost.sh
    
    • 简单说明
      • 目前还是1.0.0版本,仅可以安装最新版本的gost,配置文件在/etc/gost/config.json,运行文件在 /usr/bin/gost,进程守护文件在 /usr/lib/systemd/system/gost.service
      • gost的配置文件需要自己编写,格式参考gost的官方文档,在安装完成后可以通过 systemctl start/stop/restart/status gost,来控制gost的启动停止重启状态。
      • 要确保wget已经安装,不然无法进行。

    具体内容

    #!/usr/bin/env bash
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
    export PATH
    
    sh_ver=1.0.0
    Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
    Info="${Green_font_prefix}[信息]${Font_color_suffix}"
    Error="${Red_font_prefix}[错误]${Font_color_suffix}"
    Tip="${Green_font_prefix}[注意]${Font_color_suffix}"
    
    check_sys(){
    	if [[ -f /etc/redhat-release ]]; then
    		release="centos"
    	elif cat /etc/issue | grep -q -E -i "debian"; then
    		release="debian"
    	elif cat /etc/issue | grep -q -E -i "ubuntu"; then
    		release="ubuntu"
    	elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
    		release="centos"
    	elif cat /proc/version | grep -q -E -i "debian"; then
    		release="debian"
    	elif cat /proc/version | grep -q -E -i "ubuntu"; then
    		release="ubuntu"
    	elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
    		release="centos"
        fi
    	bit=$(uname -m)
            if test "$bit" != "x86_64"; then
               echo "请输入你的芯片架构,/386/armv5/armv6/armv7/armv8"
               read bit
            else bit="amd64"
        fi
    }
    
    Installation_dependency(){
    	gzip_ver=$(gzip -V)
    	if [[ -z ${gzip_ver} ]]; then
    		if [[ ${release} == "centos" ]]; then
    			yum update
    			yum install -y gzip
    		else
    			apt-get update
    			apt-get install -y gzip
    		fi
    	fi
    }
    
    check_root(){
    	[[ $EUID != 0 ]] && echo -e "${Error} 当前非ROOT账号(或没有ROOT权限),无法继续操作,请更换ROOT账号或使用 ${Green_background_prefix}sudo su${Font_color_suffix} 命令获取临时ROOT权限(执行后可能会提示输入当前账号的密码)。" && exit 1
    }
    
    check_new_ver(){
    ct_new_ver=$(wget --no-check-certificate -qO- -t2 -T3 https://api.github.com/repos/ginuerzh/gost/releases/latest| grep "tag_name"| head -n 1| awk -F ":" '{print $2}'| sed 's/\"//g;s/,//g;s/ //g;s/v//g')
    if [[ -z ${ct_new_ver} ]]; then
    		echo -e "${Error} gost 最新版本获取失败,请手动获取最新版本号[ https://github.com/ginuerzh/gost/releases ]"
    		read -e -p "请输入版本号 [ 格式 x.x.xx , 如 0.8.21 ] :" ct_new_ver
    		[[ -z "${ct_new_ver}" ]] && echo "取消..." && exit 1
    	else
    		echo -e "${Info} gost 目前最新版本为 ${ct_new_ver}"
    	fi
    }
    check_file(){
                if test ! -d "/usr/lib/systemd/system/";then
                 `mkdir /usr/lib/systemd/system`
                `chmod -R 777 /usr/lib/systemd/system`
                 fi
    }
    check_nor_file(){
               `rm -rf "$(pwd)"/gost`
                 `rm -rf "$(pwd)"/gost.service`
                 `rm -rf "$(pwd)"/config.json`
                 `rm -rf "$(pwd)"/gost.sh`
                 `rm -rf /etc/gost`
                 `rm -rf /usr/lib/systemd/system/gost.service`
                 `rm -rf /usr/bin/gost`
    }
    
    Install_ct(){
               check_root
               check_nor_file
               Installation_dependency
               check_file
               check_sys
               check_new_ver
               `wget --no-check-certificate https://github.com/ginuerzh/gost/releases/download/v"$ct_new_ver"/gost-linux-"$bit"-"$ct_new_ver".gz`
                `gunzip gost-linux-"$bit"-"$ct_new_ver".gz`
                `mv gost-linux-"$bit"-"$ct_new_ver" gost`
                `mv gost /usr/bin/gost`
                `chmod -R 777 /usr/bin/gost`
                `wget --no-check-certificate https://www.fiisi.com/gost/gost.service && chmod -R 777 gost.service && mv gost.service /usr/lib/systemd/system`
                `mkdir /etc/gost && wget --no-check-certificate https://www.fiisi.com/gost/config.json && mv config.json /etc/gost && chmod -R 777 /etc/gost`
                `systemctl enable gost && systemctl restart gost`
                echo "------------------------------"
                if test -a /usr/bin/gost -a /usr/lib/systemctl/gost.service -a /etc/gost/config.json;then
                 echo "${Green_font_prefix}gost似乎安装成功${Font_color_suffix}"
                 `rm -rf "$(pwd)"/gost`
                 `rm -rf "$(pwd)"/gost.service`
                 `rm -rf "$(pwd)"/config.json`
                 `rm -rf "$(pwd)"/gost.sh`
                else
                echo "${Red_font_prefix}gost没有安装成功,可以到https://www.fiisi.com评论留言询问${Font_color_suffix}"
                 `rm -rf   "$(pwd)"/gost`
                 `rm -rf "$(pwd)"/gost.service`
                 `rm -rf "$(pwd)"/config.json`
                 `rm -rf "$(pwd)"/gost.sh`
                 fi
    }
    
    Uninstall_ct(){
                 `rm -rf /usr/bin/gost`
                 `rm -rf /usr/lib/systemd/system/gost.service`
                 `rm -rf /etc/gost`
                 `rm -rf "$(pwd)"/gost.sh`
                 echo "${Red_font_prefix}gost已经成功删除${Font_color_suffix}"
    }
    
    Start_ct(){
              `systemctl start gost`
              echo "${Green_font_prefix}已启动${Font_color_suffix}"
    }
    
    Stop_ct(){
              `systemctl stop gost`
                echo "${Green_font_prefix}已停止${Font_color_suffix}"  
    }
    
    Restart_ct(){
                `systemctl restart gost`
                 echo "${Green_font_prefix}已重启${Font_color_suffix}" 
    }
        
    echo && echo -e "  gost 一键安装脚本 ${Red_font_prefix}[v${sh_ver}]${Font_color_suffix}
      ---- fiisi | https://www.fiisi.com ----
      
     ${Green_font_prefix}1.${Font_color_suffix} 安装 gost
     ${Green_font_prefix}2.${Font_color_suffix} 卸载 gost
    ————————————
     ${Green_font_prefix}3.${Font_color_suffix} 启动 gost
     ${Green_font_prefix}4.${Font_color_suffix} 停止 gost
     ${Green_font_prefix}5.${Font_color_suffix} 重启 gost
    ————————————" && echo
    read -e -p " 请输入数字 [1-5]:" num
    case "$num" in
    	1)
    	Install_ct
    	;;
    	2)
    	Uninstall_ct
    	;;
    	3)
    	Start_ct
    	;;
    	4)
    	Stop_ct
    	;;
    	5)
    	Restart_ct
    	;;
    	*)
    	echo "请输入正确数字 [1-5]"
    	;;
    esac
    

    工具人

    1 条回复 最后回复
    • ChinaTundefined 离线
      ChinaTundefined 离线
      ChinaT
      野兽先辈
      写于 最后由 编辑
      #2

      良心

      名字就是TG 联系我请直奔主题

      1 条回复 最后回复
      • 16522undefined 离线
        16522undefined 离线
        16522
        萌新
        写于 最后由 编辑
        #3

        给你点赞

        1 条回复 最后回复
        • oxszoundefined 离线
          oxszoundefined 离线
          oxszo
          写于 最后由 编辑
          #4

          不还去给那个人封了

          Leonnundefined 1 条回复 最后回复
          • oxszoundefined oxszo

            不还去给那个人封了

            Leonnundefined 离线
            Leonnundefined 离线
            Leonn
            萌新
            写于 最后由 编辑
            #5

            @oxszo 没有理由呀,毕竟买卖不是一方就能决定的,卖多少钱卖什么的权力每个人还是有的

            工具人

            1 条回复 最后回复
            • bingyinundefined 离线
              bingyinundefined 离线
              bingyin
              MJJ
              写于 最后由 编辑
              #6

              配置文件目录写错了 不是ect是etc

              Leonnundefined 1 条回复 最后回复
              • bingyinundefined bingyin

                配置文件目录写错了 不是ect是etc

                Leonnundefined 离线
                Leonnundefined 离线
                Leonn
                萌新
                写于 最后由 编辑
                #7

                @bingyin 感谢,已修改

                工具人

                1 条回复 最后回复
                • Tumultundefined 离线
                  Tumultundefined 离线
                  Tumult
                  萌新
                  写于 最后由 编辑
                  #8

                  收藏一下

                  1 条回复 最后回复
                  • Andrewundefined 离线
                    Andrewundefined 离线
                    Andrew
                    已封禁
                    写于 最后由 编辑
                    #9

                    压死倒卖狗

                    1 条回复 最后回复
                    回复
                    • 在新帖中回复
                    登录后回复
                    • 从旧到新
                    • 从新到旧
                    • 最多赞同


                    赞助商广告

                    热门标签

                    水墨云
                    633 个主题
                    iplc
                    528 个主题
                    绿云
                    483 个主题
                    nat
                    448 个主题
                    合租
                    427 个主题
                    香港
                    392 个主题
                    碳云
                    350 个主题
                    广移
                    319 个主题

                    分类

                    • 水区

                    • 主机交易

                      二手小鸡交换中 ···

                      交易
                      出租/合租
                      电子垃圾
                      交易争议

                    • 主机信息

                      主机优惠信息及AFF集合地

                      官方 Offer
                      测评跑分
                      教程

                    • 友商介绍

                    • 公告

                    2

                    在线

                    9.3k

                    用户

                    33.5k

                    主题

                    92.0k

                    帖子
                    • 登录

                    • 没有帐号? 注册

                    • 登录或注册以进行搜索。
                    • 第一个帖子
                      最后一个帖子
                    0
                    • 版块
                    • 最新
                    • 标签
                    • 称号
                    • 广告
                    • 商家收集
                    • 帮助中心