import type { GatewayBonjourBeacon } from "../../infra/bonjour-discovery.js"; import {
buildGatewayDiscoveryTarget,
serializeGatewayDiscoveryBeacon,
} from "../../infra/gateway-discovery-targets.js"; import { normalizeOptionalString } from "../../shared/string-coerce.js";
export function inferSshTargetFromRemoteUrl(rawUrl?: string | null): string | null { if (typeof rawUrl !== "string") { returnnull;
} const trimmed = normalizeOptionalString(rawUrl) ?? ""; if (!trimmed) { returnnull;
}
let host: string | null = null; try {
host = new URL(trimmed).hostname || null;
} catch { returnnull;
} if (!host) { returnnull;
} const user = normalizeOptionalString(process.env.USER) ?? ""; return user ? `${user}@${host}` : host;
}
export function buildSshTarget(input: {
user?: string;
host?: string;
port?: number;
}): string | null { const host = normalizeOptionalString(input.host) ?? ""; if (!host) { returnnull;
} const user = normalizeOptionalString(input.user) ?? ""; const base = user ? `${user}@${host}` : host; const port = input.port ?? 22; if (port && port !== 22) { return `${base}:${port}`;
} return base;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.