Commit a9064a78 authored by Matthew Holt's avatar Matthew Holt

templates: Changed .RemoteAddr to .IP and stripped port

parent 21c26f48
......@@ -51,9 +51,13 @@ 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 {
return c.req.RemoteAddr
// 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment