TUN-1101: False negatives in Cloudflared error reporting

This commit is contained in:
Adam Chalmers 2018-10-08 19:13:08 -05:00
parent da0defcec9
commit 41429cc6a8
1 changed files with 8 additions and 3 deletions

View File

@ -350,10 +350,15 @@ 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) {
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")
}
}
config.Logger.Infof("Route propagating, it may take up to 1 minute for your new route to become functional")