DE-3247 | updated logging for failing requests
This commit is contained in:
@@ -1,7 +1,24 @@
|
||||
package utils
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func NanosToMillis(timestamp int64) int64 {
|
||||
return timestamp * (int64(time.Nanosecond) / int64(time.Millisecond))
|
||||
}
|
||||
|
||||
func GetClientIP(xForwardedFor string, remoteAddr string) string {
|
||||
if xForwardedFor != "" {
|
||||
ips := strings.Split(xForwardedFor, ",")
|
||||
return strings.TrimSpace(ips[0])
|
||||
}
|
||||
|
||||
ip, _, err := net.SplitHostPort(remoteAddr)
|
||||
if err != nil {
|
||||
return remoteAddr
|
||||
}
|
||||
return ip
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user