2024-06-04 03:20:21 +03:00
|
|
|
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)
|
|
|
|
|
|
|
|
setupNftables()
|
|
|
|
r := setupGin()
|
2024-06-06 07:44:26 +03:00
|
|
|
setupAddrMapHousekeeping()
|
2024-06-04 03:20:21 +03:00
|
|
|
log.Printf("%s: ready\n", userAgent)
|
|
|
|
|
|
|
|
if err := r.Run(cfgListen); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|