Skip to content

Commit e48bc7b

Browse files
authored
Update close.go
1 parent b37c90d commit e48bc7b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

close.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ func turnOffMonitor() {
2727

2828
func handler(w http.ResponseWriter, r *http.Request) {
2929
if r.URL.Path == "/" {
30-
turnOffMonitor()
30+
// 获取客户端的 IP 地址
31+
clientIP := r.RemoteAddr
32+
// 打印请求关闭的 IP 地址
33+
fmt.Printf("Received request to turn off the screen from IP: %s\n", clientIP)
3134
fmt.Fprintln(w, "Screen will be turned off")
35+
go turnOffMonitor()
3236
} else {
3337
http.NotFound(w, r)
3438
}

0 commit comments

Comments
 (0)