feat(waf): return ip in string literal (#947)

* feat(waf): return ip in string literal

* rename
This commit is contained in:
UUBulb
2025-01-04 20:49:14 +08:00
committed by GitHub
parent e71d1553a3
commit d21179609d
3 changed files with 25 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ package utils
import (
"crypto/rand"
"errors"
"iter"
"maps"
"math/big"
"net/netip"
@@ -164,3 +165,13 @@ func Unique[T comparable](s []T) []T {
}
return ret
}
func ConvertSeq[T, U any](seq iter.Seq[T], f func(e T) U) iter.Seq[U] {
return func(yield func(U) bool) {
for e := range seq {
if !yield(f(e)) {
return
}
}
}
}