libnetwork icon indicating copy to clipboard operation
libnetwork copied to clipboard

To address issue #2502 which I opened...

Open inieves opened this issue 5 years ago • 1 comments

Added support for disabling the randomization of IP addresses in the response to DNS hostname lookup, as well as support for sorting the IP addresses in ascending or descending order.

Full backwards compatibility is maintained.

Performance penalty is 1 map lookup + 1 if statement with simple boolean equality check + 1 switch statement + sorting algorithm:

  • NONE: constant
  • ASCENDING: O(nlogn)
  • DESCENDING: O(nlogn)
  • RANDOM: O(n)

3 new functions are added to Resolver interface to support sort order:

  • SetIPSortOrderDefault(int)
  • SetIPSortOrderSpecific(string, int)
  • ClearIPSortOrderSpecific(string)

3 new function implentations are added to support the interface:

  • func (r *resolver) SetIPSortOrderDefault(ipSortMethod int)
  • func (r *resolver) SetIPSortOrderSpecific(hostname string, ipSortMethod int)
  • func (r *resolver) ClearIPSortOrderSpecific(hostname string)

1 new type is added to specify sort order:

  • NONE
  • ASCENDING
  • DESCENDING
  • RANDOM

Signed-off-by: Ian Morris Nieves [email protected]

inieves avatar Feb 03 '20 23:02 inieves

Note we have migrated this codebase over to github.com/moby/moby/libnetwork. We are not accepting PR's on this repo anymore except for backports to be included in moby 20.10

cpuguy83 avatar Jun 18 '21 22:06 cpuguy83

The feature request is reasonable, however the implementation is incomplete. And I would like to investigate alternate approaches which do not depend on stateful configuration. I have transferred the issue to moby/moby so we don't forget about it.

corhere avatar Jan 23 '24 23:01 corhere