diff --git a/tunnelstore/client.go b/tunnelstore/client.go index c5230cc8..764cfd3b 100644 --- a/tunnelstore/client.go +++ b/tunnelstore/client.go @@ -88,6 +88,7 @@ type DNSRoute struct { type DNSRouteResult struct { route *DNSRoute CName Change `json:"cname"` + Name string `json:"name"` } func NewDNSRoute(userHostname string, overwriteExisting bool) Route { @@ -135,7 +136,16 @@ func (res *DNSRouteResult) SuccessSummary() string { case ChangeUnchanged: msgFmt = "%s is already configured to route to your tunnel" } - return fmt.Sprintf(msgFmt, res.route.userHostname) + return fmt.Sprintf(msgFmt, res.hostname()) +} + +// hostname yields the resulting name for the DNS route; if that is not available from Cloudflare API, then the +// requested name is returned instead (should not be the common path, it is just a fall-back). +func (res *DNSRouteResult) hostname() string { + if res.Name != "" { + return res.Name + } + return res.route.userHostname } type LBRoute struct {