AverageHelper / ip-echo-cloudflare

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

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IP Echo

A simple no-logs Cloudflare Worker that returns the caller's IP address.

Usage

A GET request to https://ip.average.name will return a string containing the caller's IP address.

$ curl https://ip.average.name
1.2.3.4

The API is documented using OpenAPI. You can generate a TypeScript client by plugging our spec file into oazapfts:

$ oazapfts https://ip.average.name/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?

Not actively. Cloudflare lets me start streaming live access logs down on-demand, and these logs tell me the IP address and inferred location of the request, which is far from ideal. You'll just have to trust that I'm not storing that anywhere.

If you're concerned I may be snooping, feel free to run your own instance:

Prerequisites

This project requires NodeJS (version 18.17 or later) and NPM. To make sure you have them available on your machine, try running the following command:

$ npm -v && node -v
9.6.7
v18.17.1

Clone the repo

$ cd path/to/parent
$ git clone https://codeberg.org/AverageHelper/ip-echo-cloudflare.git
$ cd ip-echo-cloudflare

Install dependencies

$ npm ci

Make sure everything lints and compiles

$ npm run build

Deploy to your own Cloudflare zone

$ npm run deploy

About

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

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

License:GNU General Public License v3.0


Languages

Language:TypeScript 98.6%Language:Nix 1.4%