aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislusf <chris.lu@gmail.com>2016-04-14 14:42:19 -0700
committerchrislusf <chris.lu@gmail.com>2016-04-14 14:42:19 -0700
commit74b045e9b651daee6f9e82c4887674d830cef1f0 (patch)
tree95fe8d67824b4fa3a8c526c4b66cc94dc3e3e11d
parent6e21aeea59da3b62232b446d2efd974d95a9bc64 (diff)
downloadseaweedfs-74b045e9b651daee6f9e82c4887674d830cef1f0.tar.xz
seaweedfs-74b045e9b651daee6f9e82c4887674d830cef1f0.zip
improve performance a little bit when having white list
-rw-r--r--go/security/guard.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/go/security/guard.go b/go/security/guard.go
index 3c7e3bce3..1ee1bbd89 100644
--- a/go/security/guard.go
+++ b/go/security/guard.go
@@ -5,7 +5,6 @@ import (
"fmt"
"net"
"net/http"
- "regexp"
"strings"
"github.com/chrislusf/seaweedfs/go/glog"
@@ -108,8 +107,7 @@ func (g *Guard) checkWhiteList(w http.ResponseWriter, r *http.Request) error {
// If the whitelist entry contains a "/" it
// is a CIDR range, and we should check the
// remote host is within it
- match, _ := regexp.MatchString("/", ip)
- if match {
+ if strings.Contains(ip, "/") {
_, cidrnet, err := net.ParseCIDR(ip)
if err != nil {
panic(err)