36 lines
571 B
Go
36 lines
571 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"runtime"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
appName = "powerdns-remote-http-example"
|
||
|
appVersion = "0.0.1"
|
||
|
|
||
|
userAgent = appName + "/" + appVersion
|
||
|
|
||
|
minimumGoMaxProcs = 4
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
gmp := runtime.GOMAXPROCS(0)
|
||
|
if gmp < minimumGoMaxProcs {
|
||
|
runtime.GOMAXPROCS(minimumGoMaxProcs)
|
||
|
}
|
||
|
|
||
|
log.SetFlags(log.Flags() | log.Lmicroseconds)
|
||
|
log.Printf("%s: starting\n", userAgent)
|
||
|
|
||
|
setupDns()
|
||
|
setupAddrMapHousekeeping()
|
||
|
setupNftables()
|
||
|
r := setupGin()
|
||
|
log.Printf("%s: ready\n", userAgent)
|
||
|
|
||
|
if err := r.Run(cfgListen); err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
}
|