fix(ix): объединить туннели по клиентам и показать счётчики трафика
Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 10m24s
Docker images / backend-image (push) Successful in 2m0s
Docker images / frontend-image (push) Successful in 2m15s
Docker images / updater-image (push) Successful in 39s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / notify-webhook (push) Successful in 2s
Docker images / publish-release (push) Successful in 10s
Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 10m24s
Docker images / backend-image (push) Successful in 2m0s
Docker images / frontend-image (push) Successful in 2m15s
Docker images / updater-image (push) Successful in 39s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / notify-webhook (push) Successful in 2s
Docker images / publish-release (push) Successful in 10s
This commit is contained in:
1 parent
31f75a8eed
commit
5a46594ec9
7 files changed
+124
-56
No files matched your search
@@ -41,6 +41,16 @@ const serveRouter = (rows: RouterRows): RequestListener => async (request, respo
|
||||
const path = new URL(request.url!, "http://127.0.0.1").pathname.replace(/^\/rest/, "")
|
||||
let result: unknown
|
||||
if (request.method === "GET") result = rows[path] ?? []
|
||||
else if (request.method === "POST" && path === "/interface/print") {
|
||||
let raw = ""
|
||||
for await (const chunk of request) raw += chunk
|
||||
const body = JSON.parse(raw)
|
||||
assert.equal(body.stats, "")
|
||||
result = (rows["/interface"] ?? []).map(row => {
|
||||
const gre = rows["/interface/gre"]?.some(item => item.name === row.name)
|
||||
return { name: row.name, "rx-byte": gre ? "1536" : "9000", "tx-byte": gre ? "2048" : "8000" }
|
||||
})
|
||||
}
|
||||
else if (request.method === "PUT") {
|
||||
if (writes === failPutAt) throw Error("Synthetic RouterOS apply failure")
|
||||
let raw = ""
|
||||
@@ -312,6 +322,8 @@ try {
|
||||
const clientInput = { serverId: Number(server.id), name: "linux-auto", kind: "wireguard", hubEndpoint: "192.0.2.20",
|
||||
peerEndpoint: "192.0.2.40", exit: "local-wan", prefixes: [], destinations: ["203.0.113.0/24"], enabled: true }
|
||||
const staged = await post(managedPath + "/linux", { ...clientInput, revision: managed.revision }, 200)
|
||||
assert.match(staged.interfaceName, /^il-wg-[a-z0-9-]+-[0-9a-f]{12}$/)
|
||||
assert.ok(staged.segment.configuration.sites[0].interfaces[0].linux.clientId)
|
||||
const clientKey = { serverId: clientInput.serverId, interfaceName: staged.interfaceName }
|
||||
await post(managedPath + "/linux/credential", clientKey, 409)
|
||||
await post(managedPath + "/linux/credential", clientKey, 403, reader)
|
||||
@@ -379,6 +391,7 @@ try {
|
||||
const paired = await post(managedPath + "/linux", { ...companionInput, revision: resumed.segment.revision }, 200)
|
||||
const bindings = paired.segment.configuration.sites[0].interfaces
|
||||
const [wireguard, greBinding] = bindings
|
||||
assert.match(greBinding.name, /^il-gre-[a-z0-9-]+-[0-9a-f]{12}$/)
|
||||
assert.ok(wireguard.linux.clientId)
|
||||
const original = resumed.segment.configuration.sites[0].interfaces[0]
|
||||
assert.deepEqual(wireguard, { ...original, linux: { ...original.linux, clientId: wireguard.linux.clientId } })
|
||||
@@ -393,6 +406,11 @@ try {
|
||||
const pairPlan = await post(managedPath + "/plan", { revision: paired.segment.revision }, 200)
|
||||
assert(!pairPlan.changes.some(change => change.path.startsWith("/interface/wireguard")))
|
||||
const pairedApplied = await post(managedPath + "/apply", { revision: paired.segment.revision, digest: pairPlan.digest }, 200)
|
||||
const countersResponse = await fetch(origin + "/api/ix/segments" + managedPath + "/linux", { headers: { authorization: "Bearer " + reader } })
|
||||
assert.equal(countersResponse.status, 200)
|
||||
const observedGre = (await countersResponse.json()).items.find(item => item.interfaceName === greBinding.name)
|
||||
assert.equal(observedGre.connection.rx, "1536")
|
||||
assert.equal(observedGre.connection.tx, "2048")
|
||||
const pairVrf = rows["/ip/vrf"].find(row => row.interfaces?.includes(wireguard.name))!
|
||||
assert(pairVrf.interfaces.split(",").includes(greBinding.name))
|
||||
const greCredential = await post(managedPath + "/linux/credential",
|
||||
|
||||
Reference in new issue
Block a user