removed unnecessary pointer indirection, added rate limiter middleware

This commit is contained in:
yusing
2024-11-03 07:07:30 +08:00
parent 3bf520541b
commit 8df28628ec
17 changed files with 167 additions and 79 deletions

View File

@@ -19,7 +19,7 @@ import (
type (
forwardAuth struct {
*forwardAuthOpts
forwardAuthOpts
m *Middleware
client http.Client
}
@@ -33,14 +33,11 @@ type (
}
)
var ForwardAuth = &forwardAuth{
m: &Middleware{withOptions: NewForwardAuthfunc},
}
var ForwardAuth = &Middleware{withOptions: NewForwardAuthfunc}
func NewForwardAuthfunc(optsRaw OptionsRaw) (*Middleware, E.Error) {
fa := new(forwardAuth)
fa.forwardAuthOpts = new(forwardAuthOpts)
if err := Deserialize(optsRaw, fa.forwardAuthOpts); err != nil {
if err := Deserialize(optsRaw, &fa.forwardAuthOpts); err != nil {
return nil, err
}
if _, err := url.Parse(fa.Address); err != nil {