I believe this to be possible integration albeit we don't have a solution developed as of yet. Conceptually you could modify the ModuleLoadBalancerRedirector source and provide the ip lookup/redirection within it prior to the redirection. You can reference our
GeoIP article (or for an integration example see
this article) for this logic.
Expanding on Matt's & Richard's responses, you may also need to modify LoadBalancerRedirectorConcurrentConnects which is also included in the download.
I have done something similar in the past and I performed all of the logic in this class. The server information is stored in a Set that is ordered by connection counts. When getRedirect() is called, the first server in the list is returned.
You would need your own getRedirect method that passes in the client ip address. You cannot use the current getRedirect() method as it is defined by the ILoadBalancerRedirector interface.
To decide which server to return, you would have a 2 step process. Firstly, you would group all of the servers based on location. This would be best done at the end of the onMessage method where you would use different Sets for each location. You could do this using GeoIp as all of the servers with similar ip addresses are probably located in the same place. One thing to watch for is some isp's do not update location information for datacenter servers properly so the GeoIP lookup may be wrong. In this case, you would have to determine the location some other way. You then do a GeoIP lookup to determine the location of your client and use the closest Set of servers. Once you have the set of servers to use, you just return the least loaded server from that location.
You could extend this to also look at the total load of a location and use the next closest if that location is getting overloaded. This would require more complex logic but should be easily doable.
Remember, when using modified classes, either for the module or this class that you need to use your own class names or package names so that they do not conflict with the same classes in the main load balancer jar file.