-
Notifications
You must be signed in to change notification settings - Fork 57
/
main.go
47 lines (40 loc) · 855 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/ooclab/otunnel/pkg/client"
"github.com/ooclab/otunnel/pkg/server"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
const programVersion = "1.3.1"
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)
}