[release] v0.10.1-unstable3
This commit is contained in:
parent
a732130ca1
commit
112d1aaa99
|
@ -290,7 +290,7 @@ func Restrictions(RestrictToConstellation bool, WhitelistInboundIPs []string) fu
|
|||
isInConstellation := strings.HasPrefix(ip, "192.168.201.") || strings.HasPrefix(ip, "192.168.202.")
|
||||
|
||||
for _, ipRange := range WhitelistInboundIPs {
|
||||
utils.Debug("Checking if " + ip + " is in " + ipRange)
|
||||
Debug("Checking if " + ip + " is in " + ipRange)
|
||||
if strings.Contains(ipRange, "/") {
|
||||
if ok, _ := IPInRange(ip, ipRange); ok {
|
||||
isInWhitelist = true
|
||||
|
@ -302,24 +302,30 @@ func Restrictions(RestrictToConstellation bool, WhitelistInboundIPs []string) fu
|
|||
}
|
||||
}
|
||||
|
||||
utils.Debug("Is using whitelist: " + fmt.Sprintf("%v", isUsingWhiteList))
|
||||
utils.Debug("Is in whitelist: " + fmt.Sprintf("%v", isInWhitelist))
|
||||
utils.Debug("Is using constellation: " + fmt.Sprintf("%v", RestrictToConstellation))
|
||||
utils.Debug("Is in constellation: " + fmt.Sprintf("%v", isInConstellation))
|
||||
Debug("Is using whitelist: " + fmt.Sprintf("%v", isUsingWhiteList))
|
||||
Debug("Is in whitelist: " + fmt.Sprintf("%v", isInWhitelist))
|
||||
Debug("Is using constellation: " + fmt.Sprintf("%v", RestrictToConstellation))
|
||||
Debug("Is in constellation: " + fmt.Sprintf("%v", isInConstellation))
|
||||
|
||||
if(RestrictToConstellation) {
|
||||
if(!isInConstellation) {
|
||||
if(!isUsingWhiteList) {
|
||||
if(RestrictToConstellation) { // true
|
||||
Debug("RestrictToConstellation")
|
||||
if(!isInConstellation) { // true
|
||||
Debug("isInConstellation")
|
||||
if(!isUsingWhiteList) { // false
|
||||
Debug("isUsingWhiteList")
|
||||
Error("Request from " + ip + " is blocked because of restrictions", nil)
|
||||
http.Error(w, "Access denied", http.StatusForbidden)
|
||||
return
|
||||
} else if (!isInWhitelist) {
|
||||
} else if (!isInWhitelist) { // false
|
||||
Debug("isInWhitelist")
|
||||
Error("Request from " + ip + " is blocked because of restrictions", nil)
|
||||
http.Error(w, "Access denied", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
} else if(isUsingWhiteList && !isInWhitelist) {
|
||||
Debug("isUsingWhiteList && !isInWhitelist")
|
||||
Debug("isInWhitelist")
|
||||
Error("Request from " + ip + " is blocked because of restrictions", nil)
|
||||
http.Error(w, "Access denied", http.StatusForbidden)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue