1
mirror of https://github.com/jakejarvis/simpip.git synced 2025-06-27 16:15:41 -04:00

Update README.md

This commit is contained in:
2019-09-10 12:55:53 -04:00
parent 05585e81f4
commit 1f526e5bcd

View File

@ -1,12 +1,12 @@
# 🌎 [simpip.com](https://simpip.com/) # 🌎 [simpip](https://simpip.com/)
**⚡ Now powered purely by [Cloudflare Workers](https://www.cloudflare.com/products/cloudflare-workers/) — [try this code on the playground!](https://cloudflareworkers.com/#12bf2207fc352f52ebb27a041753c03d:https://tutorial.cloudflareworkers.com/)** The ancient PHP version is [archived here](https://github.com/jakejarvis/simpip/tree/php). **⚡ Now powered purely by [Cloudflare Workers](https://www.cloudflare.com/products/cloudflare-workers/), making it _blazing_ fast from anywhere in the world — and even more simple!** [Try this code on the playground.](https://cloudflareworkers.com/#6b0835ee482cc019b521cd68dd35c1c2:https://tutorial.cloudflareworkers.com)
![](https://github.com/jakejarvis/simpip/workflows/Deploy%20Cloudflare%20Worker/badge.svg) ![](https://github.com/jakejarvis/simpip/workflows/Deploy%20Cloudflare%20Worker/badge.svg)
A very, *very* "simple" web server that returns the visitor's IP address in plaintext...and **literally nothing** else. Perfect for CLI usage via `curl` or for automated tasks. 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.
This returns your IPv6 address by default, but to choose one or the other you can use [`curl`](https://curl.haxx.se/docs/manpage.html) flags: The server returns your IPv6 address by default, but you can explicitly choose between IPv4 and IPv6 with [`curl`](https://curl.haxx.se/docs/manpage.html) flags:
```bash ```bash
curl simpip.com # returns IPv6 *OR* IPv4 curl simpip.com # returns IPv6 *OR* IPv4
@ -15,17 +15,17 @@ curl -6 simpip.com # returns IPv6, or fails to connect if network is incompat
``` ```
## Example ## Usage
In [my terminal's dotfiles](https://github.com/jakejarvis/dotfiles), I have three aliases:`ip4` and `ip6` which are self-explanatory, and simply `ip` which returns **both** addresses *iff* your network supports IPv6 otherwise, IPv6 sliently fails and only your IPv4 address is shown. In [my terminal's dotfiles](https://github.com/jakejarvis/dotfiles/blob/f40a23352c1bd4fe18640faad872e8687e14b745/zsh/aliases.zsh#L16), 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.
```bash ```bash
alias ip4="curl -4 simpip.com --max-time 1 --proto-default https --silent" 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 ip6="curl -6 simpip.com --max-time 1 --proto-default https --silent"
alias ip="ip6; ip4" alias ip="ip4; ip6"
``` ```
Timeout is set to 1 second via `--max-time 1` (otherwise we will get stuck indefinitely trying to connect via IPv6 even if our network doesn't support it) and a secure connection preference is set using `--proto-default https`. Connection errors (particularly for IPv6) are silenced using `--silent`, so that the output of `ip` contains nothing but IP addresses, like so: 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:
```bash ```bash
jake@macbook:~$ ip4 jake@macbook:~$ ip4
@ -35,8 +35,8 @@ jake@macbook:~$ ip6
2606:4700:4700::1111 2606:4700:4700::1111
jake@macbook:~$ ip jake@macbook:~$ ip
2606:4700:4700::1111
1.1.1.1 1.1.1.1
2606:4700:4700::1111
``` ```