Pike v8.0 release 1738

Method NetUtils.sort_addresses()


Method sort_addresses

array(string) sort_addresses(array(string) addresses, array(NetworkType)|void exclude_types, bool|void separate_v6)

Description

Given a list of addresses, sort them according to connectable priority order (RFC 3484).

If exclude_types is specified, addresses that match any of the network types (({"local", "localhost"}) for the local network as an example) in the given array will be exluded from the result.

If separate_v6 is true, exclude_types separates v6 from v4. That is, you can disable "localhost" without also disabling "localhostv6".

The addresses inside each group will be returned in random order.