diff options
| author | Adnan Maolood <[email protected]> | 2021-02-27 14:03:33 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-27 14:03:33 -0500 |
| commit | f156be19b4c031174ad3b8cb67f9b6697929b02f (patch) | |
| tree | 0fa88e6246c6958f1ba0c3faa4c831d4e1f4ff1d /request.go | |
| parent | request: Add ServerName helper method (diff) | |
| download | go-gemini-f156be19b4c031174ad3b8cb67f9b6697929b02f.tar.xz go-gemini-f156be19b4c031174ad3b8cb67f9b6697929b02f.zip | |
request: Add RemoteAddr helper function
Diffstat (limited to 'request.go')
| -rw-r--r-- | request.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -119,3 +119,11 @@ func (r *Request) ServerName() string { } return "" } + +// RemoteAddr returns the remote network address of the client. +func (r *Request) RemoteAddr() net.Addr { + if r.conn != nil { + return r.conn.RemoteAddr() + } + return nil +} |