[release] v0.10.0-unstable12
This commit is contained in:
parent
2e728b3ac3
commit
0af998d06c
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.10.0-unstable11",
|
||||
"version": "0.10.0-unstable12",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
|
|
@ -260,4 +260,27 @@ func IsValidHostname(hostname string) bool {
|
|||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func Restrictions(RestrictToConstellation bool) func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// check if the request is coming from the constellation IP range 192.168.201.0/24
|
||||
if RestrictToConstellation {
|
||||
ip, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
http.Error(w, "Invalid request", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(ip, "192.168.201.") && !strings.HasPrefix(ip, "192.168.202.") {
|
||||
http.Error(w, "Access denied", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -181,6 +181,7 @@ type ProxyRouteConfig struct {
|
|||
DisableHeaderHardening bool
|
||||
VerboseForwardHeader bool
|
||||
AddionalFilters []AddionalFiltersConfig
|
||||
RestrictToConstellation bool
|
||||
}
|
||||
|
||||
type EmailConfig struct {
|
||||
|
|
Loading…
Reference in a new issue