From 28f890a70157ac234368c4a6235cc99e9662ce9b Mon Sep 17 00:00:00 2001 From: Nick Vollmar Date: Thu, 18 Apr 2019 10:42:48 -0500 Subject: [PATCH] TUN-1669: Update license message in help text. Also fix test --- Makefile | 2 +- cmd/cloudflared/main.go | 21 ++++++++++++--------- cmd/cloudflared/tunnel/cmd_test.go | 10 ++++++---- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 38a564a5..0e9d267c 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,6 @@ tunnelrpc/tunnelrpc.capnp.go: tunnelrpc/tunnelrpc.capnp .PHONY: vet vet: - go vet -tests=false ./... + go vet ./... which go-sumtype # go get github.com/BurntSushi/go-sumtype go-sumtype $$(go list ./...) diff --git a/cmd/cloudflared/main.go b/cmd/cloudflared/main.go index a5155df0..a6495584 100644 --- a/cmd/cloudflared/main.go +++ b/cmd/cloudflared/main.go @@ -11,17 +11,15 @@ import ( "github.com/cloudflare/cloudflared/log" "github.com/cloudflare/cloudflared/metrics" - "github.com/getsentry/raven-go" - "github.com/mitchellh/go-homedir" - "gopkg.in/urfave/cli.v2" + raven "github.com/getsentry/raven-go" + homedir "github.com/mitchellh/go-homedir" + cli "gopkg.in/urfave/cli.v2" "github.com/pkg/errors" ) const ( - developerPortal = "https://developers.cloudflare.com/argo-tunnel" - licenseUrl = developerPortal + "/license/" - versionText = "Print the version" + versionText = "Print the version" ) var ( @@ -62,10 +60,15 @@ func main() { app.Name = "cloudflared" app.Usage = "Cloudflare's command-line tool and agent" app.ArgsUsage = "origin-url" - app.Copyright = fmt.Sprintf(`(c) %d Cloudflare Inc. - Use is subject to the license agreement at %s`, time.Now().Year(), licenseUrl) + app.Copyright = fmt.Sprintf( + `(c) %d Cloudflare Inc. + Your installation of cloudflared software constitutes a symbol of your signature indicating that you accept + the terms of the Cloudflare License (https://developers.cloudflare.com/argo-tunnel/license/), + Terms (https://www.cloudflare.com/terms/) and Privacy Policy (https://www.cloudflare.com/privacypolicy/).`, + time.Now().Year(), + ) app.Version = fmt.Sprintf("%s (built %s)", Version, BuildTime) - app.Description = `cloudflared connects your machine or user identity to Cloudflare's global network. + app.Description = `cloudflared connects your machine or user identity to Cloudflare's global network. You can use it to authenticate a session to reach an API behind Access, route web traffic to this machine, and configure access control.` app.Flags = flags() diff --git a/cmd/cloudflared/tunnel/cmd_test.go b/cmd/cloudflared/tunnel/cmd_test.go index 4d400284..b29b3966 100644 --- a/cmd/cloudflared/tunnel/cmd_test.go +++ b/cmd/cloudflared/tunnel/cmd_test.go @@ -6,10 +6,12 @@ import ( "github.com/stretchr/testify/assert" ) -func TesthostnameFromURI(t *testing.T) { - assert.Equal(t, "ssh://awesome.warptunnels.horse:22", hostnameFromURI("ssh://awesome.warptunnels.horse:22")) - assert.Equal(t, "ssh://awesome.warptunnels.horse:22", hostnameFromURI("ssh://awesome.warptunnels.horse")) - assert.Equal(t, "rdp://localhost:3389", hostnameFromURI("rdp://localhost")) +func TestHostnameFromURI(t *testing.T) { + assert.Equal(t, "awesome.warptunnels.horse:22", hostnameFromURI("ssh://awesome.warptunnels.horse:22")) + assert.Equal(t, "awesome.warptunnels.horse:22", hostnameFromURI("ssh://awesome.warptunnels.horse")) + assert.Equal(t, "awesome.warptunnels.horse:2222", hostnameFromURI("ssh://awesome.warptunnels.horse:2222")) + assert.Equal(t, "localhost:3389", hostnameFromURI("rdp://localhost")) + assert.Equal(t, "localhost:3390", hostnameFromURI("rdp://localhost:3390")) assert.Equal(t, "", hostnameFromURI("trash")) assert.Equal(t, "", hostnameFromURI("https://awesomesauce.com")) }