From 1cbc8fb8ac4b0683eb3e3c7a1c4510f7023a33fc Mon Sep 17 00:00:00 2001 From: cthuang Date: Thu, 30 Jul 2020 15:33:10 +0100 Subject: [PATCH] TUN-3220: tunnel route reports created route --- cmd/cloudflared/tunnel/subcommands.go | 2 ++ tunnelstore/client.go | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/cmd/cloudflared/tunnel/subcommands.go b/cmd/cloudflared/tunnel/subcommands.go index 1dbcec61..d9756d11 100644 --- a/cmd/cloudflared/tunnel/subcommands.go +++ b/cmd/cloudflared/tunnel/subcommands.go @@ -548,6 +548,8 @@ func routeTunnel(c *cli.Context) error { return errors.Wrap(err, "Failed to route tunnel") } + logger.Infof(route.SuccessSummary()) + return nil } diff --git a/tunnelstore/client.go b/tunnelstore/client.go index b73b32f5..cf7053b1 100644 --- a/tunnelstore/client.go +++ b/tunnelstore/client.go @@ -44,6 +44,8 @@ type Connection struct { type Route interface { json.Marshaler RecordType() string + // SuccessSummary explains what will route to this tunnel when it's provisioned successfully + SuccessSummary() string } type DNSRoute struct { @@ -71,6 +73,10 @@ func (dr *DNSRoute) RecordType() string { return "dns" } +func (dr *DNSRoute) SuccessSummary() string { + return fmt.Sprintf("%s will route to your tunnel", dr.userHostname) +} + type LBRoute struct { lbName string lbPool string @@ -100,6 +106,10 @@ func (lr *LBRoute) RecordType() string { return "lb" } +func (lr *LBRoute) SuccessSummary() string { + return fmt.Sprintf("Load balancer %s will route to this tunnel through pool %s", lr.lbName, lr.lbPool) +} + type Client interface { CreateTunnel(name string, tunnelSecret []byte) (*Tunnel, error) GetTunnel(tunnelID uuid.UUID) (*Tunnel, error)