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