Skip to content

Commit

Permalink
Doc sample for GetSRVAddresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Edge committed Aug 28, 2023
1 parent 1230bd9 commit 3bcc144
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 3bcc144

Please sign in to comment.