https://github.com/qdm12/port-checker
Simple Docker container to test if a port works using a Golang server
https://github.com/qdm12/port-checker
docker network port utility-network
Last synced: 6 months ago
JSON representation
Simple Docker container to test if a port works using a Golang server
- Host: GitHub
- URL: https://github.com/qdm12/port-checker
- Owner: qdm12
- License: mit
- Created: 2018-09-09T17:38:23.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-25T14:13:21.000Z (11 months ago)
- Last Synced: 2025-03-30T21:05:17.700Z (7 months ago)
- Topics: docker, network, port, utility-network
- Language: Go
- Size: 250 KB
- Stars: 34
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Port Checker with Docker
*12.8MB container to check a TCP port works with a Golang HTTP server*
[](https://github.com/qdm12/port-checker/actions?query=workflow%3A%22Buildx+latest%22)
[](https://hub.docker.com/r/qmcgaw/port-checker)
[](https://hub.docker.com/r/qmcgaw/port-checker)[](https://github.com/qdm12/port-checker/issues)
[](https://github.com/qdm12/port-checker/issues)
[](https://github.com/qdm12/port-checker/issues)## Features
- Listening address configurable
- Root URL configurable - useful to test reverse proxies
- HTTP server responding with information on your client:
- Client IP (public or private)
- Browser and version
- Device type
- OS and version
- Lightweight program of around **8MB**
- Docker image is compatible with amd64, 386, arm64, arm/v6, arm/v7, s390x, ppc64le and riscv64
- Standalone binaries pre-built for each release for Linux (amd64, 386, arm64), Darwin (amd64, arm64) and Windows (amd64, 386, arm64)## Standalone binary
You can download one of the binaries attached with each Github release. For example:
```sh
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 --listening-address=":8000" --root-url="/"
```You can build the binary for a specific platform if it's not listed using for example:
```sh
CGO_ENALBED=0 GOARCH=amd64 go build -o port-checker github.com/qdm12/port-checker
```## Docker image
To test port 1234, use:
```sh
docker run --rm -p 1234:8000/tcp qmcgaw/port-checker
```To test port 1234 internally, use:
```bash
docker run --rm -e LISTENING_ADDRESS=":1234" qmcgaw/port-checker
```💁 There are also image tags, such as `:v0.1.0`, corresponding to each tagged release.
## Options
| Environment variable | Flag | Default | Possible values | Description |
| --- | --- | --- | --- | --- |
| `LISTENING_ADDRESS` | `--listening-address` | `:8000` | Valid listening address | TCP address to listen on internally |
| `ROOT_URL` | `--root-url` | `/` | URL path string | Used if it is running behind a proxy for example |## 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](https://ops.tips/blog/udp-client-and-server-in-go/)