AverageHelper / ip-echo-vercel

A simple no-logs Vercel Edge function that returns the caller's IP address. (Read-only Git mirror)

Home Page:https://git.average.name/AverageHelper/ip-echo-vercel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IP Echo

A simple no-logs Vercel Edge function that returns the caller's IP address.

Usage

A GET request to https://ipv4.average.name/api 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, you will only see an IPv4 address from this endpoint.

$ 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. You can generate a TypeScript client by plugging our spec file into oazapfts:

$ oazapfts https://raw.githubusercontent.com/AverageHelper/ip-echo-vercel/main/openapi.yaml ./ip.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:

A screenshot of Vercel's connection logs. Included is the time of the request, the request status code, the requested host name, the requested document path on the host, the requester's user agent string, and Vercel's request ID string.

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, 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!

About

A simple no-logs Vercel Edge function that returns the caller's IP address. (Read-only Git mirror)

https://git.average.name/AverageHelper/ip-echo-vercel

License:GNU General Public License v3.0


Languages

Language:TypeScript 99.6%Language:HTML 0.4%