simpip

⚡ Now powered purely by Cloudflare Workers, making it blazing fast from anywhere in the world — and even simpler! Try this code on the playground.

Usage no npm install needed!

<script type="module">
  import simpip from 'https://cdn.skypack.dev/simpip';
</script>

README

🌎 simpip

⚡ Now powered purely by Cloudflare Workers, making it blazing fast from anywhere in the world — and even simpler! Try this code on the playground.

CI

A very, very "simple" and lightning-fast web server that returns the requester's IP address in plaintext...and literally nothing else. Perfect for CLI usage via curl, wget, httpie, etc. or for automated tasks like dynamic DNS updates.

The server returns your IPv6 address by default, but you can explicitly choose between IPv4 and IPv6 with curl flags:

curl simpip.com       # returns IPv6 *OR* IPv4
curl -4 simpip.com    # returns IPv4
curl -6 simpip.com    # returns IPv6, or fails to connect if network is incompatible

Usage

In my terminal's dotfiles, I have three aliases:ip4 and ip6 which are self-explanatory, and ip which returns both addresses iff your network supports IPv6; otherwise, IPv6 sliently fails and only your IPv4 address is shown.

alias ip4="curl -4 simpip.com --max-time 1 --proto-default https --silent"
alias ip6="curl -6 simpip.com --max-time 1 --proto-default https --silent"
alias ip="ip4; ip6"

Timeout is set to 1 second with --max-time 1 (otherwise we will get stuck indefinitely attempting to connect via IPv6 even if our network doesn't support it) and a secure connection preference is set with --proto-default https. Connection errors (particularly for IPv6) are silenced with --silent so that the output of ip contains nothing but IP addresses, like so:

jake@macbook:~$ ip4
1.1.1.1

jake@macbook:~$ ip6
2606:4700:4700::1111

jake@macbook:~$ ip
1.1.1.1
2606:4700:4700::1111

License

MIT