Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
fix getIP
Browse files Browse the repository at this point in the history
  • Loading branch information
masahide committed Jan 3, 2018
1 parent ead1b79 commit 4f04cd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ func checkUa(ua string) bool {

func getIp(req *http.Request) string {
ips := req.Header["X-Forwarded-For"]
return ips[len(ips)-1]
if len(ips) > 0 {
return ips[len(ips)-1]
}
return ""
}

func getInfo(req *http.Request) HostInfo {
Expand Down

0 comments on commit 4f04cd9

Please sign in to comment.