Projects
View on GitHub
tomasen/realip
About
a golang library that can get client's real public ip address from http request headers
Developer ToolsMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalRealIP
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:
Explore related projects
Loading…