forked from ooclab/otunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (40 loc) · 847 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
45
46
47
package main
import (
"fmt"
"os"
"github.com/Sirupsen/logrus"
"github.com/ooclab/otunnel/client"
"github.com/ooclab/otunnel/server"
"github.com/urfave/cli"
)
const programVersion = "1.3.0"
var (
buildstamp = ""
githash = ""
)
func init() {
logrus.SetFormatter(&logrus.TextFormatter{
FullTimestamp: true,
TimestampFormat: "01/02 15:04:05",
})
}
func main() {
cli.VersionPrinter = func(c *cli.Context) {
fmt.Println("Current Version: ", c.App.Version)
if buildstamp != "" {
fmt.Println(" Build Time: ", buildstamp)
}
if githash != "" {
fmt.Println("Git Commit Hash: ", githash)
}
}
app := cli.NewApp()
app.Name = "otunnel"
app.Usage = "otunnel is a simple & secure tunnel tool"
app.Version = programVersion
app.Commands = []cli.Command{
client.Command,
server.Command,
}
app.Run(os.Args)
}