|
@@ -18,35 +18,10 @@ import (
|
18
|
18
|
func main() {
|
19
|
19
|
r := gin.Default()
|
20
|
20
|
|
21
|
|
- r.OPTIONS("/upload", func(c *gin.Context) {
|
22
|
|
- c.Header("Access-Control-Allow-Origin", "http://localhost:8080")
|
23
|
|
- c.Header("Access-Control-Allow-Credentials", "true")
|
24
|
|
- c.Header("Access-Control-Allow-Method", "POST")
|
25
|
|
- //c.Header("","")
|
26
|
|
- //c.Header("","")
|
27
|
|
- //Access-Control-Allow-Origin: *
|
28
|
|
- // Access-Control-Allow-Credentials: true
|
29
|
|
- //Access-Control-Expose-Headers: FooBar
|
30
|
|
- //Content-Type: text/html; charset=utf-8
|
31
|
|
- })
|
32
|
21
|
r.POST("/upload", upload)
|
33
|
|
-
|
34
|
22
|
r.GET("/pprof/:hash/:method", mapping)
|
35
|
|
- //r.GET("/pprof/:hash/", dot)
|
36
|
|
- //r.GET("/pprof/:hash/top", top)
|
37
|
|
- //r.GET("/pprof/:hash/disasm", disasm)
|
38
|
|
- //r.GET("/pprof/:hash/source", source)
|
39
|
|
- //r.GET("/pprof/:hash/peek", peek)
|
40
|
|
- //r.GET("/pprof/:hash/flamegraph", flamegraph)
|
41
|
|
- //r.GET("/pprof/:hash/saveconfig", saveconfig)
|
42
|
|
- //r.GET("/pprof/:hash/deleteconfig", deleteconfig)
|
43
|
|
-
|
44
|
|
- go func() {
|
45
|
|
- http.ListenAndServe(":8091", nil)
|
46
|
|
- }()
|
47
|
23
|
|
48
|
24
|
r.Run(":8090")
|
49
|
|
-
|
50
|
25
|
}
|
51
|
26
|
|
52
|
27
|
func mapping(c *gin.Context) {
|
|
@@ -146,40 +121,3 @@ func hash(data []byte) string {
|
146
|
121
|
func fileExist(file string) bool {
|
147
|
122
|
return false
|
148
|
123
|
}
|
149
|
|
-
|
150
|
|
-//
|
151
|
|
-//func dot(c *gin.Context) {}
|
152
|
|
-//func top(c *gin.Context) {}
|
153
|
|
-//func disasm(c *gin.Context) {}
|
154
|
|
-//func source(c *gin.Context) {}
|
155
|
|
-//func peek(c *gin.Context) {}
|
156
|
|
-//func flamegraph(c *gin.Context) {
|
157
|
|
-// hash := c.Param("hash")
|
158
|
|
-// if hash == "" {
|
159
|
|
-// c.AbortWithStatus(http.StatusNotFound)
|
160
|
|
-// return
|
161
|
|
-// }
|
162
|
|
-//
|
163
|
|
-// filename := fmt.Sprintf("%s.pprof", hash)
|
164
|
|
-// f, err := os.OpenFile(filename, os.O_RDONLY, os.ModePerm)
|
165
|
|
-// if err != nil {
|
166
|
|
-// c.AbortWithError(http.StatusInternalServerError, err)
|
167
|
|
-// return
|
168
|
|
-// }
|
169
|
|
-// defer f.Close()
|
170
|
|
-// prof, err := profile.Parse(f)
|
171
|
|
-// if err != nil {
|
172
|
|
-// c.AbortWithError(http.StatusInternalServerError, err)
|
173
|
|
-// return
|
174
|
|
-// }
|
175
|
|
-//
|
176
|
|
-// ui, err := driver.MakeWebInterface(prof, nil)
|
177
|
|
-// if err != nil {
|
178
|
|
-// c.AbortWithError(http.StatusInternalServerError, err)
|
179
|
|
-// return
|
180
|
|
-// }
|
181
|
|
-//
|
182
|
|
-// ui.Flamegraph(c.Writer, c.Request)
|
183
|
|
-//}
|
184
|
|
-//func saveconfig(c *gin.Context) {}
|
185
|
|
-//func deleteconfig(c *gin.Context) {}
|