Initial filtering of endpoints for public IPv4 addresses.
Simplified getting the address to return, it's always the first one.
Changed comment on dependency of address order.
Small test optimization.
Changed type of written data back into slice, so that the rendering as JSON or YAML will be backwards compatible again.
Merge pull request #419 from katco-/upstream-1.20

Backport:  lp:1311227: API Endpoints

Addresses https://bugs.launchpad.net/juju-core/+bug/1311227