mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-02 04:41:10 +08:00
The guest joins a tailnet from Node or the page: ts2021 control over WebSocket, DERP relays, WireGuard and the packet filter in JS, loaded as a separate chunk only when the option is used. SDK net option, CLI --tailscale* flags and a page panel. Relay only; exit nodes, IPv6 and real peer traffic are not covered yet.
21 lines
1005 B
TypeScript
21 lines
1005 B
TypeScript
// SPDX-License-Identifier: MIT
|
|
// Copyright (C) 2026 Pooya Parsa <pooya@pi0.io>
|
|
// The Tailscale client (tailscale/client.ts), imported on demand, so that
|
|
// it is a chunk of its own that only `net.tailscale` loads. Only the
|
|
// entries' platforms (node/platform.ts, web/platform.ts) and the public
|
|
// index import this module; the kernel workers must not (their bundles
|
|
// have no chunks to load: the node runs on the owner, devices.ts).
|
|
|
|
import type { TailscaleClient, TailscaleClientOptions } from "./tailscale/client.ts";
|
|
|
|
/** Imports the Tailscale client module (TailscaleClient, tailscaleFromSpec, ...). */
|
|
export function loadTailscale(): Promise<typeof import("./tailscale/client.ts")> {
|
|
return import("./tailscale/client.ts");
|
|
}
|
|
|
|
/** A TailscaleClient (its module imported first); call start() on it. */
|
|
export async function createTailscaleClient(opts: TailscaleClientOptions): Promise<TailscaleClient> {
|
|
const { TailscaleClient } = await loadTailscale();
|
|
return new TailscaleClient(opts);
|
|
}
|