Skip to content

Commit

Permalink
Merge pull request #177 from mailgun/medge/srv-docs
Browse files Browse the repository at this point in the history
Doc sample for GetSRVAddresses
  • Loading branch information
thrawn01 authored Aug 28, 2023
2 parents 1230bd9 + 3bcc144 commit 9c081b6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions discovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,16 @@ func main() {
c.Close()
}
```

### SRV Resolver

`discovery.GetSRVAddresses()` can be used directly as a utility for querying SRV DNS records. For example:

```go
// Using "" as the dnsServer argument uses the Golang built-in resolver
addresses, err = discovery.GetSRVAddresses("mytest.service.consul", "")
```

If valid, will return a list of IP:Port records associated to the given DNS entry.

Note: you can specify an explicit DNS server instead. Using `""` uses the DNS resolver of the machine.

0 comments on commit 9c081b6

Please sign in to comment.