Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 884 Bytes

README.md

File metadata and controls

32 lines (26 loc) · 884 Bytes

FastHTTP RealIP

Go package that can be used to get client's real public IP from Fast HTTP request.

License Build

Example

package main

import (
    "log"
    "github.com/valyala/fasthttp"
    "github.com/zhooravell/fasthttp-realip"
)

func main() {
	if err := fasthttp.ListenAndServe(":8080", requestHandler); err != nil {
		log.Fatalf("Error in ListenAndServe: %s", err)
	}
}

func requestHandler(ctx *fasthttp.RequestCtx) {
    log.Println("Client IP: " + realip.FromRequest(ctx))
}