https://github.com/averagehelper/ip-echo-vercel
A simple no-logs Vercel Edge function that returns the caller's IP address. (Read-only Git mirror)
https://github.com/averagehelper/ip-echo-vercel
mirror
Last synced: about 1 year ago
JSON representation
A simple no-logs Vercel Edge function that returns the caller's IP address. (Read-only Git mirror)
- Host: GitHub
- URL: https://github.com/averagehelper/ip-echo-vercel
- Owner: AverageHelper
- License: gpl-3.0
- Created: 2023-03-04T14:42:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T01:50:02.000Z (over 2 years ago)
- Last Synced: 2025-02-15T14:53:55.493Z (over 1 year ago)
- Topics: mirror
- Language: TypeScript
- Homepage: https://git.average.name/AverageHelper/ip-echo-vercel
- Size: 712 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# IP Echo
A simple no-logs Vercel Edge function that returns the caller's IP address.
## Usage
A `GET` request to will return a string containing the caller's IPv4 address. Note that, because this project is hosted on Vercel, and [Vercel does not support IPv6](https://github.com/orgs/vercel/discussions/47#discussioncomment-4314763), you will only see an IPv4 address from this endpoint.
```sh
$ curl https://ipv4.average.name/api
1.2.3.4
```
Navigating to the root returns an HTML file that defines a redirect to the `/api` endpoint, because Vercel is weird.
The API is documented using [OpenAPI](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/AverageHelper/ip-echo-vercel/main/openapi.yaml). You can generate a TypeScript client by plugging our spec file into [oazapfts](https://www.npmjs.com/package/oazapfts):
```sh
$ oazapfts https://raw.githubusercontent.com/AverageHelper/ip-echo-vercel/main/openapi.yaml ./ip.ts
```
```ts
import { ip } from "./ip";
const result = await ip();
switch (result.status) {
case 200:
console.info(result.data); // "1.2.3.4"
break;
case 404:
console.warn("Couldn't get IP address");
break;
default:
console.error("Something went very very wrong!");
}
```
## No logs?
No more than Vercel's normal logging, which looks like this:

There's not much there to identify you, unless you put some personally-identifying information into your request path, or contact me directly and inform me that you made a request.
I'm not doing any additional logging myself. You can read as much [in the code](/api/index.ts), though I suppose I cannot prove that I'm running _this_ repo on the above-named endpoint on Vercel's Edge network. If you're concerned I may be snooping, feel free to run your own instance!