Skip to content

Commit 1a96880

Browse files
committed
Adding new header image
1 parent 650b171 commit 1a96880

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

k8s/k8s.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,30 @@ package main
22

33
import (
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+
823
func 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
}

0 commit comments

Comments
 (0)