#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

#Set Chicago Timezone
#ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
timedatectl set-timezone America/Los_Angeles

# V2Ray Installation
apt-get update
apt-get install -y wget curl nano screen
bash <(curl -sL https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
bash <(curl -sL https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh)

cat > /usr/local/etc/v2ray/config.json<<-EOF
{
  "inbounds": [
    {
      "port": 18080,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "bd8f5e4e-a593-4813-95c7-ca26e2a96365",
            "alterId": 64
          }
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}
EOF
systemctl enable v2ray
systemctl start v2ray
