
# 获取系统
if [[ -f /etc/redhat-release ]]; then
  release="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
  release="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
  release="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
  release="centos"
elif cat /proc/version | grep -Eqi "debian"; then
  release="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
  release="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
  release="centos"
else
  echo -e "${red}未检测到系统版本，请联系脚本作者！${plain}\n" && exit 1
fi
##下面是安装运行环境
if [[ x"${release}" == x"centos" ]]; then
    echo -e "${green}检测是否已安装 Docker...${plain}"
    if ! command -v docker &> /dev/null; then
        echo -e "${green}安装 Docker...${plain}"
        yum install -y yum-utils
        yum-config-manager \
          --add-repo \
          https://download.docker.com/linux/centos/docker-ce.repo
        yum install docker-ce docker-ce-cli containerd.io -y
        systemctl start docker
        systemctl enable docker
    else
        echo -e "${green}Docker 已安装！${plain}"
    fi

    # 安装 docker-compose
    # ...
elif [[ x"${release}" == x"ubuntu" ]]; then
    echo -e "${green}检测是否已安装 Docker...${plain}"
    if ! command -v docker &> /dev/null; then
        echo -e "${green}安装 Docker...${plain}"
        curl -fsSL https://get.docker.com -o get-docker.sh
        bash get-docker.sh
        systemctl enable docker
        systemctl start docker
        docker -v
    else
        echo -e "${green}Docker 已安装！${plain}"
    fi

    # 安装 docker-compose
    # ...
elif [[ x"${release}" == x"debian" ]]; then
    echo -e "${green}检测是否已安装 Docker...${plain}"
    if ! command -v docker &> /dev/null; then
        echo -e "${green}安装 Docker...${plain}"
        curl -fsSL https://get.docker.com -o get-docker.sh
        bash get-docker.sh
        systemctl enable docker
        systemctl start docker
        docker -v
    else
        echo -e "${green}Docker 已安装！${plain}"
    fi

    # 安装 docker-compose
    # ...
fi

  mkdir /etc/soga
#  wget -N --user-agent="vreg45rtyhg/f4tgre45g" --no-check-certificate https://7colorshell.com/shell/key/eplcgame_com.cert -P /etc/soga
#  wget -N --user-agent="vreg45rtyhg/f4tgre45g" --no-check-certificate https://7colorshell.com/shell/key/dns.yml -P /etc/soga
#  cd /etc/soga
#  file="./dns.yml"
  read -p "请输入节点ID：" dockerid
#  read -p "请输入出口IP：" outip
#  read -p "请输入流媒体域名：" docker_dns1
#  read -p "请输入ChatGPT域名：" docker_dns2
#  sed -i "s|流媒体|$docker_dns1|" $file
#  sed -i "s|定制GPT域名|$docker_dns2|" $file
  docker run --log-opt max-size=5m --log-opt max-file=1 --restart=always --name AF$dockerid -d \
-v /etc/soga/:/etc/soga/ --network host \
-e node_id=$dockerid \
-e webapi_url=https://soga.pfvpn7.com \
-e webapi_key=xne38cxr73wx23r3 \
-e type=xiaov2board \
-e server_type=ss \
-e api=webapi \
-e soga_key=ZEpPzJLzXMW14CnxY7LSvvGk2ndnhrA3 \
-e dns_cache_time=10 \
-e forbidden_ports=22,25,465,587,3306 \
-e dns_strategy=ipv4_first \
-e proxy_protocol=true \
-e udp_proxy_protocol=true \
-e forbidden_bit_torrent=true \
-e dy_limit_enable=true \
-e dy_limit_trigger_time=300 \
-e dy_limit_trigger_speed=150 \
-e dy_limit_speed=150 \
vaxilu/soga:latest
docker ps
  