flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 422f8d44a496cf7d701c731615c8c6c043f3a9da
parent 13bb0d3c427d66d8d1e717fd5a4bc59bac5088bf
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat,  2 Jan 2021 10:58:05 -0800

remove port number from IP logs gemini

Diffstat:
Mlog.go | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/log.go b/log.go @@ -149,7 +149,12 @@ func appendQuoted(buf []byte, s string) []byte { // Anonymize user and IP? func logGemini(r *gmi.Request) { - line := fmt.Sprintf("gemini %s - [%s] %s %s\n", r.RemoteAddr.String(), + ipAddr := r.RemoteAddr.String() + host, _, err := net.SplitHostPort(ipAddr) + if err != nil { + host = ipAddr + } + line := fmt.Sprintf("gemini %s - [%s] %s %s\n", host, time.Now().Format("02/Jan/2006:15:04:05 -0700"), r.URL.Host, r.URL.Path)