templates: Changed .RemoteAddr to .IP and stripped port

This commit is contained in:
Matthew Holt 2015-05-05 15:49:22 -06:00
parent 21c26f48d0
commit a9064a7871

View File

@ -51,10 +51,14 @@ func (c context) Header(name string) string {
return c.req.Header.Get(name)
}
// RemoteAddr gets the address of the client making the request.
func (c context) RemoteAddr() string {
// IP gets the (remote) IP address of the client making the request.
func (c context) IP() string {
ip, _, err := net.SplitHostPort(c.req.RemoteAddr)
if err != nil {
return c.req.RemoteAddr
}
return ip
}
// URI returns the raw, unprocessed request URI (including query
// string and hash) obtained directly from the Request-Line of