mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
improve performance a little bit when having white list
This commit is contained in:
parent
6e21aeea59
commit
74b045e9b6
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/go/glog"
|
"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
|
// If the whitelist entry contains a "/" it
|
||||||
// is a CIDR range, and we should check the
|
// is a CIDR range, and we should check the
|
||||||
// remote host is within it
|
// remote host is within it
|
||||||
match, _ := regexp.MatchString("/", ip)
|
if strings.Contains(ip, "/") {
|
||||||
if match {
|
|
||||||
_, cidrnet, err := net.ParseCIDR(ip)
|
_, cidrnet, err := net.ParseCIDR(ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in a new issue