Skip to content

Commit

Permalink
feat: improve test coverage for clientip strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerwill90 committed Nov 28, 2024
1 parent d6012ad commit 0765bb0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea
.prof
.test
.out
*.prof
*.test
*.out
go.work
go.work.sum
qodana.yaml
Expand Down
3 changes: 2 additions & 1 deletion clientip/clientip.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ type LeftmostNonPrivate struct {
}

// NewLeftmostNonPrivate creates a [LeftmostNonPrivate] strategy. By default, loopback, link local and private net ip range
// are blacklisted. The number of IPs parsed is limited by the limit field to prevent excessive processing and potential abuse.
// are blacklisted. A sensible limit on the number of IPs to parse must be set to prevent excessive resource usage from
// adversarial headers.
func NewLeftmostNonPrivate(key HeaderKey, limit uint, opts ...BlacklistRangeOption) LeftmostNonPrivate {
if key > 1 {
panic(fmt.Errorf("header must be %s or %s", xForwardedForHdr, forwardedHdr))
Expand Down

0 comments on commit 0765bb0

Please sign in to comment.