The code behind https://ip.wtf
Just visit it.
What's my IP in a script?
IPV4=$(curl -s v4.ip.wtf)
IPV6=$(curl -s v6.ip.wtf)
echo "Public IPv4: $IPV4, Public IPv6: $IPV6"
Because I can.
Sites like this give you details like the headers their reverse proxy server injects so the results aren't very trustworthy, the "Raw HTTP request" is really the bytes your browser (or a proxy on your side of the connection) sent.
In general this aims to be as privacy preserving as possible, while revealing details about your browser and connection, that might be sensitive.
go run .
Something like:
$ docker run --name=ip.wtf -d --net=host ghcr.io/dgl/ip.wtf:latest
$ curl localhost:8080
127.0.0.1
In reality you'll need a few more pieces for a full production setup:
- Put haproxy in front of this and enable the PROXY protocol support, see https://dgl.cx/2022/04/showing-you-your-actual-http-request
- Provide the MaxMind database files in /data, e.g. add
-v db:/data
This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.
Otherwise; 0BSD, no warranty. http://©.st/dgl