add debug tool
This commit is contained in:
@@ -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
10
main.go
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user