A minimalist webspace.
curl -L 0x1234.net.
I.e. curl 0x1234.net/ip returns something
like 192.168.196.1.
Same with /headers, /ua, etc. You can use it in your scripts.
The /all endpoint in particular returns JSON, so it is easily
parseable and preferrable if you want to know several of the things
above from one request. Note that the values are base64-encoded to
make sure a '"' somewhere in the headers doesn't break the
format. Exempli gratia:
curl -s 0x1234.net/all|jq -r '.proto'|base64 -d
Just look at /all yourself to see the exact format.
IPv4/IPv6. I see the IP you connect from. If you want
specifically your IPv6, then ask curl nicely: curl -6 0x1234.net/ip.
Likewise for requesting specifically IPv4. I don't have something like
4.ifconfig.me or 6.ifconfig.me.
HTTP/HTTPS. Naturally, I suggest you use HTTPS
whenever you can. "Who would want to MiTM-substitute my external IP
address that I get from 0x1234.net/ip?" Dunno. Why give an
opportunity? However, the above /ip, /ua, /proto, etc. endpoints also
work via HTTP, simply because curl 0x1234.net/ip uses
HTTP by-default (for some bizzare reason), and that is
shorter to type than curl https://0x1234.net/ip or
curl -L 0x1234.net/ip. I advise you use the second way, though.
/ip, /headers, /ua, /time, /proto, and /all are all (pun not intended) configured in Caddy, without a backend. For example, this portion of Caddyfile returns your ip address (notice the no newline):
handle /ip {
header Content-Type text/plain
header Cache-Control no-store
header Access-Control-Allow-Origin *
respond "{http.request.remote.host}"
}
Caddy runs in a docker container with docker-compose.