Alternative ifconfig.me, Detect your IP address.
Docker Hub: https://hub.docker.com/r/abduzzy/whoami.
Start the server first
# docker
docker run --rm -d -p 8080:8080 --name whoami abduzzy/whoami:latest
# or
# podman
podman run --rm -d -p 8080:8080 --name whoami abduzzy/whoami:latestAccess http://localhost:8080 using browser and the result will be in HTML format.
Also can be accessed using HTTP Client (like curl, httpie) to get in plain text.
Add header Accept: application/json to get result in JSON format.
| path | description | plain text | JSON | HTML |
|---|---|---|---|---|
| / | Default page, show all information | ✅ | ✅ | ✅ |
| /ip | Get IP Address only | ✅ | ✅ | |
| /user-agent | Get User-Agent only | ✅ | ✅ |
All configurations can be changed from Environment Variables.
| Name | Default Value | Description |
|---|---|---|
| WHOAMI_PORT | 8080 | Change app port |
| WHOAMI_IP_SOURCE | ConnectInfo | IP Detection source. Used this when run behind reverse proxy. See IP source section (below) to see all available options |
example:
WHOAMI_PORT=80 WHOAMI_IP_SOURCE=CfConnectingIp whoami
# or
# docker
docker run --rm -d -p 80:80 --name whoami -e WHOAMI_PORT=80 -e WHOAMI_IP_SOURCE=CfConnectingIp abduzzy/whoami:latest
# or
# podman
podman run --rm -d -p 80:80 --name whoami -e WHOAMI_PORT=80 -e WHOAMI_IP_SOURCE=CfConnectingIp abduzzy/whoami:latestFrom that command, the app can be accessed on port 80 and will be using CF-Connecting-IP Header (Cloudflare) to detect IP Address.
The IP address is detected using imbolc/axum-client-ip.
The available options for IP Source:
/// IP from the `CF-Connecting-IP` header
CfConnectingIp
/// IP from the `CloudFront-Viewer-Address` header
CloudFrontViewerAddress
/// IP from the `Fly-Client-IP` header
FlyClientIp
/// Rightmost IP from the `X-Forwarded-For` header
RightmostXForwardedFor
/// IP from the `True-Client-IP` header
TrueClientIp
/// IP from the `X-Real-Ip` header
XRealIp
/// Default, used this when the app does not run behind reverse proxy
ConnectInfo
Requirement:
- Rust
- Node (PNPM)
- Clone the source
- Install node dependency
pnpm i- Generate CSS file. Used in format HTML.
pnpm build- Run the app
cargo run
# or build the app
cargo build --release- Access
http://localhost:8080
- add api list section, which contains api route list and command to run using
curl,httpie, or etc. - add detail information of the ip, like location (country, latitude, longitude), timezone, etc.