updated deps; code cleanup; updated golangci linter conf
This commit is contained in:
parent
3fd0a4204b
commit
dacc86dd83
|
@ -22,11 +22,20 @@ linters-settings:
|
|||
- return
|
||||
ignored-numbers:
|
||||
- '0'
|
||||
- '0.5'
|
||||
- '1'
|
||||
- '2'
|
||||
- '3'
|
||||
- '4'
|
||||
- '5'
|
||||
- '6'
|
||||
- '7'
|
||||
- '8'
|
||||
- '9'
|
||||
- '10'
|
||||
- '20'
|
||||
- '100'
|
||||
- '1000'
|
||||
ignored-functions:
|
||||
- strings.SplitN
|
||||
- os.OpenFile
|
||||
|
@ -42,32 +51,45 @@ linters-settings:
|
|||
allow-unused: false # report any unused nolint directives
|
||||
require-explanation: false # don't require an explanation for nolint directives
|
||||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
|
||||
tagliatelle:
|
||||
case:
|
||||
use-field-name: true
|
||||
rules:
|
||||
# Any struct tag type can be used.
|
||||
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`.
|
||||
json: snake
|
||||
yaml: snake
|
||||
xml: camel
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- bodyclose
|
||||
enable-all: true
|
||||
disable:
|
||||
- gochecknoglobals
|
||||
- depguard
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- exportloopref
|
||||
- gochecknoinits
|
||||
- gocritic
|
||||
- gofmt
|
||||
- gomnd
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- lll
|
||||
- misspell
|
||||
- noctx
|
||||
- nolintlint
|
||||
- staticcheck
|
||||
- stylecheck
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- whitespace
|
||||
- gci
|
||||
- gofumpt
|
||||
- goimports
|
||||
- varnamelen
|
||||
- funlen
|
||||
- cyclop
|
||||
- wsl
|
||||
- nosnakecase
|
||||
- nlreturn
|
||||
- godot
|
||||
- nestif
|
||||
- wrapcheck
|
||||
- gocognit
|
||||
- gocyclo
|
||||
- maintidx
|
||||
- nonamedreturns
|
||||
- exhaustivestruct
|
||||
- exhaustruct
|
||||
- forcetypeassert
|
||||
- godox
|
||||
- nakedret
|
||||
- tagalign
|
||||
- maligned
|
||||
# remove for new projects
|
||||
- errname
|
||||
- goerr113
|
||||
- tagliatelle
|
||||
|
|
|
@ -161,9 +161,8 @@ func (dml *DemoMatchLoader) getMatchDetails(sharecode string) (*protobuf.CMsgGCC
|
|||
for matchDetails := range dml.matchRecv {
|
||||
if *matchDetails.Matches[0].Matchid == matchID {
|
||||
return matchDetails, nil
|
||||
} else {
|
||||
dml.matchRecv <- matchDetails
|
||||
}
|
||||
dml.matchRecv <- matchDetails
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
@ -173,8 +172,7 @@ func (dml *DemoMatchLoader) connectToSteam() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
_, err := dml.client.Connect()
|
||||
if err != nil {
|
||||
if _, err := dml.client.Connect(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@ -188,7 +186,7 @@ func (dml *DemoMatchLoader) Setup(config *DemoMatchLoaderConfig) error {
|
|||
dml.parseMap = map[string]bool{}
|
||||
dml.parseMapL = new(sync.RWMutex)
|
||||
dml.cache = config.Cache
|
||||
dml.connectFeedback = make(chan int, 10) //nolint:gomnd
|
||||
dml.connectFeedback = make(chan int, 10)
|
||||
dml.connectionWait = retry.WithCappedDuration(time.Minute*time.Duration(config.RetryTimeout), retry.NewExponential(time.Minute))
|
||||
dml.connectionWaitTmpl = retry.WithCappedDuration(time.Minute*time.Duration(config.RetryTimeout), retry.NewExponential(time.Minute))
|
||||
err := dml.dp.Setup(config.DB, config.Worker, config.SprayTimeout)
|
||||
|
@ -223,8 +221,8 @@ func (dml *DemoMatchLoader) Setup(config *DemoMatchLoaderConfig) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dml.matchRecv = make(chan *protobuf.CMsgGCCStrike15V2_MatchList, 1000) //nolint:gomnd
|
||||
dml.parseDemo = make(chan *Demo, 1000) //nolint:gomnd
|
||||
dml.matchRecv = make(chan *protobuf.CMsgGCCStrike15V2_MatchList, 1000)
|
||||
dml.parseDemo = make(chan *Demo, 1000)
|
||||
|
||||
go dml.connectLoop()
|
||||
go dml.steamEventHandler()
|
||||
|
@ -299,7 +297,7 @@ func (dml *DemoMatchLoader) steamEventHandler() {
|
|||
go dml.setPlaying()
|
||||
case *steam.LogOnFailedEvent:
|
||||
log.Debugf("[DL] Steam login denied: %+v", e)
|
||||
switch e.Result {
|
||||
switch e.Result { //nolint:exhaustive
|
||||
case steamlang.EResult_AccountLogonDenied:
|
||||
log.Fatalf("[DL] Please provide AuthCode in config")
|
||||
case steamlang.EResult_InvalidPassword:
|
||||
|
@ -426,7 +424,7 @@ func (dml *DemoMatchLoader) handleDemo(demo *Demo, apiKey string, rl *rate.Limit
|
|||
|
||||
matchZero := matchDetails.GetMatches()[0]
|
||||
lastRound := matchZero.GetRoundstatsall()[len(matchZero.Roundstatsall)-1]
|
||||
var players []*ent.Player
|
||||
var players []*ent.Player //nolint:prealloc
|
||||
|
||||
for _, accountID := range lastRound.GetReservation().GetAccountIds() {
|
||||
tPlayer, err := utils.Player(tx.Client(), AccountID2SteamID(accountID), apiKey, rl)
|
||||
|
|
|
@ -57,7 +57,7 @@ type Spray struct {
|
|||
}
|
||||
|
||||
var (
|
||||
DemoNotFoundError = errors.New("demo not found")
|
||||
ErrorDemoNotFound = errors.New("demo not found")
|
||||
)
|
||||
|
||||
func (s *Sprays) Add(currentTime time.Duration, sprayPoint []float32, timeout int) {
|
||||
|
@ -108,7 +108,7 @@ func (s *Sprays) Avg() (avg [][]float32) {
|
|||
}
|
||||
|
||||
func (dp *DemoParser) Setup(db *ent.Client, worker, sprayTimeout int) error {
|
||||
dp.demoQueue = make(chan *Demo, 1000) //nolint:gomnd
|
||||
dp.demoQueue = make(chan *Demo, 1000)
|
||||
dp.db = db
|
||||
dp.sprayTimeout = sprayTimeout
|
||||
dp.Done = make(chan *Demo, worker)
|
||||
|
@ -136,13 +136,13 @@ func (d *Demo) download() (io.Reader, error) {
|
|||
}
|
||||
|
||||
if r.StatusCode != http.StatusOK {
|
||||
return nil, DemoNotFoundError
|
||||
return nil, ErrorDemoNotFound
|
||||
}
|
||||
return bzip2.NewReader(r.Body), nil
|
||||
}
|
||||
|
||||
func (dp *DemoParser) MatchPlayerBySteamID(stats []*ent.MatchPlayer, steamID uint64) (*ent.MatchPlayer, error) {
|
||||
for _, tStats := range stats {
|
||||
func (dp *DemoParser) MatchPlayerBySteamID(mStats []*ent.MatchPlayer, steamID uint64) (*ent.MatchPlayer, error) {
|
||||
for _, tStats := range mStats {
|
||||
tPLayer, err := tStats.Edges.PlayersOrErr()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get stats from statList: %w", err)
|
||||
|
@ -213,7 +213,7 @@ workloop:
|
|||
startTime := time.Now()
|
||||
fDemo, err := demo.download()
|
||||
if err != nil {
|
||||
if errors.Is(err, DemoNotFoundError) {
|
||||
if errors.Is(err, ErrorDemoNotFound) {
|
||||
_ = utils.Rollback(tx, err)
|
||||
if tMatch.Date.Before(time.Now().UTC().AddDate(0, 0, -30)) {
|
||||
log.Infof("[DP] demo expired for match %d", tMatch.ID)
|
||||
|
@ -222,12 +222,11 @@ workloop:
|
|||
}
|
||||
dp.Done <- demo
|
||||
continue
|
||||
} else {
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to download demo for %d: %v", demo.MatchID, err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
err = utils.Rollback(tx, err)
|
||||
log.Errorf("[DP] Unable to download demo for %d: %v", demo.MatchID, err)
|
||||
dp.Done <- demo
|
||||
continue
|
||||
}
|
||||
downloadTime := time.Since(startTime)
|
||||
|
||||
|
|
44
go.mod
44
go.mod
|
@ -8,7 +8,7 @@ require (
|
|||
github.com/an0nfunc/go-steam/v3 v3.0.6
|
||||
github.com/an0nfunc/go-steamapi v1.1.0
|
||||
github.com/gin-contrib/cors v1.4.0
|
||||
github.com/gin-gonic/gin v1.9.0
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/go-redis/cache/v8 v8.4.4
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/golang/geo v0.0.0-20230421003525-6adc56603217
|
||||
|
@ -16,66 +16,68 @@ require (
|
|||
github.com/markus-wa/demoinfocs-golang/v3 v3.3.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sethvargo/go-retry v0.2.4
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3
|
||||
golang.org/x/text v0.9.0
|
||||
golang.org/x/text v0.12.0
|
||||
golang.org/x/time v0.3.0
|
||||
google.golang.org/protobuf v1.30.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
somegit.dev/anonfunc/gositemap v0.1.3
|
||||
)
|
||||
|
||||
require (
|
||||
ariga.io/atlas v0.11.0 // indirect
|
||||
ariga.io/atlas v0.13.0 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||
github.com/bytedance/sonic v1.8.8 // indirect
|
||||
github.com/bytedance/sonic v1.10.0-rc3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
|
||||
github.com/chenzhuoyu/iasm v0.9.0 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.13.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.15.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.16.2 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.17.0 // indirect
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
|
||||
github.com/jackc/pgconn v1.14.0 // indirect
|
||||
github.com/jackc/pgconn v1.14.1 // indirect
|
||||
github.com/jackc/pgio v1.0.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||
github.com/jackc/pgtype v1.14.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.16.5 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/klauspost/compress v1.16.7 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/markus-wa/go-unassert v0.1.3 // indirect
|
||||
github.com/markus-wa/gobitread v0.2.3 // indirect
|
||||
github.com/markus-wa/godispatch v1.4.1 // indirect
|
||||
github.com/markus-wa/ice-cipher-go v0.0.0-20220823210642-1fcccd18c6c1 // indirect
|
||||
github.com/markus-wa/quickhull-go/v2 v2.2.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/oklog/ulid/v2 v2.1.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
github.com/vmihailenco/go-tinylfu v0.2.2 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
github.com/zclconf/go-cty v1.13.1 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
golang.org/x/mod v0.10.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sync v0.2.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
github.com/zclconf/go-cty v1.13.2 // indirect
|
||||
golang.org/x/arch v0.4.0 // indirect
|
||||
golang.org/x/crypto v0.12.0 // indirect
|
||||
golang.org/x/mod v0.12.0 // indirect
|
||||
golang.org/x/net v0.14.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.11.0 // indirect
|
||||
)
|
||||
|
|
93
go.sum
93
go.sum
|
@ -1,5 +1,5 @@
|
|||
ariga.io/atlas v0.11.0 h1:aGR7MzsUfmdlDYCpRErQeY2NSuRlPE0/q6drNE/5buM=
|
||||
ariga.io/atlas v0.11.0/go.mod h1:+TR129FJZ5Lvzms6dvCeGWh1yR6hMvmXBhug4hrNIGk=
|
||||
ariga.io/atlas v0.13.0 h1:20IFNuDn82d8ephVFBv9SnrGcBfzU56K+Oi0sRfYcLQ=
|
||||
ariga.io/atlas v0.13.0/go.mod h1:+TR129FJZ5Lvzms6dvCeGWh1yR6hMvmXBhug4hrNIGk=
|
||||
entgo.io/ent v0.12.3 h1:N5lO2EOrHpCH5HYfiMOCHYbo+oh5M8GjT0/cx5x6xkk=
|
||||
entgo.io/ent v0.12.3/go.mod h1:AigGGx+tbrBBYHAzGOg8ND661E5cxx1Uiu5o/otJ6Yg=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
|
@ -17,15 +17,19 @@ github.com/an0nfunc/go-steamapi v1.1.0/go.mod h1:tInHdrGkh0gaXuPnvhMG4BoW9S5gVcW
|
|||
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.8.8 h1:Kj4AYbZSeENfyXicsYppYKO0K2YWab+i2UTSY7Ukz9Q=
|
||||
github.com/bytedance/sonic v1.8.8/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
||||
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
|
||||
github.com/bytedance/sonic v1.10.0-rc3 h1:uNSnscRapXTwUgTyOF0GVljYD08p9X/Lbr9MweSV3V0=
|
||||
github.com/bytedance/sonic v1.10.0-rc3/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
|
||||
github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo=
|
||||
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
|
||||
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
|
@ -43,13 +47,15 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
|
|||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
|
||||
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g=
|
||||
github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
|
||||
github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8=
|
||||
github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
|
@ -63,8 +69,8 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl
|
|||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
||||
github.com/go-playground/validator/v10 v10.13.0 h1:cFRQdfaSMCOSfGCCLB20MHvuoHb/s5G8L5pu2ppK5AQ=
|
||||
github.com/go-playground/validator/v10 v10.13.0/go.mod h1:dwu7+CG8/CtBiJFZDz4e+5Upb6OLw04gtBYw0mcG/z4=
|
||||
github.com/go-playground/validator/v10 v10.15.0 h1:nDU5XeOKtB3GEa+uB7GNYwhVKsgjAR7VgKoNB6ryXfw=
|
||||
github.com/go-playground/validator/v10 v10.15.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-redis/cache/v8 v8.4.4 h1:Rm0wZ55X22BA2JMqVtRQNHYyzDd0I5f+Ec/C9Xx3mXY=
|
||||
github.com/go-redis/cache/v8 v8.4.4/go.mod h1:JM6CkupsPvAu/LYEVGQy6UB4WDAzQSXkR0lUCbeIcKc=
|
||||
github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc=
|
||||
|
@ -101,8 +107,8 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
|
|||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hashicorp/hcl/v2 v2.16.2 h1:mpkHZh/Tv+xet3sy3F9Ld4FyI2tUpWe9x3XtPx9f1a0=
|
||||
github.com/hashicorp/hcl/v2 v2.16.2/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
|
||||
github.com/hashicorp/hcl/v2 v2.17.0 h1:z1XvSUyXd1HP10U4lrLg5e0JMVz6CPaJvAgxM0KNZVY=
|
||||
github.com/hashicorp/hcl/v2 v2.17.0/go.mod h1:gJyW2PTShkJqQBKpAmPO3yxMxIuoXkOF2TpqXzrQyx4=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
|
||||
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||
|
@ -114,8 +120,9 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU
|
|||
github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
|
||||
github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY=
|
||||
github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
|
||||
github.com/jackc/pgconn v1.14.0 h1:vrbA9Ud87g6JdFWkHTJXppVce58qPIdP7N8y0Ml/A7Q=
|
||||
github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
|
||||
github.com/jackc/pgconn v1.14.1 h1:smbxIaZA08n6YuxEX1sDyjV/qkbtUtkH20qLkR9MUR4=
|
||||
github.com/jackc/pgconn v1.14.1/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
|
||||
github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
|
||||
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
|
||||
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
|
||||
|
@ -156,11 +163,12 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
|
|||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
|
||||
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
|
@ -199,8 +207,8 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
|
|||
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
|
||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||
|
@ -224,8 +232,8 @@ github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+t
|
|||
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
|
||||
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
|
||||
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
|
||||
github.com/pelletier/go-toml/v2 v2.0.7 h1:muncTPStnKRos5dpVKULv2FVd4bMOhNePj9CjgDb8Us=
|
||||
github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
|
||||
github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0=
|
||||
github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
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=
|
||||
|
@ -248,8 +256,8 @@ github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXY
|
|||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
|
@ -265,8 +273,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
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 v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
|
||||
|
@ -284,8 +293,8 @@ github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3 h1:shC1HB1Uogx
|
|||
github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/zclconf/go-cty v1.13.1 h1:0a6bRwuiSHtAmqCqNOE+c2oHgepv0ctoxU4FUe43kwc=
|
||||
github.com/zclconf/go-cty v1.13.1/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
|
||||
github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0=
|
||||
github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
|
@ -299,8 +308,8 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
|||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
|
||||
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.4.0 h1:A8WCeEWhLwPBKNbFi5Wv5UTCBx5zzubnXDlMOFAzFMc=
|
||||
golang.org/x/arch v0.4.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
|
@ -312,15 +321,15 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
|
|||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
|
||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
|
||||
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
|
@ -332,15 +341,15 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
|
||||
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -364,13 +373,12 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/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-20220704084225-05e143d24a9e/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=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
@ -382,8 +390,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
|
||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
|
@ -413,8 +421,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
|
|||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -435,6 +443,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
|
|||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
somegit.dev/anonfunc/gositemap v0.1.3 h1:3rsj+cejR6qdihXq6ZlFqwTDNefOXoSOYmvHrXkw+DE=
|
||||
somegit.dev/anonfunc/gositemap v0.1.3/go.mod h1:2v84uOYv0OQyfvQu9Fq1WI4zr/EjDOoxry5JrMZVEqo=
|
||||
|
|
39
main.go
39
main.go
|
@ -80,6 +80,7 @@ func housekeeping() {
|
|||
_, err = utils.PlayerFromSteam(tPlayerNeedSteamUpdate, db, conf.Steam.APIKey, rL)
|
||||
if err != nil {
|
||||
log.Warningf("[HK] Unable to update profiles from steam: %v", err)
|
||||
goto afterupdate
|
||||
}
|
||||
}
|
||||
err = rdc.Set(&cache.Item{
|
||||
|
@ -93,6 +94,7 @@ func housekeeping() {
|
|||
log.Errorf("[HK] Failure setting cache: %v", err)
|
||||
}
|
||||
}
|
||||
afterupdate:
|
||||
|
||||
// mark matches as vac/gameban
|
||||
bPlayers, err := db.Player.Query().
|
||||
|
@ -175,7 +177,7 @@ func housekeeping() {
|
|||
continue
|
||||
}
|
||||
|
||||
if v[0].Count < 10 { //nolint:gomnd
|
||||
if v[0].Count < 10 {
|
||||
log.Warningf("[HK] Found match without all players, try to reload it.")
|
||||
tMatch, err := db.Match.Get(context.Background(), mid)
|
||||
if err != nil {
|
||||
|
@ -261,11 +263,10 @@ func housekeeping() {
|
|||
|
||||
func getPlayerMeta(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
l := c.Param("limit")
|
||||
|
||||
var limit int
|
||||
var err error
|
||||
if l != "" {
|
||||
if l := c.Param("limit"); l != "" {
|
||||
limit, err = strconv.Atoi(l)
|
||||
if err != nil {
|
||||
log.Infof("[GPM] limit not an int: %v", err)
|
||||
|
@ -276,7 +277,7 @@ func getPlayerMeta(c *gin.Context) {
|
|||
limit = 4
|
||||
}
|
||||
|
||||
if limit > 10 { //nolint:gomnd
|
||||
if limit > 10 {
|
||||
log.Infof("[GPM] limit out of bounds: %d", limit)
|
||||
c.Status(http.StatusBadRequest)
|
||||
return
|
||||
|
@ -363,10 +364,9 @@ func getPlayerMeta(c *gin.Context) {
|
|||
|
||||
func getPlayer(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
t := c.Param("time")
|
||||
|
||||
var offsetTime time.Time
|
||||
if t != "" {
|
||||
if t := c.Param("time"); t != "" {
|
||||
unixOffset, err := strconv.ParseInt(t, 10, 64)
|
||||
if err != nil {
|
||||
log.Infof("[GP] offset not an int: %v", err)
|
||||
|
@ -405,9 +405,9 @@ func getPlayer(c *gin.Context) {
|
|||
var tMatches []*ent.Match
|
||||
if !offsetTime.IsZero() {
|
||||
tMatches, err = tPlayer.QueryMatches().
|
||||
Where(match.DateLT(offsetTime)).Order(ent.Desc(match.FieldDate)).Limit(10).All(context.Background()) //nolint:gomnd
|
||||
Where(match.DateLT(offsetTime)).Order(ent.Desc(match.FieldDate)).Limit(10).All(context.Background())
|
||||
} else {
|
||||
tMatches, err = tPlayer.QueryMatches().Order(ent.Desc(match.FieldDate)).Limit(10).All(context.Background()) //nolint:gomnd
|
||||
tMatches, err = tPlayer.QueryMatches().Order(ent.Desc(match.FieldDate)).Limit(10).All(context.Background())
|
||||
}
|
||||
if err != nil || len(tMatches) == 0 {
|
||||
log.Debugf("[GP] No matches found for player %s", id)
|
||||
|
@ -644,7 +644,6 @@ func getMatchRounds(c *gin.Context) {
|
|||
|
||||
func getMatchChat(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
trans := c.Query("translate")
|
||||
|
||||
if id == "" {
|
||||
c.Status(http.StatusBadRequest)
|
||||
|
@ -666,7 +665,7 @@ func getMatchChat(c *gin.Context) {
|
|||
log.Debugf("[GMC] Got header %s, selected %s from %v (w: %v)", c.GetHeader("Accept-Language"), lang, tag, weights)
|
||||
|
||||
var translate bool
|
||||
if trans != "" {
|
||||
if trans := c.Query("translate"); trans != "" {
|
||||
translate, err = strconv.ParseBool(trans)
|
||||
if err != nil {
|
||||
c.Status(http.StatusBadRequest)
|
||||
|
@ -858,10 +857,8 @@ func getMatchWeapons(c *gin.Context) {
|
|||
}
|
||||
|
||||
func getMatches(c *gin.Context) {
|
||||
t := c.Param("time")
|
||||
|
||||
var offsetTime time.Time
|
||||
if t != "" {
|
||||
if t := c.Param("time"); t != "" {
|
||||
unixOffset, err := strconv.ParseInt(t, 10, 64)
|
||||
if err != nil {
|
||||
log.Infof("[GMS] offset not an int: %v", err)
|
||||
|
@ -872,15 +869,15 @@ func getMatches(c *gin.Context) {
|
|||
offsetTime = time.Unix(unixOffset, 0).UTC()
|
||||
}
|
||||
|
||||
var mResponse []*utils.MatchResponse
|
||||
var mResponse []*utils.MatchResponse //nolint:prealloc
|
||||
|
||||
var err error
|
||||
var tMatches []*ent.Match
|
||||
if !offsetTime.IsZero() {
|
||||
tMatches, err = db.Match.Query().
|
||||
Where(match.DateLT(offsetTime)).Order(ent.Desc(match.FieldDate)).Limit(20).All(context.Background()) //nolint:gomnd
|
||||
Where(match.DateLT(offsetTime)).Order(ent.Desc(match.FieldDate)).Limit(20).All(context.Background())
|
||||
} else {
|
||||
tMatches, err = db.Match.Query().Order(ent.Desc(match.FieldDate)).Limit(20).All(context.Background()) //nolint:gomnd
|
||||
tMatches, err = db.Match.Query().Order(ent.Desc(match.FieldDate)).Limit(20).All(context.Background())
|
||||
}
|
||||
if err != nil || len(tMatches) == 0 {
|
||||
log.Debug("[GMS] No matches found")
|
||||
|
@ -893,7 +890,7 @@ func getMatches(c *gin.Context) {
|
|||
Avg float64 `json:"avg"`
|
||||
MatchID uint64 `json:"match_stats"`
|
||||
}
|
||||
avgRank := 0.0
|
||||
var avgRank float64
|
||||
|
||||
err := iMatch.QueryStats().
|
||||
Where(matchplayer.RankOldNEQ(0)).
|
||||
|
@ -953,7 +950,7 @@ func getMatch(c *gin.Context) {
|
|||
MatchID uint64 `json:"match_stats"`
|
||||
}
|
||||
|
||||
avgRank := 0.0
|
||||
var avgRank float64
|
||||
err = tMatch.QueryStats().
|
||||
Where(matchplayer.RankOldNEQ(0)).
|
||||
GroupBy(matchplayer.MatchesColumn).
|
||||
|
@ -1202,11 +1199,11 @@ func main() {
|
|||
|
||||
rdc = cache.New(&cache.Options{
|
||||
Redis: rdb,
|
||||
LocalCache: cache.NewTinyLFU(1000, time.Minute), //nolint:gomnd
|
||||
LocalCache: cache.NewTinyLFU(1000, time.Minute),
|
||||
})
|
||||
|
||||
rL = rate.NewLimiter(rate.Limit(conf.Steam.RatePerSecond), 100) //nolint:gomnd
|
||||
shareCodeRL = rate.NewLimiter(rate.Limit(0.2), 1) //nolint:gomnd
|
||||
rL = rate.NewLimiter(rate.Limit(conf.Steam.RatePerSecond), 1000)
|
||||
shareCodeRL = rate.NewLimiter(rate.Limit(0.2), 1) //nolint:gomnd
|
||||
|
||||
// setup GC
|
||||
err = demoLoader.Setup(&csgo.DemoMatchLoaderConfig{
|
||||
|
|
126
utils/utils.go
126
utils/utils.go
|
@ -390,13 +390,13 @@ func GetMetaStats(dbPlayer *ent.Player) (*MetaStatsResponse, error) {
|
|||
return mResponse.WeaponDmg[i].Dmg > mResponse.WeaponDmg[j].Dmg
|
||||
})
|
||||
|
||||
if len(mResponse.BestMates) > 10 { //nolint:gomnd
|
||||
if len(mResponse.BestMates) > 10 {
|
||||
mResponse.BestMates = mResponse.BestMates[:10]
|
||||
}
|
||||
if len(mResponse.MostMates) > 10 { //nolint:gomnd
|
||||
if len(mResponse.MostMates) > 10 {
|
||||
mResponse.MostMates = mResponse.MostMates[:10]
|
||||
}
|
||||
if len(mResponse.WeaponDmg) > 10 { //nolint:gomnd
|
||||
if len(mResponse.WeaponDmg) > 10 {
|
||||
mResponse.WeaponDmg = mResponse.WeaponDmg[:10]
|
||||
}
|
||||
|
||||
|
@ -490,13 +490,13 @@ func IsAuthCodeValid(tPlayer *ent.Player, apiKey, shareCode, authCode string, rl
|
|||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
} else {
|
||||
_, err := getNextShareCode(shareCode, apiKey, authCode, tPlayer.ID, rl)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
_, err = getNextShareCode(shareCode, apiKey, authCode, tPlayer.ID, rl)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func GetNewShareCodesForPlayer(tPlayer *ent.Player, apiKey string, rl *rate.Limiter) ([]string, error) {
|
||||
|
@ -562,7 +562,7 @@ func getNextShareCode(lastCode, apiKey, authCode string, steamID uint64, rl *rat
|
|||
|
||||
switch r.StatusCode {
|
||||
case http.StatusAccepted:
|
||||
return nil, nil
|
||||
return nil, nil //nolint:nilnil
|
||||
case http.StatusTooManyRequests:
|
||||
return nil, ErrorAuthcodeRateLimit
|
||||
case http.StatusServiceUnavailable:
|
||||
|
@ -620,65 +620,65 @@ func PlayerFromVanityURL(db *ent.Client, id, apiKey string, rl *rate.Limiter) (*
|
|||
tPlayer, err := db.Player.Query().Where(player.VanityURL(strings.ToLower(id))).Only(context.Background())
|
||||
if err == nil {
|
||||
return tPlayer, nil
|
||||
} else {
|
||||
if rl != nil {
|
||||
err := rl.Wait(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
resp, err := steamapi.ResolveVanityURL(id, apiKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.Success != 1 {
|
||||
return nil, fmt.Errorf("vanity url not found")
|
||||
}
|
||||
|
||||
nPlayer, err := PlayerFromSteamID64(db, resp.SteamID, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nPlayer, nil
|
||||
}
|
||||
|
||||
if rl != nil {
|
||||
err := rl.Wait(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
resp, err := steamapi.ResolveVanityURL(id, apiKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.Success != 1 {
|
||||
return nil, fmt.Errorf("vanity url not found")
|
||||
}
|
||||
|
||||
nPlayer, err := PlayerFromSteamID64(db, resp.SteamID, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nPlayer, nil
|
||||
}
|
||||
|
||||
func PlayerFromSteamID64(db *ent.Client, steamID uint64, apiKey string, rl *rate.Limiter) (*ent.Player, error) {
|
||||
tPlayer, err := db.Player.Get(context.Background(), steamID)
|
||||
if err == nil {
|
||||
return tPlayer, nil
|
||||
} else {
|
||||
nPlayer := &ent.Player{ID: steamID}
|
||||
uPlayer, err := PlayerFromSteam([]*ent.Player{nPlayer}, nil, apiKey, rl)
|
||||
}
|
||||
|
||||
nPlayer := &ent.Player{ID: steamID}
|
||||
uPlayer, err := PlayerFromSteam([]*ent.Player{nPlayer}, nil, apiKey, rl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(uPlayer) > 0 {
|
||||
nPlayer, err = db.Player.Create().
|
||||
SetID(steamID).
|
||||
SetName(uPlayer[0].Name).
|
||||
SetAvatar(uPlayer[0].Avatar).
|
||||
SetSteamUpdated(uPlayer[0].SteamUpdated).
|
||||
SetVanityURL(uPlayer[0].VanityURL).
|
||||
SetVanityURLReal(uPlayer[0].VanityURLReal).
|
||||
SetProfileCreated(uPlayer[0].ProfileCreated).
|
||||
SetGameBanCount(uPlayer[0].GameBanCount).
|
||||
SetVacCount(uPlayer[0].VacCount).
|
||||
SetVacDate(uPlayer[0].VacDate).
|
||||
SetGameBanDate(uPlayer[0].GameBanDate).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(uPlayer) > 0 {
|
||||
nPlayer, err = db.Player.Create().
|
||||
SetID(steamID).
|
||||
SetName(uPlayer[0].Name).
|
||||
SetAvatar(uPlayer[0].Avatar).
|
||||
SetSteamUpdated(uPlayer[0].SteamUpdated).
|
||||
SetVanityURL(uPlayer[0].VanityURL).
|
||||
SetVanityURLReal(uPlayer[0].VanityURLReal).
|
||||
SetProfileCreated(uPlayer[0].ProfileCreated).
|
||||
SetGameBanCount(uPlayer[0].GameBanCount).
|
||||
SetVacCount(uPlayer[0].VacCount).
|
||||
SetVacDate(uPlayer[0].VacDate).
|
||||
SetGameBanDate(uPlayer[0].GameBanDate).
|
||||
Save(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nPlayer, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("player %d not found", steamID)
|
||||
return nPlayer, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("player %d not found", steamID)
|
||||
}
|
||||
|
||||
func TranslateWithDeepL(text, language, baseURL, apiKey string, timeout int) (translated, detectedLanguage string, err error) {
|
||||
|
@ -711,13 +711,13 @@ func TranslateWithDeepL(text, language, baseURL, apiKey string, timeout int) (tr
|
|||
}
|
||||
|
||||
func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl *rate.Limiter) ([]*ent.Player, error) {
|
||||
var idsToUpdate []uint64
|
||||
idsToUpdate := make([]uint64, 0, len(players))
|
||||
|
||||
for _, updatePlayer := range players {
|
||||
idsToUpdate = append(idsToUpdate, updatePlayer.ID)
|
||||
}
|
||||
|
||||
batches := int(math.Round((float64(len(players)) / 1000) + 0.5)) //nolint:gomnd
|
||||
batches := int(math.Round((float64(len(players)) / 1000) + 0.5))
|
||||
|
||||
if rl != nil {
|
||||
err := rl.WaitN(context.Background(), batches)
|
||||
|
@ -731,7 +731,7 @@ func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl *r
|
|||
}
|
||||
|
||||
// TODO: what happens if a player deleted their profile?
|
||||
var nPlayers []*ent.Player
|
||||
var nPlayers []*ent.Player //nolint:prealloc
|
||||
for _, pS := range playerSum {
|
||||
// check for vanityURL
|
||||
if SteamID64RegEx.MatchString(path.Base(pS.ProfileURL)) {
|
||||
|
@ -817,14 +817,14 @@ func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl *r
|
|||
func RealIP(header *http.Header, fallback string) string {
|
||||
if header.Get("X-Forwarded-For") != "" {
|
||||
return header.Get("X-Forwarded-For")
|
||||
} else {
|
||||
return fallback
|
||||
}
|
||||
|
||||
return fallback
|
||||
}
|
||||
|
||||
func Rollback(tx *ent.Tx, err error) error {
|
||||
if rErr := tx.Rollback(); rErr != nil {
|
||||
err = fmt.Errorf("%w: %v", err, rErr)
|
||||
err = fmt.Errorf("%w: %w", err, rErr)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue