/** @file switchboard: forwards each proxied request, WebSocket upgrades included. */ import { DurableObject } from "cloudflare:workers"; /** * The one place egress happens. A 101 response from `fetch` carries its * `webSocket`; returning it passes the socket through to the caller. * * Which vat may reach which host is decided before a request gets here * (toybox's Egress gateway); this process's network service and its * systemd unit are the outer fence. */ export class Switchboard extends DurableObject { fetch(request) { return fetch(request); } } export default { fetch(request, env) { return env.BOARD.getByName("switchboard").fetch(request); }, };