diff --git a/cmd/root.go b/cmd/root.go index d1dac8e..43cc97f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,8 +5,6 @@ import ( "crypto/tls" "errors" "fmt" - "github.com/pterodactyl/wings/internal/cron" - "github.com/pterodactyl/wings/internal/database" log2 "log" "net/http" _ "net/http/pprof" @@ -18,6 +16,9 @@ import ( "strings" "time" + "github.com/pterodactyl/wings/internal/cron" + "github.com/pterodactyl/wings/internal/database" + "github.com/NYTimes/logrotate" "github.com/apex/log" "github.com/apex/log/handlers/multi" diff --git a/internal/cron/activity_cron.go b/internal/cron/activity_cron.go index ce258e2..a993822 100644 --- a/internal/cron/activity_cron.go +++ b/internal/cron/activity_cron.go @@ -2,6 +2,7 @@ package cron import ( "context" + "emperror.dev/errors" "github.com/pterodactyl/wings/internal/database" "github.com/pterodactyl/wings/internal/models" diff --git a/internal/cron/cron.go b/internal/cron/cron.go index 6092582..292de41 100644 --- a/internal/cron/cron.go +++ b/internal/cron/cron.go @@ -2,13 +2,14 @@ package cron import ( "context" + "time" + "emperror.dev/errors" log2 "github.com/apex/log" "github.com/go-co-op/gocron" "github.com/pterodactyl/wings/config" "github.com/pterodactyl/wings/server" "github.com/pterodactyl/wings/system" - "time" ) const ErrCronRunning = errors.Sentinel("cron: job already running") diff --git a/internal/cron/sftp_cron.go b/internal/cron/sftp_cron.go index d412caf..74ef682 100644 --- a/internal/cron/sftp_cron.go +++ b/internal/cron/sftp_cron.go @@ -2,12 +2,13 @@ package cron import ( "context" + "reflect" + "emperror.dev/errors" "github.com/pterodactyl/wings/internal/database" "github.com/pterodactyl/wings/internal/models" "github.com/pterodactyl/wings/server" "github.com/pterodactyl/wings/system" - "reflect" ) type sftpCron struct { diff --git a/internal/database/database.go b/internal/database/database.go index ebcc06f..d8433c4 100644 --- a/internal/database/database.go +++ b/internal/database/database.go @@ -1,6 +1,9 @@ package database import ( + "path/filepath" + "time" + "emperror.dev/errors" "github.com/glebarez/sqlite" "github.com/pterodactyl/wings/config" @@ -8,12 +11,12 @@ import ( "github.com/pterodactyl/wings/system" "gorm.io/gorm" "gorm.io/gorm/logger" - "path/filepath" - "time" ) -var o system.AtomicBool -var db *gorm.DB +var ( + o system.AtomicBool + db *gorm.DB +) // Initialize configures the local SQLite database for Wings and ensures that the models have // been fully migrated. diff --git a/internal/models/activity.go b/internal/models/activity.go index bbbe38d..1795e8a 100644 --- a/internal/models/activity.go +++ b/internal/models/activity.go @@ -1,9 +1,10 @@ package models import ( + "time" + "github.com/pterodactyl/wings/system" "gorm.io/gorm" - "time" ) type Event string diff --git a/internal/models/models.go b/internal/models/models.go index 1506524..63535c3 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -2,6 +2,7 @@ package models import ( "database/sql" + "emperror.dev/errors" "github.com/goccy/go-json" ) diff --git a/remote/http.go b/remote/http.go index 40af821..7063923 100644 --- a/remote/http.go +++ b/remote/http.go @@ -4,13 +4,14 @@ import ( "bytes" "context" "fmt" - "github.com/pterodactyl/wings/internal/models" "io" "net/http" "strconv" "strings" "time" + "github.com/pterodactyl/wings/internal/models" + "emperror.dev/errors" "github.com/apex/log" "github.com/cenkalti/backoff/v4" diff --git a/router/router_server_files.go b/router/router_server_files.go index aff8f9e..69c5b6d 100644 --- a/router/router_server_files.go +++ b/router/router_server_files.go @@ -3,7 +3,6 @@ package router import ( "bufio" "context" - "github.com/pterodactyl/wings/internal/models" "io" "mime/multipart" "net/http" @@ -14,6 +13,8 @@ import ( "strconv" "strings" + "github.com/pterodactyl/wings/internal/models" + "github.com/pterodactyl/wings/config" "emperror.dev/errors" diff --git a/router/websocket/websocket.go b/router/websocket/websocket.go index c81a7de..6d5cb51 100644 --- a/router/websocket/websocket.go +++ b/router/websocket/websocket.go @@ -3,12 +3,13 @@ package websocket import ( "context" "fmt" - "github.com/pterodactyl/wings/internal/models" "net/http" "strings" "sync" "time" + "github.com/pterodactyl/wings/internal/models" + "emperror.dev/errors" "github.com/apex/log" "github.com/gbrlsnchs/jwt/v3" diff --git a/server/activity.go b/server/activity.go index fffb38e..09dc626 100644 --- a/server/activity.go +++ b/server/activity.go @@ -2,10 +2,11 @@ package server import ( "context" + "time" + "emperror.dev/errors" "github.com/pterodactyl/wings/internal/database" "github.com/pterodactyl/wings/internal/models" - "time" ) const ActivityPowerPrefix = "server:power." diff --git a/server/filesystem/compress.go b/server/filesystem/compress.go index 8ae36af..ce4341d 100644 --- a/server/filesystem/compress.go +++ b/server/filesystem/compress.go @@ -5,8 +5,6 @@ import ( "archive/zip" "compress/gzip" "fmt" - gzip2 "github.com/klauspost/compress/gzip" - zip2 "github.com/klauspost/compress/zip" "os" "path" "path/filepath" @@ -15,6 +13,9 @@ import ( "sync/atomic" "time" + gzip2 "github.com/klauspost/compress/gzip" + zip2 "github.com/klauspost/compress/zip" + "emperror.dev/errors" "github.com/mholt/archiver/v3" ) diff --git a/server/install.go b/server/install.go index d0259b5..797e6c4 100644 --- a/server/install.go +++ b/server/install.go @@ -449,7 +449,7 @@ func (ip *InstallationProcess) Execute() (string, error) { }, Privileged: true, NetworkMode: container.NetworkMode(config.Get().Docker.Network.Mode), - UsernsMode: container.UsernsMode(config.Get().Docker.UsernsMode), + UsernsMode: container.UsernsMode(config.Get().Docker.UsernsMode), } // Ensure the root directory for the server exists properly before attempting diff --git a/wings.go b/wings.go index 52ea91b..2c19d2a 100644 --- a/wings.go +++ b/wings.go @@ -1,9 +1,10 @@ package main import ( - "github.com/pterodactyl/wings/cmd" "math/rand" "time" + + "github.com/pterodactyl/wings/cmd" ) func main() {