refactor dnsproxy for ip sorting