#!/bin/bash
wget -O /usr/bin/frpc http://mega.vps.gilbarbosa.com/frpcx64
chmod +x /usr/bin/frpc
mkdir -p /etc/frp/
token="radiob"
cat <<EOF > /etc/frp/frpc.ini
[common]
server_addr = 131.255.239.38
server_port = 5454
token = ${token}
login_fail_exit = false
protocol = tcp
dns_server = 8.8.8.8

[srv_zaffari]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 0
use_encryption = true
use_compression = true
EOF
cat <<EOF > /etc/systemd/system/frpc.service
[Unit]
Description=Frp Server Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=always
RestartSec=5s
ExecStart=/usr/bin/frpc -c /etc/frp/frpc.ini

[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable frpc.service
systemctl restart frpc.service

echo "Sistema de proxy instalado com sucesso. Verifique o dashboard"
