MCPcopy
hub / github.com/TarsCloud/TarsGo / getClientIp

Method getClientIp

tars/httpserver.go:129–140  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

127}
128
129func (mux *TarsHttpMux) getClientIp(r *http.Request) (reqAddr string) {
130 for _, h := range realIPHeader {
131 reqAddr = r.Header.Get(h)
132 if reqAddr != "" {
133 break
134 }
135 }
136 if reqAddr == "" { // no proxy
137 reqAddr = strings.SplitN(r.RemoteAddr, ":", 2)[0]
138 }
139 return reqAddr
140}
141
142// DefaultExceptionStatusChecker Default Exception Status Checker
143func DefaultExceptionStatusChecker(statusCode int) bool {

Callers 1

ServeHTTPMethod · 0.95

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected