package utils 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 }