UNPKG

@mesh-tech/mesh-cli

Version:

CLI for Mesh platform development utilities

101 lines (100 loc) 4.37 kB
import type { PidSource } from "./pid.js"; import type { OwnershipCheck } from "./tunnel-ownership.js"; import type { TunnelTarget } from "./tailscale-targets.js"; import type { DevOutput } from "../commands/dev.js"; export declare function tenantStateDir(tenant: string): string; export declare function socketPath(tenant: string): string; export declare function logPath(tenant: string): string; export declare function statePath(tenant: string): string; export declare function daemonMetaPath(tenant: string): string; export declare function runnerManifestPath(tenant: string): string; export interface TunnelState { tenant: string; env: string; socksPort: number; loginServer: string; supervisorPid: number | null; managed?: "launchd" | "detached"; startedAt: string; tunnels: TunnelTarget[]; } export declare function readTunnelState(tenant: string): TunnelState | null; export declare function writeTunnelState(tenant: string, state: TunnelState): void; export declare function clearTunnelState(tenant: string): void; export interface DaemonMeta { socksPort: number; pid: number; } export declare function readDaemonMeta(tenant: string): DaemonMeta | null; export declare function writeDaemonMeta(tenant: string, meta: DaemonMeta): void; export declare function clearDaemonMeta(tenant: string): void; export declare function parseDaemonState(statusJson: string): { backendState: string; selfName?: string; }; export declare function tailscaledBinPath(): string; export declare function tailscaleBinPath(): string; export declare function daemonState(tenant: string): { backendState: string; selfName?: string; }; export declare function parseSocksPortFromArgv(argv: string): number | null; export declare function findRunningDaemon(tenant: string): { pid: number; socksPort: number | null; } | null; export declare function portAccepts(port: number, timeoutMs?: number): Promise<boolean>; export declare function ensureDaemon(tenant: string, opts: { region: string; socksPort: number; }): Promise<number>; export declare function stopDaemon(tenant: string): void; export declare function buildTailscaleUpArgs(opts: { socket: string; loginServer: string; hostname: string; preAuthKey?: string; }): string[]; export declare function joinHeadscale(tenant: string, loginServer: string, opts?: { preAuthKey?: string; }): Promise<void>; export declare function logout(tenant: string): void; export declare function tunnelTargetsEqual(a: TunnelTarget[], b: TunnelTarget[]): boolean; export declare function supervisorTargetsMatch(state: TunnelState | null, targets: TunnelTarget[]): boolean; export declare function killSupervisor(pid: number, source?: PidSource): void; export declare function verifyTunnelOwnership(tenant: string, expected: { socksPort: number; ports: number[]; }): Promise<OwnershipCheck>; export declare function stopTunnelRunners(tenant: string, prior: TunnelState | null): void; export declare function ensureForwarders(state: TunnelState): Promise<number>; export declare function rewriteTunnelsForTargets(devOutput: DevOutput, targets: TunnelTarget[]): DevOutput; export declare function tailscaleAvailable(): boolean; export declare function ensureTailscaleTunnels(tenant: string, env: string, opts: { region: string; loginServer: string; socksPort: number; preAuthKey?: string; }): Promise<TunnelTarget[]>; export declare function startTailscaleTunnels(devOutput: DevOutput, ctx: { tenant: string; env: string; region: string; loginServer: string; socksPort: number; preAuthKey?: string; }): Promise<DevOutput>; export declare function launchAgentLabel(tenant: string): string; export declare function renderLaunchAgentPlist(args: { tenant: string; meshBin: string; nodeBin: string; logPath: string; pathEnv?: string; }): string; export declare function forwardersNeedingRebind(targets: TunnelTarget[], listening: Set<number>): TunnelTarget[]; export declare function launchAgentPath(tenant: string): string; export declare function launchdAvailable(): boolean; export declare function installLaunchAgent(tenant: string, meshBin: string): boolean; export declare function uninstallLaunchAgent(tenant: string): void; export declare function runTunnels(tenant: string): Promise<never>;