mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
add pprof for debug
This commit is contained in:
parent
254c9a8bad
commit
26a42b6510
1 changed files with 11 additions and 1 deletions
12
main.go
12
main.go
|
|
@ -28,6 +28,8 @@ import (
|
||||||
|
|
||||||
"github.com/cloudwego/hertz/pkg/network/standard"
|
"github.com/cloudwego/hertz/pkg/network/standard"
|
||||||
"github.com/hertz-contrib/http2/factory"
|
"github.com/hertz-contrib/http2/factory"
|
||||||
|
|
||||||
|
_ "net/http/pprof"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -385,6 +387,7 @@ func main() {
|
||||||
} else {
|
} else {
|
||||||
r = server.New(
|
r = server.New(
|
||||||
server.WithHostPorts(addr),
|
server.WithHostPorts(addr),
|
||||||
|
server.WithTransport(standard.NewTransporter),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -447,11 +450,18 @@ func main() {
|
||||||
fmt.Printf("A Go Based High-Performance Github Proxy \n")
|
fmt.Printf("A Go Based High-Performance Github Proxy \n")
|
||||||
fmt.Printf("Made by WJQSERVER-STUDIO\n")
|
fmt.Printf("Made by WJQSERVER-STUDIO\n")
|
||||||
|
|
||||||
|
if cfg.Server.Debug {
|
||||||
|
go func() {
|
||||||
|
http.ListenAndServe("localhost:6060", nil)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
r.Spin()
|
r.Spin()
|
||||||
defer logger.Close()
|
defer logger.Close()
|
||||||
defer func() {
|
defer func() {
|
||||||
if hertZfile != nil {
|
if hertZfile != nil {
|
||||||
err := hertZfile.Close()
|
var err error
|
||||||
|
err = hertZfile.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logError("Failed to close hertz log file: %v", err)
|
logError("Failed to close hertz log file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue