mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-21 23:03:08 +01:00
pprof
This commit is contained in:
parent
b4ce21f5c5
commit
3c10f64c66
13
main.go
13
main.go
@ -14,6 +14,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
nonSecureRand "math/rand"
|
nonSecureRand "math/rand"
|
||||||
|
"net/http"
|
||||||
|
_ "net/http/pprof"
|
||||||
|
|
||||||
"github.com/KusakabeSi/EtherGuard-VPN/gencfg"
|
"github.com/KusakabeSi/EtherGuard-VPN/gencfg"
|
||||||
"github.com/KusakabeSi/EtherGuard-VPN/ipc"
|
"github.com/KusakabeSi/EtherGuard-VPN/ipc"
|
||||||
@ -38,6 +40,7 @@ var (
|
|||||||
cfgmode = flag.String("cfgmode", "", "Running mode for generated config. [none|super|p2p]")
|
cfgmode = flag.String("cfgmode", "", "Running mode for generated config. [none|super|p2p]")
|
||||||
bind = flag.String("bind", "linux", "UDP socket bind mode. [linux|std]\nYou may need std mode if you want to run Etherguard under WSL.")
|
bind = flag.String("bind", "linux", "UDP socket bind mode. [linux|std]\nYou may need std mode if you want to run Etherguard under WSL.")
|
||||||
nouapi = flag.Bool("no-uapi", false, "Disable UAPI\nWith UAPI, you can check etherguard status by \"wg\" command")
|
nouapi = flag.Bool("no-uapi", false, "Disable UAPI\nWith UAPI, you can check etherguard status by \"wg\" command")
|
||||||
|
pprofaddr = flag.String("pprof", "", "pprof listing address")
|
||||||
version = flag.Bool("version", false, "Show version")
|
version = flag.Bool("version", false, "Show version")
|
||||||
help = flag.Bool("help", false, "Show this help")
|
help = flag.Bool("help", false, "Show this help")
|
||||||
)
|
)
|
||||||
@ -58,6 +61,15 @@ func main() {
|
|||||||
ipc.SetsocketDirectory(uapiDir)
|
ipc.SetsocketDirectory(uapiDir)
|
||||||
}
|
}
|
||||||
nonSecureRand.Seed(time.Now().UnixNano())
|
nonSecureRand.Seed(time.Now().UnixNano())
|
||||||
|
if *pprofaddr != "" {
|
||||||
|
go func() {
|
||||||
|
//内网可访问的pprof地址
|
||||||
|
err := http.ListenAndServe(*pprofaddr, nil)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("pprof error: %v", err))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
switch *mode {
|
switch *mode {
|
||||||
@ -78,7 +90,6 @@ func main() {
|
|||||||
default:
|
default:
|
||||||
err = fmt.Errorf("gencfg: generate config for %v mode are not implement", *cfgmode)
|
err = fmt.Errorf("gencfg: generate config for %v mode are not implement", *cfgmode)
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user