Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer lookup based on host range and zone match #27

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

unix1
Copy link
Contributor

@unix1 unix1 commented Dec 3, 2018

Overview

This PR implements requested feature in #23. Specifically, it modifies the customer lookup logic with the following:

  • look up customer based on host IP range first
  • if found, further filter based on qname longest common prefix match on customer zone
  • if >1 customers are matched after both of the above, return one and log a warning

Implementation

database

MySQL customers.zones table:

  • group_name field has been renamed to name
  • host field has been removed
  • the ip_start and ip_end binary fields have been added to store IP ranges

application logic

The radix tree has been removed and replaced with the newly forked and updated interval tree which stores IP ranges as intervals in memory. The logic has been adjusted to reflect the priority of IP range lookup over the qname prefix match.

Finally, there are few basic tests to validate the customer matching functionality.

Note that due to database schema updates, this change is not backward compatible. Any applications accessing the customers database must be updated to reflect the new schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant