diff --git a/bootstrap/block.go b/bootstrap/block.go index 1f5ea6b..7614a2c 100644 --- a/bootstrap/block.go +++ b/bootstrap/block.go @@ -5,7 +5,7 @@ import ( "os/signal" "syscall" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3/log" ) func BlockUntilSignalReceived() { diff --git a/bootstrap/cache_dir.go b/bootstrap/cache_dir.go index 2070df8..2ece2cf 100644 --- a/bootstrap/cache_dir.go +++ b/bootstrap/cache_dir.go @@ -4,7 +4,7 @@ import ( "os" "path/filepath" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3/log" ) func SetupCacheDirectory(cacheDir string) string { diff --git a/bootstrap/connection.go b/bootstrap/connection.go index c327e8e..b9b0e1a 100644 --- a/bootstrap/connection.go +++ b/bootstrap/connection.go @@ -3,7 +3,7 @@ package bootstrap import ( "os" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3/log" client "github.com/webishdev/fail2ban-dashboard/fail2ban-client" ) diff --git a/bootstrap/logging.go b/bootstrap/logging.go index 71ca896..ebc68ab 100644 --- a/bootstrap/logging.go +++ b/bootstrap/logging.go @@ -1,6 +1,6 @@ package bootstrap -import "github.com/gofiber/fiber/v2/log" +import "github.com/gofiber/fiber/v3/log" func ConfigureLogging(logLevel string) { switch logLevel { diff --git a/bootstrap/refresh.go b/bootstrap/refresh.go index 1c964d5..b8996e6 100644 --- a/bootstrap/refresh.go +++ b/bootstrap/refresh.go @@ -1,6 +1,6 @@ package bootstrap -import "github.com/gofiber/fiber/v2/log" +import "github.com/gofiber/fiber/v3/log" func ValidateRefreshSeconds(refreshSeconds int) int { if refreshSeconds < 10 || refreshSeconds > 600 { diff --git a/bootstrap/servers.go b/bootstrap/servers.go index 57e933e..c6adf96 100644 --- a/bootstrap/servers.go +++ b/bootstrap/servers.go @@ -3,8 +3,8 @@ package bootstrap import ( "os" - "github.com/gofiber/fiber/v2" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3" + "github.com/gofiber/fiber/v3/log" "github.com/webishdev/fail2ban-dashboard/metrics" "github.com/webishdev/fail2ban-dashboard/server" ) @@ -13,7 +13,9 @@ var osExit = os.Exit func StartDashboardServer(app *fiber.App, config *server.Configuration) { log.Infof("Dashboard available at address %s", config.Address) - serveError := app.Listen(config.Address) + serveError := app.Listen(config.Address, fiber.ListenConfig{ + DisableStartupMessage: true, + }) if serveError != nil { log.Errorf("Could not start server: %s\n", serveError) osExit(1) @@ -22,7 +24,9 @@ func StartDashboardServer(app *fiber.App, config *server.Configuration) { func StartMetricsServer(metricsApp *fiber.App, config *metrics.Configuration) { log.Infof("Metrics available at address %s", config.Address) - serveError := metricsApp.Listen(config.Address) + serveError := metricsApp.Listen(config.Address, fiber.ListenConfig{ + DisableStartupMessage: true, + }) if serveError != nil { log.Errorf("Could not start server: %s\n", serveError) osExit(1) diff --git a/bootstrap/servers_test.go b/bootstrap/servers_test.go index 23b83ce..785ed73 100644 --- a/bootstrap/servers_test.go +++ b/bootstrap/servers_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v3" "github.com/webishdev/fail2ban-dashboard/metrics" "github.com/webishdev/fail2ban-dashboard/server" ) @@ -29,9 +29,7 @@ func findAvailablePort(t *testing.T) string { func TestStartDashboardServer_Success(t *testing.T) { address := findAvailablePort(t) - app := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + app := fiber.New(fiber.Config{}) config := &server.Configuration{ Address: address, @@ -69,9 +67,7 @@ func TestStartDashboardServer_Success(t *testing.T) { func TestStartMetricsServer_Success(t *testing.T) { address := findAvailablePort(t) - metricsApp := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + metricsApp := fiber.New(fiber.Config{}) config := &metrics.Configuration{ Address: address, @@ -130,9 +126,7 @@ func TestStartDashboardServer_PortAlreadyInUse(t *testing.T) { } }(listener) - app := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + app := fiber.New(fiber.Config{}) config := &server.Configuration{ Address: address, @@ -171,9 +165,7 @@ func TestStartMetricsServer_PortAlreadyInUse(t *testing.T) { } }(listener) - metricsApp := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + metricsApp := fiber.New(fiber.Config{}) config := &metrics.Configuration{ Address: address, @@ -199,9 +191,7 @@ func TestStartDashboardServer_InvalidAddress(t *testing.T) { osExit = originalExit }() - app := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + app := fiber.New(fiber.Config{}) config := &server.Configuration{ Address: "invalid:address:format:with:too:many:colons", @@ -227,9 +217,7 @@ func TestStartMetricsServer_InvalidAddress(t *testing.T) { osExit = originalExit }() - metricsApp := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + metricsApp := fiber.New(fiber.Config{}) config := &metrics.Configuration{ Address: "invalid:address:format:with:too:many:colons", diff --git a/cmd/fail2ban-dashboard/fail2ban-dashboard.go b/cmd/fail2ban-dashboard/fail2ban-dashboard.go index e74a785..ff605a6 100644 --- a/cmd/fail2ban-dashboard/fail2ban-dashboard.go +++ b/cmd/fail2ban-dashboard/fail2ban-dashboard.go @@ -5,8 +5,8 @@ import ( "os" "strings" - "github.com/gofiber/fiber/v2" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3" + "github.com/gofiber/fiber/v3/log" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/webishdev/fail2ban-dashboard/bootstrap" @@ -188,9 +188,7 @@ func run(_ *cobra.Command, _ []string) { geoIP := geoip.NewGeoIP(absoluteCacheDir, enableSchedule) // Create dashboard application - dashboardApp := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + dashboardApp := fiber.New(fiber.Config{}) configuration := &server.Configuration{ Address: address, @@ -209,9 +207,7 @@ func run(_ *cobra.Command, _ []string) { Version: Version, } if address != metricsAddress { - metricsApp := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + metricsApp := fiber.New(fiber.Config{}) metrics.RegisterMetricsEndpoints(metricsApp, dataStore, metricConfiguration) diff --git a/fail2ban-client/fail2ban-client.go b/fail2ban-client/fail2ban-client.go index e904f06..20eb165 100644 --- a/fail2ban-client/fail2ban-client.go +++ b/fail2ban-client/fail2ban-client.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3/log" ogórek "github.com/kisielk/og-rek" "github.com/nlpodyssey/gopickle/pickle" "github.com/nlpodyssey/gopickle/types" diff --git a/fail2ban-client/parse.go b/fail2ban-client/parse.go index 6417e9c..2089286 100644 --- a/fail2ban-client/parse.go +++ b/fail2ban-client/parse.go @@ -6,7 +6,7 @@ import ( "regexp" "time" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3/log" ) var banRegex = regexp.MustCompile(`^(\S+)[ \t]+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) \+ (-?\d+) = (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})$`) diff --git a/geoip/geoip.go b/geoip/geoip.go index ac83640..81d29f2 100644 --- a/geoip/geoip.go +++ b/geoip/geoip.go @@ -15,7 +15,7 @@ import ( "sync" "time" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3/log" ) const ( diff --git a/go.mod b/go.mod index eaf6edd..98cbc58 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/webishdev/fail2ban-dashboard -go 1.26.3 +go 1.26.4 require ( - github.com/gofiber/fiber/v2 v2.52.13 + github.com/gofiber/fiber/v3 v3.3.0 github.com/kisielk/og-rek v1.3.0 github.com/nlpodyssey/gopickle v0.3.0 github.com/prometheus/client_golang v1.23.2 @@ -17,18 +17,19 @@ require ( github.com/aristanetworks/gomap v0.0.0-20240919214256-2b26376628e1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/clipperhouse/uax29/v2 v2.7.0 // indirect github.com/fsnotify/fsnotify v1.10.1 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/gofiber/schema v1.7.1 // indirect + github.com/gofiber/utils/v2 v2.0.6 // indirect github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.18.6 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.22 // indirect - github.com/mattn/go-runewidth v0.0.23 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.3.1 // indirect + github.com/philhofer/fwd v1.2.0 // indirect github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/sagikazarmark/locafero v0.12.0 // indirect @@ -36,10 +37,13 @@ require ( github.com/spf13/cast v1.10.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/subosito/gotenv v1.6.0 // indirect + github.com/tinylib/msgp v1.6.4 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.71.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/crypto v0.51.0 // indirect + golang.org/x/net v0.54.0 // indirect golang.org/x/sys v0.44.0 // indirect golang.org/x/text v0.37.0 // indirect google.golang.org/protobuf v1.36.8 // indirect diff --git a/go.sum b/go.sum index 1e10e24..203689b 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= -github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -15,10 +13,16 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho= github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo= +github.com/fxamacker/cbor/v2 v2.9.2 h1:X4Ksno9+x3cz0TZv69ec1hxP/+tymuR8PXQJyDwfh78= +github.com/fxamacker/cbor/v2 v2.9.2/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/gofiber/fiber/v2 v2.52.13 h1:TOKP64iqC9b5P49VrBW5tHhUOvDyrtJ0xePEfzJbCbk= -github.com/gofiber/fiber/v2 v2.52.13/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= +github.com/gofiber/fiber/v3 v3.3.0 h1:QBd3sYCqdy6Qs5gJYzSw4I4SbqL204jPqpdub/ueiw8= +github.com/gofiber/fiber/v3 v3.3.0/go.mod h1:YH7/TAoRaU4kF8slDCtQuFJ1NzC+3MtxUI4KfvQtaIA= +github.com/gofiber/schema v1.7.1 h1:oSJBKdgP8JeIME4TQSAqlNKTU2iBB+2RNmKi8Nsc+TI= +github.com/gofiber/schema v1.7.1/go.mod h1:A/X5Ffyru4p9eBdp99qu+nzviHzQiZ7odLT+TwxWhbk= +github.com/gofiber/utils/v2 v2.0.6 h1:7fXYy7nSsyqbH0GQUMtK4Kwjy4J7R5742VM7JsZxzOs= +github.com/gofiber/utils/v2 v2.0.6/go.mod h1:p7mAHAk3+oUK10ZX2xTw9fZQixb4hCg8SKd4IH2xroU= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -39,14 +43,14 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4= github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= -github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw= -github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/nlpodyssey/gopickle v0.3.0 h1:BLUE5gxFLyyNOPzlXxt6GoHEMMxD0qhsE4p0CIQyoLw= github.com/nlpodyssey/gopickle v0.3.0/go.mod h1:f070HJ/yR+eLi5WmM1OXJEGaTpuJEUiib19olXgYha0= github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc= github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= +github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= @@ -62,6 +66,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI= +github.com/shamaton/msgpack/v3 v3.1.2 h1:d5gWAIyMU4M0WgDjz6IFSCuXJUA2dFwRHBpDclE8CLw= +github.com/shamaton/msgpack/v3 v3.1.2/go.mod h1:DcQG8jrdrQCIxr3HlMYkiXdMhK+KfN2CitkyzsQV4uc= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= @@ -77,10 +83,14 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/tinylib/msgp v1.6.4 h1:mOwYbyYDLPj35mkA2BjjYejgJk9BuHxDdvRnb6v2ZcQ= +github.com/tinylib/msgp v1.6.4/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.71.0 h1:tepR7H+Guh9VUqxxcPggYi8R3lGUu2Rsdh+z7/FCY3k= github.com/valyala/fasthttp v1.71.0/go.mod h1:z1sDUvOShhXq/C9mwH/fSm1Vb71tUJwmQdgkBrBNwnA= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -89,6 +99,10 @@ go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.51.0 h1:IBPXwPfKxY7cWQZ38ZCIRPI50YLeevDLlLnyC5wRGTI= +golang.org/x/crypto v0.51.0/go.mod h1:8AdwkbraGNABw2kOX6YFPs3WM22XqI4EXEd8g+x7Oc8= +golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w= +golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ= golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ= golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= diff --git a/metrics/metrics.go b/metrics/metrics.go index f50a68a..75ce2e5 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -1,9 +1,9 @@ package metrics import ( - "github.com/gofiber/fiber/v2" - "github.com/gofiber/fiber/v2/log" - "github.com/gofiber/fiber/v2/middleware/adaptor" + "github.com/gofiber/fiber/v3" + "github.com/gofiber/fiber/v3/log" + "github.com/gofiber/fiber/v3/middleware/adaptor" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/webishdev/fail2ban-dashboard/store" diff --git a/server/server.go b/server/server.go index 52be16a..e659742 100644 --- a/server/server.go +++ b/server/server.go @@ -14,9 +14,9 @@ import ( textTemplate "text/template" "time" - "github.com/gofiber/fiber/v2" - "github.com/gofiber/fiber/v2/log" - "github.com/gofiber/fiber/v2/middleware/basicauth" + "github.com/gofiber/fiber/v3" + "github.com/gofiber/fiber/v3/log" + "github.com/gofiber/fiber/v3/middleware/basicauth" client "github.com/webishdev/fail2ban-dashboard/fail2ban-client" "github.com/webishdev/fail2ban-dashboard/geoip" "github.com/webishdev/fail2ban-dashboard/store" @@ -211,32 +211,32 @@ func RegisterDashboardEndpoints(app *fiber.App, dataStore *store.DataStore, geoI cleanedBasePath := path.Clean(configuration.BasePath) dashboard := app.Group(cleanedBasePath) - dashboard.Get("images/favicon.ico", func(c *fiber.Ctx) error { + dashboard.Get("images/favicon.ico", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "image/vnd.microsoft.icon") return c.Send(faviconICOFile) }) - dashboard.Get("images/mascot.png", func(c *fiber.Ctx) error { + dashboard.Get("images/mascot.png", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "image/png") return c.Send(mascotPNGFile) }) - dashboard.Get("css/main.css", func(c *fiber.Ctx) error { + dashboard.Get("css/main.css", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "text/css") return c.Send(mainCSSFile) }) - dashboard.Get("css/daisyui@5.css", func(c *fiber.Ctx) error { + dashboard.Get("css/daisyui@5.css", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "text/css") return c.Send(daisyUiCSSFile) }) - dashboard.Get("css/themes.css", func(c *fiber.Ctx) error { + dashboard.Get("css/themes.css", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "text/css") return c.Send(themesUiCSSFile) }) - dashboard.Get("css/flags.css", func(c *fiber.Ctx) error { + dashboard.Get("css/flags.css", func(c fiber.Ctx) error { codeQuery := c.Query("c") if codeQuery == "" { return c.SendStatus(fiber.StatusNotFound) @@ -258,12 +258,12 @@ func RegisterDashboardEndpoints(app *fiber.App, dataStore *store.DataStore, geoI return c.SendString(sb.String()) }) - dashboard.Get("js/browser@4.js", func(c *fiber.Ctx) error { + dashboard.Get("js/browser@4.js", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, fiber.MIMEApplicationJavaScript) return c.Send(tailwindJSFile) }) - dashboard.Get("/", func(c *fiber.Ctx) error { + dashboard.Get("/", func(c fiber.Ctx) error { accessLog(configuration.TrustProxyHeaders, "overview", c) jails := dataStore.GetJails() @@ -310,7 +310,7 @@ func RegisterDashboardEndpoints(app *fiber.App, dataStore *store.DataStore, geoI return c.SendString(sb.String()) }) - dashboard.Get("/:jail", func(c *fiber.Ctx) error { + dashboard.Get("/:jail", func(c fiber.Ctx) error { jailName := c.Params("jail") name := fmt.Sprintf("%s details", jailName) accessLog(configuration.TrustProxyHeaders, name, c) @@ -492,7 +492,7 @@ func cleanBasePathForTemplate(basePath string) string { return basePath } -func accessLog(trustProxyHeaders bool, name string, c *fiber.Ctx) { +func accessLog(trustProxyHeaders bool, name string, c fiber.Ctx) { remoteIP := c.IP() additionalInfo := "" if trustProxyHeaders { diff --git a/server/server_test.go b/server/server_test.go index 834e250..00a8c80 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v3" client "github.com/webishdev/fail2ban-dashboard/fail2ban-client" "github.com/webishdev/fail2ban-dashboard/store" ) @@ -79,27 +79,25 @@ func createTestApp(mockStore *MockDataStore, mockGeoIP *MockGeoIP, config *Confi } _ = config // Use config to avoid ineffassign warning - app := fiber.New(fiber.Config{ - DisableStartupMessage: true, - }) + app := fiber.New(fiber.Config{}) // Set up basic routes similar to the main RegisterDashboardEndpoints function - app.Get("images/favicon.ico", func(c *fiber.Ctx) error { + app.Get("images/favicon.ico", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "image/vnd.microsoft.icon") return c.Send(faviconICOFile) }) - app.Get("css/main.css", func(c *fiber.Ctx) error { + app.Get("css/main.css", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "text/css") return c.Send(mainCSSFile) }) - app.Get("css/daisyui@5.css", func(c *fiber.Ctx) error { + app.Get("css/daisyui@5.css", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, "text/css") return c.Send(daisyUiCSSFile) }) - app.Get("js/browser@4.js", func(c *fiber.Ctx) error { + app.Get("js/browser@4.js", func(c fiber.Ctx) error { c.Set(fiber.HeaderContentType, fiber.MIMEApplicationJavaScript) return c.Send(tailwindJSFile) }) @@ -606,7 +604,7 @@ func TestIndexRouteHandler(t *testing.T) { app := createTestApp(mockStore, mockGeoIP, nil) // Add the main route handler for testing - app.Get("/", func(c *fiber.Ctx) error { + app.Get("/", func(c fiber.Ctx) error { jails := mockStore.GetJails() banned := make([]client.BanEntry, 0) diff --git a/store/store.go b/store/store.go index ac51b8b..b2e4675 100644 --- a/store/store.go +++ b/store/store.go @@ -5,7 +5,7 @@ import ( "sync" "time" - "github.com/gofiber/fiber/v2/log" + "github.com/gofiber/fiber/v3/log" client "github.com/webishdev/fail2ban-dashboard/fail2ban-client" )