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.
Overview
This PR implements requested feature in #23. Specifically, it modifies the customer lookup logic with the following:
Implementation
database
MySQL
customers.zones
table:group_name
field has been renamed toname
host
field has been removedip_start
andip_end
binary fields have been added to store IP rangesapplication 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.