diff options
Diffstat (limited to 'vendor/github.com/tomasen/realip/README.md')
-rw-r--r-- | vendor/github.com/tomasen/realip/README.md | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/vendor/github.com/tomasen/realip/README.md b/vendor/github.com/tomasen/realip/README.md index 3eea89a..085f182 100644 --- a/vendor/github.com/tomasen/realip/README.md +++ b/vendor/github.com/tomasen/realip/README.md @@ -1,12 +1,27 @@ -a golang library that can get client's real public ip address from http request headers +# RealIP -[![Build Status](https://travis-ci.org/tomasen/realip.svg?branch=master)](https://travis-ci.org/Tomasen/realip) [![GoDoc](https://godoc.org/github.com/Tomasen/realip?status.svg)](http://godoc.org/github.com/Tomasen/realip) +Go package that can be used to get client's real public IP, which usually useful for logging HTTP server. -* follow the rule of X-FORWARDED-FOR/rfc7239 -* follow the rule of X-Real-Ip -* lan/intranet IP address filtered +### Feature + +* Follows the rule of X-Real-IP +* Follows the rule of X-Forwarded-For +* Exclude local or private address + +## Example + +```go +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 |