feat: add discovery role hints
This commit is contained in:
@@ -82,6 +82,12 @@ export function renderBeaconLines(beacon: GatewayBonjourBeacon, rich: boolean):
|
|||||||
if (wsUrl) {
|
if (wsUrl) {
|
||||||
lines.push(` ${colorize(rich, theme.muted, "ws")}: ${colorize(rich, theme.command, wsUrl)}`);
|
lines.push(` ${colorize(rich, theme.muted, "ws")}: ${colorize(rich, theme.command, wsUrl)}`);
|
||||||
}
|
}
|
||||||
|
if (beacon.role) {
|
||||||
|
lines.push(` ${colorize(rich, theme.muted, "role")}: ${beacon.role}`);
|
||||||
|
}
|
||||||
|
if (beacon.transport) {
|
||||||
|
lines.push(` ${colorize(rich, theme.muted, "transport")}: ${beacon.transport}`);
|
||||||
|
}
|
||||||
if (beacon.gatewayTls) {
|
if (beacon.gatewayTls) {
|
||||||
const fingerprint = beacon.gatewayTlsFingerprintSha256
|
const fingerprint = beacon.gatewayTlsFingerprintSha256
|
||||||
? `sha256 ${beacon.gatewayTlsFingerprintSha256}`
|
? `sha256 ${beacon.gatewayTlsFingerprintSha256}`
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ export type GatewayBonjourBeacon = {
|
|||||||
gatewayTls?: boolean;
|
gatewayTls?: boolean;
|
||||||
gatewayTlsFingerprintSha256?: string;
|
gatewayTlsFingerprintSha256?: string;
|
||||||
cliPath?: string;
|
cliPath?: string;
|
||||||
|
role?: string;
|
||||||
|
transport?: string;
|
||||||
txt?: Record<string, string>;
|
txt?: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -211,6 +213,8 @@ function parseDnsSdResolve(stdout: string, instanceName: string): GatewayBonjour
|
|||||||
beacon.gatewayTls = raw === "1" || raw === "true" || raw === "yes";
|
beacon.gatewayTls = raw === "1" || raw === "true" || raw === "yes";
|
||||||
}
|
}
|
||||||
if (txt.gatewayTlsSha256) beacon.gatewayTlsFingerprintSha256 = txt.gatewayTlsSha256;
|
if (txt.gatewayTlsSha256) beacon.gatewayTlsFingerprintSha256 = txt.gatewayTlsSha256;
|
||||||
|
if (txt.role) beacon.role = txt.role;
|
||||||
|
if (txt.transport) beacon.transport = txt.transport;
|
||||||
|
|
||||||
if (!beacon.displayName) beacon.displayName = decodedInstanceName;
|
if (!beacon.displayName) beacon.displayName = decodedInstanceName;
|
||||||
return beacon;
|
return beacon;
|
||||||
@@ -351,6 +355,8 @@ async function discoverWideAreaViaTailnetDns(
|
|||||||
beacon.gatewayTls = raw === "1" || raw === "true" || raw === "yes";
|
beacon.gatewayTls = raw === "1" || raw === "true" || raw === "yes";
|
||||||
}
|
}
|
||||||
if (txtMap.gatewayTlsSha256) beacon.gatewayTlsFingerprintSha256 = txtMap.gatewayTlsSha256;
|
if (txtMap.gatewayTlsSha256) beacon.gatewayTlsFingerprintSha256 = txtMap.gatewayTlsSha256;
|
||||||
|
if (txtMap.role) beacon.role = txtMap.role;
|
||||||
|
if (txtMap.transport) beacon.transport = txtMap.transport;
|
||||||
|
|
||||||
results.push(beacon);
|
results.push(beacon);
|
||||||
}
|
}
|
||||||
@@ -409,6 +415,8 @@ function parseAvahiBrowse(stdout: string): GatewayBonjourBeacon[] {
|
|||||||
current.gatewayTls = raw === "1" || raw === "true" || raw === "yes";
|
current.gatewayTls = raw === "1" || raw === "true" || raw === "yes";
|
||||||
}
|
}
|
||||||
if (txt.gatewayTlsSha256) current.gatewayTlsFingerprintSha256 = txt.gatewayTlsSha256;
|
if (txt.gatewayTlsSha256) current.gatewayTlsFingerprintSha256 = txt.gatewayTlsSha256;
|
||||||
|
if (txt.role) current.role = txt.role;
|
||||||
|
if (txt.transport) current.transport = txt.transport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ function renderZone(opts: WideAreaGatewayZoneOpts & { serial: number }): string
|
|||||||
|
|
||||||
const txt = [
|
const txt = [
|
||||||
`displayName=${opts.displayName.trim() || hostname}`,
|
`displayName=${opts.displayName.trim() || hostname}`,
|
||||||
|
`role=gateway`,
|
||||||
`transport=gateway`,
|
`transport=gateway`,
|
||||||
`gatewayPort=${opts.gatewayPort}`,
|
`gatewayPort=${opts.gatewayPort}`,
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user