-
Notifications
You must be signed in to change notification settings - Fork 0
/
pxy.go
45 lines (34 loc) · 789 Bytes
/
pxy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
// "os"
"fmt"
// "net"
// "time"
"net/http"
// "io/ioutil"
)
var cnt int = 0
func svr1() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%d, Hello, %v, %v\n", cnt, r.RemoteAddr, r.RequestURI)
cnt = cnt + 1
println(r.RemoteAddr)
})
println(http.ListenAndServe(":8080", nil))
}
func wk(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "wk: %d, Hello, %v, %v\n", cnt, r.RemoteAddr, r.RequestURI)
cnt = cnt + 1
print(r.RemoteAddr)
println(" " + r.RequestURI)
}
func test() string {
return "test string"
}
func svr2() {
s := http.Server{Addr: ":8080", Handler: http.HandlerFunc(wk)}
s.ListenAndServe()
}
func main() {
svr2()
}