- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for IsRequestFromLocalhost (1.15 sec)
-
pkg/util/net/ip.go
} else if ip.Is6() { ipv6 = append(ipv6, ip) } else { log.Debugf("ignoring un-parsable IP address: %v", ip) } } return } // IsRequestFromLocalhost returns true if request is from localhost address. func IsRequestFromLocalhost(r *http.Request) bool { ip, _, err := net.SplitHostPort(r.RemoteAddr) if err != nil { return false } userIP := net.ParseIP(ip) return userIP.IsLoopback()
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed May 01 14:41:40 UTC 2024 - 2.4K bytes - Viewed (0) -
pilot/cmd/pilot-agent/status/server.go
func (s *Server) handlePprofIndex(w http.ResponseWriter, r *http.Request) { if !istioNetUtil.IsRequestFromLocalhost(r) { http.Error(w, "Only requests from localhost are allowed", http.StatusForbidden) return } pprof.Index(w, r) } func (s *Server) handlePprofCmdline(w http.ResponseWriter, r *http.Request) { if !istioNetUtil.IsRequestFromLocalhost(r) { http.Error(w, "Only requests from localhost are allowed", http.StatusForbidden)
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Thu May 23 15:07:03 UTC 2024 - 31.1K bytes - Viewed (1) -
pkg/util/net/ip_test.go
for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { req := httptest.NewRequest("GET", "/", nil) req.RemoteAddr = tc.remoteAddr result := IsRequestFromLocalhost(req) if result != tc.expected { t.Errorf("IsRequestFromLocalhost expected %t for %s, but got %t", tc.expected, tc.remoteAddr, result) } }) }
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed May 01 14:41:40 UTC 2024 - 8.7K bytes - Viewed (0) -
pilot/pkg/bootstrap/monitoring.go
return nil } func metricsMiddleware(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if commonFeatures.MetricsLocalhostAccessOnly && !istioNetUtil.IsRequestFromLocalhost(r) { http.Error(w, "Only requests from localhost are allowed", http.StatusForbidden) return } // Pass control back to the handler handler.ServeHTTP(w, r) }) }
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed May 01 14:41:40 UTC 2024 - 4K bytes - Viewed (0) -
pilot/pkg/xds/debug.go
} func (s *DiscoveryServer) allowAuthenticatedOrLocalhost(next http.Handler) http.HandlerFunc { return func(w http.ResponseWriter, req *http.Request) { // Request is from localhost, no need to authenticate if isRequestFromLocalhost(req) { next.ServeHTTP(w, req) return } // Authenticate request with the same method as XDS authFailMsgs := make([]string, 0) var ids []string
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Tue Apr 30 00:26:45 UTC 2024 - 39.5K bytes - Viewed (0)