port-checker
port-checker copied to clipboard
Simple Docker container to test if a port works using a Golang server
Port Checker with Docker
12.8MB container to check a TCP port works with a Golang HTTP server
Features
- HTTP lightweight server responding with information on your client:
- Client IP (public or private)
- Browser and version
- Device type
- OS and version
- Compatible with amd64, 386, armv6, armv7 and arm64 v8 cpu architectures
Setup
-
To test port 1234, use:
docker run -it --rm -p 1234:8000/tcp qmcgaw/port-checker
To test port 1234 internally, use:
docker run -it --rm -e LISTENING_PORT=1234 qmcgaw/port-checker
-
With a client, access http://localhost:1234. You can also port forward with your router to test it is accessible remotely.
Binary
You can also download one of the binaries on the Github releases. For example:
wget -qO port-checker https://github.com/qdm12/port-checker/releases/download/v0.1.0/port-checker_0.1.0_linux_amd64
chmod +x port-checker
./port-checker
# Usage with
./port-checker -help
Environment variables
Environment variable | Default | Possible values | Description |
---|---|---|---|
LISTENING_PORT |
8000 |
1025 to 65535 |
TCP port to listen on internally |
ROOT_URL |
/ |
URL path string | Used if it is running behind a proxy for example |
Development
Using VSCode and Docker
- Install Docker
- On Windows, share a drive with Docker Desktop and have the project on that partition
- With Visual Studio Code, install the remote containers extension
- In Visual Studio Code, press on
F1
and selectRemote-Containers: Open Folder in Container...
- Your dev environment is ready to go!... and it's running in a container :+1:
TO DOs
- [ ] Use GeoLite database and Google Maps to show the location
- [ ] Add CSS to the HTML template
- [ ] Precise external mapped port to check it can access itself at start
- [ ] Unit testing
- [ ] Notifications (Pushbullet, email, etc. ?)
- [ ] UDP port check, see this