Initial commit

This commit is contained in:
nemunaire 2026-04-26 11:06:47 +07:00
commit 7ca2fb60c6
24 changed files with 3098 additions and 0 deletions

48
main.go Normal file
View file

@ -0,0 +1,48 @@
package main
import (
"flag"
"log"
"net"
"os"
"time"
chk "git.happydns.org/checker-authoritative-consistency/checker"
"git.happydns.org/checker-sdk-go/checker/server"
)
// Version is the standalone binary's version. It defaults to "custom-build"
// and is meant to be overridden by the CI at link time:
//
// go build -ldflags "-X main.Version=1.2.3" .
var Version = "custom-build"
var (
listenAddr = flag.String("listen", ":8080", "HTTP listen address")
healthcheck = flag.Bool("healthcheck", false, "Probe the listen address over TCP and exit (used by Docker HEALTHCHECK)")
)
func main() {
flag.Parse()
if *healthcheck {
probe := *listenAddr
if len(probe) > 0 && probe[0] == ':' {
probe = "127.0.0.1" + probe
}
conn, err := net.DialTimeout("tcp", probe, 2*time.Second)
if err != nil {
log.Printf("healthcheck failed: %v", err)
os.Exit(1)
}
conn.Close()
return
}
chk.Version = Version
srv := server.New(chk.Provider())
if err := srv.ListenAndServe(*listenAddr); err != nil {
log.Fatalf("server error: %v", err)
}
}