code wiki / _hdl_build / nx_pub_dns_apply.nx

nx_pub_dns_apply.nx source

↩ module page · 27 lines · 1470 B

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