1
0

minor improvements
Some checks failed
ci/woodpecker/push/build Pipeline failed
ci/woodpecker/manual/build Pipeline was successful
ci/woodpecker/manual/latest Pipeline was successful

This commit is contained in:
Konstantin Demin 2024-07-26 11:07:36 +03:00
parent fe1fb1935c
commit 5e5cd22273
Signed by: krd
GPG Key ID: 4D56F87A8BA65FD0
4 changed files with 15 additions and 12 deletions

2
go.mod
View File

@ -10,7 +10,7 @@ require (
github.com/klauspost/compress v1.17.9 // indirect
github.com/mattn/go-colorable v0.1.13 // 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/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0 // indirect

4
go.sum
View File

@ -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.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
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.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
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.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=

16
main.go
View File

@ -8,12 +8,12 @@ import (
const (
appName = "rngpotd"
appVersion = "0.0.1"
appVersion = "0.0.2"
userAgent = appName + "/" + appVersion
serverAgent = "nginx/1.27.0"
serverAgent = "nginx/1.27.1"
minimumGoMaxProcs = 2
maximumGoMaxProcs = 4
minimumGoMaxProcs = 4
maximumGoMaxProcs = 8
)
var (
@ -28,19 +28,19 @@ func main() {
gmp := runtime.GOMAXPROCS(0)
if gmp < minimumGoMaxProcs {
runtime.GOMAXPROCS(minimumGoMaxProcs)
}
if gmp > maximumGoMaxProcs {
} else 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()
if app == nil {
log.Fatal("failed to initialize rngpotd")
}
log.Printf("%s: ready\n", userAgent)
log.Printf("%s: going to listen %q\n", userAgent, listenEndpoint)

View File

@ -4,6 +4,10 @@ import (
"github.com/gofiber/fiber/v2"
)
const (
n_rngRetCodes = len(rngRetCodes)
)
var (
rngRetCodes = [...]int{
fiber.StatusTeapot,
@ -42,5 +46,4 @@ var (
fiber.StatusUnavailableForLegalReasons,
499, // try harder comrade!
}
n_rngRetCodes = 1
)