diff --git a/cmd/version.go b/cmd/version.go index 4a3afc6..93e3986 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.27.0" +var Version = "0.28.0" func init() { rootCmd.AddCommand(versionCmd) diff --git a/cmd/web.go b/cmd/web.go index f138b77..48b1c6a 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -293,11 +293,22 @@ func serveStaticFile(w http.ResponseWriter, r *http.Request, paths []string) err w.Write(buf) if Verbose { + remoteAddr := "" + cfIP := w.Header().Get("Cf-Connecting-Ip") + xRealIp := w.Header().Get("X-Real-Ip") + if cfIP != "" { + remoteAddr = cfIP + } else if xRealIp != "" { + remoteAddr = xRealIp + } else { + remoteAddr = r.RemoteAddr + } + fmt.Printf("%v | Served %v (%v) to %v in %v\n", startTime.Format(LogDate), filePath, humanReadableSize(len(buf)), - r.RemoteAddr, + remoteAddr, time.Since(startTime).Round(time.Microsecond), ) }