Remove SortHostPorts call from state.SetAPIHostPorts

**state, worker/peergrouper:**

Move the logic from state into the peergrouper. I'm not sure why we're
sorting the values before adding them to state at all, but the logic should
be kept outside at any rate.

**network: change SortHostPorts to maintain order of same-type addresses**

HostPorts are meant to kept in their original order. Change SortHostPorts
to swap hostnames and to the fore and give preference to either IPv4 or
IPv6, but otherwise keep the order within address type groups the same.

Fixes https://bugs.launchpad.net/juju-core/+bug/1345832
I don't think there's a good reason to bind it to `hostPortsByPreference`. It may well be useful for other callers in the package later.