summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2023-08-04 11:57:40 -0700
committerMike Crute <mike@crute.us>2023-08-04 11:57:40 -0700
commitc25f33774f4ee735853c249d1c573667706e55e4 (patch)
tree3a37c87d3d5b432c64141660ef1a70adfbe2efe4
parent4ea62bb4314cf7c9e4db3a30728ec26194ea678d (diff)
downloadwebsocket_proxy-c25f33774f4ee735853c249d1c573667706e55e4.tar.bz2
websocket_proxy-c25f33774f4ee735853c249d1c573667706e55e4.tar.xz
websocket_proxy-c25f33774f4ee735853c249d1c573667706e55e4.zip
Report version in server/client
-rw-r--r--clientmain.go4
-rw-r--r--cmd/client/client.go8
-rw-r--r--main.go5
3 files changed, 10 insertions, 7 deletions
diff --git a/clientmain.go b/clientmain.go
index d75b8bc..91fcae0 100644
--- a/clientmain.go
+++ b/clientmain.go
@@ -12,8 +12,10 @@ import (
12 _ "time/tzdata" 12 _ "time/tzdata"
13) 13)
14 14
15var appVersion string
16
15func main() { 17func main() {
16 cmd := client.NewClientCommand() 18 cmd := client.NewClientCommand(appVersion)
17 19
18 if err := cmd.Execute(); err != nil { 20 if err := cmd.Execute(); err != nil {
19 log.Fatalf("Error running root command: %s", err) 21 log.Fatalf("Error running root command: %s", err)
diff --git a/cmd/client/client.go b/cmd/client/client.go
index da4015e..f25e151 100644
--- a/cmd/client/client.go
+++ b/cmd/client/client.go
@@ -26,10 +26,10 @@ import (
26// This should be compiled into the binary 26// This should be compiled into the binary
27var clientId string 27var clientId string
28 28
29func NewClientCommand() *cobra.Command { 29func NewClientCommand(appVersion string) *cobra.Command {
30 clientCmd := &cobra.Command{ 30 clientCmd := &cobra.Command{
31 Use: "client proxy-host ssh-to-host ssh-port username", 31 Use: "client proxy-host ssh-to-host ssh-port username",
32 Short: "Run websocket client", 32 Short: fmt.Sprintf("Run websocket client (version %s)", appVersion),
33 Args: cobra.ExactArgs(3), 33 Args: cobra.ExactArgs(3),
34 Run: func(c *cobra.Command, args []string) { 34 Run: func(c *cobra.Command, args []string) {
35 cfg := app.Config{} 35 cfg := app.Config{}
@@ -41,8 +41,8 @@ func NewClientCommand() *cobra.Command {
41 return clientCmd 41 return clientCmd
42} 42}
43 43
44func Register(root *cobra.Command) { 44func Register(root *cobra.Command, appVersion string) {
45 root.AddCommand(NewClientCommand()) 45 root.AddCommand(NewClientCommand(appVersion))
46} 46}
47 47
48func generateCertificateRequest(username, host string) (ed25519.PrivateKey, []byte, error) { 48func generateCertificateRequest(username, host string) (ed25519.PrivateKey, []byte, error) {
diff --git a/main.go b/main.go
index a9c084d..c64f374 100644
--- a/main.go
+++ b/main.go
@@ -4,6 +4,7 @@ package main
4 4
5import ( 5import (
6 "embed" 6 "embed"
7 "fmt"
7 "io/fs" 8 "io/fs"
8 "log" 9 "log"
9 10
@@ -32,7 +33,7 @@ var appVersion string
32func main() { 33func main() {
33 rootCmd := &cobra.Command{ 34 rootCmd := &cobra.Command{
34 Use: "web-server", 35 Use: "web-server",
35 Short: "SSH proxy web server", 36 Short: fmt.Sprintf("SSH proxy web server (version %s)", appVersion),
36 } 37 }
37 cli.AddFlags(rootCmd, &app.Config{}, app.DefaultConfig, "") 38 cli.AddFlags(rootCmd, &app.Config{}, app.DefaultConfig, "")
38 39
@@ -42,7 +43,7 @@ func main() {
42 } 43 }
43 44
44 web.Register(rootCmd, templates, embeddedClients, appVersion) 45 web.Register(rootCmd, templates, embeddedClients, appVersion)
45 client.Register(rootCmd) 46 client.Register(rootCmd, appVersion)
46 register.Register(rootCmd) 47 register.Register(rootCmd)
47 48
48 if err := rootCmd.Execute(); err != nil { 49 if err := rootCmd.Execute(); err != nil {