fix: replace slices.Contains with manual iteration for whitelist check

This commit is contained in:
SunBK201 2024-11-09 03:43:05 +08:00
parent e34de96116
commit 1ce1d4a401

View File

@ -7,7 +7,6 @@ import (
"fmt" "fmt"
"io" "io"
"net" "net"
"slices"
"strings" "strings"
"time" "time"
@ -446,8 +445,11 @@ func CopyPileline(dst io.Writer, src io.Reader, destAddrPort string) {
isMatchUaPattern = true isMatchUaPattern = true
} }
} }
if slices.Contains(whitelist, uaStr) { for _, v := range whitelist {
isInWhiteList = true if v == uaStr {
isInWhiteList = true
break
}
} }
if isInWhiteList || !isMatchUaPattern { if isInWhiteList || !isMatchUaPattern {
if !isMatchUaPattern { if !isMatchUaPattern {