Frédéric Guillot 27196589fb Add FeedIcon API call and update dependencies 8 роки тому
..
.travis.yml 27196589fb Add FeedIcon API call and update dependencies 8 роки тому
README.md 27196589fb Add FeedIcon API call and update dependencies 8 роки тому
realip.go 27196589fb Add FeedIcon API call and update dependencies 8 роки тому
realip_test.go 27196589fb Add FeedIcon API call and update dependencies 8 роки тому

README.md

RealIP

GoDoc

Go package that can be used to get client's real public IP, which usually useful for logging HTTP server.

Feature

  • Follows the rule of X-Real-IP
  • Follows the rule of X-Forwarded-For
  • Exclude local or private address

Example

package main

import "github.com/Tomasen/realip"

func (h *Handler) ServeIndexPage(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
	clientIP := realip.FromRequest(r)
	log.Println("GET / from", clientIP)
}

Developing

Commited code must pass: