[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110365":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":25,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":29,"discoverSource":30},110365,"tailnet-do","littledivy\u002Ftailnet-do","littledivy","Put a Cloudflare Durable Object on your Tailscale tailnet",null,"JavaScript",277,13,75,1,0,2,62,182,9,74.44,false,"main",true,[],"2026-11-13 04:54:58","2026-11-23 19:03:21","# tailnet-do\n\nPut a Cloudflare Durable Object on your Tailscale tailnet. The object becomes a normal tailnet device with its own `100.x` address. It can serve HTTP or TCP to your other devices, dial into private machines, and act as an exit node or subnet router.\n\nUnder the hood this is Tailscale's own userspace client (WireGuard, netstack, DERP) compiled to WebAssembly. The control plane and DERP relays are reached over outbound WebSockets. Traffic that leaves an exit node goes out through `cloudflare:sockets`.\n\n```js\nimport { TailnetObject } from \"tailnet-do\";\n\nexport class Node extends TailnetObject {\n  async onTailnet(tailnet) {\n    \u002F\u002F Tailnet-only HTTP. `who` says which user and device is calling.\n    tailnet.serve(80, (req, who) => new Response(`hi ${who.loginName}`));\n  }\n}\n\nexport default {\n  async fetch(req, env) {\n    const node = env.NODE.getByName(\"main\");\n    \u002F\u002F Reach a private machine from a plain Worker, through the DO.\n    return node.tailnetFetch(\"http:\u002F\u002Fhomelab:8080\u002Fstatus\");\n  },\n};\n```\n\nSet `TS_AUTHKEY` (and optionally `TS_HOSTNAME`, `TS_CONTROL_URL`) as secrets. Without an auth key, the node starts an interactive login and puts the URL in `status().loginURL`.\n\n## API\n\nInside a Durable Object, `Tailnet.start(ctx, options)` returns a node. `TailnetObject` wraps it for you.\n\n- `connect(\"host:port\")` opens TCP to a tailnet host. It returns a socket shaped like `cloudflare:sockets`, and MagicDNS names work.\n- `fetch(url, init)` is HTTP over the tailnet.\n- `serve(port, (request, who) => Response)` is an HTTP server on the node's tailnet address.\n- `listen(port, (socket, who) => {})` accepts raw TCP.\n- `whois(\"ip:port\")`, `status()`, `ready()` and `logout()` do what their names say.\n\nOptions: `authKey`, `hostname`, `controlURL`, `ephemeral`, `tags`, `exitNode`, `advertiseRoutes`, `dohURL`, `keepAlive`, `statePrefix`, `onLog`.\n\n`TailnetObject` also exposes `tailnetConnect`, `tailnetFetch` and `tailnetStatus` as RPC methods, so Workers without their own node can use the tailnet through a DO stub.\n\n## Limits\n\n- An exit node only forwards TCP, plus DNS answered over DoH. Workers have no UDP sockets, so QUIC falls back to TCP. Outbound port 25 is blocked, and outbound sockets to Cloudflare IP ranges may be blocked.\n- A Durable Object lives in one location, so traffic exits from where the object was created. Use `locationHint` to place exit nodes in specific regions.\n\n## Layout and building\n\n- `go\u002F` holds the Go engine: a js\u002Fwasm main built against the vendored Tailscale tree.\n- `vendor\u002Ftailscale` is a git submodule pinned to the tested commit.\n- `patches\u002Ftailscale\u002F` holds our changes to Tailscale as `git format-patch` files.\n- `src\u002F` is the JS library. `src\u002Ftailnet.wasm` is a build output.\n- `examples\u002Fexit-node\u002F` is an exit node that also serves a page on the tailnet.\n\n```sh\ngit submodule update --init --depth 1\nnpm run build                      # apply patches, then build src\u002Ftailnet.wasm\ncd examples\u002Fexit-node && npx wrangler dev\n```\n\nTo change Tailscale, start from a clean pinned checkout, run `git -C vendor\u002Ftailscale am ..\u002F..\u002Fpatches\u002Ftailscale\u002F*.patch`, and add your commits on top. Then run `.\u002Fscripts\u002Fupdate-patches.sh tailscale` to regenerate `patches\u002Ftailscale\u002F`.\n","tailnet-do 是一个将 Cloudflare Durable Object 集成至 Tailscale 网络的轻量级工具，使 DO 获得独立的 Tailscale 设备身份（100.x 地址）并参与私有网络通信。它基于 Tailscale 官方代码编译为 WebAssembly，通过 WebSocket 连接控制平面与 DERP 中继，支持在 DO 内提供 Tailnet 专属 HTTP\u002FTCP 服务、访问私有设备、充当出口节点或子网路由器。适用于需要无服务器化、地理分布式出口能力、或在 Cloudflare Workers 生态中扩展 Tailscale 网络边界的场景，如远程运维网关、内网服务代理和跨地域安全隧道。","2026-11-24 04:38:47","CREATED_QUERY"]