Show domains in pool status

This commit is contained in:
2026-08-18 02:53:40 +03:00
parent a1fa90c66a
commit eb5f4cbf5a
12 changed files with 517 additions and 141 deletions
+42 -3
View File
@@ -1,7 +1,14 @@
import { storeJson } from '../fileModels/store.json'
import { i18n } from '../i18n'
import { sdk } from '../sdk'
import { curlJson, defaultStratumPort, uiPort } from '../utils'
import {
curlJson,
defaultStratumPort,
defaultStratumPublicTlsPort,
defaultStratumTlsPort,
endpointPorts,
uiPort,
} from '../utils'
const API_BASE = `http://127.0.0.1:${uiPort}`
@@ -158,8 +165,22 @@ export const poolStatus = sdk.Action.withoutInput(
// the execution function
async ({ effects }) => {
const stratumPort =
(await storeJson.read((s) => s.stratumPort).once()) ?? defaultStratumPort
// Effective external ports, straight from the OS. The Configure form holds
// a *request*; if the port was taken the OS granted a different one, and
// this is where the user finds out what miners must actually connect to.
const requests = (await storeJson
.read((s) => ({
stratum: s.stratumPort,
tls: s.stratumTlsPort,
publicTls: s.stratumPublicTlsPort,
}))
.once()) ?? {
stratum: defaultStratumPort,
tls: defaultStratumTlsPort,
publicTls: defaultStratumPublicTlsPort,
}
const ports = await endpointPorts(effects, requests, 'once')
const stratumPort = ports[0].assigned ?? ports[0].requested
// Fetch from inside the service's network namespace: temp subcontainers
// share it, so curl reaches kamado-api on 127.0.0.1.
@@ -354,6 +375,24 @@ export const poolStatus = sdk.Action.withoutInput(
// ── 2. Stratum ───────────────────────────────────────────────────────────
log('')
sep()
log('● Endpoints (the ports miners connect to)')
for (const p of ports) {
const assigned = p.assigned ?? p.requested
const note =
p.assigned === null
? ' (not assigned yet)'
: p.assigned !== p.requested
? ` <- REQUESTED ${p.requested}, reassigned by StartOS`
: ''
log(` ${pad(p.label, 30)} ${assigned}${note}`)
// Domains publish on the requested port rather than the assigned one, so
// list them explicitly instead of letting the reader assume the number
// above applies to them too.
for (const d of p.domains) {
log(` ${pad(' domain:', 30)} ${d.fqdn}:${d.port}`)
}
}
log('')
log(`● Stratum (port ${stratumPort})`)
if (snap?.ckpool_ok) {
log(