TUN-1669: Update license message in help text. Also fix test

This commit is contained in:
Nick Vollmar 2019-04-18 10:42:48 -05:00
parent 2e2fa29637
commit 28f890a701
3 changed files with 19 additions and 14 deletions

View File

@ -74,6 +74,6 @@ tunnelrpc/tunnelrpc.capnp.go: tunnelrpc/tunnelrpc.capnp
.PHONY: vet .PHONY: vet
vet: vet:
go vet -tests=false ./... go vet ./...
which go-sumtype # go get github.com/BurntSushi/go-sumtype which go-sumtype # go get github.com/BurntSushi/go-sumtype
go-sumtype $$(go list ./...) go-sumtype $$(go list ./...)

View File

@ -11,17 +11,15 @@ import (
"github.com/cloudflare/cloudflared/log" "github.com/cloudflare/cloudflared/log"
"github.com/cloudflare/cloudflared/metrics" "github.com/cloudflare/cloudflared/metrics"
"github.com/getsentry/raven-go" raven "github.com/getsentry/raven-go"
"github.com/mitchellh/go-homedir" homedir "github.com/mitchellh/go-homedir"
"gopkg.in/urfave/cli.v2" cli "gopkg.in/urfave/cli.v2"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
const ( const (
developerPortal = "https://developers.cloudflare.com/argo-tunnel" versionText = "Print the version"
licenseUrl = developerPortal + "/license/"
versionText = "Print the version"
) )
var ( var (
@ -62,10 +60,15 @@ func main() {
app.Name = "cloudflared" app.Name = "cloudflared"
app.Usage = "Cloudflare's command-line tool and agent" app.Usage = "Cloudflare's command-line tool and agent"
app.ArgsUsage = "origin-url" app.ArgsUsage = "origin-url"
app.Copyright = fmt.Sprintf(`(c) %d Cloudflare Inc. app.Copyright = fmt.Sprintf(
Use is subject to the license agreement at %s`, time.Now().Year(), licenseUrl) `(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.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, You can use it to authenticate a session to reach an API behind Access, route web traffic to this machine,
and configure access control.` and configure access control.`
app.Flags = flags() app.Flags = flags()

View File

@ -6,10 +6,12 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TesthostnameFromURI(t *testing.T) { func TestHostnameFromURI(t *testing.T) {
assert.Equal(t, "ssh://awesome.warptunnels.horse:22", hostnameFromURI("ssh://awesome.warptunnels.horse:22")) assert.Equal(t, "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, "awesome.warptunnels.horse:22", hostnameFromURI("ssh://awesome.warptunnels.horse"))
assert.Equal(t, "rdp://localhost:3389", hostnameFromURI("rdp://localhost")) 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("trash"))
assert.Equal(t, "", hostnameFromURI("https://awesomesauce.com")) assert.Equal(t, "", hostnameFromURI("https://awesomesauce.com"))
} }