-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathmain.go
More file actions
63 lines (59 loc) · 1.19 KB
/
main.go
File metadata and controls
63 lines (59 loc) · 1.19 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
package main
import (
"LoginFish/pkg/model"
_ "LoginFish/pkg/model"
"LoginFish/pkg/router"
_ "LoginFish/pkg/router"
"fmt"
"log"
"net/http"
"os"
)
func testdata() {
site := model.Site{
UUID: "",
Domain: "127.0.0.1",
Title: "123123",
UserName: "admin",
PassWord: "12345",
Download: "asdasd.exe",
AccessCount: 0,
DownloadCount: 0,
}
model.Conn.Save(&site)
return
for i := 0; i < 10; i++ {
log.Println(i)
site := model.Site{
UUID: "",
Domain: fmt.Sprintf("site-%d.baidu.com", i),
Title: fmt.Sprintf("site-%d.baidu.com", i),
UserName: "admin",
PassWord: "12345",
Download: "asdasd.exe",
AccessCount: 0,
DownloadCount: 0,
}
model.Conn.Save(&site)
}
}
func main() {
//testdata()
// if len(os.Args) > 1 && os.Args[1] == "init" {
// testdata()
// return
// }
port := "5522"
if len(os.Args) > 1 {
port = os.Args[1]
}
router.Router.LoadHTMLGlob("static/template/*.html")
srv := &http.Server{
Addr: fmt.Sprintf(":%s", port),
Handler: router.Router,
}
if err := srv.ListenAndServe(); err != nil {
log.Fatalln("Listen Webapi Error : ", err)
panic(err)
}
}