-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkerrigan.go
123 lines (116 loc) · 2.38 KB
/
kerrigan.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package main
import (
"fmt"
"os"
"pnt/cmd"
"pnt/utils"
"strconv"
"time"
"github.com/urfave/cli"
)
var compileAt string
var (
app = cli.NewApp()
//Seednodes seednodes 填写种子节点
Seednodes = cli.StringFlag{
Name: "seednode, n",
EnvVar: "SEEDNODES",
Usage: "seednodes host string",
//Value: "127.0.0.1:8800,122.0.0.1:8899",
Value: "150.109.11.142:38888",
}
//ControlPort ControlPort
ControlPort = cli.UintFlag{
Name: "controlport, c",
Usage: "control tunnel port",
Value: 38888,
}
//TunnClientPort DataClientPort
TunnClientPort = cli.UintFlag{
Name: "port, p",
Usage: "data tunnel client port",
Value: 12345,
}
//SortHandlerPort SortHandlerPort
SortHandlerPort = cli.UintFlag{
Name: "sorthandlerport, a",
Usage: "sort handler port",
Value: 12398,
}
//ServerModel ServerModel
ServerModel = cli.BoolFlag{
Name: "server, s",
Usage: "start with server model",
}
//GenesisFlag GenesisFlag
GenesisFlag = cli.BoolFlag{
Name: "genesis, g",
Usage: "start as genesis model",
}
//DebugModel DebugModel
DebugModel = cli.StringFlag{
Name: "debug",
Usage: "Quiet start release, debug, test default debug",
Value: "debug",
}
//LogModel LogModel
LogModel = cli.IntFlag{
Name: "logmodel",
Usage: "log model set, 0 to cache, 1 to file",
Value: 1,
}
//CacheLines CacheLines
CacheLines = cli.IntFlag{
Name: "cachelines",
Usage: "cache lines set",
Value: 500,
}
//LogFilePath LogFilePath
LogFilePath = cli.StringFlag{
Name: "logpath",
Usage: "redirect log into file",
Value: "/tmp/kerri.log",
}
//APIPort ApiPort
APIPort = cli.IntFlag{
Name: "apiport",
Usage: "api server port",
Value: 48899,
}
)
func init() {
app.Action = cmd.Pnt
app.Name = "kerrigan"
timestamp, _ := strconv.ParseInt(compileAt, 10, 64)
app.Compiled = time.Unix(timestamp, 0)
version := os.Getenv("QUEEN_VERSION")
if version == "" {
app.Version = "1.0.0"
}
app.Usage = "the kerrigan usage"
app.Copyright = "Copyright 2017-2018 pujielan"
app.Flags = []cli.Flag{
Seednodes,
ServerModel,
ControlPort,
TunnClientPort,
GenesisFlag,
DebugModel,
LogModel,
CacheLines,
LogFilePath,
// TimeOut,
APIPort,
}
//add plugin flags
app.Flags = utils.AddPluginFlags(app.Flags)
}
func addPlugin() {
app.Flags = append(app.Flags)
}
func main() {
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}