Rathole
A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
- updated
- variables
- 2
- images
- 1
- author
- tunayada@gmail.com
- sha256
- 771c5364cec9
- source
- rathole/egg-rathole.json
Readme
Rathole
A secure, stable and high-performance reverse proxy for NAT traversal, written in Rust
rathole, like frp and ngrok, can help to expose the service on the device behind the NAT to the Internet, via a server with a public IP.
This egg only includes server side of rathole
Please refer to https://github.com/rapiz1/rathole for more information about rathole
Variables
2 settings
-
Version
- env
- VERSION
- default
- latest
- rules
- required|string|max:20
- viewable
- editable
-
Secret
Your random token
- env
- TOKEN
- default
- none
- rules
- required|string|min:5|max:60
- viewable
- editable
Installation script 41 lines container ghcr.io/ptero-eggs/installers:debian entrypoint bash show hide
#!/bin/bash
## get release info and download links
mkdir -p /mnt/server
cd /mnt/server
LATEST_JSON=$(curl --silent "https://api.github.com/repos/rapiz1/rathole/releases/latest")
RELEASES=$(curl --silent "https://api.github.com/repos/rapiz1/rathole/releases")
ARCH=$([[ "$(uname -m)" == "x86_64" ]] && echo "amd64" || echo "aarch64")
if ["${ARCH}" == "aarch64"]; then
MATCH=rathole-aarch64-unknown-linux-musl.zip
else
MATCH=rathole-x86_64-unknown-linux-gnu.zip
fi
if [ -z "${VERSION}" ] || [ "${VERSION}" == "latest" ]; then
DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})
else
VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .tag_name')
if [ "${VERSION}" == "${VERSION_CHECK}" ]; then
DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})
else
echo -e "defaulting to latest release"
DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)
fi
fi
echo "Download url: ${DOWNLOAD_URL}"
curl -ssL -o rathole.zip ${DOWNLOAD_URL}
unzip rathole.zip
rm rathole.zip
touch server.toml
printf "[server]\nbind_addr=\"0.0.0.0:${SERVER_PORT}\"\n\n[server.services.test]\ntoken=\"${TOKEN}\"\nbind_addr=\"0.0.0.0:${SERVER_PORT}\"" > server.toml
chmod +x rathole
## install end
echo "-----------------------------------------"
echo "Installation completed..."
echo "-----------------------------------------"