mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 04:30:54 +00:00
Merge pull request #399 from Max-Liu/master
repaired the wrong IP when using in localhost (Mac os x)
This commit is contained in:
commit
e18b9f0321
@ -98,8 +98,10 @@ func (input *BeegoInput) IP() string {
|
|||||||
}
|
}
|
||||||
ip := strings.Split(input.Request.RemoteAddr, ":")
|
ip := strings.Split(input.Request.RemoteAddr, ":")
|
||||||
if len(ip) > 0 {
|
if len(ip) > 0 {
|
||||||
|
if ip[0] != "["{
|
||||||
return ip[0]
|
return ip[0]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return "127.0.0.1"
|
return "127.0.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user