scrm-go

ip_helper.go 166B

1234567891011121314
  1. package utils
  2. import (
  3. "net/http"
  4. )
  5. func GetIP(r *http.Request) string {
  6. ip := r.Header.Get("X-Forwarded-For")
  7. if ip == "" {
  8. ip = r.RemoteAddr
  9. }
  10. return ip
  11. }