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