File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,30 @@ package main
22
33import (
44 "fmt"
5+ "net"
56 "net/http"
67)
78
9+ var (
10+ version = "1.2-yaml"
11+ bannedIp = "0.0.0.0"
12+ )
13+
14+ func getServerIP () string {
15+ conn , err := net .Dial ("udp" , "8.8.8.8:80" )
16+ if err != nil {
17+ panic (err )
18+ }
19+ defer conn .Close ()
20+ return conn .LocalAddr ().(* net.UDPAddr ).IP .String ()
21+ }
22+
823func playHome (w http.ResponseWriter , r * http.Request ) {
924 html := `<!DOCTYPE html><html><body><center>
10- <img src="https://raw.githubusercontent.com/twogg-git/k8s-workshop/master/src/1.0 .png">
25+ <img src="https://raw.githubusercontent.com/twogg-git/k8s-workshop/master/src/1.2 .png">
1126 <h1 style="color:green">Playing with Kubernetes</h1>
12- <h3 style="color:blue">Version: twogghub/k8s-workshop:1.0-baby</h3>
27+ <h2 style="color:blue">Your server IP:` + getServerIP () + `</h2>
28+ <h3 style="color:blue">Version: twogghub/k8s-workshop:` + version + `</h3>
1329 </center></body></html>`
1430 fmt .Fprintf (w , html )
1531}
You can’t perform that action at this time.
0 commit comments