code wiki / bin / nx_sites_daemon.nx

nx_sites_daemon.nx

buildroot/runtime/bin/nx_sites_daemon.nx

42666 B714 linesdepth 14pulls 94 transitivereach 0 importersview sourcekind servicetopic sites
docsdependenciesstructsconstsfunctions

about

nx_sites_daemon.nx -- sovereign multi-vhost HTTPS daemon (pure Nishi, silicon-up). Serves andelinwest.com + nishifamily.com (+ /wiki) by Host-header / path dispatch over the PROVEN TLS 1.3 + Ed25519 path. Operator 2026-05-28 (full autonomy): "get andelinwest.com and nishifamily.com/wiki up ... near hundred percent site uptime." Reuses only the proven primitives (run_ed25519 handshake + app_recv + app_send) the ed25519 test daemon validated end-to-end. Avoids the mv daemon's nx_wiki_route_dispatch (which returns empty on the NAS). Dispatch is simple substring matching on the decrypted request -- reliable for placeholders. Real wiki engine swaps in later behind the same vhost routing. M6 anti-pretend-stub: each page SELF-LABELS as a launch placeholder and shows real structure (andelinwest names its compliance blockers; the wiki lists the actual shipped substrate components).

dependencies 13 imports · 0 importers

nx_syscalls.nx nx_csprng.nx nx_http_server.nx nx_tls13_server_session.nx nx_tls13_server_session_run.nx nx_tls13_server_session_app_data.n nx_sites_telemetry.nx nx_wiki_status.nx nx_wiki_article.nx nx_wiki_queue.nx nx_sites_daemon.nx

diagram shows first 10 each side; +3 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_csprng.nxnx_http_server.nxnx_tls13_server_session.nxnx_tls13_server_session_run.nxnx_tls13_server_session_app_data.nxnx_sites_telemetry.nxnx_wiki_status.nxnx_wiki_article.nxnx_wiki_queue.nxnx_host_router.nxnx_sni_cert_select.nxnx_http_proxy.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap sd_load_chain sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sd_load_key sys_mmap ↻ sys_read_file ↻ sys_read_file ↻ sd_load_cert_table sys_mmap ↻ sd_field sd_next_line sd_load_chain ↻ sd_load_key ↻ sys_write sd_u64_to_dec sd_atoi nx_http_server_addr_any nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe sys_mmap ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close ↻ sys_listen sd_strlen sd_build_resp sd_append_str sd_append sd_strlen ↻ sys_mmap ↻ sd_u64_to_dec ↻

structs

none

consts

