MCPcopy Index your code
hub / github.com/tinode/chat / getRemoteAddr

Function getRemoteAddr

server/http.go:368–380  ·  view source on GitHub ↗

Obtain IP address of the client.

(req *http.Request)

Source from the content-addressed store, hash-verified

366
367// Obtain IP address of the client.
368func getRemoteAddr(req *http.Request) string {
369 var addr string
370 if globals.useXForwardedFor {
371 addr = req.Header.Get("X-Forwarded-For")
372 if !isRoutableIP(addr) {
373 addr = ""
374 }
375 }
376 if addr != "" {
377 return addr
378 }
379 return req.RemoteAddr
380}
381
382// debugSession is session debug info.
383type debugSession struct {

Callers 3

serveLongPollFunction · 0.85
largeFileServeHTTPFunction · 0.85
largeFileReceiveHTTPFunction · 0.85

Calls 2

isRoutableIPFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…