ginbump/request_address.go
func GetRequesterAddress(r *http.Request) string {
	if xff := r.Header.Get("X-Forwarded-For"); xff != "" {
		return ParseForwarded(xff)
	}

	if ip, _, err := net.SplitHostPort(r.RemoteAddr); err == nil {
		return ip
	}

	return ""
}
func GetRequesterAddress(r *http.Request) string {
	if xff := r.Header.Get("X-Forwarded-For"); xff != "" {
		return ParseForwarded(xff)
	}

	if ip, _, err := net.SplitHostPort(r.RemoteAddr); err == nil {
		return ip
	}

	return ""
}
// GetRequesterAddress does a best effort lookup for the real IP address of the
// requester. Many load balancers (such as AWS's ELB) set a X-Forwarded-For
// header which can be used to determine the IP address of the client when the
// server is behind a load balancer.
//
// It is possible however for the client to spoof this header if the load
// balancer is not configured to remove it from the request or if the server is
// accessed directly.
//
// For uses such as rate limitting, only use this function if you can trust that
// the load balancer will strip the header from the client and that the server
// will not be directly accessible by the public (only though the load
// balancer).