#!/bin/bash

# c proxy build environment
sudo apt update
sudo apt install make gcc g++ cmake -y   
sudo apt install libgnutls28-dev
sudo apt install libglib2.0-dev
sudo apt install libgcrypt20-dev
sudo apt install libsctp-dev
sudo apt install libidn-dev
sudo apt install libhiredis-dev

# Install Go
wget https://dl.google.com/go/go1.24.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.24.0.linux-amd64.tar.gz

# add go to path
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
echo "export GOPATH=$HOME/go" >> ~/.bashrc
echo "export PATH=$PATH:$GOPATH/bin" >> ~/.bashrc
source ~/.bashrc

cd ocs.git/selfcare/proxy
go mod init proxy
go mod tidy
go get github.com/sirupsen/logrus
go get github.com/go-sql-driver/mysql
go get github.com/go-redis/redis/v8
go get github.com/antonfisher/nested-logrus-formatter
go get github.com/gin-gonic/gin 
go get github.com/reiver/go-oi
go get github.com/reiver/go-telnet
go get github.com/reiver/go-telnet/telsh
go get github.com/go-mysql-org/go-mysql/canal
go get github.com/go-mysql-org/go-mysql/mysql
go get github.com/go-mysql-org/go-mysql/replication
go get github.com/golang/protobuf/proto
go get github.com/withlin/canal-go/client
go get github.com/withlin/canal-go/protocol/entry
go get github.com/robfig/cron
go get github.com/ircop/tclient