35const NX_SD_PORT: i64 = 8443
36const NX_SD_BUDGET: i64 = 100000000
40const NX_SD_MAX_CHILDREN: i64 = 64
48const NX_SD_CERT_PATH: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_fullchain.der" as *u8
49const NX_SD_PRIV_PATH: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_ecdsa_key.bin" as *u8
56const NX_SD_CERT_NISHI: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_nishifamily_fullchain.der" as *u8
57const NX_SD_PRIV_NISHI: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_nishifamily_ecdsa_key.bin" as *u8
58const NX_SD_CERT_ANDELIN: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_andelinwest_fullchain.der" as *u8
59const NX_SD_PRIV_ANDELIN: *u8 = "/volume1/homes/elderwesto/nishihost/certs/le_andelinwest_ecdsa_key.bin" as *u8
62const NX_SD_MSG_PEEK: i64 = 2
63const NX_SD_SNI_PEEK_CAP: i64 = 8192
65const NX_SD_SITES_CONF: *u8 = "/volume1/homes/elderwesto/nishihost/sites.conf" as *u8
68const NX_SD_TELEMETRY_PATH: *u8 = "/volume1/homes/elderwesto/nishihost/sites_telemetry.log" as *u8
71const NX_SD_MAX_REQ_PER_CONN: i64 = 64
72const NX_SD_OUTCAP: i64 = 16384
75const NX_SD_STATUS_CAP: i64 = 65536
77const NX_SD_ART_CAP: i64 = 65536
79const NX_SD_DYN_CAP: i64 = 65536
82const RESP_FAVICON: *u8 = "HTTP/1.1 204 No Content\r\nConnection: keep-alive\r\n\r\n" as *u8
84const BODY_ANDELIN: *u8 = "<!DOCTYPE html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>Andelin West Law - Coming Soon</title><style>body{font-family:Georgia,serif;max-width:680px;margin:8vh auto;padding:0 24px;color:#1a1a2e;line-height:1.6}h1{font-size:2rem}.tag{color:#555}.note{margin-top:2rem;padding:16px 20px;background:#f4f4f8;border-left:4px solid #2a4d8f;font-size:.95rem}.foot{margin-top:3rem;font-size:.8rem;color:#888}</style></head><body><h1>Andelin West Law</h1><p class=\"tag\">A modern legal practice. Site launching soon.</p><div class=\"note\"><strong>Placeholder page.</strong> Served by the sovereign Nishi substrate. The full site is pending attorney review of state-bar advertising rules, ADA accessibility conformance, and the privacy notice before any client-facing or intake content goes live.</div><p class=\"foot\">Served bits-up by the Nishi stack &mdash; TLS 1.3 + Ed25519, no third-party web server.</p></body></html>\n" as *u8
86const BODY_WIKI: *u8 = "<!DOCTYPE html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>Nishi Ecosystem Wiki</title><style>body{font-family:-apple-system,Segoe UI,Roboto,sans-serif;max-width:760px;margin:6vh auto;padding:0 24px;color:#161622;line-height:1.65}h1{font-size:2.1rem}h2{font-size:1.1rem;margin-top:2rem;color:#2a4d8f}ul{padding-left:1.2rem}li{margin:.35rem 0}.note{padding:14px 18px;background:#eef2fb;border-left:4px solid #2a4d8f;border-radius:4px;font-size:.95rem}code{background:#f0f0f4;padding:1px 5px;border-radius:3px;font-size:.9em}.foot{margin-top:3rem;font-size:.8rem;color:#888}</style></head><body><h1>Nishi Ecosystem Wiki</h1><p class=\"note\"><strong>Launch placeholder &mdash; the live wiki engine is coming online.</strong> What you are reading is itself served bits-up by the substrate below: no nginx, no OpenSSL, no libc.</p><p style=\"margin:1.2rem 0\"><a href=\"/wiki/status\"><strong>&#9656; Live stack scorecard &rarr;</strong></a> &nbsp; <a href=\"/wiki/components\"><strong>&#9656; Component articles (Gitea&times;Wikipedia) &rarr;</strong></a></p><h2>Shipped substrate</h2><ul><li>Self-hosting NishiLang compiler (RV64 + x86_64), bits-up from C bootstrap</li><li>TLS 1.3 server + Ed25519 signatures (RFC 8446 / 8032) &mdash; serving this page now</li><li>SHA-256/512, ChaCha20-Poly1305, AES-GCM, HKDF, Argon2id &mdash; all KAT-verified</li><li>Sovereign secrets vault (HashiCorp-class, ChaCha20-Poly1305 at rest)</li><li>Multi-vhost HTTPS daemon with DHCP-stable routing + auto-healing watchdog</li></ul><h2>In progress</h2><ul><li>Full wiki engine (search index, doc store, markdown render)</li><li>Modern auth (OPAQUE PAKE + BIP39 recovery, no cookies)</li><li>Multi-agent concurrent editing (CRDT, sovereign)</li></ul><p class=\"foot\">nishifamily.com/wiki &mdash; bits-up sovereign hosting on the west NAS.</p></body></html>\n" as *u8
88const BODY_FAMILY: *u8 = "<!DOCTYPE html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>Nishi Family</title><style>body{font-family:-apple-system,Segoe UI,Roboto,sans-serif;max-width:680px;margin:8vh auto;padding:0 24px;color:#161622;line-height:1.65;text-align:center}h1{font-size:2.3rem}.tag{color:#555;font-size:1.05rem}a{color:#2a4d8f}.foot{margin-top:3rem;font-size:.8rem;color:#888}</style></head><body><h1>Nishi Family</h1><p class=\"tag\">The family hub &mdash; home of the Nishi sovereign ecosystem.</p><p><a href=\"/wiki\">Explore the Nishi Ecosystem Wiki &rarr;</a></p><p class=\"foot\">Served bits-up by the Nishi stack &mdash; TLS 1.3 + Ed25519, no third-party web server.</p></body></html>\n" as *u8
195const NX_SD_CERT_MANIFEST: *u8 = "/volume1/homes/elderwesto/nishihost/certs/sni_certs.manifest" as *u8
196const NX_SD_CERT_MAX: i64 = 32

functions

90func sd_strlen(s: *u8) -> i64
called by 2: sd_append_strmain
97func sd_contains(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64
called by 1: main
116func sd_body_start(hay: *u8, hlen: i64) -> i64
called by 1: main
131func sd_u64_to_dec(n: i64, buf: *u8) -> i64
called by 2: sd_build_respmain
146func sd_append(dst: *u8, off: i64, src: *u8, n: i64) -> i64
152func sd_append_str(dst: *u8, off: i64, s: *u8) -> i64
called by 1: sd_build_resp calls 2: sd_appendsd_strlen
159func sd_build_resp(out: *u8, ctype: *u8, body: *u8, body_len: i64) -> i64
174func sd_load_chain(path: *u8, len_box: *i64) -> *u8
183func sd_load_key(path: *u8) -> *u8
199func sd_atoi(s: *u8) -> i64
called by 1: main
214func sd_field(buf: *u8, pos: i64, end: i64, out: *u8, out_cap: i64) -> i64
called by 1: sd_load_cert_table
251func sd_next_line(buf: *u8, pos: i64, end: i64) -> i64
called by 1: sd_load_cert_table
263func sd_load_cert_table(man: *u8, man_n: i64,
309func main(argc: i64, argv: *i64) -> i64