add debug tool

This commit is contained in:
zu1k
2020-08-15 19:26:14 +08:00
parent 222800134f
commit b0b72c19c9
2 changed files with 11 additions and 1 deletions

View File

@@ -30,8 +30,8 @@ func Check(p proxy.Proxy) (delay uint16, err error) {
return
}
ctx, cancel := context.WithTimeout(context.Background(), defaultURLTestTimeout)
defer cancel()
delay, err = clashProxy.URLTest(ctx, "http://www.gstatic.com/generate_204")
cancel()
return delay, err
}

10
main.go
View File

@@ -3,12 +3,15 @@ package main
import (
"flag"
"fmt"
"net/http"
"github.com/zu1k/proxypool/api"
"github.com/zu1k/proxypool/app"
)
func main() {
go pprof()
filePath := flag.String("c", "", "path to config file: source.yaml")
flag.Parse()
if *filePath == "" {
@@ -22,3 +25,10 @@ func main() {
api.Run()
}
func pprof() {
ip := "127.0.0.1:6060"
if err := http.ListenAndServe(ip, nil); err != nil {
fmt.Printf("start pprof failed on %s\n", ip)
}
}