mirror of
https://github.com/ergolyam/check-host.git
synced 2025-12-05 20:08:09 +00:00
the project provides backend and frontend for checking ip address and port
| .github/workflows | ||
| static | ||
| templates | ||
| .gitignore | ||
| dockerfile | ||
| main.py | ||
| pyproject.toml | ||
| readme.md | ||
| uv.lock | ||
check-host
A Python application using FastAPI to check your public IP address and verify if a specified port is open. This app provides a web interface and an API for checking the IP address and port status.
Initial Setup
- Clone the repository: Clone this repository using
git clone. - Create Virtual Env: Create a Python Virtual Env
venvto download the required dependencies and libraries. - Download Dependencies: Download the required dependencies into the Virtual Env
venvusinguv.
git clone https://github.com/ergolyam/check-host.git
cd check-host
python -m venv .venv
.venv/bin/python -m pip install uv
.venv/bin/python -m uv sync
Deploy
- Run:
PORT="8000" RELOAD="True" uv run main.py
Container
-
Pull container:
podman pull ghcr.io/ergolyam/check-host:latest -
Deploy in container
podman run -d \ --name check-host \ --cap-add=NET_RAW \ --cap-add=NET_ADMIN \ --network host \ -e PORT="8000" \ ghcr.io/ergolyam/check-host:latest
Proxy on nginx
- Create a file /etc/nginx/sites-enabled/example.com with the lines:
server { listen 80 default; listen [::1]:80 default; server_name example.com; location / { proxy_pass http://[::1]:8000/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
Usage
- Open your web browser and navigate to http://localhost:8000
API Endpoints
-
Get your public IP:
curl http://localhost:8000/myip- Response:
{ "ip": "your-public-ip" }
- Response:
-
Check a port's status:
curl http://localhost:8000/check-port/80- Response
{ "host": "your-public-ip", "port": 80, "status": "open/closed/filtered/error" }
- Response
Features
- Display the client's public IP address.
- Check the status of a specific port (open, closed, or filtered).
- Simple and user-friendly web interface.
- API endpoints for programmatic access.