mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-23 00:33:50 +01:00
[chore]: Bump github.com/ulule/limiter/v3 from 3.11.1 to 3.11.2 (#1841)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
2e7043be95
commit
e50b228539
2
go.mod
2
go.mod
@ -46,7 +46,7 @@ require (
|
||||
github.com/superseriousbusiness/exif-terminator v0.5.0
|
||||
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB.0.20230227143000-f4900831d6c8
|
||||
github.com/tdewolff/minify/v2 v2.12.5
|
||||
github.com/ulule/limiter/v3 v3.11.1
|
||||
github.com/ulule/limiter/v3 v3.11.2
|
||||
github.com/uptrace/bun v1.1.13
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.13
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.13
|
||||
|
8
go.sum
8
go.sum
@ -96,7 +96,7 @@ github.com/abema/go-mp4 v0.10.1/go.mod h1:vPl9t5ZK7K0x68jh12/+ECWBCXoWuIDtNgPtU2
|
||||
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
|
||||
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
||||
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
|
||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
|
||||
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
|
||||
@ -592,8 +592,8 @@ github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6
|
||||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||
github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU=
|
||||
github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ulule/limiter/v3 v3.11.1 h1:wm6YaA2JwIXc0S+z8TK8/neWMOTf4m20I5jL1dwLRcw=
|
||||
github.com/ulule/limiter/v3 v3.11.1/go.mod h1:4nk/9RHEJthkjD+mmkqYxaPfD4pkB91PTH7k8ozB80g=
|
||||
github.com/ulule/limiter/v3 v3.11.2 h1:P4yOrxoEMJbOTfRJR2OzjL90oflzYPPmWg+dvwN2tHA=
|
||||
github.com/ulule/limiter/v3 v3.11.2/go.mod h1:QG5GnFOCV+k7lrL5Y8kgEeeflPH3+Cviqlqa8SVSQxI=
|
||||
github.com/uptrace/bun v1.1.13 h1:IrxlIJHzCHFwmIzx66A9vi6qx8rHsHFiiT9LqlafHZw=
|
||||
github.com/uptrace/bun v1.1.13/go.mod h1:UsZPd0AuHOx2QkkKXnqkHnFBjVp5tKqI7s4A750u9v0=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.13 h1:j9BecpkRA9SDVBwh6oKhC5rABk4B40s66OCcqBHSQXM=
|
||||
@ -607,7 +607,7 @@ github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.21/go.mod h1:hiCFa1UeZITK
|
||||
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.14.0/go.mod h1:ol1PCaL0dX20wC0htZ7sYCsvCYmrouYra0zHzaclZhE=
|
||||
github.com/valyala/fasthttp v1.44.0 h1:R+gLUhldIsfg1HokMuQjdQ5bh9nuXHPIfvkYUu9eR5Q=
|
||||
github.com/valyala/fasthttp v1.47.0 h1:y7moDoxYzMooFpT5aHgNgVOQDrS3qlkfiP9mDtGGK9c=
|
||||
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
|
||||
|
2
vendor/github.com/ulule/limiter/v3/README.md
generated
vendored
2
vendor/github.com/ulule/limiter/v3/README.md
generated
vendored
@ -17,7 +17,7 @@ _Dead simple rate limit middleware for Go._
|
||||
Using [Go Modules](https://github.com/golang/go/wiki/Modules)
|
||||
|
||||
```bash
|
||||
$ go get github.com/ulule/limiter/v3@v3.11.1
|
||||
$ go get github.com/ulule/limiter/v3@v3.11.2
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
35
vendor/github.com/ulule/limiter/v3/drivers/store/memory/store.go
generated
vendored
35
vendor/github.com/ulule/limiter/v3/drivers/store/memory/store.go
generated
vendored
@ -2,11 +2,11 @@
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ulule/limiter/v3"
|
||||
"github.com/ulule/limiter/v3/drivers/store/common"
|
||||
"github.com/ulule/limiter/v3/internal/bytebuffer"
|
||||
)
|
||||
|
||||
// Store is the in-memory store.
|
||||
@ -35,11 +35,7 @@ func NewStoreWithOptions(options limiter.StoreOptions) limiter.Store {
|
||||
|
||||
// Get returns the limit for given identifier.
|
||||
func (store *Store) Get(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error) {
|
||||
buffer := bytebuffer.New()
|
||||
defer buffer.Close()
|
||||
buffer.Concat(store.Prefix, ":", key)
|
||||
|
||||
count, expiration := store.cache.Increment(buffer.String(), 1, rate.Period)
|
||||
count, expiration := store.cache.Increment(store.getCacheKey(key), 1, rate.Period)
|
||||
|
||||
lctx := common.GetContextFromState(time.Now(), rate, expiration, count)
|
||||
return lctx, nil
|
||||
@ -47,11 +43,7 @@ func (store *Store) Get(ctx context.Context, key string, rate limiter.Rate) (lim
|
||||
|
||||
// Increment increments the limit by given count & returns the new limit value for given identifier.
|
||||
func (store *Store) Increment(ctx context.Context, key string, count int64, rate limiter.Rate) (limiter.Context, error) {
|
||||
buffer := bytebuffer.New()
|
||||
defer buffer.Close()
|
||||
buffer.Concat(store.Prefix, ":", key)
|
||||
|
||||
newCount, expiration := store.cache.Increment(buffer.String(), count, rate.Period)
|
||||
newCount, expiration := store.cache.Increment(store.getCacheKey(key), count, rate.Period)
|
||||
|
||||
lctx := common.GetContextFromState(time.Now(), rate, expiration, newCount)
|
||||
return lctx, nil
|
||||
@ -59,11 +51,7 @@ func (store *Store) Increment(ctx context.Context, key string, count int64, rate
|
||||
|
||||
// Peek returns the limit for given identifier, without modification on current values.
|
||||
func (store *Store) Peek(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error) {
|
||||
buffer := bytebuffer.New()
|
||||
defer buffer.Close()
|
||||
buffer.Concat(store.Prefix, ":", key)
|
||||
|
||||
count, expiration := store.cache.Get(buffer.String(), rate.Period)
|
||||
count, expiration := store.cache.Get(store.getCacheKey(key), rate.Period)
|
||||
|
||||
lctx := common.GetContextFromState(time.Now(), rate, expiration, count)
|
||||
return lctx, nil
|
||||
@ -71,12 +59,17 @@ func (store *Store) Peek(ctx context.Context, key string, rate limiter.Rate) (li
|
||||
|
||||
// Reset returns the limit for given identifier.
|
||||
func (store *Store) Reset(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error) {
|
||||
buffer := bytebuffer.New()
|
||||
defer buffer.Close()
|
||||
buffer.Concat(store.Prefix, ":", key)
|
||||
|
||||
count, expiration := store.cache.Reset(buffer.String(), rate.Period)
|
||||
count, expiration := store.cache.Reset(store.getCacheKey(key), rate.Period)
|
||||
|
||||
lctx := common.GetContextFromState(time.Now(), rate, expiration, count)
|
||||
return lctx, nil
|
||||
}
|
||||
|
||||
// getCacheKey returns the full path for an identifier.
|
||||
func (store *Store) getCacheKey(key string) string {
|
||||
buffer := strings.Builder{}
|
||||
buffer.WriteString(store.Prefix)
|
||||
buffer.WriteString(":")
|
||||
buffer.WriteString(key)
|
||||
return buffer.String()
|
||||
}
|
||||
|
58
vendor/github.com/ulule/limiter/v3/internal/bytebuffer/pool.go
generated
vendored
58
vendor/github.com/ulule/limiter/v3/internal/bytebuffer/pool.go
generated
vendored
@ -1,58 +0,0 @@
|
||||
package bytebuffer
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// ByteBuffer is a wrapper around a slice to reduce memory allocation while handling blob of data.
|
||||
type ByteBuffer struct {
|
||||
blob []byte
|
||||
}
|
||||
|
||||
// New creates a new ByteBuffer instance.
|
||||
func New() *ByteBuffer {
|
||||
entry := bufferPool.Get().(*ByteBuffer)
|
||||
entry.blob = entry.blob[:0]
|
||||
return entry
|
||||
}
|
||||
|
||||
// Bytes returns the content buffer.
|
||||
func (buffer *ByteBuffer) Bytes() []byte {
|
||||
return buffer.blob
|
||||
}
|
||||
|
||||
// String returns the content buffer.
|
||||
func (buffer *ByteBuffer) String() string {
|
||||
// Copied from strings.(*Builder).String
|
||||
return *(*string)(unsafe.Pointer(&buffer.blob)) // nolint: gosec
|
||||
}
|
||||
|
||||
// Concat appends given arguments to blob content
|
||||
func (buffer *ByteBuffer) Concat(args ...string) {
|
||||
for i := range args {
|
||||
buffer.blob = append(buffer.blob, args[i]...)
|
||||
}
|
||||
}
|
||||
|
||||
// Close recycles underlying resources of encoder.
|
||||
func (buffer *ByteBuffer) Close() {
|
||||
// Proper usage of a sync.Pool requires each entry to have approximately
|
||||
// the same memory cost. To obtain this property when the stored type
|
||||
// contains a variably-sized buffer, we add a hard limit on the maximum buffer
|
||||
// to place back in the pool.
|
||||
//
|
||||
// See https://golang.org/issue/23199
|
||||
if buffer != nil && cap(buffer.blob) < (1<<16) {
|
||||
bufferPool.Put(buffer)
|
||||
}
|
||||
}
|
||||
|
||||
// A byte buffer pool to reduce memory allocation pressure.
|
||||
var bufferPool = &sync.Pool{
|
||||
New: func() interface{} {
|
||||
return &ByteBuffer{
|
||||
blob: make([]byte, 0, 1024),
|
||||
}
|
||||
},
|
||||
}
|
3
vendor/modules.txt
vendored
3
vendor/modules.txt
vendored
@ -712,13 +712,12 @@ github.com/twitchyliquid64/golang-asm/unsafeheader
|
||||
# github.com/ugorji/go/codec v1.2.9
|
||||
## explicit; go 1.11
|
||||
github.com/ugorji/go/codec
|
||||
# github.com/ulule/limiter/v3 v3.11.1
|
||||
# github.com/ulule/limiter/v3 v3.11.2
|
||||
## explicit; go 1.17
|
||||
github.com/ulule/limiter/v3
|
||||
github.com/ulule/limiter/v3/drivers/middleware/gin
|
||||
github.com/ulule/limiter/v3/drivers/store/common
|
||||
github.com/ulule/limiter/v3/drivers/store/memory
|
||||
github.com/ulule/limiter/v3/internal/bytebuffer
|
||||
# github.com/uptrace/bun v1.1.13
|
||||
## explicit; go 1.18
|
||||
github.com/uptrace/bun
|
||||
|
Loading…
Reference in New Issue
Block a user