WIP(osal.coredns): add example for coredns usage

- added openssl and iproute2 installation to install_v.sh since they're
  needed in coredns installation and usage.
- fixed bug in coredns build process.
- fixed bug in getting own public ip.
- fixed bugs in json encoding dns records before pushing to redis
This commit is contained in:
2025-02-10 17:07:49 +00:00
parent 86e3fdb910
commit 3117d288b1
5 changed files with 57 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
#!/usr/bin/env -S v -n -w -cg -d use_openssl -enable-globals run
import freeflowuniverse.herolib.installers.infra.coredns as coredns_installer
import freeflowuniverse.herolib.osal.coredns
@@ -11,10 +11,36 @@ installer.start()!
// TODO: create heroscript and run it to add dns records
mut script := '
dns.a_record
name: "a_rec1"
ip: "1.1.1.1"
'
!!dns.a_record
name: "host1"
ip: "1.1.1.1"
!!dns.aaaa_record
name: "host2"
ip: "2001:db8::1"
ttl: 300
!!dns.mx_record
host: "mail.heroexample.com"
preference: 10
ttl: 300
!!dns.txt_record
text: "v=spf1 mx ~all"
ttl: 300
!!dns.srv_record
target: "sip.heroexample.com"
port: 5060
priority: 10
weight: 100
ttl: 300
!!dns.ns_record
host: "ns1.heroexample.com"
ttl: 300
'
mut plbook := playbook.new(text: script)!
coredns.play_dns(mut plbook)!
rec := coredns.play_dns(mut plbook)!
rec.set('heroexample.com')!