code wiki / _hdl_build / nx_pub_dns_apply.nx
nx_pub_dns_apply.nx source
↩ module page · 26 lines · 1339 B
1import "nx_gate_base.nx"
2// nx_pub_dns_apply.nx -- STEP 2: the publisher EMITS the public-domain wiring directive (nishifamily.com -> the
3// publisher endpoint) to a config artifact for HOSTING to apply (DNS A / stable reverse-proxy). The publisher owns
4// the EMISSION; hosting/the opaque-gateway APPLIES the record (coordinated). license_tier: ORIGINAL expect_exit: 0
5import "nx_syscalls.nx"
6import "nx_publisher.nx"
7
8
9func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("
10" as *u8); return ok }
11func main() -> i64 {
12 pub_init()
13 __syscall(83, "knowledge/publish/dns" as *u8 as i64, 493, 0, 0, 0, 0)
14 let conf: *u8 = "knowledge/publish/dns/nishifamily.conf" as *u8
15 let ok: i64 = pub_dns_emit("nishifamily.com" as *u8, "192.168.8.240" as *u8, 443, conf)
16 gw("=== STEP 2: public-domain wiring directive EMITTED ===\n" as *u8)
17 if ok == 1 {
18 let lenp: *i64 = sys_mmap(8) as *i64; let d: *u8 = sys_read_file(conf, lenp)
19 gw(" -> knowledge/publish/dns/nishifamily.conf:\n " as *u8)
20 if (d as i64) != 0 { sys_write(1, d, lenp[0]) }
21 gw("\n HANDOFF: hosting/opaque-gateway applies this DNS A / reverse-proxy record (coordinated). Publisher EMITS.\n" as *u8)
22 return 0
23 }
24 gw(" EMIT FAILED\n" as *u8)
25 return 1
26}