Permalink
Browse files

api: add explicit DNS cache

The API connection logic in juju.NewAPIConnection implements
a half-hearted DNS cache by resolving DNS addresses itself
and storing them in the controllers.yaml fields.
This obscures the actual addresses that have been
returned from the controller.

Instead of that, we make api.Open responsible for
all DNS resolution and pass a DNS cache interface
into DialOpts so that the NewAPIConnection logic
can still do its own DNS caching.

This means that the API connection logic always knows
the symbolic host name of the controller that it's
dialing, which is important when using public certificate
validation.

It also means that even when a Go client calls api.Open with
a single host name, it will get the benefit of concurrent
dialing to each of the resolved IP addresses.
  • Loading branch information...
1 parent 19c2b32 commit 874fbd53dd898c325edc36ec37d0518f03bfd987 @rogpeppe rogpeppe committed May 25, 2017
Showing with 507 additions and 94 deletions.
  1. +192 −60 api/apiclient.go
  2. +275 −32 api/apiclient_test.go
  3. +8 −1 api/export_test.go
  4. +32 −1 api/interface.go
Oops, something went wrong.

0 comments on commit 874fbd5

Please sign in to comment.