mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-06 22:40:31 -05:00
templates: Changed .RemoteAddr to .IP and stripped port
This commit is contained in:
parent
21c26f48d0
commit
a9064a7871
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue