summary refs log tree commit diff stats
path: root/svc
diff options
context:
space:
mode:
Diffstat (limited to 'svc')
-rw-r--r--svc/http.go6
1 files changed, 0 insertions, 6 deletions
diff --git a/svc/http.go b/svc/http.go
index 0118912..d39ab4e 100644
--- a/svc/http.go
+++ b/svc/http.go
@@ -23,7 +23,6 @@ const ctxKey ipCtxKey = iota
 // If getwtxt is behind a reverse proxy, get the last entry
 // in the X-Forwarded-For or X-Real-IP HTTP header as the user IP.
 func newCtxUserIP(ctx context.Context, r *http.Request) context.Context {
-
 	base := strings.Split(r.RemoteAddr, ":")
 	uip := base[0]
 
@@ -45,18 +44,15 @@ func newCtxUserIP(ctx context.Context, r *http.Request) context.Context {
 
 // Retrieves a request's IP address from the request's context
 func getIPFromCtx(ctx context.Context) net.IP {
-
 	uip, ok := ctx.Value(ctxKey).(string)
 	if !ok {
 		log.Printf("Couldn't retrieve IP from request\n")
 	}
-
 	return net.ParseIP(uip)
 }
 
 // Shim function to modify/pass context value to a handler
 func ipMiddleware(hop http.Handler) http.Handler {
-
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		ctx := newCtxUserIP(r.Context(), r)
 		hop.ServeHTTP(w, r.WithContext(ctx))
@@ -65,7 +61,6 @@ func ipMiddleware(hop http.Handler) http.Handler {
 
 func log200(r *http.Request) {
 	useragent := r.Header["User-Agent"]
-
 	uip := getIPFromCtx(r.Context())
 	log.Printf("*** %v :: 200 :: %v %v :: %v\n", uip, r.Method, r.URL, useragent)
 }
@@ -73,7 +68,6 @@ func log200(r *http.Request) {
 func errHTTP(w http.ResponseWriter, r *http.Request, err error, code int) {
 	useragent := r.Header["User-Agent"]
 	uip := getIPFromCtx(r.Context())
-
 	log.Printf("*** %v :: %v :: %v %v :: %v :: %v\n", uip, code, r.Method, r.URL, useragent, err.Error())
 	http.Error(w, fmt.Sprintf("Error %v: %v", code, err.Error()), code)
 }