Files
MikrotikManager/backend/src/services/routeros-native-paths.ts
T
Denozordec 1af3755a77
Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 12m5s
Docker images / frontend-image (push) Successful in 2m29s
Docker images / updater-image (push) Successful in 40s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / backend-image (push) Successful in 2m16s
Docker images / publish-release (push) Successful in 11s
Docker images / notify-webhook (push) Successful in 2s
fix(ipsec): восстановить создание клиентов и экспорт сертификатов
2026-11-22 14:24:19 +07:00

27 lines
1.5 KiB
TypeScript

export function encodeRosId(rosId: string): string {
const id = rosId.startsWith("*") ? rosId : `*${rosId.replace(/^\*/, "")}`
return encodeURIComponent(id)
}
/** RouterOS 7.24 file IDs use case-sensitive `**<base62>` instead of the legacy single asterisk. */
export function isRouterOsNativeId(value: unknown): value is string {
return typeof value === "string" && value.length <= 256 && /^\*\*?[a-z0-9]+$/i.test(value)
}
export function routerOsIdKey(value: string): string {
return value.startsWith("**") ? value : value.toLowerCase().replace(/^\*0+(?=[a-z0-9])/, "*")
}
export const greDependencyPaths = ["/interface", "/interface/bridge/port", "/interface/vlan",
"/interface/list/member", "/ip/vrf", "/ip/route", "/ipv6/route", "/routing/filter/rule",
"/routing/ospf/interface-template", "/routing/bfd/configuration", "/routing/bgp/connection", "/routing/rule",
...["ip", "ipv6"].flatMap(family => ["filter", "nat", "mangle", "raw"].map(table => `/${family}/firewall/${table}`))] as const
export const wireguardInterfaceRuntimeDependencyPaths = ["/routing/bgp/session", "/routing/ospf/neighbor",
"/routing/ospf/interface", "/routing/bfd/session"] as const
export const wireguardInterfaceDependencyPaths = [...new Set<string>([...greDependencyPaths, "/interface/vxlan",
"/interface/vrrp", "/interface/bonding", "/interface/eoip", "/interface/gre", "/interface/ipip", "/ip/dhcp-server",
"/ip/dhcp-client", "/ipv6/dhcp-server", "/ipv6/dhcp-client", "/ip/ipsec/peer", "/ip/ipsec/policy",
...wireguardInterfaceRuntimeDependencyPaths])]