HF PanelDocsv1.0.0

Customer tunnels

Make HF Tunnel tunnels on a hosting account and connect a computer to them with HF Server, the API or a one-line command.

When HF Tunnel is switched on on your hosting server, your hosting account can have its own tunnels. Each tunnel has a name, a local port and a secret key. A computer that runs the tunnel client with that key shares its local site at https://<name>.<tunnel domain>.

Where: the HF Panel API (/v1/tunnels), or HF Server's command line

What you need

  • HF Tunnel switched on on the server (by its administrator, see Tunnels on your own server).
  • An API token made in the Control Panel under Account › Password & security. Making tunnels and getting a tunnel's key need a Read & change token.

With HF Server

The easiest way: add your server to the HF Server desktop app once, then share a site through it.

bash
hostfog servers add https://panel.yourdomain.com:8443 hf_xxxxxxxx --name myserver
hostfog share shop --server myserver --name shop

HF Server makes the tunnel shop on your account (or reuses it), downloads the tunnel client from your server and connects. It prints the link, https://shop.<tunnel domain>. Stop with hostfog unshare shop. See Command line.

With the API

Request What it does
GET /v1/tunnels whether HF Tunnel is on, the tunnel domain, your limit, whether the tunnel server is online, and your tunnels
POST /v1/tunnels {"name": "shop", "port": 3000} makes a tunnel (port 1–65535, 80 by default)
GET /v1/tunnels/{name}/client everything a tunnel client needs: server address and port (7000), credentials, the tunnel's key and the client download address
DELETE /v1/tunnels/{name} deletes the tunnel; its address stops working at once

The API's address is https://api.yourdomain.com:2087/v1 (or the address your host gives). Full details are in the Developers section of this documentation (API: tunnels).

With a one-line command

Every tunnel has a download address that contains its key, given as client_download by GET /v1/tunnels/{name}/client, for example:

text
https://api.yourdomain.com:2087/v1/tunnel-get?t=<key>&os=bin&arch=

Replace os=bin&arch= with os=sh (macOS and Linux) or os=ps1 (Windows), and run it:

macOS and Linux:

bash
curl -fsSL "https://api.yourdomain.com:2087/v1/tunnel-get?t=<key>&os=sh" | sh

Windows (PowerShell):

powershell
irm "https://api.yourdomain.com:2087/v1/tunnel-get?t=<key>&os=ps1" | iex

The script downloads the right tunnel client for the computer (once), downloads the tunnel's settings and connects:

text
  Your site on port 3000 is going live at:  https://shop.port.yourdomain.com
  Keep this window open — press Ctrl+C to stop sharing.
Detail Value
Where the client is kept ~/.hostfog-tunnel (macOS, Linux) or %LOCALAPPDATA%\HostFogTunnel (Windows)
Systems Linux and macOS on x86-64 and ARM64; Windows on x64 and ARM64
Another local port add &port=8080 to the address

To run the tunnel client yourself, os=toml downloads just the tunnel's settings file.

Warning: the download address contains the tunnel's key. Anyone with it can serve content on your tunnel's address. Keep it as secret as a password; delete and re-create the tunnel if it leaks.