From 41429cc6a8e28d3b1b65e85eb7ad0d243f625771 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Mon, 8 Oct 2018 19:13:08 -0500 Subject: [PATCH] TUN-1101: False negatives in Cloudflared error reporting --- origin/tunnel.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/origin/tunnel.go b/origin/tunnel.go index 6c6785aa..d020707b 100644 --- a/origin/tunnel.go +++ b/origin/tunnel.go @@ -350,9 +350,14 @@ func RegisterTunnel(ctx context.Context, muxer *h2mux.Muxer, config *TunnelConfi } // Print out the user's trial zone URL in a nice box (if they requested and got one) - if isTrialTunnel := config.Hostname == "" && registration.Url != ""; isTrialTunnel { - for _, line := range asciiBox(trialZoneMsg(registration.Url), 2) { - config.Logger.Infoln(line) + if isTrialTunnel := config.Hostname == ""; isTrialTunnel { + if url, err := url.Parse(registration.Url); err == nil { + for _, line := range asciiBox(trialZoneMsg(url.String()), 2) { + config.Logger.Infoln(line) + } + } else { + config.Logger.Errorln("Failed to connect tunnel, please try again.") + return fmt.Errorf("empty URL in response from Cloudflare edge") } }