pancheri/cmd/pancheri-render/main.go

60 lines
1.3 KiB
Go
Raw Normal View History

2023-10-02 14:21:08 +00:00
package main
import (
"flag"
"git.e3t.cc/e3team/pancheri"
"net"
"os"
)
func main() {
//configPath := flag.String("zone", "", "Zone file to render")
printUsage := flag.Bool("help", false, "Print command line usage")
flag.Parse()
if *printUsage {
flag.Usage()
os.Exit(0)
}
var aRecords []pancheri.RecordA
aRecords = append(aRecords, pancheri.RecordA{
In: "test.xe.",
Ip: net.ParseIP("1.2.3.4"),
TTL: 600,
})
var aaaaRecords []pancheri.RecordAAAA
aaaaRecords = append(aaaaRecords, pancheri.RecordAAAA{
In: "testv6.xe.",
Ip: net.ParseIP("bd1f:f314:5398:0e3d:b3e0:f427:73ef:60fb"),
TTL: 600,
})
var cnameRecords []pancheri.RecordCNAME
cnameRecords = append(cnameRecords, pancheri.RecordCNAME{
In: "cname.xe.",
Target: "test.xe.",
TTL: 600,
})
var txtRecords []pancheri.RecordTXT
txtRecords = append(txtRecords, pancheri.RecordTXT{
In: "txt.xe.",
Content: []string{"WHY HELLO THERE MY FELLOW E3TEAMERS"},
TTL: 600,
})
zone := pancheri.Zone{
ReducedHash: "0433da05bf22d86c1886fca6e3e2c3239b86f1e6ebea9b94201483c8596c0468",
Root: "xe",
ARecords: aRecords,
AAAARecords: aaaaRecords,
CNAMERecords: cnameRecords,
TXTRecords: txtRecords,
Zonefile: "zone_example.yml",
}
println(zone.RenderZone())
}