I think this is automatically handled by libtorrent when you specify a proxy ie it automatically stops the dht.
If you have proof to the contrary, I'll be happy to solve it. (I haven't actually tested this, since I don't have access to a proxy)