minor improvements
This commit is contained in:
parent
fe1fb1935c
commit
5e5cd22273
2
go.mod
2
go.mod
@ -10,7 +10,7 @@ require (
|
|||||||
github.com/klauspost/compress v1.17.9 // indirect
|
github.com/klauspost/compress v1.17.9 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasthttp v1.55.0 // indirect
|
github.com/valyala/fasthttp v1.55.0 // indirect
|
||||||
|
4
go.sum
4
go.sum
@ -11,8 +11,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
|||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
|
16
main.go
16
main.go
@ -8,12 +8,12 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
appName = "rngpotd"
|
appName = "rngpotd"
|
||||||
appVersion = "0.0.1"
|
appVersion = "0.0.2"
|
||||||
userAgent = appName + "/" + appVersion
|
userAgent = appName + "/" + appVersion
|
||||||
serverAgent = "nginx/1.27.0"
|
serverAgent = "nginx/1.27.1"
|
||||||
|
|
||||||
minimumGoMaxProcs = 2
|
minimumGoMaxProcs = 4
|
||||||
maximumGoMaxProcs = 4
|
maximumGoMaxProcs = 8
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -28,19 +28,19 @@ func main() {
|
|||||||
gmp := runtime.GOMAXPROCS(0)
|
gmp := runtime.GOMAXPROCS(0)
|
||||||
if gmp < minimumGoMaxProcs {
|
if gmp < minimumGoMaxProcs {
|
||||||
runtime.GOMAXPROCS(minimumGoMaxProcs)
|
runtime.GOMAXPROCS(minimumGoMaxProcs)
|
||||||
}
|
} else if gmp > maximumGoMaxProcs {
|
||||||
if gmp > maximumGoMaxProcs {
|
|
||||||
runtime.GOMAXPROCS(maximumGoMaxProcs)
|
runtime.GOMAXPROCS(maximumGoMaxProcs)
|
||||||
}
|
}
|
||||||
|
|
||||||
n_rngRetCodes = len(rngRetCodes)
|
|
||||||
|
|
||||||
log.SetFlags(log.Flags() | log.Lmicroseconds)
|
log.SetFlags(log.Flags() | log.Lmicroseconds)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
log.Printf("%s: starting\n", userAgent)
|
log.Printf("%s: starting\n", userAgent)
|
||||||
|
|
||||||
app := initFiberApp()
|
app := initFiberApp()
|
||||||
|
if app == nil {
|
||||||
|
log.Fatal("failed to initialize rngpotd")
|
||||||
|
}
|
||||||
|
|
||||||
log.Printf("%s: ready\n", userAgent)
|
log.Printf("%s: ready\n", userAgent)
|
||||||
log.Printf("%s: going to listen %q\n", userAgent, listenEndpoint)
|
log.Printf("%s: going to listen %q\n", userAgent, listenEndpoint)
|
||||||
|
@ -4,6 +4,10 @@ import (
|
|||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
n_rngRetCodes = len(rngRetCodes)
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
rngRetCodes = [...]int{
|
rngRetCodes = [...]int{
|
||||||
fiber.StatusTeapot,
|
fiber.StatusTeapot,
|
||||||
@ -42,5 +46,4 @@ var (
|
|||||||
fiber.StatusUnavailableForLegalReasons,
|
fiber.StatusUnavailableForLegalReasons,
|
||||||
499, // try harder comrade!
|
499, // try harder comrade!
|
||||||
}
|
}
|
||||||
n_rngRetCodes = 1
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user