mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 09:33:43 +01:00
richer test endpoint (#36)
This commit is contained in:
parent
5e4eee670f
commit
65284d696a
@ -47,6 +47,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="info">
|
<div id="info">
|
||||||
<h2>The Current Now is {{ .Now }}</h2>
|
<h2>The Current Now is {{ .Now }}</h2>
|
||||||
|
<p>The current <code>HOST</code> header: {{ .Host }}</p>
|
||||||
|
<p>The remote host making the request: {{ .Remote }}</p>
|
||||||
<p>This host has these IP addresses: {{ .Ips }}</p>
|
<p>This host has these IP addresses: {{ .Ips }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/opentracing/opentracing-go/log"
|
"github.com/opentracing/opentracing-go/log"
|
||||||
"github.com/openziti-test-kitchen/zrok/cmd/zrok/endpoint_ui"
|
"github.com/openziti-test-kitchen/zrok/cmd/zrok/endpoint_ui"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net"
|
"net"
|
||||||
@ -56,8 +57,11 @@ func (cmd *testEndpointCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *testEndpointCommand) handleIndex(w http.ResponseWriter, r *http.Request) {
|
func (cmd *testEndpointCommand) handleIndex(w http.ResponseWriter, r *http.Request) {
|
||||||
|
logrus.Infof("%v {%v} -> /index.html", r.RemoteAddr, r.Host)
|
||||||
ed := &endpointData{
|
ed := &endpointData{
|
||||||
Now: time.Now(),
|
Now: time.Now(),
|
||||||
|
Host: r.Host,
|
||||||
|
Remote: r.RemoteAddr,
|
||||||
}
|
}
|
||||||
ed.getIps()
|
ed.getIps()
|
||||||
if err := cmd.t.Execute(w, ed); err != nil {
|
if err := cmd.t.Execute(w, ed); err != nil {
|
||||||
@ -67,6 +71,8 @@ func (cmd *testEndpointCommand) handleIndex(w http.ResponseWriter, r *http.Reque
|
|||||||
|
|
||||||
type endpointData struct {
|
type endpointData struct {
|
||||||
Now time.Time
|
Now time.Time
|
||||||
|
Host string
|
||||||
|
Remote string
|
||||||
Ips string
|
Ips string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user