pinggy-server
is a FastAPI-based application designed to manage SSH tunnels using Pinggy. It provides a programmatic interface to create and manage tunnels efficiently.
- Create and configure SSH tunnels
- Monitor and manage tunnel status
- Easy setup and deployment with Docker
You can run pinggy-server
via Docker using make up
. Alternatively, follow these steps for a manual setup:
-
Clone the repository:
git clone https://github.com/yourusername/pinggy-server.git cd pinggy-server
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
Environment Variable | Description | Example Value |
---|---|---|
DATABASE_URL |
URL for the database | /app/db/pinggy.db |
PINGGY_TOKEN |
Optional Pinggy token | your_pinggy_token |
- Set up your environment variables in a
.env
file:DATABASE_URL=/app/db/pinggy.db PINGGY_TOKEN=your_pinggy_token # Optional
- Run the application:
uvicorn app.main\:app --host 0.0.0.0 --port 8000
-
POST /api/tunnels
: Create a new tunnel. Accepts a JSON payload with the following fields:{ "hostname": "tunnel_host", "port": "tunnel_port" }
Mock Response:
{ "id": 1, "status": "RUNNING", "hostname": "localhost", "port": 3000, "http_url": "http://xxxx.pinggy.link", "https_url": "https://xxxx.pinggy.link" }
-
GET /api/tunnels/{tunnel_id}
: Retrieve details of a specific tunnel. Mock Response:{ "id": 1, "status": "RUNNING", "hostname": "localhost", "port": 3000, "http_url": "http://xxxx.pinggy.link", "https_url": "https://xxxx.pinggy.link" }
-
DELETE /api/tunnels/{tunnel_id}
: Delete a specific tunnel. Mock Response:{ "message": "Tunnel with ID 1 has been deleted." }
-
Run tests:
pytest
-
Lint the code:
flake8
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License.