diff options
| author | Adnan Maolood <[email protected]> | 2021-02-27 14:02:30 -0500 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2021-02-27 14:02:30 -0500 |
| commit | 82bdffc1ebac233079aae388f7b7062368a2819e (patch) | |
| tree | f75bec145ea12f2c3fe6722dde0ea36c4c996cee /request.go | |
| parent | request: Cache calls to TLS (diff) | |
| download | go-gemini-82bdffc1ebac233079aae388f7b7062368a2819e.tar.xz go-gemini-82bdffc1ebac233079aae388f7b7062368a2819e.zip | |
request: Add ServerName helper method
Diffstat (limited to 'request.go')
| -rw-r--r-- | request.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -110,3 +110,12 @@ func (r *Request) TLS() *tls.ConnectionState { } return r.tls } + +// ServerName returns the value of the TLS Server Name Indication extension +// sent by the client. +func (r *Request) ServerName() string { + if tls := r.TLS(); tls != nil { + return tls.ServerName + } + return "" +} |