MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / replaceRemoteAddr

Function replaceRemoteAddr

server/router.go:254–261  ·  view source on GitHub ↗

replaceRemoteAddr sets the req.RemoteAddr for request

(req *http.Request, ip string)

Source from the content-addressed store, hash-verified

252
253// replaceRemoteAddr sets the req.RemoteAddr for request
254func replaceRemoteAddr(req *http.Request, ip string) {
255 _, port, err := net.SplitHostPort(req.RemoteAddr)
256 if err != nil {
257 port = "80"
258 }
259
260 req.RemoteAddr = net.JoinHostPort(strings.TrimSpace(ip), port)
261}
262
263// Silent sets Silent flag which suppresses logs to true. We do not need to log
264// requests like /health of /favicon.ico

Callers 1

replaceRemoteAddrMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected