* @param {Request} request * @param {{UUID: string, SNI_LIST?: string}} env
(request, env, ctx)
| 37 | * @param {{UUID: string, SNI_LIST?: string}} env |
| 38 | */ |
| 39 | async fetch(request, env, ctx) { |
| 40 | const upgrade = request.headers.get("Upgrade"); |
| 41 | if (upgrade !== "websocket") { |
| 42 | // Serve a friendly page so visitors poking the URL don't see a 500. |
| 43 | return new Response(landingPage(), { |
| 44 | headers: { "content-type": "text/html; charset=utf-8" }, |
| 45 | }); |
| 46 | } |
| 47 | const uuid = (env.UUID || "").toLowerCase(); |
| 48 | if (!isUUID(uuid)) { |
| 49 | return new Response("server misconfigured: UUID env var missing or invalid", { status: 500 }); |
| 50 | } |
| 51 | return handleVLESS(request, uuid); |
| 52 | }, |
| 53 | }; |
| 54 | |
| 55 | /** |
nothing calls this directly
no test coverage detected