v2 – github.com/jcmturner/dnsutils/v2 Index | Files

package dnsutils

import "github.com/jcmturner/dnsutils/v2"

Index

Functions

func OrderedSRV

func OrderedSRV(service, proto, name string) (int, map[int]*net.SRV, error)

OrderedSRV returns a count of the results and a map keyed on the order they should be used. This based on the records' priority and randomised selection based on their relative weighting. The function's inputs are the same as those for net.LookupSRV To use in the correct order:

count, orderedSRV, err := OrderedSRV(service, proto, name) i := 1

for  i <= count {
  srv := orderedSRV[i]
  // Do something such as dial this SRV. If fails move on the the next or break if it succeeds.
  i += 1
}

Source Files

srv.go

Version
v2.0.0 (latest)
Published
Feb 4, 2020
Platform
linux/amd64
Imports
3 packages
Last checked
now

Tools for package owners.