mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 23:53:19 +01:00
better test endpoint ui
This commit is contained in:
parent
378d83715b
commit
ac7ec589f6
@ -377,10 +377,28 @@
|
||||
</div>
|
||||
<div id="container">
|
||||
<div id="info">
|
||||
<h2>The Current Now is {{ .Now }}</h2>
|
||||
<p>The current 'HOST' header: {{ .Host }}</p>
|
||||
<p>The remote host making the request: {{ .Remote }}</p>
|
||||
<p>This host has these IP addresses: {{ .Ips }}</p>
|
||||
<h2>{{ .Now }}</h2>
|
||||
|
||||
<h3>Local:</h3>
|
||||
<table>
|
||||
<tr><td>Host Header</td><td>{{ .Host }}</td></tr>
|
||||
<tr><td>Remote Address</td><td>{{ .Remote }}</td></tr>
|
||||
<tr><td>Local IP Addresses</td><td>{{ .Ips }}</td></tr>
|
||||
</table>
|
||||
|
||||
<h3>Headers:</h3>
|
||||
<table>
|
||||
{{ range $header, $value := .Headers }}
|
||||
<tr>
|
||||
<td>{{ $header }}</td>
|
||||
<td>
|
||||
{{ range $v := $value }}
|
||||
{{ $v }}
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -56,22 +56,28 @@ func (cmd *testEndpointCommand) run(_ *cobra.Command, _ []string) {
|
||||
|
||||
func (cmd *testEndpointCommand) serveIndex(w http.ResponseWriter, r *http.Request) {
|
||||
logrus.Infof("%v {%v} -> /index.html", r.RemoteAddr, r.Host)
|
||||
ed := &endpointData{
|
||||
Now: time.Now(),
|
||||
Host: r.Host,
|
||||
Remote: r.RemoteAddr,
|
||||
}
|
||||
ed.getIps()
|
||||
if err := cmd.t.Execute(w, ed); err != nil {
|
||||
if err := cmd.t.Execute(w, newEndpointData(r)); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
type endpointData struct {
|
||||
Now time.Time
|
||||
Host string
|
||||
Remote string
|
||||
Ips string
|
||||
Now time.Time
|
||||
Host string
|
||||
Headers map[string][]string
|
||||
Remote string
|
||||
Ips string
|
||||
}
|
||||
|
||||
func newEndpointData(r *http.Request) *endpointData {
|
||||
ed := &endpointData{
|
||||
Now: time.Now(),
|
||||
Host: r.Host,
|
||||
Headers: r.Header,
|
||||
Remote: r.RemoteAddr,
|
||||
}
|
||||
ed.getIps()
|
||||
return ed
|
||||
}
|
||||
|
||||
func (ed *endpointData) getIps() {
|
||||
|
Loading…
Reference in New Issue
Block a user