https://github.com/codeskyblue/realip
Get real IP behide nginx (Do not ignore private address)
https://github.com/codeskyblue/realip
Last synced: about 1 month ago
JSON representation
Get real IP behide nginx (Do not ignore private address)
- Host: GitHub
- URL: https://github.com/codeskyblue/realip
- Owner: codeskyblue
- License: mit
- Created: 2018-05-09T02:48:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-17T03:24:49.000Z (over 6 years ago)
- Last Synced: 2025-03-27T03:22:36.254Z (about 2 months ago)
- Language: Go
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RealIP
Get real IP behide nginx (Do not ignore private address)Follows the rule of `X-Forwardd-For` and `X-Real-IP`
Refs:
## Install
```
go get -v github.com/codeskyblue/realip
```## Usage
```go
package mainimport "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](LICENSE)