initial commit
This commit is contained in:
50
main.go
Normal file
50
main.go
Normal file
@@ -0,0 +1,50 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user