package
module
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Dec 17, 2018
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 6
Opens a new window with list of known importers.
README
¶
RealIP
Get real IP behide nginx (Do not ignore private address)
Follows the rule of X-Forwardd-For and X-Real-IP
Refs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For
Install
go get -v github.com/codeskyblue/realip
Usage
package main
import "github.com/codeskyblue/realip"
func (h *Handler) ServeIndexPage(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
clientIP := realip.FromRequest(r)
log.Println("GET / from", clientIP)
}
Thanks to
LICENSE
MIT
Documentation
¶
FromRequest return real request IP
Source Files
¶
Click to show internal directories.
Click to hide internal directories.