-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
37 lines (34 loc) · 780 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
package main
import (
"github.com/dubuqingfeng/bit-node-crawler/dbs"
"github.com/dubuqingfeng/bit-node-crawler/fetchers"
"github.com/dubuqingfeng/bit-node-crawler/utils"
log "github.com/sirupsen/logrus"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
)
func init() {
utils.InitConfig("./configs/config.yaml")
dbs.InitMySQLDB()
}
func main() {
// new node fetcher
if utils.Config.Debug {
go func() {
if err := http.ListenAndServe("0.0.0.0:6061", nil); err != nil {
log.Error(err)
}
}()
}
fetcher := fetchers.NewNodeFetcher(utils.Config.CoinType)
fetcher.Run()
// exit sign
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt)
go func() {
<-sig // Wait for ^C signal
log.Warningf("Interrupt signal detected, shutting down.")
}()
}