-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_frp.sh
38 lines (29 loc) · 964 Bytes
/
setup_frp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# 获取最新版本的 FRP
FRP_LATEST_VERSION=$(curl -s https://api.github.com/repos/fatedier/frp/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
# 下载 FRP
echo "Downloading FRP ${FRP_LATEST_VERSION}..."
wget -q --show-progress https://github.com/fatedier/frp/releases/download/v0.56.0/frp_0.56.0_freebsd_amd64.tar.gz -O frp.tar.gz
# 解压 FRP
echo "Extracting FRP..."
tar -xf frp.tar.gz
# 创建 FRP 目录并进入
mkdir -p "frp_${FRP_LATEST_VERSION}_linux_amd64" && cd "frp_${FRP_LATEST_VERSION}_linux_amd64"
# 提示用户输入 FRP 服务器的 IP 地址
read -p "Enter the FRP server IP address: " FRP_SERVER_IP
# 创建 FRP 配置文件
cat <<EOF > frpc.ini
[common]
server_addr = $FRP_SERVER_IP
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
EOF
# 启动 FRP
echo "Starting FRP..."
cd /root/frp_0.56.0_freebsd_amd64
./frpc -c frpc.ini &
echo "FRP service started successfully."