MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / clientIP

Function clientIP

internal/auth/auth.go:288–297  ·  view source on GitHub ↗

clientIP 从请求中提取客户端真实 IP(优先 X-Real-IP,否则 RemoteAddr)。

(r *http.Request)

Source from the content-addressed store, hash-verified

286
287// clientIP 从请求中提取客户端真实 IP(优先 X-Real-IP,否则 RemoteAddr)。
288func clientIP(r *http.Request) string {
289 if ip := r.Header.Get("X-Real-IP"); ip != "" {
290 return ip
291 }
292 host, _, err := net.SplitHostPort(r.RemoteAddr)
293 if err != nil {
294 return r.RemoteAddr
295 }
296 return host
297}

Callers 2

HandleLoginMethod · 0.70
LoginFromRequestMethod · 0.70

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected