Expose config options for cleartext stratum port

This commit is contained in:
2026-08-01 06:31:15 +03:00
commit a2ae800a19
36 changed files with 4585 additions and 0 deletions
+77
View File
@@ -0,0 +1,77 @@
import { IMPOSSIBLE, VersionInfo, YAML } from '@start9labs/start-sdk'
import { readFile, rm } from 'fs/promises'
import { storeJson } from '../fileModels/store.json'
import { defaultStratumPort, defaultStratumTlsPort, LogLevel } from '../utils'
/** Shape of the 0.3.5.1 wrapper's config.yaml (main volume, start9/config.yaml). */
type LegacyConfig = {
bitcoind?: { type?: string }
'stratum-port'?: number
tls?: { enabled?: string; port?: number }
'zmq-enabled'?: boolean
advanced?: {
'pool-identifier'?: string
startdiff?: number
mindiff?: number
maxdiff?: number
dropidle?: number
'log-level'?: LogLevel
'mempool-explorer'?: { type?: string; url?: string }
}
}
export const current = VersionInfo.of({
version: '0.2.0:0',
releaseNotes: {
en_US:
'StartOS 0.4.0 port. Stratum is now exposed directly on the LAN as a raw TCP interface (no more router forwards or simpleproxy), Bitcoin Core is reached over the internal network bridge with cookie authentication, and settings moved from Config to the Configure action. Existing settings, found-block history, and the stratum TLS certificate are migrated automatically.',
es_ES:
'Adaptación a StartOS 0.4.0. Stratum ahora se expone directamente en la LAN como interfaz TCP, Bitcoin Core se alcanza a través del puente de red interno con autenticación por cookie, y la configuración se movió a la acción Configurar. Los ajustes existentes, el historial de bloques y el certificado TLS se migran automáticamente.',
de_DE:
'Portierung auf StartOS 0.4.0. Stratum wird jetzt direkt im LAN als TCP-Schnittstelle bereitgestellt, Bitcoin Core wird über die interne Netzwerk-Bridge mit Cookie-Authentifizierung erreicht, und die Einstellungen sind in die Aktion „Konfigurieren“ umgezogen. Bestehende Einstellungen, Blockhistorie und das TLS-Zertifikat werden automatisch migriert.',
pl_PL:
'Port na StartOS 0.4.0. Stratum jest teraz udostępniany bezpośrednio w sieci LAN jako interfejs TCP, Bitcoin Core jest osiągany przez wewnętrzny mostek sieciowy z uwierzytelnianiem cookie, a ustawienia przeniesiono do akcji Konfiguruj. Istniejące ustawienia, historia bloków i certyfikat TLS są migrowane automatycznie.',
fr_FR:
'Portage vers StartOS 0.4.0. Stratum est désormais exposé directement sur le LAN comme interface TCP, Bitcoin Core est atteint via le pont réseau interne avec authentification par cookie, et les réglages ont migré vers laction Configurer. Les réglages existants, lhistorique des blocs et le certificat TLS sont migrés automatiquement.',
},
migrations: {
up: async ({ effects }) => {
// Migrate from the 0.3.5.1 wrapper: its config.yaml lives on the main
// volume under start9/. The SQLite DB (data/kamado.db), TLS certs
// (tls/) and the ckpool volume carry over untouched — only the config
// format changed.
const configYaml: LegacyConfig | undefined = await readFile(
'/media/startos/volumes/main/start9/config.yaml',
'utf-8',
).then(YAML.parse, () => undefined)
if (configYaml) {
const adv = configYaml.advanced ?? {}
const mempool = adv['mempool-explorer']
await storeJson.merge(effects, {
// Carried over so miners pointed at the old forwarded port keep
// working: the same number is requested as the interface's
// preferred external port.
stratumPort: configYaml['stratum-port'] ?? defaultStratumPort,
stratumTlsPort: configYaml.tls?.port ?? defaultStratumTlsPort,
coinbaseTag: adv['pool-identifier'] ?? '/Kamado/',
startDiff: adv.startdiff ?? 16384,
minDiff: adv.mindiff ?? 1000,
maxDiff: adv.maxdiff ?? 0,
dropIdle: adv.dropidle ?? 0,
logLevel: adv['log-level'] ?? 'info',
zmqEnabled: configYaml['zmq-enabled'] ?? true,
tlsEnabled: configYaml.tls?.enabled === 'enabled',
mempoolExplorerUrl:
mempool?.type === 'custom' && mempool.url ? mempool.url : null,
})
// remove old start9 dir
await rm('/media/startos/volumes/main/start9', {
recursive: true,
}).catch(console.error)
}
},
down: IMPOSSIBLE,
},
})
+7
View File
@@ -0,0 +1,7 @@
import { VersionGraph } from '@start9labs/start-sdk'
import { current } from './current'
export const versionGraph = VersionGraph.of({
current,
other: [],
})