fix(traffic): сделать JH сервером WG и патчить traffic-flow по id
Docker images / prepare-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 1m43s
Docker images / frontend-image (push) Successful in 2m52s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 45s
Docker images / publish-release (push) Successful in 9s

RouterOS не принимает PATCH без .id у singleton. Пир на jump-host без endpoint: клиент — хост MM с Endpoint JH:13232.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-09-06 22:58:31 +07:00
co-authored by Cursor
parent 63bed28251
commit f0dc5acfd3
5 changed files with 71 additions and 81 deletions
+18 -12
View File
@@ -13,7 +13,7 @@ import {
Sheet, SheetContent, SheetHeader, SheetTitle,
SheetDescription, SheetFooter, SheetClose,
} from "@/components/ui/sheet"
import { applyTrafficFlowOverlay, getTrafficFlowSettings } from "@/shared/api/traffic-flow"
import { applyTrafficFlowOverlay } from "@/shared/api/traffic-flow"
import type { ServerRead } from "@mmapp/contracts/servers"
import type { TrafficFlowHostFile, TrafficFlowOverlayResult } from "@mmapp/contracts/traffic-flow"
import {
@@ -52,11 +52,17 @@ function FlowOverlaySheet({
setResult(null)
setCopied(false)
setTab("wg-quick")
setServerId(jumpHosts[0] ? String(jumpHosts[0].id) : "")
void getTrafficFlowSettings(backendUrl)
.then((s) => setEndpoint(s.publicEndpoint))
.catch(() => setEndpoint(""))
}, [open, jumpHosts, backendUrl])
const first = jumpHosts[0]
const nextId = first ? String(first.id) : ""
setServerId(nextId)
setEndpoint(first?.host ?? "")
}, [open, jumpHosts])
function handleServerChange(id: string) {
setServerId(id)
const selected = jumpHosts.find((s) => String(s.id) === id)
if (selected) setEndpoint(selected.host)
}
const formats = useMemo((): TrafficFlowHostFile[] => {
if (!result) return []
@@ -106,7 +112,7 @@ function FlowOverlaySheet({
<SheetHeader className="px-6 pt-6 pb-4 border-b shrink-0">
<SheetTitle>Подключить jump-host</SheetTitle>
<SheetDescription>
Настроит wg-flow и Traffic Flow на MikroTik и сразу выдаст файлы для Linux-хоста Docker MM (wg-quick / compose / firewall).
Создаст wg-flow на выбранном MikroTik (сервер, listen 13232) и сразу выдаст wg-quick / compose для Linux-хоста Docker MM (клиент).
</SheetDescription>
</SheetHeader>
<div className="flex-1 min-h-0 overflow-y-auto px-6 py-5 flex flex-col gap-5">
@@ -114,7 +120,7 @@ function FlowOverlaySheet({
<select
className="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none"
value={serverId}
onChange={(e) => setServerId(e.target.value)}
onChange={(e) => handleServerChange(e.target.value)}
>
<option value="">Выберите сервер</option>
{jumpHosts.map((s) => (
@@ -125,15 +131,15 @@ function FlowOverlaySheet({
</select>
</FormField>
<FormField
label="Публичный IP или DNS хоста Docker MM"
label="Публичный IP или DNS jump-host"
required
hint="Откуда JH стучится на WG listen (51821). Хост с wg-quick, не контейнер backend."
hint="Куда хост MM (wg-quick) стучится по UDP 13232. Не контейнер backend."
>
<Input
className="font-mono"
value={endpoint}
onChange={(e) => setEndpoint(e.target.value)}
placeholder="203.0.113.10"
placeholder="jh.example.com"
autoComplete="off"
/>
</FormField>
@@ -143,7 +149,7 @@ function FlowOverlaySheet({
<InfoIcon />
<AlertTitle>Ключи и UDP 4739</AlertTitle>
<AlertDescription>
Приватный ключ хоста в SQLite панели не кладите в git. UDP 4739 публикуйте только на WG-IP, не на 0.0.0.0.
Приватный ключ хоста в SQLite панели не кладите в git. UDP 4739 публикуйте только на WG-IP хоста, не на 0.0.0.0 контейнера.
</AlertDescription>
</Alert>
<ul className="text-xs text-muted-foreground flex flex-col gap-1">