break everything

- upgrade dependencies
- run gofmt and goimports to organize code
- fix typos
- other small tweaks
This commit is contained in:
Matthew Penner
2021-08-02 15:07:00 -06:00
parent 4a5e0bb86f
commit 3c54c1f840
57 changed files with 1056 additions and 450 deletions

View File

@@ -15,6 +15,7 @@ import (
"emperror.dev/errors"
"github.com/apex/log"
"github.com/cenkalti/backoff/v4"
"github.com/pterodactyl/wings/system"
)
@@ -118,7 +119,7 @@ func (c *client) requestOnce(ctx context.Context, method, path string, body io.R
return &Response{res}, err
}
// request executes a HTTP request against the Panel API. If there is an error
// request executes an HTTP request against the Panel API. If there is an error
// encountered with the request it will be retried using an exponential backoff.
// If the error returned from the Panel is due to API throttling or because there
// are invalid authentication credentials provided the request will _not_ be
@@ -170,7 +171,7 @@ func (c *client) request(ctx context.Context, method, path string, body io.Reade
// This allows for issues with DNS resolution, or rare race conditions due to
// slower SQL queries on the Panel to potentially self-resolve without just
// immediately failing the first request. The example below shows the amount of
// time that has ellapsed between each call to the handler when an error is
// time that has elapsed between each call to the handler when an error is
// returned. You can tweak these values as needed to get the effect you desire.
//
// If maxAttempts is a value greater than 0 the backoff will be capped at a total

View File

@@ -12,11 +12,11 @@ import (
func createTestClient(h http.HandlerFunc) (*client, *httptest.Server) {
s := httptest.NewServer(h)
c := &client{
httpClient: s.Client(),
baseUrl: s.URL,
httpClient: s.Client(),
baseUrl: s.URL,
maxAttempts: 1,
tokenId: "testid",
token: "testtoken",
tokenId: "testid",
token: "testtoken",
}
return c, s
}

View File

@@ -6,6 +6,7 @@ import (
"strings"
"github.com/apex/log"
"github.com/pterodactyl/wings/parser"
)
@@ -32,7 +33,7 @@ type Pagination struct {
// ServerConfigurationResponse holds the server configuration data returned from
// the Panel. When a server process is started, Wings communicates with the
// Panel to fetch the latest build information as well as get all of the details
// Panel to fetch the latest build information as well as get all the details
// needed to parse the given Egg.
//
// This means we do not need to hit Wings each time part of the server is