Adds Authelia (forward-auth) and nginx portal container for single-endpoint authenticated access via Caddy reverse proxy. Configures Grafana auth proxy for header-based auto-login. Updates Vue UI base paths and API routes for /exabgp/ and /traffic/ subpath serving. Adds traffic-gen responder container on dedicated Docker network. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25 lines
1019 B
JavaScript
25 lines
1019 B
JavaScript
const BASE = '/exabgp/api'
|
|
|
|
async function req(method, path, body) {
|
|
const opts = { method, headers: { 'Content-Type': 'application/json' } }
|
|
if (body) opts.body = JSON.stringify(body)
|
|
const r = await fetch(BASE + path, opts)
|
|
if (!r.ok) throw new Error(`${method} ${path} → ${r.status}`)
|
|
return r.json()
|
|
}
|
|
|
|
export const api = {
|
|
health: () => req('GET', '/healthz'),
|
|
peers: () => req('GET', '/peers'),
|
|
routes: () => req('GET', '/routes'),
|
|
scenarios: () => req('GET', '/scenarios'),
|
|
loadScenario: name => req('POST', `/scenario/${name}`),
|
|
unloadScenario: name => req('DELETE', `/scenario/${name}`),
|
|
announce: payload => req('POST', '/announce', payload),
|
|
withdraw: prefixes => req('POST', '/withdraw', { prefixes }),
|
|
withdrawAll: () => req('POST', '/withdraw/all'),
|
|
fullTableStart: (count, batchSize) => req('POST', '/full-table/start', { count, batch_size: batchSize }),
|
|
fullTableStatus: () => req('GET', '/full-table/status'),
|
|
fullTableStop: () => req('POST', '/full-table/stop'),
|
|
}
|