forked from zu1k/proxypool
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
44 lines (37 loc) · 827 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
39
40
41
42
43
44
package main
import (
"flag"
"fmt"
"net/http"
_ "net/http/pprof"
"os"
"github.com/zu1k/proxypool/api"
"github.com/zu1k/proxypool/internal/app"
"github.com/zu1k/proxypool/internal/cron"
"github.com/zu1k/proxypool/internal/database"
"github.com/zu1k/proxypool/pkg/proxy"
)
var configFilePath = ""
func main() {
go func() {
http.ListenAndServe("0.0.0.0:6060", nil)
}()
flag.StringVar(&configFilePath, "c", "", "path to config file: config.yaml")
flag.Parse()
if configFilePath == "" {
configFilePath = os.Getenv("CONFIG_FILE")
}
if configFilePath == "" {
configFilePath = "config.yaml"
}
err := app.InitConfigAndGetters(configFilePath)
if err != nil {
panic(err)
}
database.InitTables()
proxy.InitGeoIpDB()
fmt.Println("Do the first crawl...")
go app.CrawlGo()
go cron.Cron()
api.Run()
}