-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
71 lines (53 loc) · 1.7 KB
/
main.go
File metadata and controls
71 lines (53 loc) · 1.7 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package main
import (
domainCheckData "domainCheck/src/data"
domainCheckDb "domainCheck/src/db"
domainCheckMail "domainCheck/src/email"
domainCheckGenTxt "domainCheck/src/genTxt"
domainCheckScanner "domainCheck/src/sacnner"
"log"
"os"
"github.com/coderguang/GameEngine_go/sgcmd"
"github.com/coderguang/GameEngine_go/sgserver"
_ "net/http/pprof"
"github.com/coderguang/GameEngine_go/sglog"
)
func StartCheckByDb(cmd []string) {
for i := 1; i < 6; i++ {
go domainCheckScanner.CheckDomainExpireDt("com", i)
go domainCheckScanner.CheckDomainExpireDt("cn", i)
go domainCheckScanner.CheckDomainExpireDt("net", i)
}
}
func StartGenDataAndCheck(cmd []string) {
file := "./domainTxt/domain.txt"
domainCheckGenTxt.CreateDominFile(file)
domainCheckScanner.ScanDomainByFile(file)
StartCheckByDb(cmd)
}
func TestMail(cmd []string) {
domainCheckMail.SendMailNotice("just test", "can it?")
}
func registCmd() {
sgcmd.RegistCmd("StartCheckByDb", "[\"StartCheckByDb\"] will start check by db data", StartCheckByDb)
sgcmd.RegistCmd("StartGenDataAndCheck", "[\"StartGenDataAndCheck\"] will start gen domainData and check by file data", StartGenDataAndCheck)
sgcmd.RegistCmd("TestMail", "[\"TestMail\"] TestMail", TestMail)
}
func main() {
sgserver.StartLogServer("debug", "./log", log.LstdFlags, true)
arg_num := len(os.Args) - 1
if arg_num < 1 {
sglog.Error("please input config file ")
return
}
sglog.Info("welcome to domain check !any question can ask royalchen@royalchen.com")
err := domainCheckData.InitConfig(os.Args[1])
if err != nil {
os.Exit(1)
}
domainCheckDb.InitDbConnection()
domainCheckMail.InitEmailConnect()
registCmd()
sgcmd.StartCmdWaitInputLoop()
log.Println("end all scanner")
}