code wiki / (root) / nx_pages_https_daemon.nx

nx_pages_https_daemon.nx

buildroot/runtime/nx_pages_https_daemon.nx

13860 B359 linesdepth 12pulls 65 transitivereach 0 importersview sourcekind servicetopic pages
docsdependenciesstructsconstsfunctions

about

nx_pages_https_daemon.nx -- D1.3 of NISHI_DEPLOY_ROADMAP. Composes nx_edge_daemon's TLS 1.3 handshake stones with nx_pages_vhost + nx_pages_static for full HTTPS hosting of nishifamily.com (and any vhost configured in the table). Pre-existing pieces (no changes needed): nx_edge_daemon -- handshake driver (recv_ch, emit_sh, derive_hs, derive_traffic, emit_ee, emit_certificate, emit_cv, emit_sf, recv_cf) + TCP socket setup nx_tls13_server_session_app_recv / app_send -- AEAD record I/O nx_pages_vhost -- Host-header dispatch (D1.1) nx_pages_static -- file serve with mime + 200/404/405 nx_http.nx http_parse -- full HTTP/1.1 request parse (FIXED earlier in NISHI_DEPLOY_ROADMAP) D1.3 work in this file: - Replace nx_edge_handle_connection's "read encrypted, ignore it, send a single static HTML" with "decrypt, parse, vhost-dispatch, serve, encrypt". - Mount a multi-vhost configuration suitable for nishifamily.com. Per [[NISHI_DEPLOY_ROADMAP]] D1.3. D1.4 (HTTP->HTTPS on :80) and D1.5 (ACME auto-renew loop) layer on top of this.

dependencies 20 imports · 0 importers

nx_syscalls.nx nx_x25519_ephemeral.nx nx_tls13.nx nx_tls13_record.nx nx_tls13_server_session.nx nx_tls13_server_session_recv_ch.nx nx_tls13_server_session_emit_sh.nx nx_tls13_server_session_derive_hs. nx_tls13_server_session_derive_tra nx_tls13_server_session_emit_ee.nx nx_pages_https_daemon.nx

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

imports: nx_syscalls.nxnx_x25519_ephemeral.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_server_session.nxnx_tls13_server_session_recv_ch.nxnx_tls13_server_session_emit_sh.nxnx_tls13_server_session_derive_hs.nxnx_tls13_server_session_derive_traffic.nxnx_tls13_server_session_emit_ee.nxnx_tls13_server_session_emit_certificate.nxnx_tls13_server_session_emit_cv.nxnx_tls13_server_session_emit_sf.nxnx_tls13_server_session_recv_cf.nxnx_tls13_server_session_app_data.nxnx_http.nxnx_http_server.nxnx_pages_vhost.nxnx_pages_static.nxnx_pages_config.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 sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_pages_https_daemon_run sys_mmap ↻ sys_read_file ↻ nx_vhost_table_init _phttps_setup_vhosts nx_pages_config_load sys_mmap ↻ sys_read_file ↻ _pcfg_find_byte _pcfg_is_ws _pcfg_byte_eq nx_vhost_add _vh_arena_push_cstr _pcfg_parse_i64 nx_vhost_set_fallback _phttps_setup_vhosts_hardc nx_vhost_add ↻ nx_vhost_set_fallback ↻ 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 sys_write nx_http_server_accept_one sys_accept

structs

none

consts

46const NX_MAGIC_2048: i64 = 2048
47const NX_MAGIC_4096: i64 = 4096
49const NX_PHTTPS_OK: i64 = 0
50const NX_PHTTPS_ERR_HANDSHAKE: i64 = 1
51const NX_PHTTPS_ERR_APP_RECV: i64 = 2
52const NX_PHTTPS_ERR_PARSE: i64 = 3
53const NX_PHTTPS_ERR_APP_SEND: i64 = 4
54const NX_PHTTPS_ERR_SOCKET_WRITE: i64 = 5
56const NX_PHTTPS_PORT: i64 = 8443
57const NX_PHTTPS_REQ_REC_CAP: i64 = 16384
58const NX_PHTTPS_PLAIN_CAP: i64 = 16384
59const NX_PHTTPS_RESP_CAP: i64 = 1048576 // 1 MB max response body
60const NX_PHTTPS_OUT_REC_CAP: i64 = 1048768 // resp + TLS record overhead
61const NX_PHTTPS_BACKLOG: i64 = 64

functions

70func _phttps_handshake(
151func nx_pages_https_handle_connection(
241func _phttps_setup_vhosts_hardcoded(t: *NxVHostTable, cursor: *i64) -> i64
253func _phttps_setup_vhosts(t: *NxVHostTable, cursor: *i64) -> i64
260func nx_pages_https_daemon_run(
324func main() -> i64