mirror of
https://github.com/openziti/zrok.git
synced 2025-01-11 00:18:43 +01:00
additional endpoint detail (#36)
This commit is contained in:
parent
106b8ba469
commit
2b65166f2a
@ -12,6 +12,7 @@
|
|||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
padding: 25;
|
||||||
font-family: 'JetBrains Mono', Consolas, 'Courier New', monospace;
|
font-family: 'JetBrains Mono', Consolas, 'Courier New', monospace;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
@ -58,8 +59,8 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root">
|
<div id="root">
|
||||||
<div id="banner">
|
<div id="banner">
|
||||||
<svg id="ziggy" viewBox="0 0 21.9 37.6" style="width: 200px; height: 343.38px;">
|
<svg id="ziggy" viewBox="0 0 21.9 37.6" style="width: 200px; height: 343.38px;">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@ -389,11 +390,13 @@
|
|||||||
<div id="info">
|
<div id="info">
|
||||||
<h2>{{ .Now }}</h2>
|
<h2>{{ .Now }}</h2>
|
||||||
|
|
||||||
<h3>This Endpoint:</h3>
|
<h3>At This Endpoint:</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td class="td-key">Host Header</td><td>{{ .Host }}</td></tr>
|
<tr><td>Remote Address</td><td>{{ .RemoteAddr }}</td></tr>
|
||||||
<tr><td class="td-key">Remote Address</td><td>{{ .Remote }}</td></tr>
|
<tr><td>This Host</td><td>{{ .Host }}</td></tr>
|
||||||
<tr><td class="td-key">Local IP Addresses</td><td>{{ .Ips }}</td></tr>
|
<tr><td>This Host Detail</td><td>{{ .HostDetail }}</td></tr>
|
||||||
|
<tr><td>Local IP Addresses</td><td>{{ .Ips }}</td></tr>
|
||||||
|
<tr><td>Host Header</td><td>{{ .HostHeader }}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3>Extended Headers:</h3>
|
<h3>Extended Headers:</h3>
|
||||||
@ -401,7 +404,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{ range $header, $value := .Headers }}
|
{{ range $header, $value := .Headers }}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td-key">{{ $header }}</td>
|
<td>{{ $header }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ range $v := $value }}
|
{{ range $v := $value }}
|
||||||
{{ $v }}
|
{{ $v }}
|
||||||
@ -413,6 +416,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -62,23 +62,35 @@ func (cmd *testEndpointCommand) serveIndex(w http.ResponseWriter, r *http.Reques
|
|||||||
|
|
||||||
type endpointData struct {
|
type endpointData struct {
|
||||||
Now time.Time
|
Now time.Time
|
||||||
|
RemoteAddr string
|
||||||
Host string
|
Host string
|
||||||
Headers map[string][]string
|
HostDetail string
|
||||||
Remote string
|
|
||||||
Ips string
|
Ips string
|
||||||
|
HostHeader string
|
||||||
|
Headers map[string][]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newEndpointData(r *http.Request) *endpointData {
|
func newEndpointData(r *http.Request) *endpointData {
|
||||||
ed := &endpointData{
|
ed := &endpointData{
|
||||||
Now: time.Now(),
|
Now: time.Now(),
|
||||||
Host: r.Host,
|
HostHeader: r.Host,
|
||||||
Headers: r.Header,
|
Headers: r.Header,
|
||||||
Remote: r.RemoteAddr,
|
RemoteAddr: r.RemoteAddr,
|
||||||
}
|
}
|
||||||
|
ed.getHostInfo()
|
||||||
ed.getIps()
|
ed.getIps()
|
||||||
return ed
|
return ed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ed *endpointData) getHostInfo() {
|
||||||
|
host, hostDetail, err := getHost()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error getting host detail: %v", err)
|
||||||
|
}
|
||||||
|
ed.Host = host
|
||||||
|
ed.HostDetail = hostDetail
|
||||||
|
}
|
||||||
|
|
||||||
func (ed *endpointData) getIps() {
|
func (ed *endpointData) getIps() {
|
||||||
addrs, err := net.InterfaceAddrs()
|
addrs, err := net.InterfaceAddrs()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
var Default = NewHTTPClient(nil)
|
var Default = NewHTTPClient(nil)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DefaultHost is the default Host
|
// DefaultHost is the default HostHeader
|
||||||
// found in Meta (info) section of spec file
|
// found in Meta (info) section of spec file
|
||||||
DefaultHost string = "localhost"
|
DefaultHost string = "localhost"
|
||||||
// DefaultBasePath is the default BasePath
|
// DefaultBasePath is the default BasePath
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// zrok client access
|
// zrok client access
|
||||||
// Schemes:
|
// Schemes:
|
||||||
// http
|
// http
|
||||||
// Host: localhost
|
// HostHeader: localhost
|
||||||
// BasePath: /api/v1
|
// BasePath: /api/v1
|
||||||
// Version: 1.0.0
|
// Version: 1.0.0
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user