I’m working on a library to help get the “real” client IP from HTTP requests: https://github.com/realclientip/realclientip-go https://pkg.go.dev/github.com/realclientip/realclientip-go
Right now the “strategies” are like: type Strategy func(headers http.Header, remoteAddr string) string ... clientIPStrategy, err := realclientip.RightmostTrustedCountStrategy("X-Forwarded-For", 1) ... clientIP := clientIPStrategy(req.Header, req.RemoteAddr) So, functions matching a signature are created that process the input. But I keep wondering: Should I be returning types (structs) adhering to an interface instead? I’m starting to think I should, but I can’t think of what difference it would make. Any feedback would be appreciated. Adam Pritchard -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20a8eac9-98b2-4af5-87f3-e811d5a97e3cn%40googlegroups.com.