Skip to content

a golang library that can get client's real public ip address from http request headers

License

Notifications You must be signed in to change notification settings

yuttasakcom/fasthttp-realip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RealIP [fasthttp]

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/krecu/fasthttp-realip"

func RealIpHandler(ctx *fasthttp.RequestCtx) {
	clientIP := realip.FromRequest(ctx)
	log.Println("GET / from", clientIP)
}

Developing

Commited code must pass:

About

a golang library that can get client's real public ip address from http request headers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%