1
0
rngpotd/main.go

51 lines
904 B
Go
Raw Normal View History

2024-07-19 16:52:06 +03:00
package main
import (
"flag"
"log"
"runtime"
)
const (
appName = "rngpotd"
appVersion = "0.0.1"
userAgent = appName + "/" + appVersion
serverAgent = "nginx/1.27.0"
minimumGoMaxProcs = 2
maximumGoMaxProcs = 4
)
var (
listenEndpoint string
)
func init() {
flag.StringVar(&listenEndpoint, "listen", ":8888", "listen (\":port\", \"address:port\")")
}
func main() {
gmp := runtime.GOMAXPROCS(0)
if gmp < minimumGoMaxProcs {
runtime.GOMAXPROCS(minimumGoMaxProcs)
}
if gmp > maximumGoMaxProcs {
runtime.GOMAXPROCS(maximumGoMaxProcs)
}
n_rngRetCodes = len(rngRetCodes)
log.SetFlags(log.Flags() | log.Lmicroseconds)
flag.Parse()
log.Printf("%s: starting\n", userAgent)
app := initFiberApp()
log.Printf("%s: ready\n", userAgent)
log.Printf("%s: going to listen %q\n", userAgent, listenEndpoint)
if err := app.Listen(listenEndpoint); err != nil {
log.Fatal(err)
}
}