-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.go
57 lines (50 loc) · 1.54 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"fmt"
"github.com/phpgao/proxy_pool/schedule"
"github.com/phpgao/proxy_pool/server"
"github.com/phpgao/proxy_pool/ulimit"
"github.com/phpgao/proxy_pool/util"
"github.com/phpgao/proxy_pool/validator"
"time"
)
var (
logger = util.GetLogger("main")
VERSION = "development"
BuildTime = time.Now().Format("2006-01-02T15:04:05Z07:00")
GoVersion = "development"
)
func main() {
// print welcome msg
ShowWelcome()
//wash cache
validator.Update()
if util.ServerConf.Manager {
logger.Info("Running in as Manager")
scheduler := schedule.NewScheduler()
go scheduler.Run()
}
if util.ServerConf.Worker {
logger.Info("Running in as Worker")
go validator.NewValidator()
go validator.OldValidator()
}
server.RunService()
}
func ShowWelcome() {
fmt.Printf(`
______ _
| ___ \ | |
| |_/ / __ _____ ___ _ _ __ ___ ___ | | Proxy pool %s
| __/ '__/ _ \ \/ / | | | | '_ \ / _ \ / _ \| | Proxy port: %d
| | | | | (_) > <| |_| | | |_) | (_) | (_) | | Api port: %d
\_| |_| \___/_/\_\\__, | | .__/ \___/ \___/|_| %s
__/ | | |
|___/ |_| `, VERSION, util.ServerConf.ApiPort, util.ServerConf.ProxyPort, "https://phpgao.com")
fmt.Println()
logger.Info("Proxy_pool is starting")
logger.Infof("Proxy_pool BUILD_TIME == %s", BuildTime)
logger.Infof("Proxy_pool GO_VERSION == %s", GoVersion)
logger.Info("Configuration loaded")
ulimit.Set()
}