@@ -323,8 +323,9 @@ func NewDialer(ctx context.Context, opts ...Option) (*Dialer, error) {
323323}
324324
325325// Dial returns a net.Conn connected to the specified Cloud SQL instance. The
326- // icn argument must be the instance's connection name, which is in the format
327- // "project-name:region:instance-name".
326+ // icn argument may be the instance's connection name in the format
327+ // "project-name:region:instance-name" or a DNS name that resolves to an
328+ // instance connection name.
328329func (d * Dialer ) Dial (ctx context.Context , icn string , opts ... DialOption ) (conn net.Conn , err error ) {
329330 select {
330331 case <- d .closed :
@@ -345,9 +346,14 @@ func (d *Dialer) Dial(ctx context.Context, icn string, opts ...DialOption) (conn
345346 if err != nil {
346347 return nil , err
347348 }
349+
348350 // Log if resolver changed the instance name input string.
349- if cn .String () != icn {
350- d .logger .Debugf (ctx , "resolved instance %s to %s" , icn , cn )
351+ if cn .DomainName () != "" {
352+ // icn is a domain name, which resolves to a actual icn
353+ d .logger .Debugf (ctx , "resolved domain name %s to %s" , icn , cn .String ())
354+ } else if cn .String () != icn {
355+ // icn was not a domain name, but the resolver changed it and cn != icn
356+ d .logger .Debugf (ctx , "resolved instance connection string %s to %s" , icn , cn .String ())
351357 }
352358
353359 cfg := d .defaultDialConfig
0 commit comments