Skip to content

Instantly share code, notes, and snippets.

@Kenya-West
Created May 27, 2023 07:59
Show Gist options
  • Save Kenya-West/71b30a8900a1f2c3a488111faddc737e to your computer and use it in GitHub Desktop.
Save Kenya-West/71b30a8900a1f2c3a488111faddc737e to your computer and use it in GitHub Desktop.
Set of scripts that setup frp client and server
FRP_PREFIX=frpc
mkdir ~/${FRP_PREFIX} && cd "$_"
echo "[common]
server_addr = YOUR_SERVER_IP # e. g. 70.91.70.100
server_port = 7000
authentication_method = token
token = SOMETOKEN
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22000 # if ssh is opened on 22000
remote_port = 22000 # if ssh is opened on 22000 on server" > ./${FRP_PREFIX}.ini
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")'
}
GHVERSION=$(get_latest_release "fatedier/frp")
GHVERSION_WITHOUT_V=${GHVERSION//v/}
wget -c https://github.com/fatedier/frp/releases/download/${GHVERSION}/frp_${GHVERSION_WITHOUT_V}_linux_386.tar.gz -O - | tar -xvz
mv frp_${GHVERSION_WITHOUT_V}_linux_386/${FRP_PREFIX} ./${FRP_PREFIX}
# launch in background
./${FRP_PREFIX} -c ./${FRP_PREFIX}.ini > /dev/null 2>&1 &
FRP_PREFIX=frps
mkdir ~/${FRP_PREFIX} && cd "$_"
echo "[common]
bind_port = 7000
dashboard_port = 7500
# dashboard's username and password are both optional
dashboard_user = someuser
dashboard_pwd = 12345678
# these two lines rely on authentication method and are optional, too
authentication_method = token
token = SOMETOKEN" > ./${FRP_PREFIX}.ini
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")'
}
GHVERSION=$(get_latest_release "fatedier/frp")
GHVERSION_WITHOUT_V=${GHVERSION//v/}
wget -c https://github.com/fatedier/frp/releases/download/${GHVERSION}/frp_${GHVERSION_WITHOUT_V}_linux_386.tar.gz -O - | tar -xvz
mv frp_${GHVERSION_WITHOUT_V}_linux_386/${FRP_PREFIX} ./${FRP_PREFIX}
# launch in background
./${FRP_PREFIX} -c ./${FRP_PREFIX}.ini > /dev/null 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment