From 22ab7e250bf1fce36cf1797a8f73537aa0f58892 Mon Sep 17 00:00:00 2001 From: Adrien PONSIN Date: Tue, 15 Apr 2025 19:37:23 +0200 Subject: [PATCH] add remote address field on incoming request --- cmd/middleman/main.go | 6 ++++-- command/serve.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/middleman/main.go b/cmd/middleman/main.go index 8c20506..0de2335 100644 --- a/cmd/middleman/main.go +++ b/cmd/middleman/main.go @@ -62,11 +62,13 @@ func buildVersion() string { info, ok := debug.ReadBuildInfo() if ok { if info.Main.Version != "" { - return info.Main.Version + "-" + info.Main.Sum + version = info.Main.Version + commit = info.Main.Sum } } if version == "" && commit == "" { - return "dev" + "-" + noCommit{}.String() + version = "dev" + commit = noCommit{}.String() } return version + "-" + commit } diff --git a/command/serve.go b/command/serve.go index 1947531..699b3b1 100644 --- a/command/serve.go +++ b/command/serve.go @@ -148,7 +148,7 @@ func Serve(group *errgroup.Group) *cli.Command { } func (ph *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - log.Debug().Str("http_method", r.Method).Str("path", r.URL.Path).Msg("incoming request") + log.Debug().Str("remote_addr", r.RemoteAddr).Str("http_method", r.Method).Str("path", r.URL.Path).Msg("incoming request") mr, ok := containerMethodRegex["*"] if ok { if err := checkMethodPath(w, r, mr); err != nil {