...

Package dns

import "go.mongodb.org/mongo-driver/x/mongo/driver/dns"
Overview
Index

Overview ▾

Variables

DefaultResolver is a Resolver that uses the default Resolver from the net package.

var DefaultResolver = &Resolver{net.LookupSRV, net.LookupTXT}

type Resolver

Resolver resolves DNS records.

type Resolver struct {
    // Holds the functions to use for DNS lookups
    LookupSRV func(string, string, string) (string, []*net.SRV, error)
    LookupTXT func(string) ([]string, error)
}

func (*Resolver) GetConnectionArgsFromTXT

func (r *Resolver) GetConnectionArgsFromTXT(host string) ([]string, error)

GetConnectionArgsFromTXT gets the TXT record associated with the host and returns the connection arguments.

func (*Resolver) ParseHosts

func (r *Resolver) ParseHosts(host string, srvName string, stopOnErr bool) ([]string, error)

ParseHosts uses the srv string and service name to get the hosts.