38 lines
833 B
Go
38 lines
833 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
|
|
"gitlab.smoothnet.org/nhyatt/bind-response-policy-zone-creator/internal/config"
|
|
"gitlab.smoothnet.org/nhyatt/bind-response-policy-zone-creator/internal/log"
|
|
)
|
|
|
|
var cfg config.Config
|
|
|
|
func main() {
|
|
// Blocklist Collection
|
|
// https://firebog.net/
|
|
|
|
var err error
|
|
|
|
if cfg, err = config.Init(); err != nil {
|
|
log.Error("error initializing program", "error", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Set the zone serial number
|
|
cfg.ConfigFile.ZoneConfig.Serial = time.Now().In(cfg.TZLocal).Format("0601021504")
|
|
|
|
// get remote URL data
|
|
badDomains := getListData()
|
|
|
|
// clean-up
|
|
cfg.ConfigFile.ZoneConfig.BlockedDomains = cleanBadDomains(badDomains)
|
|
|
|
// write file
|
|
if err := buildBindResponsePolicyFile(); err != nil {
|
|
log.Error("unable to write file", "error", err, "path", cfg.BindOutputFileName)
|
|
}
|
|
}
|