From f10bdfa88fc78259dda03c6bc61364bf49ed8512 Mon Sep 17 00:00:00 2001 From: Maximilian Wittenburg Date: Thu, 25 Jan 2024 21:58:05 +0100 Subject: [PATCH 1/2] remove get5 and rcon stuff --- .../environment/environment.go | 2 - cmd/unwindia_pterodactyl/jobs/worker.go | 33 +-- cmd/unwindia_pterodactyl/server/server.go | 49 +---- cmd/unwindia_pterodactyl/template/template.go | 36 ---- .../template/template_test.go | 194 ------------------ go.mod | 1 - go.sum | 28 --- 7 files changed, 2 insertions(+), 341 deletions(-) delete mode 100644 cmd/unwindia_pterodactyl/template/template.go delete mode 100644 cmd/unwindia_pterodactyl/template/template_test.go diff --git a/cmd/unwindia_pterodactyl/environment/environment.go b/cmd/unwindia_pterodactyl/environment/environment.go index 750560f..dee31f8 100644 --- a/cmd/unwindia_pterodactyl/environment/environment.go +++ b/cmd/unwindia_pterodactyl/environment/environment.go @@ -32,8 +32,6 @@ type environment struct { PteroClientApiURL url.URL `env:"PTERODACTYL_CLIENT_API_URL,notEmpty"` PteroClientApiToken string `env:"PTERODACTYL_CLIENT_API_TOKEN,notEmpty"` PteroFetchInterval time.Duration `env:"PTERODACTYL_FETCH_INTERVAL" envDefault:"15s"` - - RconRetries int `env:"RCON_RETRIES" envDefault:"10" envDescription:"How often to retry"` } // Environment holds all environment configuration with more advanced typing and validation diff --git a/cmd/unwindia_pterodactyl/jobs/worker.go b/cmd/unwindia_pterodactyl/jobs/worker.go index 7c3ba2a..f9e9c88 100644 --- a/cmd/unwindia_pterodactyl/jobs/worker.go +++ b/cmd/unwindia_pterodactyl/jobs/worker.go @@ -9,9 +9,7 @@ import ( "github.com/GSH-LAN/Unwindia_common/src/go/workitemLock" "github.com/GSH-LAN/Unwindia_pterodactyl/cmd/unwindia_pterodactyl/database" "github.com/GSH-LAN/Unwindia_pterodactyl/cmd/unwindia_pterodactyl/pterodactyl" - "github.com/GSH-LAN/Unwindia_pterodactyl/cmd/unwindia_pterodactyl/template" "github.com/ThreeDotsLabs/watermill/message" - rcon "github.com/forewing/csgo-rcon" "github.com/gammazero/workerpool" jsoniter "github.com/json-iterator/go" "github.com/modern-go/reflect2" @@ -33,11 +31,10 @@ type Worker struct { semaphore *semaphore.Weighted jobLock workitemLock.WorkItemLock config config.ConfigClient - rconRetries int baseTopic string } -func NewWorker(ctx context.Context, db database.DatabaseClient, pool *workerpool.WorkerPool, pteroClient pterodactyl.Client, matchPublisher message.Publisher, config config.ConfigClient, rconRetries int, baseTopic string) *Worker { +func NewWorker(ctx context.Context, db database.DatabaseClient, pool *workerpool.WorkerPool, pteroClient pterodactyl.Client, matchPublisher message.Publisher, config config.ConfigClient, baseTopic string) *Worker { w := Worker{ ctx: ctx, db: db, @@ -47,7 +44,6 @@ func NewWorker(ctx context.Context, db database.DatabaseClient, pool *workerpool semaphore: semaphore.NewWeighted(int64(1)), jobLock: workitemLock.NewMemoryWorkItemLock(), config: config, - rconRetries: rconRetries, baseTopic: baseTopic, } return &w @@ -177,33 +173,6 @@ func (w *Worker) processJob(ctx context.Context, job *database.Job) error { return err } - rconClient := rcon.New(job.MatchInfo.ServerAddress, servermgmtpass, time.Second*10) - go func() { - time.Sleep(gsTemplate.ServerReadyRconWaitTime.Duration) - - for _, command := range gsTemplate.ServerReadyRconCommands { - for i := 0; i < w.rconRetries; i++ { - parsedCommand, err := template.ParseTemplateForMatch(command, &job.MatchInfo) - if err != nil { - log.Error().Err(err).Str("jobid", job.ID.String()).Str("command", command).Msg("Error parsing rcon command template") - continue - } - - _, err = rconClient.Execute(parsedCommand) - if err != nil { - log.Error().Err(err).Str("jobid", job.ID.String()).Str("command", parsedCommand).Str("address", job.MatchInfo.ServerAddress).Msg("Error executing rcon command") - continue - } - - log.Debug().Str("command", parsedCommand).Msg("Successfully executed command") - time.Sleep(time.Second) - break - } - } - }() - - // We now need to publish to message queue - msg := messagebroker.Message{ Type: messagebroker.MessageTypeUpdated, SubType: messagebroker.UNWINDIA_MATCH_SERVER_READY.String(), diff --git a/cmd/unwindia_pterodactyl/server/server.go b/cmd/unwindia_pterodactyl/server/server.go index ed70ba0..d64d4e0 100644 --- a/cmd/unwindia_pterodactyl/server/server.go +++ b/cmd/unwindia_pterodactyl/server/server.go @@ -13,7 +13,6 @@ import ( "github.com/GSH-LAN/Unwindia_pterodactyl/cmd/unwindia_pterodactyl/messagequeue" "github.com/GSH-LAN/Unwindia_pterodactyl/cmd/unwindia_pterodactyl/pterodactyl" "github.com/GSH-LAN/Unwindia_pterodactyl/cmd/unwindia_pterodactyl/router" - "github.com/GSH-LAN/Unwindia_pterodactyl/cmd/unwindia_pterodactyl/template" "github.com/ThreeDotsLabs/watermill/message" "github.com/gammazero/workerpool" "github.com/gin-gonic/gin" @@ -63,7 +62,7 @@ func NewServer(ctx context.Context, env *environment.Environment, cfgClient conf return nil, err } - jobHandler := jobs.NewWorker(ctx, dbClient, wp, pteroClient, matchPublisher, cfgClient, env.RconRetries, env.PulsarBaseTopic) + jobHandler := jobs.NewWorker(ctx, dbClient, wp, pteroClient, matchPublisher, cfgClient, env.PulsarBaseTopic) srv := Server{ ctx: ctx, @@ -223,11 +222,7 @@ func (s *Server) setupRouter() { // GinErrorHandler middleware for handle problem details error on gin s.router.Use(func(c *gin.Context) { c.Next() - for _, err := range c.Errors { - - // add custom map problem details here... - if _, err := problem.ResolveProblemDetails(c.Writer, c.Request, err); err != nil { log.Error().Err(err).Msg("gin error") } @@ -240,14 +235,9 @@ func (s *Server) setupRouter() { //internal.GET("/health", gin.WrapF(handlers.NewJSONHandlerFunc(health.Health, nil))) internal.GET("/metrics", gin.WrapH(promhttp.Handler())) - //serverApi := s.router.Group("/api/v1/server") - //serverApi.POST("/") - v1Api := s.router.Group("/api/v1") v1Api.POST("/jobs", s.handleCreateJob) v1Api.POST("/preinstall/:game/:amount", s.handlePreinstall) - - v1Api.GET("/match/:matchid/:template", s.handleMatchTemplate) } func (s *Server) handleCreateJob(ctx *gin.Context) { @@ -321,40 +311,3 @@ func (s *Server) handlePreinstall(ctx *gin.Context) { ctx.JSON(http.StatusCreated, gin.H{"servers": createdJobs}) } } - -func (s *Server) handleMatchTemplate(ctx *gin.Context) { - matchid := ctx.Param("matchid") - templateName := ctx.Param("template") - - matchInfo, err := s.dbClient.GetMatchInfoForMatchId(s.ctx, matchid) - if err != nil { - log.Error().Err(err).Msg("error getting info for match") - ctx.JSON(http.StatusInternalServerError, gin.H{ - "error": err.Error(), - }) - return - } - - templateText, ok := s.config.GetConfig().Templates[fmt.Sprintf("PTERODACTYL_%s.gohtml", templateName)] - if !ok { - log.Error().Str("template", templateName).Msg("template not found") - ctx.JSON(http.StatusBadRequest, gin.H{ - "error": fmt.Errorf("template %s not found", templateName), - }) - return - } - - parsedMatchTemplate, err := template.ParseTemplateForMatch(templateText, &matchInfo.MatchInfo) - if err != nil { - log.Error().Err(err).Msg("Error parsing template") - ctx.JSON(http.StatusInternalServerError, gin.H{ - "error": err.Error(), - }) - return - } - log.Debug().Str("commentText", parsedMatchTemplate).Msg("parsed Template") - - log.Info().Str("matchid", matchid).Str("template", templateName).Msg("creating template for match") - - ctx.String(http.StatusOK, parsedMatchTemplate) -} diff --git a/cmd/unwindia_pterodactyl/template/template.go b/cmd/unwindia_pterodactyl/template/template.go deleted file mode 100644 index 80af466..0000000 --- a/cmd/unwindia_pterodactyl/template/template.go +++ /dev/null @@ -1,36 +0,0 @@ -package template - -import ( - "errors" - "github.com/GSH-LAN/Unwindia_common/src/go/matchservice" - "github.com/rs/zerolog/log" - "strings" - "text/template" -) - -func ParseTemplateForMatch(tpl string, matchinfo *matchservice.MatchInfo) (string, error) { - if matchinfo == nil { - return "", errors.New("empty matchinfo") - } - - funcs := map[string]any{ - "contains": strings.Contains, - "hasPrefix": strings.HasPrefix, - "hasSuffix": strings.HasSuffix, - } - - tmpl, err := template.New("match").Option("missingkey=error").Funcs(funcs).Parse(tpl) - if err != nil { - log.Err(err).Msg("Error parsing template") - return "", err - } - - parsedTemplate := strings.Builder{} - err = tmpl.Execute(&parsedTemplate, matchinfo) - if err != nil { - log.Err(err).Msg("Error parsing matchinfo into template") - return "", err - } - - return parsedTemplate.String(), nil -} diff --git a/cmd/unwindia_pterodactyl/template/template_test.go b/cmd/unwindia_pterodactyl/template/template_test.go deleted file mode 100644 index cfa2c5e..0000000 --- a/cmd/unwindia_pterodactyl/template/template_test.go +++ /dev/null @@ -1,194 +0,0 @@ -package template - -import ( - "github.com/GSH-LAN/Unwindia_common/src/go/matchservice" - "testing" -) - -const ( - templateText1 = `This match is managed by UNWINDIA - -{{if not (and .Team1.Ready .Team2.Ready) -}} - -As soon both teams are ready your gameserver will be genereated. -{{ else -}} -{{ if ne .ServerAddress "" -}} -Your server is ready, find the connection details below: - -IP-Address: {{ .ServerAddress }} -Password: {{ .ServerPassword }} -RCON-Password: {{ .ServerPasswordMgmt }} - -connect {{ .ServerAddress -}};password {{ .ServerPassword -}} -{{ else -}} -Since both Teams are ready now your server is getting prepared. This process will take a few minutes. -{{ end -}} -{{ end -}} -` - - expectedTemplateText1NewMatch = `This match is managed by UNWINDIA - -As soon both teams are ready your gameserver will be genereated. -` - - expectedTemplateText1TeamsReady = `This match is managed by UNWINDIA - -Since both Teams are ready now your server is getting prepared. This process will take a few minutes. -` - - expectedTemplateText1TeamsAndServerReady = `This match is managed by UNWINDIA - -Your server is ready, find the connection details below: - -IP-Address: 127.0.0.1:27015 -Password: password -RCON-Password: secret - -connect 127.0.0.1:27015;password password -` - - templateTextBroken = ` This is a broken template {{ .UnKnownAttribute}} ` -) - -var matchNew = matchservice.MatchInfo{ - Id: "123", - MsID: "456", - Team1: matchservice.Team{ - Id: "team1id", - Name: "cool-team", - Players: nil, - Picture: nil, - Ready: false, - }, - Team2: matchservice.Team{ - Id: "team2id", - Name: "nice-teams", - Players: nil, - Picture: nil, - Ready: false, - }, - PlayerAmount: 10, - Game: "csgo", - Map: "", - ServerAddress: "", - ServerPassword: "", - ServerPasswordMgmt: "", - ServerTvAddress: "", - ServerTvPassword: "", -} - -var matchTeamsReady = matchservice.MatchInfo{ - Id: "123", - MsID: "456", - Team1: matchservice.Team{ - Id: "team1id", - Name: "cool-team", - Players: nil, - Picture: nil, - Ready: true, - }, - Team2: matchservice.Team{ - Id: "team2id", - Name: "nice-teams", - Players: nil, - Picture: nil, - Ready: true, - }, - PlayerAmount: 10, - Game: "csgo", - Map: "", - ServerAddress: "", - ServerPassword: "", - ServerPasswordMgmt: "", - ServerTvAddress: "", - ServerTvPassword: "", -} - -var matchTeamsAndServerReady = matchservice.MatchInfo{ - Id: "123", - MsID: "456", - Team1: matchservice.Team{ - Id: "team1id", - Name: "cool-team", - Players: nil, - Picture: nil, - Ready: true, - }, - Team2: matchservice.Team{ - Id: "team2id", - Name: "nice-teams", - Players: nil, - Picture: nil, - Ready: true, - }, - PlayerAmount: 10, - Game: "csgo", - Map: "", - ServerAddress: "127.0.0.1:27015", - ServerPassword: "password", - ServerPasswordMgmt: "secret", - ServerTvAddress: "127.0.0.1:27115", - ServerTvPassword: "tvpassword", -} - -func TestParseTemplateForMatch(t *testing.T) { - type args struct { - tpl string - matchinfo *matchservice.MatchInfo - } - tests := []struct { - name string - args args - want string - wantErr bool - }{ - { - name: "ok-template_new_match", - args: args{ - tpl: templateText1, - matchinfo: &matchNew, - }, - want: expectedTemplateText1NewMatch, - wantErr: false, - }, - { - name: "ok-template_teams_ready", - args: args{ - tpl: templateText1, - matchinfo: &matchTeamsReady, - }, - want: expectedTemplateText1TeamsReady, - wantErr: false, - }, - { - name: "ok-template_teams_and_server_ready", - args: args{ - tpl: templateText1, - matchinfo: &matchTeamsAndServerReady, - }, - want: expectedTemplateText1TeamsAndServerReady, - wantErr: false, - }, - { - name: "err-template_text_broken", - args: args{ - tpl: templateTextBroken, - matchinfo: &matchNew, - }, - want: "", - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := ParseTemplateForMatch(tt.args.tpl, tt.args.matchinfo) - if (err != nil) != tt.wantErr { - t.Errorf("ParseTemplateForMatch() error = %v, wantErr %v", err, tt.wantErr) - return - } - if got != tt.want { - t.Errorf("ParseTemplateForMatch() got = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/go.mod b/go.mod index 0ebd087..8278e71 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/alexliesenfeld/health v0.8.0 github.com/apache/pulsar-client-go v0.11.1 github.com/caarlos0/env/v10 v10.0.0 - github.com/forewing/csgo-rcon v1.3.1-0.20220429151413-081f8216b783 github.com/gammazero/workerpool v1.1.3 github.com/gin-gonic/gin v1.9.1 github.com/hellofresh/health-go/v5 v5.5.2 diff --git a/go.sum b/go.sum index 41403b3..1f41ac6 100644 --- a/go.sum +++ b/go.sum @@ -16,7 +16,6 @@ github.com/ThreeDotsLabs/watermill v1.3.5 h1:50JEPEhMGZQMh08ct0tfO1PsgMOAOhV3zxK github.com/ThreeDotsLabs/watermill v1.3.5/go.mod h1:O/u/Ptyrk5MPTxSeWM5vzTtZcZfxXfO9PK9eXTYiFZY= github.com/alexliesenfeld/health v0.8.0 h1:lCV0i+ZJPTbqP7LfKG7p3qZBl5VhelwUFCIVWl77fgk= github.com/alexliesenfeld/health v0.8.0/go.mod h1:TfNP0f+9WQVWMQRzvMUjlws4ceXKEL3WR+6Hp95HUFc= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/apache/pulsar-client-go v0.11.1 h1:WxLitlPG4Dz62BblGlx51wm0rw76eRefJsWdawI22QM= github.com/apache/pulsar-client-go v0.11.1/go.mod h1:FoijqJwgjroSKptIWp1vvK1CXs8dXnQiL8I+MHOri4A= github.com/ardielle/ardielle-go v1.5.2 h1:TilHTpHIQJ27R1Tl/iITBzMwiUGSlVfiVhwDNGM3Zj4= @@ -42,9 +41,6 @@ github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpV github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0= github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= @@ -54,13 +50,8 @@ 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= github.com/dimfeld/httptreemux v5.0.1+incompatible h1:Qj3gVcDNoOthBAqftuD596rm4wg/adLLz5xh5CmpiCA= github.com/dimfeld/httptreemux v5.0.1+incompatible/go.mod h1:rbUlSV+CCpv/SuqUTP/8Bk2O3LyUV436/yaRGkhP6Z0= -github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= -github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/forewing/csgo-rcon v1.3.1-0.20220429151413-081f8216b783 h1:I9/u0l/TIJdfdlxwtiIXG7ufPRPxY60qFUHzFKXN39A= -github.com/forewing/csgo-rcon v1.3.1-0.20220429151413-081f8216b783/go.mod h1:G90K8Gac0D3/4ff+MfCNtoMOACOnLIV1V8mJG1351vM= -github.com/forewing/gobuild v1.1.2/go.mod h1:f64Y49pcmjwPt4RlhwuUwjAOYo5nMkbUo/+KsaXHKT0= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= @@ -123,7 +114,6 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hellofresh/health-go/v5 v5.5.2 h1:h17lycd6foR2AUcd2tLYRKyU9YM7oyVtTAqUDqcM5JE= github.com/hellofresh/health-go/v5 v5.5.2/go.mod h1:+ENHPehFhTo9xwpJ/vQIe4iP2Uh3a4fUIcA6Rl8DqJ0= -github.com/jackmordaunt/icns/v2 v2.1.3/go.mod h1:6aYIB9eSzyfHHMKqDf17Xrs1zetQPReAkiUSHzdw4cI= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= @@ -134,17 +124,13 @@ github.com/kamva/mgm/v3 v3.5.0 h1:/2mNshpqwAC9spdzJZ0VR/UZ/SY/PsNTrMjT111KQjM= github.com/kamva/mgm/v3 v3.5.0/go.mod h1:F4J1hZnXQMkqL3DZgR7Z7BOuiTqQG/JTic3YzliG4jk= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= -github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -170,7 +156,6 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/meysamhadeli/problem-details v1.2.4 h1:lahRZ4IM0H3B+8yYWN0zX/olPKHlplKRlldtpRNf8ag= github.com/meysamhadeli/problem-details v1.2.4/go.mod h1:n17OvjZmKryjP249Zz9ca1xxka7LBqgL5XjSF9hxdVA= -github.com/mholt/archiver/v4 v4.0.0-alpha.5/go.mod h1:J7SYS/UTAtnO3I49RQEf+2FYZVwo7XBOh9Im43VrjNs= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -183,9 +168,7 @@ github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8 github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nwaples/rardecode/v2 v2.0.0-beta.2/go.mod h1:yntwv/HfMc/Hbvtq9I19D1n58te3h6KsqCf3GxyfBGY= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= @@ -198,12 +181,9 @@ github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOS github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4/v4 v4.1.12/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= 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.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= @@ -228,7 +208,6 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -237,7 +216,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -249,14 +227,11 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/swaggest/swgui v1.8.0 h1:dPu8TsYIOraaObAkyNdoiLI8mu7nOqQ6SU7HOv254rM= github.com/swaggest/swgui v1.8.0/go.mod h1:YBaAVAwS3ndfvdtW8A4yWDJpge+W57y+8kW+f/DqZtU= -github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= 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/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= @@ -288,7 +263,6 @@ golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUu golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -327,7 +301,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210921065528-437939a70204/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -380,7 +353,6 @@ gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= From d0d78df7e9be0797d54441b03f53c1f345da6f6e Mon Sep 17 00:00:00 2001 From: Maximilian Wittenburg Date: Thu, 15 Feb 2024 21:18:51 +0100 Subject: [PATCH 2/2] cleanup stuff --- Dockerfile | 2 +- cmd/unwindia_pterodactyl/errors/httpErrors.go | 9 -------- .../messagequeue/publisher_matchinfo.go | 1 - cmd/unwindia_pterodactyl/server/errors.go | 15 ------------- pkg/godactyl/LICENSE | 21 ------------------- pkg/godactyl/README.md | 2 -- 6 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 cmd/unwindia_pterodactyl/errors/httpErrors.go delete mode 100644 cmd/unwindia_pterodactyl/messagequeue/publisher_matchinfo.go delete mode 100644 cmd/unwindia_pterodactyl/server/errors.go delete mode 100644 pkg/godactyl/LICENSE delete mode 100644 pkg/godactyl/README.md diff --git a/Dockerfile b/Dockerfile index 626c2cb..a0ea8fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w # Runtime image FROM redhat/ubi9-minimal:9.3 -RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm +RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm RUN microdnf -y update && microdnf -y install ca-certificates inotify-tools && microdnf reinstall -y tzdata COPY --from=build-env /app/app / diff --git a/cmd/unwindia_pterodactyl/errors/httpErrors.go b/cmd/unwindia_pterodactyl/errors/httpErrors.go deleted file mode 100644 index e33637b..0000000 --- a/cmd/unwindia_pterodactyl/errors/httpErrors.go +++ /dev/null @@ -1,9 +0,0 @@ -package errors - -import "github.com/meysamhadeli/problem-details" - -type BadParamError struct { - problem.ProblemDetailErr - Description string `json:"description,omitempty"` - AdditionalInfo string `json:"additionalInfo,omitempty"` -} diff --git a/cmd/unwindia_pterodactyl/messagequeue/publisher_matchinfo.go b/cmd/unwindia_pterodactyl/messagequeue/publisher_matchinfo.go deleted file mode 100644 index 48c078b..0000000 --- a/cmd/unwindia_pterodactyl/messagequeue/publisher_matchinfo.go +++ /dev/null @@ -1 +0,0 @@ -package messagequeue diff --git a/cmd/unwindia_pterodactyl/server/errors.go b/cmd/unwindia_pterodactyl/server/errors.go deleted file mode 100644 index a008481..0000000 --- a/cmd/unwindia_pterodactyl/server/errors.go +++ /dev/null @@ -1,15 +0,0 @@ -package server - -import "fmt" - -type InvalidGameError struct { - Game string -} - -func NewInvalidGameError(game string) *InvalidGameError { - return &InvalidGameError{Game: game} -} - -func (e *InvalidGameError) Error() string { - return fmt.Sprintf("game %s is invalid", e.Game) -} diff --git a/pkg/godactyl/LICENSE b/pkg/godactyl/LICENSE deleted file mode 100644 index 872107c..0000000 --- a/pkg/godactyl/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Maximilian Wittenburg - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/pkg/godactyl/README.md b/pkg/godactyl/README.md deleted file mode 100644 index ac7060c..0000000 --- a/pkg/godactyl/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# godactyl -pterodactyl api client for go \ No newline at end of file