Skip to content

VityaSchel/cf-ons-resolver

Repository files navigation

Cloudflare Session Name Service (SNS/ONS) resolver worker

Made with Elysia, running on Bun with WASM for id.session.community

Deployed version: cf-ons-resolver.hloth.workers.dev

You are encouraged to deploy your own resolved to avoid rate limits and decrease load on my worker.

Deploy

Prerequisites:

  • Enable Cloudflare Workers in your Cloudflare account
  • Install Bun
  1. Clone this repository
  2. Install dependencies using bun install
  3. Run bun cf-typegen to generate files for the worker
  4. Run bun run deploy to deploy this worker under your Cloudflare Compute service

🌿 Help reduce the environmental impact of data center emissions and waste generated during computation. Switch to "Green Compute" mode in Workers & Pages -> Compute setting

Usage

GET /resolve/:ons

  • HTTP 200: {"ok":true,"sessionId":"05ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"}
  • HTTP 200: {"ok":true,"sessionId":null}
  • HTTP 400: {"ok":false,"error":"Invalid ONS"}
  • HTTP 500: {"ok":false,"error":"Internal Server Error"}

Example:

  • GET /resolve/hloth -> {"ok":true,"sessionId":"057aeb66e45660c3bdfb7c62706f6440226af43ec13f3b6f899c1dd4db1b8fce5b"}

License

MIT

Donate

hloth.dev/donate