TUN-4461: Log resulting DNS hostname if one is received from Cloudflare API
This commit is contained in:
parent
d6d65d183b
commit
98a0844f56
|
@ -88,6 +88,7 @@ type DNSRoute struct {
|
||||||
type DNSRouteResult struct {
|
type DNSRouteResult struct {
|
||||||
route *DNSRoute
|
route *DNSRoute
|
||||||
CName Change `json:"cname"`
|
CName Change `json:"cname"`
|
||||||
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDNSRoute(userHostname string, overwriteExisting bool) Route {
|
func NewDNSRoute(userHostname string, overwriteExisting bool) Route {
|
||||||
|
@ -135,7 +136,16 @@ func (res *DNSRouteResult) SuccessSummary() string {
|
||||||
case ChangeUnchanged:
|
case ChangeUnchanged:
|
||||||
msgFmt = "%s is already configured to route to your tunnel"
|
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 {
|
type LBRoute struct {
|
||||||
|
|
Loading…
Reference in New Issue