MCPcopy Create free account
hub / github.com/SamNet-dev/snix / fetch

Function fetch

cfworker/worker.js:39–52  ·  view source on GitHub ↗

* @param {Request} request * @param {{UUID: string, SNI_LIST?: string}} env

(request, env, ctx)

Source from the content-addressed store, hash-verified

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/**

Callers

nothing calls this directly

Calls 3

landingPageFunction · 0.85
isUUIDFunction · 0.85
handleVLESSFunction · 0.85

Tested by

no test coverage detected