forked from zu1k/proxypool
-
Notifications
You must be signed in to change notification settings - Fork 18
/
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/ilpl/proxypool/api"
"github.com/ilpl/proxypool/internal/app"
"github.com/ilpl/proxypool/internal/cron"
"github.com/ilpl/proxypool/internal/database"
"github.com/ilpl/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()
}