mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 10:40:46 +08:00
feat(ne): add Linux SSH bastion hop type
Support hop_vendor=linux via Paramiko direct-tcpip tunnel; ZTE CLI hop unchanged. UI hop type selector and distinct list badges. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d395aa7174
commit
d3eae3351c
9 changed files with 232 additions and 59 deletions
26
web/src/utils/hopProxy.ts
Normal file
26
web/src/utils/hopProxy.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { isAutoHopTemplate, zteHopTemplate } from "./zteHop";
|
||||
|
||||
export type HopVendor = "zte" | "linux";
|
||||
|
||||
export const HOP_VENDORS: HopVendor[] = ["zte", "linux"];
|
||||
|
||||
export function isLinuxHopVendor(vendor: string): boolean {
|
||||
return String(vendor || "").toLowerCase() === "linux";
|
||||
}
|
||||
|
||||
export function patchHopVendorChange(
|
||||
vendor: HopVendor,
|
||||
prev: { hop_protocol: string; hop_vrf: string; hop_command_template: string },
|
||||
): { hop_vendor: HopVendor; hop_protocol: string; hop_vrf: string; hop_command_template: string } {
|
||||
if (vendor === "linux") {
|
||||
return { hop_vendor: "linux", hop_protocol: "ssh", hop_vrf: "", hop_command_template: "" };
|
||||
}
|
||||
return {
|
||||
hop_vendor: "zte",
|
||||
hop_protocol: prev.hop_protocol || "ssh",
|
||||
hop_vrf: prev.hop_vrf,
|
||||
hop_command_template: zteHopTemplate(prev.hop_protocol || "ssh", prev.hop_vrf),
|
||||
};
|
||||
}
|
||||
|
||||
export { isAutoHopTemplate, zteHopTemplate };
|
||||
Loading…
Add table
Add a link
Reference in a new issue