This project implements a tunnel service similar to Ngrok, allowing users to expose their local servers to the internet securely. The implementation consists of a client-side application (client.py
) and a server-side application (app.py
) using FastAPI for handling WebSocket connections and HTTP requests.
to run open cmd and ./linkifyr.exe --url http://127.0.0.1:5000/
--server_url linkifyr.thefcraft.site --server_protocol https
- Dynamic urls like https://{client_id}.linkifyr.thefcraft.site
- Securely exposes local servers to the internet.
- Handles HTTP/HTTPS requests and forwards them to the local server.
- Displays connection status and information using Rich for a better CLI experience.
python client.py --url http://127.0.0.1:5000/
╭─────────────────────────────────────────────────────── Linkifyr Tunnel ──────────────────────────────────────────────────────────╮
│ Session Status: online │
│ Account: User │
│ Version: 1.0.0 │
│ Region: Unknown │
│ Latency: Unknown │
│ Web Interface: Under development │
│ Forwarding: https://62dc-f9-d0-9f65.dev.thefcraft.site -> http://127.0.0.1:5000/ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Client ID: 62dc-f9-d0-9f65
Connection established
Your site http://127.0.0.1:5000/ is live at https://62dc-f9-d0-9f65.linkifyr.thefcraft.site
- Python 3.7+
aiohttp
requests
fastapi
uvicorn
rich
cryptography
Install the required packages using pip:
pip install aiohttp requests fastapi uvicorn rich cryptography
The client-side application (client.py
) connects to the server, retrieves a unique client ID, and establishes a WebSocket connection for forwarding requests.
Run the client-side application with the following command:
python client.py --url http://127.0.0.1:5000/ --server_url Ilinkifyr.thefcraft.site --server_protocol https
--url
: The local URL to be exposed (default:http://127.0.0.1:5000/
).--server_url
: The server URL to connect to (default:dev.thefcraft.site
).--server_protocol
: The protocol to use for server connection (http
orhttps
, default:https
).
The server-side application (app.py
) uses FastAPI to handle incoming WebSocket connections and HTTP requests, forwarding them to the appropriate client.
Run the server-side application with the following command:
uvicorn app:app --host 0.0.0.0 --port 8080
use wildcard domain
adding a wildcard custom domain on onrender
- Client Connection: The client connects to the server and retrieves a unique client ID.
- WebSocket Connection: The client establishes a WebSocket connection using the retrieved client ID.
- Request Forwarding: The server forwards incoming HTTP requests to the connected client, which processes them and returns the response.
.
├── client.py
├── app.py
└── README.md
client.py
: Contains the client-side logic for connecting to the server and forwarding requests.app.py
: Contains the server-side logic for handling WebSocket connections and HTTP requests.README.md
: Project documentation.
This project is licensed under the MIT License. See the LICENSE file for details.
- Ngrok for the inspiration.
- FastAPI for the excellent web framework.
- Rich for the beautiful CLI components.
For more details, visit the GitHub repository.