forked from GhostTroops/scan4all
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (34 loc) · 921 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"embed"
"fmt"
"github.com/hktalent/scan4all/lib/api"
"github.com/hktalent/scan4all/lib/util"
"log"
"net/http"
_ "net/http/pprof"
"runtime"
"sync"
)
//go:embed config/*
var config embed.FS
var Wg sync.WaitGroup
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
util.Wg = &Wg
util.DoInit(&config)
szTip := ""
if util.GetValAsBool("enablDevDebug") {
// debug 优化时启用///////////////////////
go func() {
szTip = "Since you started http://127.0.0.1:6060/debug/pprof/ with -debug, close the program with: control + C"
fmt.Println("debug info: \nopen http://127.0.0.1:6060/debug/pprof/\n\ngo tool pprof -seconds=10 -http=:9999 http://localhost:6060/debug/pprof/heap")
http.ListenAndServe(":6060", nil)
}()
//////////////////////////////////////////*/
}
api.StartScan(nil)
log.Printf("wait for all threads to end\n%s", szTip)
util.Wg.Wait()
util.CloseAll()
}