summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/tunnel/Makefile1
-rw-r--r--cmd/tunnel/main.go12
-rw-r--r--cmd/tunneld/Makefile1
-rw-r--r--cmd/tunneld/main.go21
4 files changed, 25 insertions, 10 deletions
diff --git a/cmd/tunnel/Makefile b/cmd/tunnel/Makefile
deleted file mode 100644
index 946951c..0000000
--- a/cmd/tunnel/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-include ../../scripts/build.mk
diff --git a/cmd/tunnel/main.go b/cmd/tunnel/main.go
index b6a4ee4..864dd9b 100644
--- a/cmd/tunnel/main.go
+++ b/cmd/tunnel/main.go
@@ -13,10 +13,13 @@ import (
)
var (
- systemFlag = flag.Bool("system", false, "use system instance")
- socketFlag = flag.String("S", "", "path to control socket")
+ systemFlag = flag.Bool("system", false, "use system instance")
+ socketFlag = flag.String("S", "", "path to control socket")
+ versionFlag = flag.Bool("version", false, "print version and exit")
)
+var BuildVersion string
+
func init() {
log.SetFlags(0)
}
@@ -40,6 +43,11 @@ func getSystemSocketPath() string {
func main() {
flag.Parse()
+ if *versionFlag {
+ fmt.Fprintln(os.Stderr, BuildVersion)
+ os.Exit(1)
+ }
+
if flag.NArg() < 1 {
log.Fatalf("Usage: %s command [arguments], try help", os.Args[0])
}
diff --git a/cmd/tunneld/Makefile b/cmd/tunneld/Makefile
deleted file mode 100644
index 946951c..0000000
--- a/cmd/tunneld/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-include ../../scripts/build.mk
diff --git a/cmd/tunneld/main.go b/cmd/tunneld/main.go
index c808aab..40d60d8 100644
--- a/cmd/tunneld/main.go
+++ b/cmd/tunneld/main.go
@@ -22,13 +22,16 @@ import (
)
var (
- debugFlag = flag.Bool("d", false, "debug: print time and source info")
- forceFlag = flag.Bool("f", false, "try start with force")
- syslogFlag = flag.Bool("s", false, "write log to syslog instead of stdout")
- configFlag = flag.String("c", "", "path to configuration file")
- socketFlag = flag.String("S", "", "path to control socket")
+ debugFlag = flag.Bool("d", false, "debug: print time and source info")
+ forceFlag = flag.Bool("f", false, "try start with force")
+ syslogFlag = flag.Bool("s", false, "write log to syslog instead of stdout")
+ configFlag = flag.String("c", "", "path to configuration file")
+ socketFlag = flag.String("S", "", "path to control socket")
+ versionFlag = flag.Bool("version", false, "print version and exit")
)
+var BuildVersion string
+
const trimSize = 32
func initLog() {
@@ -312,6 +315,12 @@ func deconfigure(s *server.Server) error {
func main() {
flag.Parse()
+
+ if *versionFlag {
+ fmt.Fprintln(os.Stderr, BuildVersion)
+ os.Exit(1)
+ }
+
initLog()
socket := getSocketPath()
@@ -323,7 +332,7 @@ func main() {
}
}
- s, err := server.New(socket)
+ s, err := server.New(socket, BuildVersion)
if err != nil {
log.Fatal(err)
}